Update following the changes of Blending&Culling options
[platform/core/uifw/dali-demo.git] / examples / mesh-sorting / mesh-sorting-example.cpp
index b019791..4dc7237 100644 (file)
  */
 
 // EXTERNAL INCLUDES
-
-// INTERNAL INCLUDES
-#include "shared/view.h"
-
+#include <dali/devel-api/rendering/renderer.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <stdio.h>
 #include <sstream>
 #include <cstring>
 
+// INTERNAL INCLUDES
+#include "shared/view.h"
+
 using namespace Dali;
 
 namespace
@@ -32,12 +32,12 @@ namespace
 
 const char* MATERIAL_SAMPLES[] =
 {
-  DALI_IMAGE_DIR "people-medium-1.jpg",
-  DALI_IMAGE_DIR "people-medium-4.jpg",
-  DALI_IMAGE_DIR "people-medium-11.jpg",
-  DALI_IMAGE_DIR "people-small-16.jpg",
-  DALI_IMAGE_DIR "people-medium-15.jpg",
-  DALI_IMAGE_DIR "people-medium-6.jpg",
+  DEMO_IMAGE_DIR "people-medium-1.jpg",
+  DEMO_IMAGE_DIR "people-medium-4.jpg",
+  DEMO_IMAGE_DIR "people-medium-11.jpg",
+  DEMO_IMAGE_DIR "people-small-16.jpg",
+  DEMO_IMAGE_DIR "people-medium-15.jpg",
+  DEMO_IMAGE_DIR "people-medium-6.jpg",
 };
 const unsigned int NUMBER_OF_SAMPLES(sizeof(MATERIAL_SAMPLES)/sizeof(const char*));
 
@@ -104,7 +104,7 @@ Geometry CreateGeometry()
   // Create indices
   unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 };
   Property::Map indexFormat;
-  indexFormat["indices"] = Property::UNSIGNED_INTEGER;
+  indexFormat["indices"] = Property::INTEGER;
   PropertyBuffer indices = PropertyBuffer::New( indexFormat, 6 );
   indices.SetData(indexData);
 
@@ -169,9 +169,8 @@ public:
     for( unsigned i=0; i<NUMBER_OF_SAMPLES; ++i)
     {
       Image image = ResourceImage::New( MATERIAL_SAMPLES[i] );
-      Sampler sampler = Sampler::New(image, "sTexture");
       Material material = Material::New( mShader );
-      material.AddSampler( sampler );
+      material.AddTexture(image, "sTexture");
       if( i==0 ) { firstMat = material; }
 
       Renderer renderer = Renderer::New( mGeometry, material );
@@ -181,7 +180,7 @@ public:
       meshActor.SetSize(175, 175);
       meshActor.RegisterProperty("index", (int)i);
 
-      renderer.SetDepthIndex(0);
+      renderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 );
       // Test with actor alpha
       meshActor.SetParentOrigin( ParentOrigin::CENTER );
       meshActor.SetAnchorPoint( AnchorPoint::CENTER );
@@ -189,8 +188,7 @@ public:
 
       meshActor.SetOpacity( i%2?0.7f:1.0f );
 
-      Property::Index index=meshActor.RegisterProperty("hue", i/(float)NUMBER_OF_SAMPLES);
-      meshActor.AddUniformMapping( index, "uHue" );
+      meshActor.RegisterProperty("uHue", i/(float)NUMBER_OF_SAMPLES);
 
       meshActor.TouchedSignal().Connect(this, &ExampleController::OnTouched);
       std::ostringstream oss;
@@ -242,7 +240,7 @@ public:
       mDepthIndices[index] = newDepthIndex;
 
       Renderer renderer = actor.GetRendererAt(0);
-      renderer.SetDepthIndex(newDepthIndex);
+      renderer.SetProperty( Renderer::Property::DEPTH_INDEX, newDepthIndex);
 
       PrintDepths();
     }