Merge "Fix resource ready state" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / scrollable / bouncing-effect-actor.cpp
index c06e400..be63772 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 // EXTERNAL INCLUDES
 #include <dali/public-api/math/vector3.h>
 #include <dali/public-api/object/property-map.h>
-#include <dali/devel-api/object/property-buffer.h>
-#include <dali/devel-api/rendering/geometry.h>
-#include <dali/devel-api/rendering/texture-set.h>
-#include <dali/devel-api/rendering/renderer.h>
-#include <dali/devel-api/rendering/shader.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/rendering/shader.h>
+#include <dali/public-api/rendering/texture-set.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
 
 namespace Dali
 {
@@ -48,31 +50,6 @@ const float LAYER_HEIGHTS[5] =
   26.f / 130.f
 };
 
-#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
-}
-);
-
-// 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
-);
-
 } // namespace Anon
 
 Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
@@ -114,7 +91,7 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
   Property::Map vertexFormat;
   vertexFormat["aPosition1"] = Property::VECTOR3;
   vertexFormat["aPosition2"] = Property::VECTOR3;
-  PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
+  VertexBuffer vertices = VertexBuffer::New( vertexFormat );
   vertices.SetData( vertexData, 20u );
 
   unsigned short indexData[30] = { 0,3,1,0,2,3,4,7,5,4,6,7,8,11,9,8,10,11,12,15,13,12,14,15,16,19,17,16,18,19};
@@ -124,7 +101,7 @@ Actor CreateBouncingEffectActor( Property::Index& bouncePropertyIndex )
   meshGeometry.SetIndexBuffer( indexData, sizeof(indexData)/sizeof(indexData[0]) );
 
   // Create the shader
-  Shader shader = Shader::New( MESH_VERTEX_SHADER, MESH_FRAGMENT_SHADER );
+  Shader shader = Shader::New( SHADER_BOUNCING_EFFECT_MESH_SHADER_VERT, SHADER_BOUNCING_EFFECT_MESH_SHADER_FRAG );
 
   // Create renderer
   Renderer renderer = Renderer::New( meshGeometry, shader );