#include "rive-animation-view-impl.h"
// EXTERNAL INCLUDES
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali-toolkit/devel-api/controls/control-devel.h>
// INTERNAL INCLUDES
#include <dali-extension/devel-api/rive-animation-view/rive-animation-view.h>
{
namespace
{
-
Geometry CreateQuadGeometry()
{
const float halfWidth = 0.5f;
DALI_TYPE_REGISTRATION_END()
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
- attribute mediump vec2 aPosition;\n
- uniform highp mat4 uMvpMatrix;\n
- uniform highp vec3 uSize;\n
- varying mediump vec2 vTexCoord;\n
- \n
- void main()\n
- {\n
- gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);\n
- vTexCoord = aPosition + vec2(0.5);\n
- }\n
-);
+ attribute mediump vec2 aPosition;\n
+ uniform highp mat4 uMvpMatrix;\n
+ uniform highp vec3 uSize;\n
+ varying mediump vec2 vTexCoord;\n
+ \n void main()\n {
+ \n
+ gl_Position = uMvpMatrix * vec4(aPosition * uSize.xy, 0.0, 1.0);
+ \n
+ vTexCoord = aPosition + vec2(0.5);
+ \n
+ }\n);
const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
- varying mediump vec2 vTexCoord;\n
- uniform sampler2D sTexture;\n
- uniform lowp vec4 uColor;\n
- \n
- void main()\n
- {\n
- gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
- }\n
-);
+ varying mediump vec2 vTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform lowp vec4 uColor;\n
+ \n void main()\n {
+ \n
+ gl_FragColor = texture2D(sTexture, vTexCoord) * uColor;
+ \n
+ }\n);
#if defined(DEBUG_ENABLED)
Debug::Filter* gRiveAnimationLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_RIVE_ANIMATION");
}
DALI_LOG_INFO(gRiveAnimationLogFilter, Debug::Verbose, "RiveAnimationView::OnSceneConnection [%p]\n", this);
-
}
void RiveAnimationView::OnSceneDisconnection()
Geometry geometry = CreateQuadGeometry();
Shader shader = Shader::New(VERTEX_SHADER, FRAGMENT_SHADER);
- mRenderer = Renderer::New(geometry, shader);
+ mRenderer = Renderer::New(geometry, shader);
TextureSet textureSet = TextureSet::New();
mRenderer.SetTextures(textureSet);
void RiveAnimationView::ClearAnimationsData()
{
- mAnimationData.animations.clear();
- mAnimationData.elapsedTimes.clear();
- mAnimationData.fillColors.clear();
- mAnimationData.strokeColors.clear();
- mAnimationData.opacities.clear();
- mAnimationData.scales.clear();
- mAnimationData.rotations.clear();
- mAnimationData.positions.clear();
+ mAnimationData.animations.clear();
+ mAnimationData.elapsedTimes.clear();
+ mAnimationData.fillColors.clear();
+ mAnimationData.strokeColors.clear();
+ mAnimationData.opacities.clear();
+ mAnimationData.scales.clear();
+ mAnimationData.rotations.clear();
+ mAnimationData.positions.clear();
}
void RiveAnimationView::SetVectorImageSize()
void RiveAnimationView::OnSizeNotification(PropertyNotification& source)
{
- Vector3 size = Self().GetCurrentProperty<Vector3>(Actor::Property::SIZE);
+ Vector3 size = Self().GetCurrentProperty<Vector3>(Actor::Property::SIZE);
mSize.width = size.width;
mSize.height = size.height;