Merge branch 'devel/new_mesh' into devel/master 86/42386/2
authorFrancisco Santos <f1.santos@samsung.com>
Fri, 26 Jun 2015 14:24:45 +0000 (15:24 +0100)
committerFrancisco Santos <f1.santos@samsung.com>
Fri, 26 Jun 2015 16:00:45 +0000 (17:00 +0100)
Change-Id: I41d2ce44857efc23c3a830ede52849b4d415b6f6

1  2 
dali-toolkit/internal/controls/scrollable/bouncing-effect-actor.cpp

@@@ -38,33 -39,32 +39,32 @@@ namespace Interna
  namespace
  {
  // Bouncing effect is presented by stacked three layers with same color and opacity
- const size_t NUM_LAYERS( 3 );
  const Vector3 LAYER_HEIGHTS( 1.f, 27.f/42.f, 13.f/42.f);
  
- // use the actor color to paint every layer
- const char* MESH_FRAGMENT_SHADER =
- "void main()\n"
- "{\n"
- "  gl_FragColor = uColor;\n"
- "}\n";
- // Constraint to move the vertices vertically
- struct VertexPositionConstraint
- {
-   VertexPositionConstraint( float initialY, float range )
-   : mInitialY( initialY ),
-     mRange( range )
-   {
-   }
-   void operator()( Vector3& current, const PropertyInputContainer& inputs )
-   {
-     current.y = mInitialY + mRange * fabsf( inputs[0]->GetFloat() );
-   }
+ #define MAKE_SHADER(A)#A
+ // Modify the vertex position according to the bounce coefficient;
+ const char* MESH_VERTEX_SHADER = MAKE_SHADER(
+ attribute mediump vec3    aPosition1;\n
+ attribute mediump vec3    aPosition2;\n
+ uniform   mediump mat4    uMvpMatrix;\n
+ uniform   mediump vec3    uSize;
+ uniform   mediump float   uBounceCoefficient;\n
+ \n
+ void main()\n
+ {\n
+   gl_Position = uMvpMatrix * vec4(mix( aPosition1, aPosition2, abs(uBounceCoefficient) )*uSize, 1.0);\n
+ }
+ );
  
-   float mInitialY;
-   float mRange;
- };
+ // use the actor color to paint every layer
+ const char* MESH_FRAGMENT_SHADER = MAKE_SHADER(
+ uniform lowp  vec4    uColor;\n
+ void main()\n
+ {\n
+   gl_FragColor = uColor;\n
 -}\n;
++}\n
+ );
  
  } // namespace Anon