Remove obsolete and unnecessary animated and double buffered values from material 35/50435/6
authorKimmo Hoikka <kimmo.hoikka@samsung.com>
Wed, 28 Oct 2015 16:17:30 +0000 (16:17 +0000)
committerKimmo Hoikka <kimmo.hoikka@samsung.com>
Fri, 30 Oct 2015 10:20:08 +0000 (10:20 +0000)
- material color removed since actor color will always override if (because we can use same renderer with multiple actors)
- blend color changed to pointer in scene graph and non animateable
- blending options cached in event thread and not double buffered in update as they are almost never ever changed

Change-Id: Iec99b52f1bd5ce2d38cd2fa8888117a326383fe4

27 files changed:
automated-tests/src/dali-devel/utc-Dali-Actor.cpp
automated-tests/src/dali-devel/utc-Dali-Geometry.cpp
automated-tests/src/dali-devel/utc-Dali-Material.cpp
automated-tests/src/dali-devel/utc-Dali-PropertyBuffer.cpp
automated-tests/src/dali-devel/utc-Dali-Renderer.cpp
automated-tests/src/dali-devel/utc-Dali-Sampler.cpp
automated-tests/src/dali-devel/utc-Dali-Shader.cpp
automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp
automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h
automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h
automated-tests/src/dali/utc-Dali-ImageActor.cpp
automated-tests/src/dali/utc-Dali-MeshMaterial.cpp
automated-tests/src/dali/utc-Dali-RenderTask.cpp
dali/devel-api/rendering/material.cpp
dali/devel-api/rendering/material.h
dali/internal/event/rendering/material-impl.cpp
dali/internal/event/rendering/material-impl.h
dali/internal/render/data-providers/material-data-provider.h
dali/internal/render/renderers/render-image-renderer.cpp
dali/internal/render/renderers/render-image-renderer.h
dali/internal/render/renderers/render-new-renderer.cpp
dali/internal/render/renderers/render-new-renderer.h
dali/internal/render/renderers/render-renderer.cpp
dali/internal/render/renderers/render-renderer.h
dali/internal/update/rendering/scene-graph-material.cpp
dali/internal/update/rendering/scene-graph-material.h
dali/public-api/actors/blending.h

index 7322fa4..7a7d72f 100644 (file)
@@ -35,7 +35,7 @@ int UtcDaliActorAddRendererP(void)
   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   actor.AddRenderer( renderer );
@@ -87,7 +87,7 @@ int UtcDaliActorAddRendererOnStage(void)
   application.Render(0);
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   application.SendNotification();
@@ -116,7 +116,7 @@ int UtcDaliActorRemoveRendererP(void)
   DALI_TEST_EQUALS( actor.GetRendererCount(), 0u, TEST_LOCATION );
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   actor.AddRenderer( renderer );
index 7c32d69..fda690c 100644 (file)
@@ -154,7 +154,7 @@ int UtcDaliGeometryAddVertexBuffer(void)
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer1 );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
@@ -232,7 +232,7 @@ int UtcDaliGeometryRemoveVertexBuffer(void)
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer1 );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
@@ -266,7 +266,7 @@ int UtcDaliGeometrySetIndexBuffer(void)
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
@@ -323,7 +323,7 @@ int UtcDaliGeometrySetGetGeometryType01(void)
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( vertexBuffer );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
@@ -454,7 +454,7 @@ int UtcDaliGeometrySetGetGeometryType02(void)
   geometry.AddVertexBuffer( vertexBuffer );
   geometry.SetIndexBuffer( indexBuffer );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
@@ -565,6 +565,7 @@ int UtcDaliGeometrySetGetGeometryType02(void)
 
   END_TEST;
 }
+
 int UtcDaliGeometrySetGetRequireDepthTesting(void)
 {
   TestApplication application;
@@ -587,11 +588,11 @@ int UtcDaliGeometrySetGetRequireDepthTesting(void)
   geometry.SetRequiresDepthTesting(true);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
   application.SendNotification();
   application.Render();
 //  TODO: Not supported yes
-//  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+//  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
 //  std::ostringstream out;
 //  out << GL_DEPTH_TEST;
 //  DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", out.str().c_str() ) );
@@ -623,11 +624,11 @@ int UtcDaliGeometryPropertyRequiresDepthTest(void)
   geometry.SetProperty(Geometry::Property::REQUIRES_DEPTH_TEST, true );
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
   application.SendNotification();
   application.Render();
-//  TODO: Not supported yes
-//  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+//  TODO: Not supported yet
+//  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
 //  std::ostringstream out;
 //  out << GL_DEPTH_TEST;
 //  DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", out.str().c_str() ) );
@@ -645,7 +646,6 @@ int UtcDaliGeometryConstraint(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -690,7 +690,6 @@ int UtcDaliGeometryConstraint02(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -749,7 +748,6 @@ int UtcDaliGeometryAnimatedProperty01(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -793,7 +791,6 @@ int UtcDaliGeometryAnimatedProperty02(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
index 38bf8a9..ffb248f 100644 (file)
@@ -196,7 +196,7 @@ int UtcDaliMaterialGetNumberOfTextures(void)
   tet_infoline("Test GetNumberOfTextures()");
 
   Image image = BufferImage::New(32, 32, Pixel::RGBA8888);
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -231,7 +231,7 @@ int UtcDaliMaterialSetFaceCullingMode(void)
 
   tet_infoline("Test SetFaceCullingMode(cullingMode)");
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
@@ -263,10 +263,12 @@ int UtcDaliMaterialBlendingOptions01(void)
   tet_infoline("Test SetBlendFunc(src, dest) ");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
+  // set a transparent actor color so that blending is enabled
+  actor.SetOpacity( 0.5f );
   actor.AddRenderer(renderer);
   actor.SetSize(400, 400);
   Stage::GetCurrent().Add(actor);
@@ -274,18 +276,16 @@ int UtcDaliMaterialBlendingOptions01(void)
   material.SetBlendFunc(BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE);
 
   // Test that Set was successful:
-  {
-    BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO );
-    BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO );
-    BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO );
-    BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO );
-    material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+  BlendingFactor::Type srcFactorRgb( BlendingFactor::ZERO );
+  BlendingFactor::Type destFactorRgb( BlendingFactor::ZERO );
+  BlendingFactor::Type srcFactorAlpha( BlendingFactor::ZERO );
+  BlendingFactor::Type destFactorAlpha( BlendingFactor::ZERO );
+  material.GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
 
-    DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb,    TEST_LOCATION );
-    DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE,  destFactorRgb,   TEST_LOCATION );
-    DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha,  TEST_LOCATION );
-    DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE,  destFactorAlpha, TEST_LOCATION );
-  }
+  DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorRgb,    TEST_LOCATION );
+  DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE,  destFactorRgb,   TEST_LOCATION );
+  DALI_TEST_EQUALS( BlendingFactor::ONE_MINUS_SRC_COLOR, srcFactorAlpha,  TEST_LOCATION );
+  DALI_TEST_EQUALS( BlendingFactor::SRC_ALPHA_SATURATE,  destFactorAlpha, TEST_LOCATION );
 
   application.SendNotification();
   application.Render();
@@ -307,10 +307,11 @@ int UtcDaliMaterialBlendingOptions02(void)
   tet_infoline("Test SetBlendFunc(srcRgb, destRgb, srcAlpha, destAlpha) ");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
+  actor.SetOpacity( 0.5f ); // enable blending
   actor.AddRenderer(renderer);
   actor.SetSize(400, 400);
   Stage::GetCurrent().Add(actor);
@@ -353,7 +354,7 @@ int UtcDaliMaterialBlendingOptions03(void)
   tet_infoline("Test GetBlendEquation() defaults ");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
@@ -362,13 +363,11 @@ int UtcDaliMaterialBlendingOptions03(void)
   Stage::GetCurrent().Add(actor);
 
   // Test the defaults as documented in blending.h
-  {
-    BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
-    BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
-    material.GetBlendEquation( equationRgb, equationAlpha );
-    DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION );
-    DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION );
-  }
+  BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT );
+  BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT );
+  material.GetBlendEquation( equationRgb, equationAlpha );
+  DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION );
+  DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION );
 
   END_TEST;
 }
@@ -381,10 +380,11 @@ int UtcDaliMaterialBlendingOptions04(void)
   tet_infoline("Test SetBlendEquation() ");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
+  actor.SetOpacity( 0.1f );
   actor.AddRenderer(renderer);
   actor.SetSize(400, 400);
   Stage::GetCurrent().Add(actor);
@@ -426,10 +426,11 @@ int UtcDaliMaterialSetBlendMode01(void)
   tet_infoline("Test setting the blend mode to on with an opaque color renders with blending enabled");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
+  actor.SetOpacity( 0.98f );
   actor.AddRenderer(renderer);
   actor.SetSize(400, 400);
   Stage::GetCurrent().Add(actor);
@@ -437,12 +438,12 @@ int UtcDaliMaterialSetBlendMode01(void)
   material.SetBlendMode(BlendingMode::ON);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -458,10 +459,11 @@ int UtcDaliMaterialSetBlendMode02(void)
   tet_infoline("Test setting the blend mode to off with a transparent color renders with blending disabled (and not enabled)");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
+  actor.SetOpacity( 0.15f );
   actor.AddRenderer(renderer);
   actor.SetSize(400, 400);
   Stage::GetCurrent().Add(actor);
@@ -469,12 +471,12 @@ int UtcDaliMaterialSetBlendMode02(void)
   material.SetBlendMode(BlendingMode::OFF);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -489,10 +491,11 @@ int UtcDaliMaterialSetBlendMode03(void)
   tet_infoline("Test setting the blend mode to auto with a transparent material color renders with blending enabled");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(0.5f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
+  actor.SetOpacity( 0.75f );
   actor.AddRenderer(renderer);
   actor.SetSize(400, 400);
   Stage::GetCurrent().Add(actor);
@@ -500,12 +503,12 @@ int UtcDaliMaterialSetBlendMode03(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -520,7 +523,7 @@ int UtcDaliMaterialSetBlendMode04(void)
   tet_infoline("Test setting the blend mode to auto with an opaque color renders with blending disabled");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
@@ -531,12 +534,12 @@ int UtcDaliMaterialSetBlendMode04(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -551,7 +554,7 @@ int UtcDaliMaterialSetBlendMode04b(void)
   tet_infoline("Test setting the blend mode to auto with an opaque material color and a transparent actor color renders with blending enabled");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
@@ -563,12 +566,12 @@ int UtcDaliMaterialSetBlendMode04b(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -583,7 +586,7 @@ int UtcDaliMaterialSetBlendMode04c(void)
   tet_infoline("Test setting the blend mode to auto with an opaque material color and an opaque actor color renders with blending disabled");
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
@@ -595,12 +598,12 @@ int UtcDaliMaterialSetBlendMode04c(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -616,7 +619,7 @@ int UtcDaliMaterialSetBlendMode05(void)
 
   Geometry geometry = CreateQuadGeometry();
   BufferImage image = BufferImage::New( 40, 40, Pixel::RGBA8888 );
-  Material material = CreateMaterial(1.0f, image);
+  Material material = CreateMaterial( image );
   Renderer renderer = Renderer::New( geometry, material );
 
   Actor actor = Actor::New();
@@ -627,12 +630,12 @@ int UtcDaliMaterialSetBlendMode05(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -648,7 +651,6 @@ int UtcDaliMaterialSetBlendMode06(void)
   Geometry geometry = CreateQuadGeometry();
   Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_TRANSPARENT );
   Material material = Material::New(shader);
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Renderer renderer = Renderer::New( geometry, material );
 
@@ -660,12 +662,12 @@ int UtcDaliMaterialSetBlendMode06(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -682,7 +684,6 @@ int UtcDaliMaterialSetBlendMode06(void)
   Geometry geometry = CreateQuadGeometry();
   Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
   Material material = Material::New(shader);
-  material.SetProperty(Material::Property::COLOR, Color::TRANSPARENT);
 
   Renderer renderer = Renderer::New( geometry, material );
 
@@ -694,12 +695,12 @@ int UtcDaliMaterialSetBlendMode06(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -715,7 +716,6 @@ int UtcDaliMaterialSetBlendMode08(void)
   Geometry geometry = CreateQuadGeometry();
   Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
   Material material = Material::New(shader);
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
   BufferImage image = BufferImage::New( 50, 50, Pixel::RGB888 );
   material.AddTexture( image, "sTexture" );
   Renderer renderer = Renderer::New( geometry, material );
@@ -728,12 +728,12 @@ int UtcDaliMaterialSetBlendMode08(void)
   material.SetBlendMode(BlendingMode::AUTO);
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
-  glAbstraction.EnableCullFaceCallTrace(true);
+  glAbstraction.EnableEnableDisableCallTrace(true);
 
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = glAbstraction.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = glAbstraction.GetEnableDisableTrace();
   DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", "GL_BLEND" ) );
 
   END_TEST;
@@ -749,10 +749,6 @@ int UtcDaliMaterialGetBlendMode(void)
   Material material = Material::New(shader);
 
   // default value
-  DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::OFF, TEST_LOCATION );
-
-  // AUTO
-  material.SetBlendMode(BlendingMode::AUTO);
   DALI_TEST_EQUALS( material.GetBlendMode(), BlendingMode::AUTO, TEST_LOCATION );
 
   // ON
@@ -775,7 +771,6 @@ int UtcDaliMaterialSetBlendColor(void)
   Geometry geometry = CreateQuadGeometry();
   Shader shader = Shader::New( "vertexSrc", "fragmentSrc", Shader::HINT_OUTPUT_IS_OPAQUE );
   Material material = Material::New(shader);
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
   BufferImage image = BufferImage::New( 50, 50, Pixel::RGBA8888 );
   material.AddTexture( image, "sTexture" );
   Renderer renderer = Renderer::New( geometry, material );
@@ -787,6 +782,7 @@ int UtcDaliMaterialSetBlendColor(void)
 
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
 
+  material.SetBlendColor( Color::TRANSPARENT );
   application.SendNotification();
   application.Render();
   DALI_TEST_EQUALS( glAbstraction.GetLastBlendColor(), Color::TRANSPARENT, TEST_LOCATION );
@@ -838,7 +834,6 @@ int UtcDaliMaterialConstraint(void)
 
   Shader shader = Shader::New( "VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -883,7 +878,6 @@ int UtcDaliMaterialConstraint02(void)
 
   Shader shader = Shader::New( "VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -940,7 +934,6 @@ int UtcDaliMaterialAnimatedProperty01(void)
 
   Shader shader = Shader::New( "VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -984,7 +977,6 @@ int UtcDaliMaterialAnimatedProperty02(void)
 
   Shader shader = Shader::New( "VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -1035,7 +1027,7 @@ int UtcDaliMaterialSetTextureUniformName01(void)
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image, "sTexture" );
 
   int textureIndex = material.GetTextureIndex( "sTexture" );
@@ -1073,7 +1065,7 @@ int UtcDaliMaterialSetTextureUniformName02(void)
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
   Image image2 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image, "sTexture");
   material.SetTextureUniformName( 0, "sEffectTexture" );
   material.AddTexture( image2, "sTexture2");
@@ -1114,7 +1106,7 @@ int UtcDaliMaterialSetTextureAffectsTransparency(void)
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image, "sTexture" );
 
   Geometry geometry = CreateQuadGeometry();
@@ -1130,11 +1122,11 @@ int UtcDaliMaterialSetTextureAffectsTransparency(void)
   // Test SetAffectsTransparency( false )
   material.SetTextureAffectsTransparency( 0, false );
 
-  gl.EnableCullFaceCallTrace(true);
+  gl.EnableEnableDisableCallTrace(true);
   application.SendNotification();
   application.Render();
 
-  TraceCallStack& glEnableStack = gl.GetCullFaceTrace();
+  TraceCallStack& glEnableStack = gl.GetEnableDisableTrace();
   std::ostringstream blendStr;
   blendStr << GL_BLEND;
   DALI_TEST_CHECK( ! glEnableStack.FindMethodAndParams( "Enable", blendStr.str().c_str() ) );
@@ -1143,7 +1135,7 @@ int UtcDaliMaterialSetTextureAffectsTransparency(void)
   material.SetTextureAffectsTransparency( 0, true );
 
   glEnableStack.Reset();
-  gl.EnableCullFaceCallTrace(true);
+  gl.EnableEnableDisableCallTrace(true);
   application.SendNotification();
   application.Render();
 
@@ -1158,7 +1150,7 @@ int UtcDaliMaterialAddTexture01(void)
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image, "sTexture");
 
   Geometry geometry = CreateQuadGeometry();
@@ -1198,7 +1190,7 @@ int UtcDaliMaterialAddTexture02(void)
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
 
   Sampler sampler = Sampler::New();
   sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
@@ -1242,7 +1234,7 @@ int UtcDaliMaterialRemoveTexture(void)
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.RemoveTexture(0);
   DALI_TEST_EQUALS( material.GetNumberOfTextures(), 0, TEST_LOCATION );
 
@@ -1269,7 +1261,7 @@ int UtcDaliMaterialSetSampler(void)
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image, "sTexture");
 
   Geometry geometry = CreateQuadGeometry();
@@ -1331,7 +1323,7 @@ int UtcDaliMaterialGetTextureIndex(void)
   Image image3 = BufferImage::New( 64, 64, Pixel::RGBA8888 );
 
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image0, "sTexture0");
   material.AddTexture( image1, "sTexture1");
   material.AddTexture( image2, "sTexture2");
index 89014df..83dedfc 100644 (file)
@@ -143,7 +143,7 @@ int UtcDaliPropertyBufferSetData01(void)
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( propertyBuffer );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
@@ -189,7 +189,7 @@ int UtcDaliPropertyBufferSetData02(void)
   Geometry geometry = Geometry::New();
   geometry.AddVertexBuffer( propertyBuffer );
 
-  Material material = CreateMaterial(1.f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
   actor.SetSize(Vector3::ONE * 100.f);
index 784762a..1d28209 100644 (file)
@@ -46,7 +46,7 @@ int UtcDaliRendererNew01(void)
   TestApplication application;
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   DALI_TEST_EQUALS( (bool)renderer, true, TEST_LOCATION );
@@ -66,7 +66,7 @@ int UtcDaliRendererCopyConstructor(void)
   TestApplication application;
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   Renderer rendererCopy( renderer );
@@ -80,7 +80,7 @@ int UtcDaliRendererAssignmentOperator(void)
   TestApplication application;
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   Renderer renderer2;
@@ -96,7 +96,7 @@ int UtcDaliRendererDownCast01(void)
   TestApplication application;
 
   Geometry geometry = CreateQuadGeometry();
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry, material);
 
   BaseHandle handle(renderer);
@@ -126,7 +126,7 @@ int UtcDaliRendererSetGetGeometry(void)
   Geometry geometry2 = CreateQuadGeometry();
   geometry2.RegisterProperty( "uFadeColor", Color::GREEN );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Renderer renderer = Renderer::New(geometry1, material);
   Actor actor = Actor::New();
   actor.AddRenderer(renderer);
@@ -167,10 +167,10 @@ int UtcDaliRendererSetGetMaterial(void)
   TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
   glAbstraction.EnableCullFaceCallTrace(true);
 
-  Material material1 = CreateMaterial(1.0f);
+  Material material1 = CreateMaterial();
   material1.RegisterProperty( "uFadeColor", Color::RED );
 
-  Material material2 = CreateMaterial(1.0f);
+  Material material2 = CreateMaterial();
   material2.RegisterProperty( "uFadeColor", Color::GREEN );
 
   Geometry geometry = CreateQuadGeometry();
@@ -212,7 +212,7 @@ int UtcDaliRendererSetGetDepthIndex(void)
 
   tet_infoline("Test SetDepthIndex, GetDepthIndex");
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New(geometry, material);
   Actor actor = Actor::New();
@@ -250,7 +250,6 @@ int UtcDaliRendererConstraint01(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -295,7 +294,6 @@ int UtcDaliRendererConstraint02(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -354,7 +352,6 @@ int UtcDaliRendererAnimatedProperty01(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -398,7 +395,6 @@ int UtcDaliRendererAnimatedProperty02(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -456,7 +452,6 @@ int UtcDaliRendererUniformMapPrecendence01(void)
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
   material.AddTexture( image, "sTexture" );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
@@ -521,7 +516,6 @@ int UtcDaliRendererUniformMapPrecendence02(void)
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
   material.AddTexture( image, "sTexture" );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
@@ -588,7 +582,6 @@ int UtcDaliRendererUniformMapPrecendence03(void)
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
   material.AddTexture( image, "sTexture" );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
@@ -655,7 +648,6 @@ int UtcDaliRendererUniformMapPrecendence04(void)
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
   material.AddTexture( image, "sTexture" );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
@@ -717,7 +709,6 @@ int UtcDaliRendererUniformMapPrecendence05(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
@@ -780,7 +771,6 @@ int UtcDaliRendererUniformMapMultipleUniforms01(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
@@ -839,7 +829,6 @@ int UtcDaliRendererUniformMapMultipleUniforms02(void)
 
   Shader shader = Shader::New("VertexSource", "FragmentSource");
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   PropertyBuffer vertexBuffer = CreatePropertyBuffer();
   Geometry geometry = CreateQuadGeometryFromBuffer(vertexBuffer);
index 41322f6..5b175a1 100644 (file)
@@ -121,7 +121,7 @@ int UtcSamplerSetFilterMode(void)
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
   Sampler sampler = Sampler::New();
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   material.AddTexture( image, "sTexture", sampler );
 
   Geometry geometry = CreateQuadGeometry();
@@ -248,7 +248,7 @@ int UtcSamplerSetWrapMode(void)
   TestApplication application;
 
   Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 );
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Sampler sampler = Sampler::New();
   material.AddTexture( image, "sTexture", sampler );
 
index 5cf3a34..922bdaa 100644 (file)
@@ -124,7 +124,6 @@ int UtcDaliShaderConstraint01(void)
 
   Shader shader = Shader::New(VertexSource, FragmentSource);
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -169,7 +168,6 @@ int UtcDaliShaderConstraint02(void)
 
   Shader shader = Shader::New(VertexSource, FragmentSource);
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -226,7 +224,6 @@ int UtcDaliShaderAnimatedProperty01(void)
 
   Shader shader = Shader::New(VertexSource, FragmentSource);
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
@@ -270,7 +267,6 @@ int UtcDaliShaderAnimatedProperty02(void)
 
   Shader shader = Shader::New(VertexSource, FragmentSource);
   Material material = Material::New( shader );
-  material.SetProperty(Material::Property::COLOR, Color::WHITE);
 
   Geometry geometry = CreateQuadGeometry();
   Renderer renderer = Renderer::New( geometry, material );
index 51f3e29..dff2386 100644 (file)
 namespace Dali
 {
 
-Material CreateMaterial(float opacity)
+Material CreateMaterial()
 {
   Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
   Material material = Material::New(shader);
 
-  Vector4 color = Color::WHITE;
-  color.a = opacity;
-  material.SetProperty(Material::Property::COLOR, color);
   return material;
 }
 
-Material CreateMaterial(float opacity, Image image)
+Material CreateMaterial( Image image )
 {
   Shader shader = Shader::New( "vertexSrc", "fragmentSrc" );
   Material material = Material::New(shader);
 
-  Vector4 color = Color::WHITE;
-  color.a = opacity;
-  material.SetProperty(Material::Property::COLOR, color);
-
   material.AddTexture( image, "sTexture" );
 
   return material;
index a123808..2d39e01 100644 (file)
@@ -27,8 +27,8 @@
 namespace Dali
 {
 
-Material CreateMaterial(float opacity);
-Material CreateMaterial(float opacity, Image image);
+Material CreateMaterial();
+Material CreateMaterial(Image image);
 Geometry CreateQuadGeometry();
 Geometry CreateQuadGeometryFromBuffer( PropertyBuffer vertexData );
 PropertyBuffer CreatePropertyBuffer();
index 51df9ce..dea1c90 100644 (file)
@@ -409,7 +409,7 @@ public:
   {
     std::stringstream out;
     out << cap;
-    mCullFaceTrace.PushCall("Disable", out.str());
+    mEnableDisableTrace.PushCall("Disable", out.str());
   }
 
   inline void DisableVertexAttribArray(GLuint index)
@@ -435,7 +435,7 @@ public:
   {
     std::stringstream out;
     out << cap;
-    mCullFaceTrace.PushCall("Enable", out.str());
+    mEnableDisableTrace.PushCall("Enable", out.str());
   }
 
   inline void EnableVertexAttribArray(GLuint index)
@@ -1583,6 +1583,11 @@ public: // TEST FUNCTIONS
   inline void ResetCullFaceCallStack() { mCullFaceTrace.Reset(); }
   inline TraceCallStack& GetCullFaceTrace() { return mCullFaceTrace; }
 
+  //Methods for Enable/Disable call verification
+  inline void EnableEnableDisableCallTrace(bool enable) { mEnableDisableTrace.Enable(enable); }
+  inline void ResetEnableDisableCallStack() { mEnableDisableTrace.Reset(); }
+  inline TraceCallStack& GetEnableDisableTrace() { return mEnableDisableTrace; }
+
   //Methods for Shader verification
   inline void EnableShaderCallTrace(bool enable) { mShaderTrace.Enable(enable); }
   inline void ResetShaderCallStack() { mShaderTrace.Reset(); }
@@ -1813,6 +1818,7 @@ private:
   ActiveTextureType mActiveTextures[ MIN_TEXTURE_UNIT_LIMIT ];
 
   TraceCallStack mCullFaceTrace;
+  TraceCallStack mEnableDisableTrace;
   TraceCallStack mShaderTrace;
   TraceCallStack mTextureTrace;
   TraceCallStack mTexParamaterTrace;
index 56525af..5af5485 100644 (file)
@@ -666,13 +666,13 @@ int UtcDaliImageActorUseImageAlpha01(void)
   ImageActor actor = ImageActor::New( image );
   actor.SetBlendMode( BlendingMode::ON );
   actor.SetSize(100, 50);
-  application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
+  application.GetGlAbstraction().EnableEnableDisableCallTrace(true); // For Enable(GL_BLEND)
   Stage::GetCurrent().Add(actor);
 
   application.SendNotification();
   application.Render();
 
-  const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
+  const TraceCallStack& callTrace = application.GetGlAbstraction().GetEnableDisableTrace();
   DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION );
   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
   END_TEST;
@@ -688,13 +688,13 @@ int UtcDaliImageActorUseImageAlpha02(void)
   ImageActor actor = ImageActor::New( image );
   actor.SetBlendMode( BlendingMode::OFF );
   actor.SetSize(100, 50);
-  application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
+  application.GetGlAbstraction().EnableEnableDisableCallTrace(true); // For Enable(GL_BLEND)
   Stage::GetCurrent().Add(actor);
 
   application.SendNotification();
   application.Render();
 
-  const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
+  const TraceCallStack& callTrace = application.GetGlAbstraction().GetEnableDisableTrace();
   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
   DALI_TEST_EQUALS( BlendEnabled( callTrace), false, TEST_LOCATION );
   END_TEST;
@@ -711,13 +711,13 @@ int UtcDaliImageActorUseImageAlpha03(void)
   actor.SetBlendMode( BlendingMode::AUTO );
   actor.SetColor(Vector4(1.0, 1.0, 1.0, 0.5));
   actor.SetSize(100, 50);
-  application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
+  application.GetGlAbstraction().EnableEnableDisableCallTrace(true); // For Enable(GL_BLEND)
   Stage::GetCurrent().Add(actor);
 
   application.SendNotification();
   application.Render();
 
-  const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
+  const TraceCallStack& callTrace = application.GetGlAbstraction().GetEnableDisableTrace();
   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
   DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION );
   END_TEST;
@@ -744,13 +744,13 @@ int UtcDaliImageActorUseImageAlpha04(void)
   actor.SetBlendMode( BlendingMode::ON );
   actor.SetColor(Vector4(1.0, 1.0, 1.0, 1.0));
   actor.SetSize(100, 50);
-  application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
+  application.GetGlAbstraction().EnableEnableDisableCallTrace(true); // For Enable(GL_BLEND)
   Stage::GetCurrent().Add(actor);
 
   application.SendNotification();
   application.Render();
 
-  const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
+  const TraceCallStack& callTrace = application.GetGlAbstraction().GetEnableDisableTrace();
   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
   DALI_TEST_EQUALS( BlendEnabled( callTrace), true, TEST_LOCATION );
   END_TEST;
@@ -767,13 +767,13 @@ int UtcDaliImageActorUseImageAlpha05(void)
   actor.SetBlendMode( BlendingMode::AUTO );
   actor.SetColor(Vector4(1.0, 1.0, 1.0, 1.0));
   actor.SetSize(100, 50);
-  application.GetGlAbstraction().EnableCullFaceCallTrace(true); // For Enable(GL_BLEND)
+  application.GetGlAbstraction().EnableEnableDisableCallTrace(true); // For Enable(GL_BLEND)
   Stage::GetCurrent().Add(actor);
 
   application.SendNotification();
   application.Render();
 
-  const TraceCallStack& callTrace = application.GetGlAbstraction().GetCullFaceTrace();
+  const TraceCallStack& callTrace = application.GetGlAbstraction().GetEnableDisableTrace();
   DALI_TEST_EQUALS( BlendDisabled( callTrace ), false, TEST_LOCATION );
   DALI_TEST_EQUALS( BlendEnabled( callTrace), false, TEST_LOCATION );
   END_TEST;
@@ -1641,7 +1641,7 @@ int UtcDaliImageActorTestClearCache(void)
   application.Render();
 
   // There should be a single call to Clear
-  DALI_TEST_EQUALS( application.GetGlAbstraction().GetClearCountCalled() , 1u, TEST_LOCATION );
+  DALI_TEST_EQUALS( application.GetGlAbstraction().GetClearCountCalled(), 1u, TEST_LOCATION );
 
   // the last set clear mask should be COLOR, DEPTH & STENCIL which occurs at the start of each frame
   GLbitfield mask = application.GetGlAbstraction().GetLastClearMask();
index 67eeb02..fc696f5 100644 (file)
@@ -35,48 +35,6 @@ void mesh_material_test_cleanup(void)
   test_return_value = TET_PASS;
 }
 
-
-namespace
-{
-
-Material ConstructMaterial( const std::string& vertexShader,
-                            const std::string& fragmentShader,
-                            float opacity )
-{
-  Shader shader = Shader::New( vertexShader, fragmentShader );
-  Material customMaterial = Material::New(shader);
-  Vector4 color = Color::WHITE;
-  color.a = opacity;
-  customMaterial.SetProperty(Material::Property::COLOR, color);
-  return customMaterial;
-}
-
-void TestBlending( TestApplication& application, Material material, float actorOpacity, BlendingMode::Type blendingMode, bool expectedBlend )
-{
-  // Generate geometry & renderers
-  //Mesh mesh = Mesh::New(meshData);
-
-  application.SendNotification();
-  application.Render(0);
-  application.Render();
-  application.SendNotification();
-
-  Actor actor = Actor::New();
-  Stage::GetCurrent().Add(actor);
-
-  //material.SetBlendMode(blendingMode);
-  actor.SetOpacity(actorOpacity);
-
-  TraceCallStack& cullFaceTrace = application.GetGlAbstraction().GetCullFaceTrace();
-  cullFaceTrace.Enable(true);
-  application.SendNotification();
-  application.Render();
-  //DALI_TEST_EQUALS( BlendEnabled( cullFaceTrace ), expectedBlend, TEST_LOCATION );
-}
-
-} // anonymous namespace
-
-
 /**
  * Test cases
  *
index 7ae8a9f..1bba4c6 100644 (file)
@@ -1991,7 +1991,7 @@ int UtcDaliRenderTaskContinous05(void)
   CameraActor offscreenCameraActor = CameraActor::New();
   Stage::GetCurrent().Add( offscreenCameraActor );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
   Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
   Integration::ResourceId imageRequestId = imageRequest->GetId();
@@ -2096,7 +2096,7 @@ int UtcDaliRenderTaskOnce02(void)
   CameraActor offscreenCameraActor = CameraActor::New();
   Stage::GetCurrent().Add( offscreenCameraActor );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
   Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
   Integration::ResourceId imageRequestId = imageRequest->GetId();
@@ -2213,7 +2213,7 @@ int UtcDaliRenderTaskOnce04(void)
   CameraActor offscreenCameraActor = CameraActor::New();
   Stage::GetCurrent().Add( offscreenCameraActor );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
   Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
   Integration::ResourceId imageRequestId = imageRequest->GetId();
@@ -2722,7 +2722,7 @@ int UtcDaliRenderTaskOnceNoSync02(void)
   CameraActor offscreenCameraActor = CameraActor::New();
   Stage::GetCurrent().Add( offscreenCameraActor );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
   Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
   Integration::ResourceId imageRequestId = imageRequest->GetId();
@@ -2821,7 +2821,7 @@ int UtcDaliRenderTaskOnceNoSync04(void)
   CameraActor offscreenCameraActor = CameraActor::New();
   Stage::GetCurrent().Add( offscreenCameraActor );
 
-  Material material = CreateMaterial(1.0f);
+  Material material = CreateMaterial();
   Image image = CreateLoadingImage(application, "aFile.jpg", ResourceImage::IMMEDIATE, Image::UNUSED);
   Integration::ResourceRequest* imageRequest = application.GetPlatform().GetRequest();
   Integration::ResourceId imageRequestId = imageRequest->GetId();
index aeb7885..f02d9ad 100644 (file)
@@ -28,7 +28,6 @@ namespace Dali
 
 Material Material::New( Shader shader )
 {
-  // TODO: MESH_REWORK
   Internal::MaterialPtr material = Internal::Material::New();
   material->SetShader( GetImplementation(shader) );
 
@@ -145,6 +144,11 @@ void Material::SetFaceCullingMode( FaceCullingMode cullingMode )
   GetImplementation(*this).SetFaceCullingMode( cullingMode );
 }
 
+Material::FaceCullingMode Material::GetFaceCullingMode()
+{
+  return GetImplementation(*this).GetFaceCullingMode();
+}
+
 void Material::SetBlendMode( BlendingMode::Type mode )
 {
   GetImplementation(*this).SetBlendMode( mode );
@@ -199,7 +203,7 @@ void Material::SetBlendColor( const Vector4& color )
   GetImplementation(*this).SetBlendColor( color );
 }
 
-const Vector4& Material::GetBlendColor() const
+Vector4 Material::GetBlendColor() const
 {
   return GetImplementation(*this).GetBlendColor();
 }
index 32afde3..acc98ca 100644 (file)
@@ -63,24 +63,18 @@ public:
   {
     enum
     {
-      COLOR = DEFAULT_OBJECT_PROPERTY_START_INDEX,  ///< name "color",                          type VECTOR4
-      FACE_CULLING_MODE,                            ///< name "face-culling-mode",              type STRING
-      BLENDING_MODE,                                ///< name "blending-mode",                  type STRING
-      BLEND_EQUATION_RGB,                           ///< name "blend-equation-rgb",             type STRING
-      BLEND_EQUATION_ALPHA,                         ///< name "blend-equation-alpha",           type STRING
-      BLENDING_SRC_FACTOR_RGB,                      ///< name "source-blend-factor-rgb",        type STRING
-      BLENDING_DEST_FACTOR_RGB,                     ///< name "destination-blend-factor-rgb",   type STRING
-      BLENDING_SRC_FACTOR_ALPHA,                    ///< name "source-blend-factor-alpha",      type STRING
-      BLENDING_DEST_FACTOR_ALPHA,                   ///< name "destination-blend-factor-alpha", type STRING
-      BLEND_COLOR,                                  ///< name "blend-color",                    type VECTOR4
+      FACE_CULLING_MODE = DEFAULT_OBJECT_PROPERTY_START_INDEX, ///< name "face-culling-mode",              type INTEGER
+      BLENDING_MODE,                                           ///< name "blending-mode",                  type INTEGER
+      BLEND_EQUATION_RGB,                                      ///< name "blend-equation-rgb",             type INTEGER
+      BLEND_EQUATION_ALPHA,                                    ///< name "blend-equation-alpha",           type INTEGER
+      BLENDING_SRC_FACTOR_RGB,                                 ///< name "source-blend-factor-rgb",        type INTEGER
+      BLENDING_DEST_FACTOR_RGB,                                ///< name "destination-blend-factor-rgb",   type INTEGER
+      BLENDING_SRC_FACTOR_ALPHA,                               ///< name "source-blend-factor-alpha",      type INTEGER
+      BLENDING_DEST_FACTOR_ALPHA,                              ///< name "destination-blend-factor-alpha", type INTEGER
+      BLEND_COLOR,                                             ///< name "blend-color",                    type VECTOR4
     };
   };
 
-  /// @name Uniform Mapping
-  /** @{ */
-       ///< property "COLOR", uniform "uMaterialColor"
-  /** @} */
-
   /**
    * @brief Creates a new Material object
    *
@@ -200,13 +194,20 @@ public:
   /**
    * @brief Set the culling mode for this material
    *
-   * Calling this function sets the properties CULLING_MODE
+   * Calling this function sets the property CULLING_MODE
    *
    * @param[in] cullingMode The culling mode for this material
    */
   void SetFaceCullingMode( FaceCullingMode cullingMode );
 
   /**
+   * @brief Get the face culling mode for this material
+   *
+   * @return The face culling mode for this material
+   */
+  FaceCullingMode GetFaceCullingMode();
+
+  /**
    * @brief Sets the blending mode.
    *
    * Possible values are: BlendingMode::OFF, BlendingMode::AUTO and BlendingMode::ON. Default is BlendingMode::AUTO.
@@ -315,7 +316,7 @@ public:
    *
    * @return The blend color.
    */
-  const Vector4& GetBlendColor() const;
+  Vector4 GetBlendColor() const;
 
 public:
   /**
index 1f4b75b..55d3905 100644 (file)
@@ -41,16 +41,15 @@ namespace
  *            |name                              |type     |writable|animatable|constraint-input|enum for index-checking|
  */
 DALI_PROPERTY_TABLE_BEGIN
-DALI_PROPERTY( "color",                           VECTOR4,  true, true,   true, Dali::Material::Property::COLOR )
-DALI_PROPERTY( "face-culling-mode",               STRING,   true, false,  false, Dali::Material::Property::FACE_CULLING_MODE )
-DALI_PROPERTY( "blending-mode",                   STRING,   true, false,  false, Dali::Material::Property::BLENDING_MODE )
-DALI_PROPERTY( "blend-equation-rgb",              STRING,   true, false,  false, Dali::Material::Property::BLEND_EQUATION_RGB )
-DALI_PROPERTY( "blend-equation-alpha",            STRING,   true, false,  false, Dali::Material::Property::BLEND_EQUATION_ALPHA )
-DALI_PROPERTY( "source-blend-factor-rgb",         STRING,   true, false,  false, Dali::Material::Property::BLENDING_SRC_FACTOR_RGB )
-DALI_PROPERTY( "destination-blend-factor-rgb",    STRING,   true, false,  false, Dali::Material::Property::BLENDING_DEST_FACTOR_RGB )
-DALI_PROPERTY( "source-blend-factor-alpha",       STRING,   true, false,  false, Dali::Material::Property::BLENDING_SRC_FACTOR_ALPHA )
-DALI_PROPERTY( "destination-blend-factor-alpha",  STRING,   true, false,  false, Dali::Material::Property::BLENDING_DEST_FACTOR_ALPHA )
-DALI_PROPERTY( "blend-color",                     VECTOR4,  true, true,   true, Dali::Material::Property::BLEND_COLOR )
+DALI_PROPERTY( "face-culling-mode",               INTEGER,   true, false,  false, Dali::Material::Property::FACE_CULLING_MODE )
+DALI_PROPERTY( "blending-mode",                   INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_MODE )
+DALI_PROPERTY( "blend-equation-rgb",              INTEGER,   true, false,  false, Dali::Material::Property::BLEND_EQUATION_RGB )
+DALI_PROPERTY( "blend-equation-alpha",            INTEGER,   true, false,  false, Dali::Material::Property::BLEND_EQUATION_ALPHA )
+DALI_PROPERTY( "source-blend-factor-rgb",         INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_SRC_FACTOR_RGB )
+DALI_PROPERTY( "destination-blend-factor-rgb",    INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_DEST_FACTOR_RGB )
+DALI_PROPERTY( "source-blend-factor-alpha",       INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_SRC_FACTOR_ALPHA )
+DALI_PROPERTY( "destination-blend-factor-alpha",  INTEGER,   true, false,  false, Dali::Material::Property::BLENDING_DEST_FACTOR_ALPHA )
+DALI_PROPERTY( "blend-color",                     VECTOR4,   true, false,  false, Dali::Material::Property::BLEND_COLOR )
 DALI_PROPERTY_TABLE_END( DEFAULT_ACTOR_PROPERTY_START_INDEX )
 
 const ObjectImplHelper<DEFAULT_PROPERTY_COUNT> MATERIAL_IMPL = { DEFAULT_PROPERTY_DETAILS };
@@ -182,19 +181,26 @@ size_t Material::GetNumberOfTextures() const
 
 void Material::SetFaceCullingMode( Dali::Material::FaceCullingMode cullingMode )
 {
-  if( NULL != mSceneObject )
+  if( mFaceCullingMode != cullingMode )
   {
-    SceneGraph::DoubleBufferedPropertyMessage<int>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mFaceCullingMode, &SceneGraph::DoubleBufferedProperty<int>::Set, static_cast<int>(cullingMode) );
+    mFaceCullingMode = cullingMode;
+
+    SetFaceCullingModeMessage( GetEventThreadServices(), *mSceneObject, mFaceCullingMode );
   }
 }
 
-void Material::SetBlendMode( BlendingMode::Type mode )
+Dali::Material::FaceCullingMode Material::GetFaceCullingMode()
 {
-  mBlendingMode = mode;
+  return mFaceCullingMode;
+}
 
-  if( NULL != mSceneObject )
+void Material::SetBlendMode( BlendingMode::Type mode )
+{
+  if( mBlendingMode != mode )
   {
-    SceneGraph::DoubleBufferedPropertyMessage<int>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mBlendingMode, &SceneGraph::DoubleBufferedProperty<int>::Set, static_cast<int>(mode) );
+    mBlendingMode = mode;
+
+    SetBlendingModeMessage( GetEventThreadServices(), *mSceneObject, mBlendingMode );
   }
 }
 
@@ -252,15 +258,24 @@ void Material::GetBlendEquation( BlendingEquation::Type& equationRgb,
 
 void Material::SetBlendColor( const Vector4& color )
 {
-  if( mSceneObject )
+  if( !mBlendColor )
+  {
+    mBlendColor = new Vector4();
+  }
+  if( *mBlendColor != color )
   {
-    SceneGraph::AnimatablePropertyMessage<Vector4>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mBlendColor, &SceneGraph::AnimatableProperty<Vector4>::Bake, color );
+    *mBlendColor = color;
+    SetBlendColorMessage( GetEventThreadServices(), *mSceneObject, *mBlendColor );
   }
 }
 
-const Vector4& Material::GetBlendColor() const
+Vector4 Material::GetBlendColor() const
 {
-  return mSceneObject->mBlendColor[ GetEventThreadServices().GetEventBufferIndex() ];
+  if( mBlendColor )
+  {
+    return *mBlendColor;
+  }
+  return Color::TRANSPARENT; // GL default
 }
 
 const SceneGraph::Material* Material::GetMaterialSceneObject() const
@@ -313,91 +328,121 @@ void Material::SetDefaultProperty( Property::Index index,
 {
   switch( index )
   {
-    case Dali::Material::Property::COLOR:
-    {
-      SceneGraph::AnimatablePropertyMessage<Vector4>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mColor, &SceneGraph::AnimatableProperty<Vector4>::Bake, propertyValue.Get<Vector4>() );
-      break;
-    }
     case Dali::Material::Property::FACE_CULLING_MODE:
     {
-      SceneGraph::DoubleBufferedPropertyMessage<int>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mFaceCullingMode, &SceneGraph::DoubleBufferedProperty<int>::Set, propertyValue.Get<int>() );
+      int faceCullingMode;
+      if( propertyValue.Get( faceCullingMode ) )
+      {
+        SetFaceCullingMode( Dali::Material::FaceCullingMode( faceCullingMode ) );
+      }
       break;
     }
     case Dali::Material::Property::BLENDING_MODE:
     {
-      if( mSceneObject )
+      int blendingMode;
+      if( propertyValue.Get( blendingMode ) )
       {
-        SceneGraph::DoubleBufferedPropertyMessage<int>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mBlendingMode, &SceneGraph::DoubleBufferedProperty<int>::Set, propertyValue.Get<int>() );
+        SetBlendMode( BlendingMode::Type( blendingMode ) );
       }
       break;
     }
     case Dali::Material::Property::BLEND_EQUATION_RGB:
     {
-      BlendingEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
-      mBlendingOptions.SetBlendEquation( static_cast<BlendingEquation::Type>(propertyValue.Get<int>()), alphaEquation );
+      int blendingEquation;
+      if( propertyValue.Get( blendingEquation ) )
+      {
+        BlendingEquation::Type alphaEquation = mBlendingOptions.GetBlendEquationAlpha();
+        mBlendingOptions.SetBlendEquation( static_cast<BlendingEquation::Type>( blendingEquation ), alphaEquation );
+        SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+      }
       break;
     }
     case Dali::Material::Property::BLEND_EQUATION_ALPHA:
     {
-      BlendingEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
-      mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendingEquation::Type>(propertyValue.Get<int>()) );
+      int blendingEquation;
+      if( propertyValue.Get( blendingEquation ) )
+      {
+        BlendingEquation::Type rgbEquation = mBlendingOptions.GetBlendEquationRgb();
+        mBlendingOptions.SetBlendEquation( rgbEquation, static_cast<BlendingEquation::Type>( blendingEquation ) );
+        SetBlendingOptionsMessage( GetEventThreadServices(), *mSceneObject, mBlendingOptions.GetBitmask() );
+      }
       break;
     }
     case Dali::Material::Property::BLENDING_SRC_FACTOR_RGB:
     {
-      BlendingFactor::Type srcFactorRgb;
-      BlendingFactor::Type destFactorRgb;
-      BlendingFactor::Type srcFactorAlpha;
-      BlendingFactor::Type destFactorAlpha;
-      GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-      SetBlendFunc( static_cast<BlendingFactor::Type>(propertyValue.Get<int>()),
-                    destFactorRgb,
-                    srcFactorAlpha,
-                    destFactorAlpha );
+      int blendingFactor;
+      if( propertyValue.Get( blendingFactor ) )
+      {
+        BlendingFactor::Type srcFactorRgb;
+        BlendingFactor::Type destFactorRgb;
+        BlendingFactor::Type srcFactorAlpha;
+        BlendingFactor::Type destFactorAlpha;
+        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+        SetBlendFunc( static_cast<BlendingFactor::Type>( blendingFactor ),
+                      destFactorRgb,
+                      srcFactorAlpha,
+                      destFactorAlpha );
+      }
       break;
     }
     case Dali::Material::Property::BLENDING_DEST_FACTOR_RGB:
     {
-      BlendingFactor::Type srcFactorRgb;
-      BlendingFactor::Type destFactorRgb;
-      BlendingFactor::Type srcFactorAlpha;
-      BlendingFactor::Type destFactorAlpha;
-      GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-      SetBlendFunc( srcFactorRgb,
-                    static_cast<BlendingFactor::Type>(propertyValue.Get<int>()),
-                    srcFactorAlpha,
-                    destFactorAlpha );
+      int blendingFactor;
+      if( propertyValue.Get( blendingFactor ) )
+      {
+        BlendingFactor::Type srcFactorRgb;
+        BlendingFactor::Type destFactorRgb;
+        BlendingFactor::Type srcFactorAlpha;
+        BlendingFactor::Type destFactorAlpha;
+        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+        SetBlendFunc( srcFactorRgb,
+                      static_cast<BlendingFactor::Type>( blendingFactor ),
+                      srcFactorAlpha,
+                      destFactorAlpha );
+      }
       break;
     }
     case Dali::Material::Property::BLENDING_SRC_FACTOR_ALPHA:
     {
-      BlendingFactor::Type srcFactorRgb;
-      BlendingFactor::Type destFactorRgb;
-      BlendingFactor::Type srcFactorAlpha;
-      BlendingFactor::Type destFactorAlpha;
-      GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-      SetBlendFunc( srcFactorRgb,
-                    destFactorRgb,
-                    static_cast<BlendingFactor::Type>(propertyValue.Get<int>()),
-                    destFactorAlpha );
+      int blendingFactor;
+      if( propertyValue.Get( blendingFactor ) )
+      {
+        BlendingFactor::Type srcFactorRgb;
+        BlendingFactor::Type destFactorRgb;
+        BlendingFactor::Type srcFactorAlpha;
+        BlendingFactor::Type destFactorAlpha;
+        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+        SetBlendFunc( srcFactorRgb,
+                      destFactorRgb,
+                      static_cast<BlendingFactor::Type>( blendingFactor ),
+                      destFactorAlpha );
+      }
       break;
     }
     case Dali::Material::Property::BLENDING_DEST_FACTOR_ALPHA:
     {
-      BlendingFactor::Type srcFactorRgb;
-      BlendingFactor::Type destFactorRgb;
-      BlendingFactor::Type srcFactorAlpha;
-      BlendingFactor::Type destFactorAlpha;
-      GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
-      SetBlendFunc( srcFactorRgb,
-                    destFactorRgb,
-                    srcFactorAlpha,
-                    static_cast<BlendingFactor::Type>(propertyValue.Get<int>()) );
+      int blendingFactor;
+      if( propertyValue.Get( blendingFactor ) )
+      {
+        BlendingFactor::Type srcFactorRgb;
+        BlendingFactor::Type destFactorRgb;
+        BlendingFactor::Type srcFactorAlpha;
+        BlendingFactor::Type destFactorAlpha;
+        GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha );
+        SetBlendFunc( srcFactorRgb,
+                      destFactorRgb,
+                      srcFactorAlpha,
+                      static_cast<BlendingFactor::Type>( blendingFactor ) );
+      }
       break;
     }
     case Dali::Material::Property::BLEND_COLOR:
     {
-      SceneGraph::AnimatablePropertyMessage<Vector4>::Send( GetEventThreadServices(), mSceneObject, &mSceneObject->mBlendColor, &SceneGraph::AnimatableProperty<Vector4>::Bake, propertyValue.Get<Vector4>() );
+      Vector4 blendColor;
+      if( propertyValue.Get( blendColor ) )
+      {
+        SetBlendColor( blendColor );
+      }
       break;
     }
   }
@@ -413,33 +458,18 @@ void Material::SetSceneGraphProperty( Property::Index index,
 
 Property::Value Material::GetDefaultProperty( Property::Index index ) const
 {
-  BufferIndex bufferIndex = GetEventThreadServices().GetEventBufferIndex();
   Property::Value value;
 
   switch( index )
   {
-    case Dali::Material::Property::COLOR:
-    {
-      if( mSceneObject )
-      {
-        value = mSceneObject->mColor[bufferIndex];
-      }
-      break;
-    }
     case Dali::Material::Property::FACE_CULLING_MODE:
     {
-      if( mSceneObject )
-      {
-        value = mSceneObject->mFaceCullingMode[bufferIndex];
-      }
+      value = mFaceCullingMode;
       break;
     }
     case Dali::Material::Property::BLENDING_MODE:
     {
-      if( mSceneObject )
-      {
-        value = mSceneObject->mBlendingMode[bufferIndex];
-      }
+      value = mBlendingMode;
       break;
     }
     case Dali::Material::Property::BLEND_EQUATION_RGB:
@@ -494,10 +524,7 @@ Property::Value Material::GetDefaultProperty( Property::Index index ) const
     }
     case Dali::Material::Property::BLEND_COLOR:
     {
-      if( mSceneObject )
-      {
-        value = mSceneObject->mBlendColor[bufferIndex];
-      }
+      value = mBlendColor;
       break;
     }
   }
@@ -517,85 +544,14 @@ const SceneGraph::PropertyOwner* Material::GetSceneObject() const
 
 const SceneGraph::PropertyBase* Material::GetSceneObjectAnimatableProperty( Property::Index index ) const
 {
-  DALI_ASSERT_ALWAYS( IsPropertyAnimatable( index ) && "Property is not animatable" );
-
-  const SceneGraph::PropertyBase* property = NULL;
-
-  if( OnStage() )
-  {
-    property = MATERIAL_IMPL.GetRegisteredSceneGraphProperty( this,
-                                                              &Material::FindAnimatableProperty,
-                                                              &Material::FindCustomProperty,
-                                                              index );
-
-    if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
-    {
-      switch(index)
-      {
-        case Dali::Material::Property::COLOR:
-        {
-          property = &mSceneObject->mColor;
-          break;
-        }
-        case Dali::Material::Property::BLEND_COLOR:
-        {
-          property = &mSceneObject->mBlendColor;
-          break;
-        }
-        default:
-        {
-          DALI_ASSERT_ALWAYS( 0 && "Property is not animatable");
-          break;
-        }
-      }
-    }
-  }
-
-  return property;
+  PropertyMetadata* property = index >= PROPERTY_CUSTOM_START_INDEX ? static_cast<PropertyMetadata*>(FindCustomProperty( index )) : static_cast<PropertyMetadata*>(FindAnimatableProperty( index ));
+  DALI_ASSERT_ALWAYS( property && "Property index is invalid" );
+  return property->GetSceneGraphProperty();
 }
 
 const PropertyInputImpl* Material::GetSceneObjectInputProperty( Property::Index index ) const
 {
-  const PropertyInputImpl* property = NULL;
-
-  if( OnStage() )
-  {
-    const SceneGraph::PropertyBase* baseProperty =
-      MATERIAL_IMPL.GetRegisteredSceneGraphProperty( this,
-                                                     &Material::FindAnimatableProperty,
-                                                     &Material::FindCustomProperty,
-                                                     index );
-    property = static_cast<const PropertyInputImpl*>( baseProperty );
-
-    if( property == NULL && index < DEFAULT_PROPERTY_MAX_COUNT )
-    {
-      switch(index)
-      {
-        case Dali::Material::Property::COLOR:
-        {
-          property = &mSceneObject->mColor;
-          break;
-        }
-        case Dali::Material::Property::FACE_CULLING_MODE:
-        {
-          property = &mSceneObject->mFaceCullingMode;
-          break;
-        }
-        case Dali::Material::Property::BLEND_COLOR:
-        {
-          property = &mSceneObject->mBlendColor;
-          break;
-        }
-        default:
-        {
-          DALI_ASSERT_ALWAYS( 0 && "Property cannot be a constraint input");
-          break;
-        }
-      }
-    }
-  }
-
-  return property;
+  return GetSceneObjectAnimatableProperty( index );
 }
 
 int Material::GetPropertyComponentIndex( Property::Index index ) const
@@ -640,6 +596,12 @@ void Material::Disconnect()
 
 Material::Material()
 : mSceneObject( NULL ),
+  mShader( NULL ),
+  mTextures(),
+  mFaceCullingMode( Dali::Material::NONE ),
+  mBlendingMode( Dali::BlendingMode::AUTO ),
+  mBlendingOptions(), // initialises to defaults
+  mBlendColor( NULL ),
   mOnStage( false )
 {
 }
@@ -657,6 +619,7 @@ void Material::Initialize()
 
 Material::~Material()
 {
+  delete mBlendColor;
   if( EventThreadServices::IsCoreRunning() )
   {
     EventThreadServices& eventThreadServices = GetEventThreadServices();
index 5b36fe7..666fc3b 100644 (file)
@@ -108,12 +108,18 @@ public:
    * @copydoc Dali::Material::GetNumberOfTextures()
    */
   size_t GetNumberOfTextures() const;
+
   /**
    * @copydoc Dali::Material::SetFaceCullingMode()
    */
   void SetFaceCullingMode( Dali::Material::FaceCullingMode cullingMode );
 
   /**
+   * @copydoc Dali::Material::GetFaceCullingMode()
+   */
+  Dali::Material::FaceCullingMode GetFaceCullingMode();
+
+  /**
    * @copydoc Dali::Material::SetBlendMode()
    */
   void SetBlendMode( BlendingMode::Type mode );
@@ -163,7 +169,7 @@ public:
   /**
    * @copydoc Dali::Material::GetBlendColor()
    */
-  const Vector4& GetBlendColor() const;
+  Vector4 GetBlendColor() const;
 
   /**
    * @brief Get the material scene object
@@ -308,13 +314,16 @@ private: // unimplemented methods
   Material( const Material& );
   Material& operator=( const Material& );
 
-private: //data
+private: // Data
+
+  SceneGraph::Material* mSceneObject;
   IntrusivePtr<Shader> mShader; ///< Connector that holds the shader used by this material
   std::vector<Material::Texture> mTextures; ///<Vector of textures used by this material
-  SceneGraph::Material* mSceneObject;
 
-  BlendingMode::Type mBlendingMode; ///< Local store
-  BlendingOptions mBlendingOptions; ///< Local copy of blending options bitmask
+  Dali::Material::FaceCullingMode mFaceCullingMode; ///< Local copy of face culling mode
+  BlendingMode::Type mBlendingMode;                 ///< Local copy of blending mode
+  BlendingOptions mBlendingOptions;                 ///< Local copy of blending options bitmask
+  Vector4* mBlendColor;                             ///< Local copy of blend color, pointer only as its reraly used
   bool mOnStage;
 
 };
index 0aaf795..7093da5 100644 (file)
@@ -24,6 +24,8 @@ namespace Dali
 {
 namespace Internal
 {
+class BlendingOptions;
+
 namespace SceneGraph
 {
 
@@ -41,43 +43,17 @@ public:
   {
   }
 
-  virtual const Vector4& GetBlendColor( BufferIndex bufferIndex ) const = 0;
-
-  /**
-   * Get the RGB source factor
-   * @return the RGB source factor
-   */
-  virtual BlendingFactor::Type GetBlendSrcFactorRgb( BufferIndex bufferIndex ) const = 0;
-
-  /**
-   * Get the Alpha source factor
-   * @return the Alpha source factor
-   */
-  virtual BlendingFactor::Type GetBlendSrcFactorAlpha( BufferIndex bufferIndex ) const = 0;
-
   /**
-   * Get the RGB destination factor
-   * @return the RGB destination factor
+   * Get the blend color
+   * @return blend color of NULL if blend color is not set
    */
-  virtual BlendingFactor::Type GetBlendDestFactorRgb( BufferIndex bufferIndex ) const = 0;
+  virtual Vector4* GetBlendColor() const = 0;
 
   /**
-   * Get the Alpha destination factor
-   * @return the Alpha destination factor
+   * Get the blending options
+   * @return the blending options
    */
-  virtual BlendingFactor::Type GetBlendDestFactorAlpha( BufferIndex bufferIndex ) const = 0;
-
-  /**
-   * Get the RGB blending equation
-   * @return the RGB blending equation
-   */
-  virtual BlendingEquation::Type GetBlendEquationRgb( BufferIndex bufferIndex ) const = 0;
-
-  /**
-   * Get the Alpha blending equation
-   * @return the Alpha blending equation
-   */
-  virtual BlendingEquation::Type GetBlendEquationAlpha( BufferIndex bufferIndex ) const = 0;
+  virtual const BlendingOptions& GetBlendingOptions() const = 0;
 
 protected:
   /**
@@ -89,7 +65,9 @@ protected:
 };
 
 } // namespace SceneGraph
+
 } // namespace Internal
+
 } // namespace Dali
 
 #endif // DALI_INTERNAL_SCENE_GRAPH_MATERIAL_DATA_PROVIDER_H
index 06f2c7e..8089ea7 100644 (file)
@@ -352,11 +352,8 @@ void ImageRenderer::DoRender( Context& context, SceneGraph::TextureCache& textur
   }
 }
 
-void ImageRenderer::DoSetBlending(Context& context, BufferIndex bufferIndex, bool blend )
+void ImageRenderer::DoSetBlending( Context& context )
 {
-  // Enables/disables blending mode.
-  context.SetBlend( blend );
-
   // Set the blend color
   const Vector4* const customColor = mBlendingOptions.GetBlendColor();
   if( customColor )
index 1db683a..421fe9f 100644 (file)
@@ -144,7 +144,7 @@ public:
   /**
    * @copydoc Dali::Internal::SceneGraph::Renderer::DoSetBlending()
    */
-  virtual void DoSetBlending( Context& context, BufferIndex bufferIndex, bool blend );
+  virtual void DoSetBlending( Context& context );
 
 protected: // TextureObserver implementation
 
index 4552bb0..90d2c3e 100644 (file)
@@ -99,25 +99,27 @@ void NewRenderer::DoSetCullFaceMode( Context& context, BufferIndex bufferIndex )
 {
 }
 
-void NewRenderer::DoSetBlending( Context& context, BufferIndex bufferIndex, bool blend )
+void NewRenderer::DoSetBlending( Context& context )
 {
-  context.SetBlend( blend );
-  if( blend )
-  {
-    const SceneGraph::MaterialDataProvider& material = mRenderDataProvider->GetMaterial();
+  const SceneGraph::MaterialDataProvider& material = mRenderDataProvider->GetMaterial();
 
-    context.SetCustomBlendColor( material.GetBlendColor( bufferIndex ) );
+  // Blend color is optional and rarely used
+  Vector4* blendColor = material.GetBlendColor();
+  if( blendColor )
+  {
+    context.SetCustomBlendColor( *blendColor );
+  }
 
-    // Set blend source & destination factors
-    context.BlendFuncSeparate( material.GetBlendSrcFactorRgb( bufferIndex ),
-                               material.GetBlendDestFactorRgb( bufferIndex ),
-                               material.GetBlendSrcFactorAlpha( bufferIndex ),
-                               material.GetBlendDestFactorAlpha( bufferIndex ) );
+  const BlendingOptions& blending = material.GetBlendingOptions();
+  // Set blend source & destination factors
+  context.BlendFuncSeparate( blending.GetBlendSrcFactorRgb(),
+                             blending.GetBlendDestFactorRgb(),
+                             blending.GetBlendSrcFactorAlpha(),
+                             blending.GetBlendDestFactorAlpha() );
 
-    // Set blend equations
-    context.BlendEquationSeparate( material.GetBlendEquationRgb( bufferIndex ),
-                                   material.GetBlendEquationAlpha( bufferIndex ) );
-  }
+  // Set blend equations
+  context.BlendEquationSeparate( blending.GetBlendEquationRgb(),
+                                 blending.GetBlendEquationAlpha() );
 }
 
 void NewRenderer::DoRender( Context& context, SceneGraph::TextureCache& textureCache, const SceneGraph::NodeDataProvider& node, BufferIndex bufferIndex, Program& program, const Matrix& modelViewMatrix, const Matrix& viewMatrix )
index 42e981b..0b7f550 100644 (file)
@@ -127,12 +127,12 @@ public: // Implementation of Renderer
   /**
    * @copydoc SceneGraph::Renderer::DoSetCullFaceMode
    */
-  virtual void DoSetCullFaceMode(Context& context, BufferIndex bufferIndex );
+  virtual void DoSetCullFaceMode( Context& context, BufferIndex bufferIndex );
 
   /**
    * @copydoc SceneGraph::Renderer::DoSetBlending
    */
-  virtual void DoSetBlending(Context& context, BufferIndex bufferIndex, bool blend );
+  virtual void DoSetBlending( Context& context );
 
   /**
    * @copydoc SceneGraph::Renderer::DoRender()
index 5f1beed..6b3706e 100644 (file)
@@ -185,7 +185,12 @@ void Renderer::Render( Context& context,
 
   DoSetCullFaceMode( context, bufferIndex );
 
-  DoSetBlending( context, bufferIndex, blend );
+  // Enable/disable blending
+  context.SetBlend( blend );
+  if( blend )
+  {
+    DoSetBlending( context );
+  }
 
   // Ignore missing uniforms - custom shaders and flat color shaders don't have SAMPLER
   // set projection and view matrix if program has not yet received them yet this frame
index 7bf76f7..6aa3d07 100644 (file)
@@ -168,15 +168,16 @@ private:
 
   /**
    * Called from Render prior to DoRender(). Default method to set CullFaceMode
-   * @todo MESH_REWORK Remove after merge
+   * @param context to use
+   * @param bufferIndex to use
    */
   virtual void DoSetCullFaceMode( Context& context, BufferIndex bufferIndex );
 
   /**
    * Called from Render prior to DoRender(). Default method to set blending options
-   * @todo MESH_REWORK Remove after merge
+   * @param context to use
    */
-  virtual void DoSetBlending( Context& context, BufferIndex bufferIndex, bool blend ) = 0;
+  virtual void DoSetBlending( Context& context ) = 0;
 
   /**
    * Called from Render; implemented in derived classes.
index ffea32c..492e790 100644 (file)
@@ -31,19 +31,19 @@ namespace Internal
 namespace SceneGraph
 {
 
-namespace
-{
-const unsigned int DEFAULT_BLENDING_OPTIONS( BlendingOptions().GetBitmask() );
-}
-
 Material::Material()
-: mColor( Color::WHITE ),
-  mBlendColor( Color::TRANSPARENT ),
-  mFaceCullingMode(Dali::Material::NONE),
-  mBlendingMode(Dali::BlendingMode::AUTO),
-  mBlendingOptions( DEFAULT_BLENDING_OPTIONS ),
-  mShader(NULL),
-  mBlendPolicy(OPAQUE)
+: mShader( NULL ),
+  mBlendColor( NULL ),
+  mSamplers(),
+  mTextureId(),
+  mUniformName(),
+  mIsFullyOpaque(),
+  mAffectsTransparency(),
+  mConnectionObservers(),
+  mFaceCullingMode( Dali::Material::NONE ),
+  mBlendingMode( Dali::BlendingMode::AUTO ),
+  mBlendingOptions(), // initializes to defaults
+  mBlendPolicy( OPAQUE )
 {
   // Observe own property-owner's uniform map
   AddUniformMapObserver( *this );
@@ -66,17 +66,26 @@ void Material::SetShader( Shader* shader )
 
 Shader* Material::GetShader() const
 {
-  // @todo - Fix this - move shader setup to the Renderer connect to stage...
   return mShader;
 }
 
+void Material::SetFaceCullingMode( unsigned int faceCullingMode )
+{
+  mFaceCullingMode = static_cast< Dali::Material::FaceCullingMode >( faceCullingMode );
+}
+
+void Material::SetBlendingMode( unsigned int blendingMode )
+{
+  mBlendingMode = static_cast< BlendingMode::Type >( blendingMode );
+}
+
 void Material::PrepareRender( BufferIndex bufferIndex )
 {
   mBlendPolicy = OPAQUE;
 
   // @todo MESH_REWORK Add dirty flags to reduce processing.
 
-  switch(mBlendingMode[bufferIndex])
+  switch( mBlendingMode )
   {
     case BlendingMode::OFF:
     {
@@ -104,12 +113,6 @@ void Material::PrepareRender( BufferIndex bufferIndex )
 
       if( opaque )
       {
-        // Check the material color:
-        opaque = ( mColor[ bufferIndex ].a >= FULLY_OPAQUE );
-      }
-
-      if( opaque )
-      {
         unsigned int opaqueCount=0;
         unsigned int affectingCount=0;
         size_t textureCount( GetTextureCount() );
@@ -132,62 +135,36 @@ void Material::PrepareRender( BufferIndex bufferIndex )
   }
 }
 
-
 Material::BlendPolicy Material::GetBlendPolicy() const
 {
   return mBlendPolicy;
 }
 
-void Material::SetBlendingOptions( BufferIndex updateBufferIndex, unsigned int options )
-{
-  mBlendingOptions.Set( updateBufferIndex, options );
-}
-
-const Vector4& Material::GetBlendColor(BufferIndex bufferIndex) const
-{
-  return mBlendColor[bufferIndex];
-}
-
-BlendingFactor::Type Material::GetBlendSrcFactorRgb( BufferIndex bufferIndex ) const
-{
-  BlendingOptions blendingOptions;
-  blendingOptions.SetBitmask( mBlendingOptions[ bufferIndex ] );
-  return blendingOptions.GetBlendSrcFactorRgb();
-}
-
-BlendingFactor::Type Material::GetBlendSrcFactorAlpha( BufferIndex bufferIndex ) const
+void Material::SetBlendingOptions( unsigned int options )
 {
-  BlendingOptions blendingOptions;
-  blendingOptions.SetBitmask( mBlendingOptions[ bufferIndex ] );
-  return blendingOptions.GetBlendSrcFactorAlpha();
+  mBlendingOptions.SetBitmask( options );
 }
 
-BlendingFactor::Type Material::GetBlendDestFactorRgb( BufferIndex bufferIndex ) const
+void Material::SetBlendColor( const Vector4& blendColor )
 {
-  BlendingOptions blendingOptions;
-  blendingOptions.SetBitmask( mBlendingOptions[ bufferIndex ] );
-  return blendingOptions.GetBlendDestFactorRgb();
-}
-
-BlendingFactor::Type Material::GetBlendDestFactorAlpha( BufferIndex bufferIndex ) const
-{
-  BlendingOptions blendingOptions;
-  blendingOptions.SetBitmask( mBlendingOptions[ bufferIndex ] );
-  return blendingOptions.GetBlendDestFactorAlpha();
+  if( mBlendColor )
+  {
+    *mBlendColor = blendColor;
+  }
+  else
+  {
+    mBlendColor = new Vector4( blendColor );
+  }
 }
 
-BlendingEquation::Type Material::GetBlendEquationRgb( BufferIndex bufferIndex ) const
+Vector4* Material::GetBlendColor() const
 {
-  BlendingOptions blendingOptions;
-  blendingOptions.SetBitmask( mBlendingOptions[ bufferIndex ] );
-  return blendingOptions.GetBlendEquationRgb();
+  return mBlendColor;
 }
 
-BlendingEquation::Type Material::GetBlendEquationAlpha( BufferIndex bufferIndex ) const
+const BlendingOptions& Material::GetBlendingOptions() const
 {
-  BlendingOptions blendingOptions;
-  blendingOptions.SetBitmask( mBlendingOptions[ bufferIndex ] );
-  return blendingOptions.GetBlendEquationAlpha();
+  return mBlendingOptions;
 }
 
 void Material::AddTexture( const std::string& name, ResourceId id, Render::Sampler* sampler )
@@ -264,16 +241,8 @@ void Material::ConnectedUniformMapChanged( )
   mConnectionObservers.ConnectedUniformMapChanged();
 }
 
-void Material::ResetDefaultProperties( BufferIndex updateBufferIndex )
-{
-  mColor.ResetToBaseValue( updateBufferIndex );
-  mBlendColor.ResetToBaseValue( updateBufferIndex );
-  mFaceCullingMode.CopyPrevious( updateBufferIndex );
-
-  mBlendingMode.CopyPrevious( updateBufferIndex );
-  mBlendingOptions.CopyPrevious( updateBufferIndex );
-}
-
 } // namespace SceneGraph
+
 } // namespace Internal
+
 } // namespace Dali
index 3f13d1e..eed1cb3 100644 (file)
@@ -17,6 +17,8 @@
  * limitations under the License.
  */
 
+// INTERNAL INCLUDES
+#include <dali/devel-api/rendering/material.h>
 #include <dali/internal/common/buffer-index.h>
 #include <dali/internal/common/blending-options.h>
 #include <dali/internal/event/common/event-thread-services.h>
@@ -74,6 +76,24 @@ public:
   void SetShader( Shader* shader );
 
   /**
+   * Get the shader effect of this material
+   * @return the shader effect;
+   */
+  Shader* GetShader() const;
+
+  /**
+   * Set the face culling mode
+   * @param[in] faceCullingMode to use
+   */
+  void SetFaceCullingMode( unsigned int faceCullingMode );
+
+  /**
+   * Set the blending mode
+   * @param[in] blendingMode to use
+   */
+  void SetBlendingMode( unsigned int blendingMode );
+
+  /**
    * Prepare the material for rendering.
    *
    * Determine whether blending is enabled for this material, and store the result.
@@ -90,10 +110,15 @@ public:
 
   /**
    * Set the blending options. This should only be called from the update thread.
-   * @param[in] updateBufferIndex The current update buffer index.
    * @param[in] options A bitmask of blending options.
    */
-  void SetBlendingOptions( BufferIndex updateBufferIndex, unsigned int options );
+  void SetBlendingOptions( unsigned int options );
+
+  /**
+   * Set the blend color for blending operation
+   * @param blendColor to pass to GL
+   */
+  void SetBlendColor( const Vector4& blendColor );
 
   /**
    * Adds a new texture to be used by the material
@@ -128,7 +153,7 @@ public:
    * @param[in] index The index of the texture in the array of textures
    * @param[in] uniformName The new uniform name
    */
-  void SetTextureUniformName( size_t index, const std::string& uniformName);
+  void SetTextureUniformName( size_t index, const std::string& uniformName );
 
   /**
    * Establish if a given texture will affect the transparency of the object ( true by default )
@@ -146,39 +171,15 @@ public: // Implementation of MaterialDataProvider
   /**
    * @copydoc MaterialDataProvider::GetBlendColor
    */
-  virtual const Vector4& GetBlendColor(BufferIndex bufferIndex) const;
-
-  /**
-   * @copydoc MaterialDataProvider::GetBlendSrcFactorRgb
-   */
-  virtual BlendingFactor::Type GetBlendSrcFactorRgb(BufferIndex bufferIndex) const;
-
-  /**
-   * @copydoc MaterialDataProvider::GetBlendSrcFactorAlpha
-   */
-  virtual BlendingFactor::Type GetBlendSrcFactorAlpha( BufferIndex bufferIndex ) const;
-
-  /**
-   * @copydoc MaterialDataProvider::GetBlendDestFactorRgb
-   */
-  virtual BlendingFactor::Type GetBlendDestFactorRgb( BufferIndex bufferIndex ) const;
+  virtual Vector4* GetBlendColor() const;
 
   /**
-   * @copydoc MaterialDataProvider::GetBlendDestFactorAlpha
+   * @copydoc MaterialDataProvider::GetBlendingOptions
    */
-  virtual BlendingFactor::Type GetBlendDestFactorAlpha( BufferIndex bufferIndex ) const;
-
-  /**
-   * @copydoc MaterialDataProvider::GetBlendEquationRgb
-   */
-  virtual BlendingEquation::Type GetBlendEquationRgb( BufferIndex bufferIndex ) const;
-
-  /**
-   * @copydoc MaterialDataProvider::GetBlendEquationAlpha
-   */
-  virtual BlendingEquation::Type GetBlendEquationAlpha( BufferIndex bufferIndex ) const;
+  virtual const BlendingOptions& GetBlendingOptions() const;
 
 public: // Implementation of ObjectOwnerContainer template methods
+
   /**
    * Connect the object to the scene graph
    *
@@ -195,6 +196,7 @@ public: // Implementation of ObjectOwnerContainer template methods
   void DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
 
 public: // Implementation of ConnectionChangePropagator
+
   /**
    * @copydoc ConnectionChangePropagator::AddObserver
    */
@@ -206,11 +208,6 @@ public: // Implementation of ConnectionChangePropagator
   void RemoveConnectionObserver(ConnectionChangePropagator::Observer& observer);
 
 public:
-  /**
-   * Get the shader effect of this material
-   * @return the shader effect;
-   */
-  Shader* GetShader() const;
 
   /**
    * Get the ResourceId of a texture used by the material
@@ -267,35 +264,30 @@ public: // ConnectionChangePropagator::Observer
   /**
    * @copydoc ConnectionChangePropagator::ConnectedUniformMapChanged
    */
-  virtual void ConnectedUniformMapChanged( );
+  virtual void ConnectedUniformMapChanged();
 
 public: // PropertyOwner implementation
-  /**
-   * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
-   */
-  virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
 
   void SetIsFullyOpaque( size_t index, bool isFullyOpaque )
   {
     mIsFullyOpaque[index] = isFullyOpaque;
   }
 
-public: // Property data
-  AnimatableProperty<Vector4> mColor;
-  AnimatableProperty<Vector4> mBlendColor;
-  DoubleBufferedProperty<int> mFaceCullingMode;
-  DoubleBufferedProperty<int> mBlendingMode;
-  DoubleBufferedProperty<int> mBlendingOptions;
+private: // Data
 
-private:
   Shader* mShader;
-  Vector<Render::Sampler*> mSamplers; // Not owned
-  Vector<ResourceId>  mTextureId;
-  std::vector<std::string> mUniformName;
-  Vector<bool>        mIsFullyOpaque;
-  Vector<bool>        mAffectsTransparency;
+  Vector4* mBlendColor; // not double buffered as its not animateable and not frequently changed
+  Vector< Render::Sampler* > mSamplers; // Not owned
+  Vector< ResourceId >  mTextureId;
+  std::vector< std::string > mUniformName;
+  Vector< bool >        mIsFullyOpaque;
+  Vector< bool >        mAffectsTransparency;
   ConnectionChangePropagator mConnectionObservers;
+  Dali::Material::FaceCullingMode  mFaceCullingMode; // not double buffered as its not animateable and not frequently changed
+  BlendingMode::Type  mBlendingMode; // not double buffered as its not animateable and not frequently changed
+  BlendingOptions  mBlendingOptions; // not double buffered as its not animateable and not frequently changed
   BlendPolicy mBlendPolicy; ///< The blend policy as determined by PrepareRender
+
 };
 
 inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Material& material, Shader& shader )
@@ -309,9 +301,29 @@ inline void SetShaderMessage( EventThreadServices& eventThreadServices, const Ma
   new (slot) LocalType( &material, &Material::SetShader, &shader );
 }
 
+inline void SetFaceCullingModeMessage( EventThreadServices& eventThreadServices, const Material& material, Dali::Material::FaceCullingMode faceCullingMode )
+{
+  typedef MessageValue1< Material, unsigned int > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+  new (slot) LocalType( &material, &Material::SetFaceCullingMode, faceCullingMode );
+}
+
+inline void SetBlendingModeMessage( EventThreadServices& eventThreadServices, const Material& material, BlendingMode::Type blendingMode )
+{
+  typedef MessageValue1< Material, unsigned int > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+  new (slot) LocalType( &material, &Material::SetBlendingMode, blendingMode );
+}
+
 inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices, const Material& material, unsigned int options )
 {
-  typedef MessageDoubleBuffered1< Material, unsigned int > LocalType;
+  typedef MessageValue1< Material, unsigned int > LocalType;
 
   // Reserve some memory inside the message queue
   unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
@@ -319,6 +331,16 @@ inline void SetBlendingOptionsMessage( EventThreadServices& eventThreadServices,
   new (slot) LocalType( &material, &Material::SetBlendingOptions, options );
 }
 
+inline void SetBlendColorMessage( EventThreadServices& eventThreadServices, const Material& material, const Vector4& blendColor )
+{
+  typedef MessageValue1< Material, Vector4 > LocalType;
+
+  // Reserve some memory inside the message queue
+  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+
+  new (slot) LocalType( &material, &Material::SetBlendColor, blendColor );
+}
+
 inline void AddTextureMessage( EventThreadServices& eventThreadServices, const Material& material, const std::string& uniformName, ResourceId id, Render::Sampler* sampler )
 {
   typedef MessageValue3< Material, std::string, ResourceId, Render::Sampler* > LocalType;
@@ -386,7 +408,9 @@ inline void SetTextureAffectsTransparencyMessage( EventThreadServices& eventThre
 }
 
 } // namespace SceneGraph
+
 } // namespace Internal
+
 } // namespace Dali
 
 #endif //  DALI_INTERNAL_SCENE_GRAPH_MATERIAL_H
index ea85674..b216eb4 100644 (file)
@@ -32,12 +32,11 @@ namespace BlendingMode
 {
 /**
  * @brief Blending mode.
- * @see Dali::RenderableActor::SetBlendMode() and Dali::RenderableActor::GetBlendMode()
  */
 enum Type
 {
   OFF,  ///< Blending is disabled.
-  AUTO, ///< Blending is enabled if there is alpha channel.
+  AUTO, ///< Blending is enabled if there is alpha channel. This is the default mode.
   ON    ///< Blending is enabled.
 };