Updated shader source to set precision explicitly
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-api / shader-effects / motion-blur-effect.cpp
index 830accc..1b77466 100644 (file)
  *
  */
 
+// CLASS HEADER
 #include <dali-toolkit/public-api/shader-effects/motion-blur-effect.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/animation/constraints.h>
+
 namespace Dali
 {
 
@@ -74,15 +79,15 @@ MotionBlurEffect::~MotionBlurEffect()
 {
 }
 
-MotionBlurEffect MotionBlurEffect::Apply( Actor handle )
+MotionBlurEffect MotionBlurEffect::Apply( RenderableActor renderable )
 {
   MotionBlurEffect newEffect = New( MOTION_BLUR_NUM_SAMPLES );
-  handle.SetShaderEffect( newEffect );
+  renderable.SetShaderEffect( newEffect );
 
   Property::Index uModelProperty = newEffect.GetPropertyIndex( MOTION_BLUR_MODEL_LASTFRAME );
 
   Constraint constraint = Constraint::New<Matrix>( uModelProperty,
-                                                   Source( handle, Actor::WORLD_MATRIX ),
+                                                   Source( renderable, Actor::WORLD_MATRIX ),
                                                    EqualToConstraint() );
 
   // and set up constraint.
@@ -95,7 +100,7 @@ MotionBlurEffect MotionBlurEffect::New()
   return New( MOTION_BLUR_NUM_SAMPLES );
 }
 
-MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
+MotionBlurEffect MotionBlurEffect::New( unsigned int numBlurSamples )
 {
   // Dali vertexSource prefix for reference:
   // precision highp float;
@@ -109,6 +114,7 @@ MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
   // varying   vec2  vTexCoord;
   std::string vertexSource;
   vertexSource =
+    "precision mediump float;\n"
     "uniform mat4 uModelLastFrame;\n"
     "uniform float uTimeDelta;\n"
 
@@ -181,7 +187,6 @@ MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
   std::string fragmentSource;
   fragmentSource =
     "precision mediump float;\n"
-
     "uniform vec2 uObjectFadeStart;\n"
     "uniform vec2 uObjectFadeEnd;\n"
     "uniform float uAlphaScale;\n"
@@ -222,8 +227,7 @@ MotionBlurEffect MotionBlurEffect::New( const unsigned int numBlurSamples )
     "}\n";
 
   // NOTE: we must turn on alpha blending for the actor (HINT_BLENDING)
-  ShaderEffect shader = ShaderEffect::New( vertexSource,
-                                           fragmentSource,
+  ShaderEffect shader = ShaderEffect::New( vertexSource, fragmentSource,
                                            GEOMETRY_TYPE_IMAGE,
                                            ShaderEffect::GeometryHints( ShaderEffect::HINT_BLENDING | ShaderEffect::HINT_GRID) );
 
@@ -326,4 +330,3 @@ const std::string& MotionBlurEffect::GetAlphaScalePropertyName() const
 }
 
 }
-