Make Renderer use MixColor + Deprecate DevelRenderer's Opacity and VisualRenderer... 80/316980/5
authorEunki, Hong <eunkiki.hong@samsung.com>
Mon, 2 Sep 2024 06:38:19 +0000 (15:38 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Fri, 13 Sep 2024 01:19:13 +0000 (10:19 +0900)
Let we make MixColor as Renderer property.

And also, make VisualRenderer's MixColor use Renderer's MixColor property directly.

And also, make we don't register preMultipliedAlpha uniform for whole visual renderer.

Due to the Visual MixColor was Vector3 and Renderer MixColor is Vector4,
we need to make VisualMixColor non-animatable.

TODO : Need to change toolkit side codes.

Change-Id: Ida7b788be00ef7b14bba7d86d937a4581726339d
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
18 files changed:
automated-tests/src/dali/utc-Dali-Actor.cpp
automated-tests/src/dali/utc-Dali-DecoratedVisualRenderer.cpp
automated-tests/src/dali/utc-Dali-Renderer.cpp
automated-tests/src/dali/utc-Dali-VisualRenderer.cpp
dali/devel-api/rendering/renderer-devel.h
dali/internal/event/rendering/renderer-impl.cpp
dali/internal/event/rendering/renderer-impl.h
dali/internal/event/rendering/visual-renderer-impl.cpp
dali/internal/event/rendering/visual-renderer-impl.h
dali/internal/render/data-providers/render-data-provider.h
dali/internal/render/renderers/render-renderer.cpp
dali/internal/update/rendering/scene-graph-renderer-messages.h
dali/internal/update/rendering/scene-graph-renderer.cpp
dali/internal/update/rendering/scene-graph-renderer.h
dali/internal/update/rendering/scene-graph-visual-renderer.cpp
dali/internal/update/rendering/scene-graph-visual-renderer.h
dali/public-api/rendering/renderer.h
dali/public-api/rendering/visual-renderer.h

index 635ee3b48b459922844b2a33988ca911068505e8..2a7532daeb8b2d6943745c4318eeb02c84574b23 100644 (file)
@@ -30,9 +30,9 @@
 #include <test-actor-utils.h>
 #include <test-native-image.h>
 
-#include <cfloat> // For FLT_MAX
-#include <string>
+#include <cfloat>     // For FLT_MAX
 #include <functional> // for std::function
+#include <string>
 
 #include "assert.h"
 
@@ -5428,7 +5428,7 @@ int UtcDaliActorPropertyScissorClippingActor02(void)
   DALI_TEST_CHECK(renderer);
 
   // Make Renderer opacity 0.
-  renderer[DevelRenderer::Property::OPACITY] = 0.0f;
+  renderer[Dali::Renderer::Property::OPACITY] = 0.0f;
 
   // Note: Scissor coords are have flipped Y values compared with DALi's coordinate system.
   // We choose BOTTOM_LEFT to give us x=0, y=0 starting coordinates for the first test.
@@ -12322,7 +12322,7 @@ int utcDaliActorPartialUpdateAnimation02(void)
   // Make an animation
   Renderer  renderer  = actor.GetRendererAt(0);
   Animation animation = Animation::New(1.0f);
-  animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.5f, TimePeriod(0.5f, 0.5f));
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::OPACITY), 0.5f, TimePeriod(0.5f, 0.5f));
   animation.SetLoopCount(3);
   animation.Play();
 
@@ -12810,8 +12810,8 @@ int utcDaliActorPartialUpdateChangeTransparency(void)
 
   // Make the actor transparent by changing opacity of the Renderer
   // It changes a uniform value
-  Renderer renderer                          = actor.GetRendererAt(0);
-  renderer[DevelRenderer::Property::OPACITY] = 0.0f;
+  Renderer renderer                           = actor.GetRendererAt(0);
+  renderer[Dali::Renderer::Property::OPACITY] = 0.0f;
 
   application.SendNotification();
 
@@ -12830,7 +12830,7 @@ int utcDaliActorPartialUpdateChangeTransparency(void)
   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
 
   // Make the actor opaque again
-  renderer[DevelRenderer::Property::OPACITY] = 1.0f;
+  renderer[Dali::Renderer::Property::OPACITY] = 1.0f;
 
   application.SendNotification();
 
@@ -12849,7 +12849,7 @@ int utcDaliActorPartialUpdateChangeTransparency(void)
   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
 
   // Make the actor translucent
-  renderer[DevelRenderer::Property::OPACITY] = 0.5f;
+  renderer[Dali::Renderer::Property::OPACITY] = 0.5f;
 
   application.SendNotification();
 
@@ -12868,7 +12868,7 @@ int utcDaliActorPartialUpdateChangeTransparency(void)
   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
 
   // Change Renderer opacity - also translucent
-  renderer[DevelRenderer::Property::OPACITY] = 0.2f;
+  renderer[Dali::Renderer::Property::OPACITY] = 0.2f;
 
   application.SendNotification();
 
@@ -13278,7 +13278,7 @@ int utcDaliActorPartialUpdateOneActorMultipleRenderers(void)
   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
 
   // Make renderer2 dirty
-  renderer2[DevelRenderer::Property::OPACITY] = 0.5f;
+  renderer2[Dali::Renderer::Property::OPACITY] = 0.5f;
 
   application.SendNotification();
 
@@ -13381,7 +13381,7 @@ int utcDaliActorPartialUpdateMultipleActorsOneRenderer(void)
   DALI_TEST_EQUALS(damagedRects.size(), 0, TEST_LOCATION);
 
   // Make renderer dirty
-  renderer[DevelRenderer::Property::OPACITY] = 0.5f;
+  renderer[Dali::Renderer::Property::OPACITY] = 0.5f;
 
   application.SendNotification();
 
@@ -15022,9 +15022,9 @@ int UtcDaliActorCalculateWorldTransform09(void)
 
   tet_infoline("Check the current position value if leaf actor doesn't inherit scale. (Real world usecase error)");
 
-  Actor rootActor = Actor::New();
+  Actor rootActor   = Actor::New();
   Actor middleActor = Actor::New();
-  Actor leafActor = Actor::New();
+  Actor leafActor   = Actor::New();
 
   Vector3 rootActorPosition = Vector3(0.0f, 50.0f, 100.0f);
 
@@ -15034,15 +15034,15 @@ int UtcDaliActorCalculateWorldTransform09(void)
   rootActor[Actor::Property::ANCHOR_POINT]  = AnchorPoint::CENTER;
   rootActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
 
-  Vector3 middleActorPosition = Vector3(100.0f, 0.0f, 0.0f);
-  Vector3 middleActorSize     = Vector3(200.0f, 400.0f, 0.0f);
+  Vector3 middleActorPosition                 = Vector3(100.0f, 0.0f, 0.0f);
+  Vector3 middleActorSize                     = Vector3(200.0f, 400.0f, 0.0f);
   middleActor[Actor::Property::POSITION]      = middleActorPosition;
   middleActor[Actor::Property::SCALE]         = Vector3::ONE;
   middleActor[Actor::Property::SIZE]          = middleActorSize;
   middleActor[Actor::Property::ANCHOR_POINT]  = AnchorPoint::CENTER;
   middleActor[Actor::Property::PARENT_ORIGIN] = ParentOrigin::CENTER;
 
-  Vector3 leafActorPosition = Vector3(0.0f, 100.0f, 0.0f);
+  Vector3 leafActorPosition                 = Vector3(0.0f, 100.0f, 0.0f);
   leafActor[Actor::Property::POSITION]      = leafActorPosition;
   leafActor[Actor::Property::SCALE]         = Vector3::ONE;
   leafActor[Actor::Property::SIZE]          = Vector2(200, 400);
@@ -15060,7 +15060,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  Matrix actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  Matrix  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   Vector3 worldPosition = Vector3(actualMatrix.GetTranslation());
 
   Vector3 actualWorldPosition = rootActorPosition + middleActorPosition - middleActorSize * 0.5 /*ParentOrigin::TOP_LEFT*/ + leafActorPosition;
@@ -15075,7 +15075,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
@@ -15083,14 +15083,14 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
 
   // Change rootActor's position.
   // Test at least 2 frames.
-  rootActorPosition = Vector3(-200.0f, -100.0f, 300.0f);
+  rootActorPosition                    = Vector3(-200.0f, -100.0f, 300.0f);
   rootActor[Actor::Property::POSITION] = rootActorPosition;
 
   // Actual world position changed
@@ -15099,7 +15099,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
@@ -15107,14 +15107,14 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
 
   // Change middleActor's size.
   // Test at least 2 frames.
-  middleActorSize = Vector3(400.0f, 300.0f, 0.0f);
+  middleActorSize                    = Vector3(400.0f, 300.0f, 0.0f);
   middleActor[Actor::Property::SIZE] = middleActorSize;
 
   // Actual world position changed
@@ -15123,7 +15123,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
@@ -15131,7 +15131,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
@@ -15143,7 +15143,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
@@ -15151,7 +15151,7 @@ int UtcDaliActorCalculateWorldTransform09(void)
   application.SendNotification();
   application.Render(0);
 
-  actualMatrix = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
+  actualMatrix  = leafActor.GetCurrentProperty<Matrix>(Actor::Property::WORLD_MATRIX);
   worldPosition = Vector3(actualMatrix.GetTranslation());
 
   DALI_TEST_EQUALS(actualWorldPosition, worldPosition, 0.001f, TEST_LOCATION);
index 08122d38eb2d6c0221df2c5f2654888b5494ec75..4a9509bf8ab57db27653c309393171e7b401cc53 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -202,9 +202,9 @@ int UtcDaliDecoratedVisualRendererDefaultProperties(void)
   VisualRenderer          baseVisualRenderer = VisualRenderer::New(geometry, shader);
   Renderer                baseRenderer       = Renderer::New(geometry, shader);
 
-  DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 28, TEST_LOCATION);
-  DALI_TEST_EQUALS(baseVisualRenderer.GetPropertyCount(), 28 + 8, TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetPropertyCount(), 28 + 8 + 6, TEST_LOCATION);
+  DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 32, TEST_LOCATION);
+  DALI_TEST_EQUALS(baseVisualRenderer.GetPropertyCount(), 32 + 8, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetPropertyCount(), 32 + 8 + 6, TEST_LOCATION);
 
   TEST_RENDERER_PROPERTY(renderer, "cornerRadius", Property::VECTOR4, true, true, true, DecoratedVisualRenderer::Property::CORNER_RADIUS, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "cornerRadiusPolicy", Property::FLOAT, true, false, true, DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, TEST_LOCATION);
@@ -331,6 +331,8 @@ int UtcDaliDecoratedVisualRendererAnimatedProperty02(void)
   END_TEST;
 }
 
+namespace
+{
 struct DecoratedVisualProperties
 {
   DecoratedVisualProperties() = default;
@@ -375,13 +377,13 @@ struct DecoratedVisualProperties
     progress.mTransformOffset  = start.mTransformOffset + (end.mTransformOffset - start.mTransformOffset) * alpha;
     progress.mTransformSize    = start.mTransformSize + (end.mTransformSize - start.mTransformSize) * alpha;
     progress.mExtraSize        = start.mExtraSize + (end.mExtraSize - start.mExtraSize) * alpha;
-    progress.mMixColor         = start.mMixColor + (end.mMixColor - start.mMixColor) * alpha;
     progress.mCornerRadius     = start.mCornerRadius + (end.mCornerRadius - start.mCornerRadius) * alpha;
     progress.mBorderlineWidth  = start.mBorderlineWidth + (end.mBorderlineWidth - start.mBorderlineWidth) * alpha;
     progress.mBorderlineColor  = start.mBorderlineColor + (end.mBorderlineColor - start.mBorderlineColor) * alpha;
     progress.mBorderlineOffset = start.mBorderlineOffset + (end.mBorderlineOffset - start.mBorderlineOffset) * alpha;
     progress.mBlurRadius       = start.mBlurRadius + (end.mBlurRadius - start.mBlurRadius) * alpha;
 
+    progress.mMixColor                = end.mMixColor; ///< mMixColor is not animatable anymore.
     progress.mTransformOffsetSizeMode = end.mTransformOffsetSizeMode;
     progress.mTransformOrigin         = end.mTransformOrigin;
     progress.mTransformAnchorPoint    = end.mTransformAnchorPoint;
@@ -539,6 +541,7 @@ void CheckSceneGraphDecoratedVisualProperties(DecoratedVisualRenderer renderer,
   actualProps.mTransformOffsetSizeMode = renderer.GetCurrentProperty<Vector4>(VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE);
   actualProps.mExtraSize               = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::EXTRA_SIZE);
   actualProps.mMixColor                = renderer.GetCurrentProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR);
+  actualProps.mPreMultipliedAlpha      = renderer.GetCurrentProperty<float>(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA);
 
   actualProps.mCornerRadius       = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
   actualProps.mCornerRadiusPolicy = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY);
@@ -571,51 +574,59 @@ void CheckUniforms(DecoratedVisualRenderer renderer, DecoratedVisualProperties p
   tet_infoline("CheckUniforms\n");
 
   TraceCallStack::NamedParams params;
+  uint32_t                    uniformIndex = 0;
 
   tet_printf("Callback trace: \n%s\n", callStack.GetTraceString().c_str());
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[0].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[0].name.c_str(), props.mTransformOffset));
-
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[1].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[1].name.c_str(), props.mTransformSize));
-
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[2].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[2].name.c_str(), props.mTransformOrigin));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformOffset));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[3].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[3].name.c_str(), props.mTransformAnchorPoint));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformSize));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[4].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[4].name.c_str(), props.mTransformOffsetSizeMode));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformOrigin));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[5].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[5].name.c_str(), props.mExtraSize));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformAnchorPoint));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[6].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector3>(uniforms[6].name.c_str(), props.mMixColor));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[uniformIndex].name.c_str(), props.mTransformOffsetSizeMode));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[7].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[7].name.c_str(), props.mPreMultipliedAlpha));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mExtraSize));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[8].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[8].name.c_str(), props.mCornerRadius));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[uniformIndex].name.c_str(), props.mCornerRadius));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[9].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[9].name.c_str(), props.mCornerRadiusPolicy));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[uniformIndex].name.c_str(), props.mCornerRadiusPolicy));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[10].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[10].name.c_str(), props.mBorderlineWidth));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[uniformIndex].name.c_str(), props.mBorderlineWidth));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[11].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[11].name.c_str(), props.mBorderlineColor));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[uniformIndex].name.c_str(), props.mBorderlineColor));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[12].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[12].name.c_str(), props.mBorderlineOffset));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[uniformIndex].name.c_str(), props.mBorderlineOffset));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[13].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[13].name.c_str(), props.mBlurRadius));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[uniformIndex].name.c_str(), props.mBlurRadius));
+  ++uniformIndex;
 }
+} // namespace
 
 int UtcDaliDecoratedVisualRendererAnimatedProperty03(void)
 {
@@ -632,8 +643,6 @@ int UtcDaliDecoratedVisualRendererAnimatedProperty03(void)
                                           {"anchorPoint", Property::VECTOR2},
                                           {"offsetSizeMode", Property::VECTOR4},
                                           {"extraSize", Property::VECTOR2},
-                                          {"mixColor", Property::VECTOR3},
-                                          {"preMultipliedAlpha", Property::FLOAT},
                                           {"cornerRadius", Property::VECTOR4},
                                           {"cornerRadiusPolicy", Property::FLOAT},
                                           {"borderlineWidth", Property::FLOAT},
@@ -673,7 +682,7 @@ int UtcDaliDecoratedVisualRendererAnimatedProperty03(void)
   animation.AnimateTo(Property(renderer, VisualRenderer::Property::TRANSFORM_OFFSET), targetProps.mTransformOffset);
   animation.AnimateTo(Property(renderer, VisualRenderer::Property::TRANSFORM_SIZE), targetProps.mTransformSize);
   animation.AnimateTo(Property(renderer, VisualRenderer::Property::EXTRA_SIZE), targetProps.mExtraSize);
-  animation.AnimateTo(Property(renderer, VisualRenderer::Property::VISUAL_MIX_COLOR), targetProps.mMixColor);
+  renderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, targetProps.mMixColor); ///< visual mix color is not animatable.
 
   animation.AnimateTo(Property(renderer, DecoratedVisualRenderer::Property::CORNER_RADIUS), targetProps.mCornerRadius);
   animation.AnimateTo(Property(renderer, DecoratedVisualRenderer::Property::BORDERLINE_WIDTH), targetProps.mBorderlineWidth);
index 6de5ee46190215b3598e0ea54cb23357a1ca9775..da8a7617a343bde1226151f8bf91966034da343e 100644 (file)
@@ -261,39 +261,44 @@ int UtcDaliRendererDefaultProperties(void)
 {
   TestApplication application;
   /* from renderer-impl.cpp
-  DALI_PROPERTY( "depthIndex",                      INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_INDEX )
-  DALI_PROPERTY( "faceCullingMode",                 INTEGER,   true, false,  false, Dali::Renderer::Property::FACE_CULLING_MODE )
-  DALI_PROPERTY( "blendMode",                       INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_MODE )
-  DALI_PROPERTY( "blendEquationRgb",                INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_EQUATION_RGB )
-  DALI_PROPERTY( "blendEquationAlpha",              INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA )
-  DALI_PROPERTY( "blendFactorSrcRgb",               INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB )
-  DALI_PROPERTY( "blendFactorDestRgb",              INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB )
-  DALI_PROPERTY( "blendFactorSrcAlpha",             INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA )
-  DALI_PROPERTY( "blendFactorDestAlpha",            INTEGER,   true, false,  false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA )
-  DALI_PROPERTY( "blendColor",                      VECTOR4,   true, false,  false, Dali::Renderer::Property::BLEND_COLOR )
-  DALI_PROPERTY( "blendPreMultipliedAlpha",         BOOLEAN,   true, false,  false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA )
-  DALI_PROPERTY( "indexRangeFirst",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_FIRST )
-  DALI_PROPERTY( "indexRangeCount",                 INTEGER,   true, false,  false, Dali::Renderer::Property::INDEX_RANGE_COUNT )
-  DALI_PROPERTY( "depthWriteMode",                  INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_WRITE_MODE )
-  DALI_PROPERTY( "depthFunction",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_FUNCTION )
-  DALI_PROPERTY( "depthTestMode",                   INTEGER,   true, false,  false, Dali::Renderer::Property::DEPTH_TEST_MODE )
-  DALI_PROPERTY( "renderMode",                      INTEGER,   true, false,  false, Dali::Renderer::Property::RENDER_MODE )
-  DALI_PROPERTY( "stencilFunction",                 INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION )
-  DALI_PROPERTY( "stencilFunctionMask",             INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK )
-  DALI_PROPERTY( "stencilFunctionReference",        INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE )
-  DALI_PROPERTY( "stencilMask",                     INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_MASK )
-  DALI_PROPERTY( "stencilOperationOnFail",          INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL )
-  DALI_PROPERTY( "stencilOperationOnZFail",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL )
-  DALI_PROPERTY( "stencilOperationOnZPass",         INTEGER,   true, false,  false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS )
-  DALI_PROPERTY( "opacity",                         FLOAT,     true, true,   true,  Dali::DevelRenderer::Property::OPACITY )
-  DALI_PROPERTY( "renderingBehavior",               INTEGER,   true, false,  false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR )
-  DALI_PROPERTY( "blendEquation",                   INTEGER,   true, false,  false, Dali::DevelRenderer::Property::BLEND_EQUATION )
+  DALI_PROPERTY("depthIndex", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_INDEX)
+  DALI_PROPERTY("faceCullingMode", INTEGER, true, false, false, Dali::Renderer::Property::FACE_CULLING_MODE)
+  DALI_PROPERTY("blendMode", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_MODE)
+  DALI_PROPERTY("blendEquationRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_RGB)
+  DALI_PROPERTY("blendEquationAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_EQUATION_ALPHA)
+  DALI_PROPERTY("blendFactorSrcRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_RGB)
+  DALI_PROPERTY("blendFactorDestRgb", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_RGB)
+  DALI_PROPERTY("blendFactorSrcAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_SRC_ALPHA)
+  DALI_PROPERTY("blendFactorDestAlpha", INTEGER, true, false, false, Dali::Renderer::Property::BLEND_FACTOR_DEST_ALPHA)
+  DALI_PROPERTY("blendColor", VECTOR4, true, false, false, Dali::Renderer::Property::BLEND_COLOR)
+  DALI_PROPERTY("blendPreMultipliedAlpha", BOOLEAN, true, false, false, Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA)
+  DALI_PROPERTY("indexRangeFirst", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_FIRST)
+  DALI_PROPERTY("indexRangeCount", INTEGER, true, false, false, Dali::Renderer::Property::INDEX_RANGE_COUNT)
+  DALI_PROPERTY("depthWriteMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_WRITE_MODE)
+  DALI_PROPERTY("depthFunction", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_FUNCTION)
+  DALI_PROPERTY("depthTestMode", INTEGER, true, false, false, Dali::Renderer::Property::DEPTH_TEST_MODE)
+  DALI_PROPERTY("renderMode", INTEGER, true, false, false, Dali::Renderer::Property::RENDER_MODE)
+  DALI_PROPERTY("stencilFunction", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION)
+  DALI_PROPERTY("stencilFunctionMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_MASK)
+  DALI_PROPERTY("stencilFunctionReference", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_FUNCTION_REFERENCE)
+  DALI_PROPERTY("stencilMask", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_MASK)
+  DALI_PROPERTY("stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL)
+  DALI_PROPERTY("stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL)
+  DALI_PROPERTY("stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS)
+  DALI_PROPERTY("rendererMixColor", VECTOR4, true, true, true, Dali::Renderer::Property::MIX_COLOR)
+  DALI_PROPERTY("rendererMixColorRed", FLOAT, true, true, true, Dali::Renderer::Property::MIX_COLOR_RED)
+  DALI_PROPERTY("rendererMixColorGreen", FLOAT, true, true, true, Dali::Renderer::Property::MIX_COLOR_GREEN)
+  DALI_PROPERTY("rendererMixColorBlue", FLOAT, true, true, true, Dali::Renderer::Property::MIX_COLOR_BLUE)
+  DALI_PROPERTY("rendererOpacity", FLOAT, true, true, true, Dali::Renderer::Property::OPACITY)
+  DALI_PROPERTY("renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR)
+  DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION)
+  DALI_PROPERTY("instanceCount", INTEGER, true, false, false, Dali::DevelRenderer::Property::INSTANCE_COUNT)
 */
 
   Geometry geometry = CreateQuadGeometry();
   Shader   shader   = CreateShader();
   Renderer renderer = Renderer::New(geometry, shader);
-  DALI_TEST_EQUALS(renderer.GetPropertyCount(), 28, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetPropertyCount(), 32, TEST_LOCATION);
 
   TEST_RENDERER_PROPERTY(renderer, "depthIndex", Property::INTEGER, true, false, false, Renderer::Property::DEPTH_INDEX, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "faceCullingMode", Property::INTEGER, true, false, false, Renderer::Property::FACE_CULLING_MODE, TEST_LOCATION);
@@ -319,10 +324,14 @@ int UtcDaliRendererDefaultProperties(void)
   TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_FAIL, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZFail", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "stencilOperationOnZPass", Property::INTEGER, true, false, false, Renderer::Property::STENCIL_OPERATION_ON_Z_PASS, TEST_LOCATION);
-  TEST_RENDERER_PROPERTY(renderer, "opacity", Property::FLOAT, true, true, true, DevelRenderer::Property::OPACITY, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "rendererMixColor", Property::VECTOR4, true, true, true, Renderer::Property::MIX_COLOR, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "rendererMixColorRed", Property::FLOAT, true, true, true, Renderer::Property::MIX_COLOR_RED, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "rendererMixColorGreen", Property::FLOAT, true, true, true, Renderer::Property::MIX_COLOR_GREEN, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "rendererMixColorBlue", Property::FLOAT, true, true, true, Renderer::Property::MIX_COLOR_BLUE, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "rendererOpacity", Property::FLOAT, true, true, true, Renderer::Property::OPACITY, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "renderingBehavior", Property::INTEGER, true, false, false, DevelRenderer::Property::RENDERING_BEHAVIOR, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "blendEquation", Property::INTEGER, true, false, false, DevelRenderer::Property::BLEND_EQUATION, TEST_LOCATION);
-  TEST_RENDERER_PROPERTY(renderer, "instanceCount", Property::INTEGER, true, false, false, Dali::DevelRenderer::Property::INSTANCE_COUNT, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "instanceCount", Property::INTEGER, true, false, false, DevelRenderer::Property::INSTANCE_COUNT, TEST_LOCATION);
 
   END_TEST;
 }
@@ -3394,7 +3403,7 @@ int UtcDaliRendererOpacity(void)
   actor.SetProperty(Actor::Property::COLOR, Vector4(1.0f, 0.0f, 1.0f, 1.0f));
   application.GetScene().Add(actor);
 
-  Property::Value value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+  Property::Value value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
   float           opacity;
   DALI_TEST_CHECK(value.Get(opacity));
   DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
@@ -3410,16 +3419,16 @@ int UtcDaliRendererOpacity(void)
   DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uActorColor", actualActorColor));
   DALI_TEST_EQUALS(actualActorColor.a, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
 
-  renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.5f);
+  renderer.SetProperty(Dali::Renderer::Property::OPACITY, 0.5f);
 
   application.SendNotification();
   application.Render();
 
-  value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
   DALI_TEST_CHECK(value.Get(opacity));
   DALI_TEST_EQUALS(opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
 
-  value = renderer.GetCurrentProperty(DevelRenderer::Property::OPACITY);
+  value = renderer.GetCurrentProperty(Dali::Renderer::Property::OPACITY);
   DALI_TEST_CHECK(value.Get(opacity));
   DALI_TEST_EQUALS(opacity, 0.5f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
 
@@ -3452,36 +3461,341 @@ int UtcDaliRendererOpacityAnimation(void)
   application.SendNotification();
   application.Render(0);
 
-  Property::Value value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+  Property::Value value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
   float           opacity;
   DALI_TEST_CHECK(value.Get(opacity));
   DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
 
   Animation animation = Animation::New(1.0f);
-  animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.0f);
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::OPACITY), 0.0f);
   animation.Play();
 
   application.SendNotification();
   application.Render(1000);
 
-  value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
   DALI_TEST_CHECK(value.Get(opacity));
   DALI_TEST_EQUALS(opacity, 0.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
 
   // Need to clear the animation before setting the property as the animation value is baked and will override any previous setters
   animation.Clear();
-  renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.1f);
+  renderer.SetProperty(Dali::Renderer::Property::OPACITY, 0.1f);
 
-  animation.AnimateBy(Property(renderer, DevelRenderer::Property::OPACITY), 0.5f);
+  animation.AnimateBy(Property(renderer, Dali::Renderer::Property::OPACITY), 0.5f);
   animation.Play();
 
   application.SendNotification();
   application.Render(1000);
 
-  value = renderer.GetProperty(DevelRenderer::Property::OPACITY);
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
   DALI_TEST_CHECK(value.Get(opacity));
   DALI_TEST_EQUALS(opacity, 0.6f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
-  DALI_TEST_EQUALS(opacity, renderer.GetCurrentProperty(DevelRenderer::Property::OPACITY).Get<float>(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, renderer.GetCurrentProperty(Dali::Renderer::Property::OPACITY).Get<float>(), Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliRendererMixColor(void)
+{
+  TestApplication application;
+
+  tet_infoline("Test MIX_COLOR property");
+
+  Geometry geometry = CreateQuadGeometry();
+  Shader   shader   = Shader::New("vertexSrc", "fragmentSrc");
+  Renderer renderer = Renderer::New(geometry, shader);
+
+  Vector4 actorColor(0.8f, 0.5f, 0.7f, 1.0f);
+
+  Actor actor = Actor::New();
+  actor.AddRenderer(renderer);
+  actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+  actor.SetProperty(Actor::Property::COLOR, actorColor);
+  application.GetScene().Add(actor);
+
+  Property::Value value;
+  Vector4         mixColor;
+  float           mixColorRed;
+  float           mixColorGreen;
+  float           mixColorBlue;
+  float           opacity;
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, Vector4::ONE, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  application.SendNotification();
+  application.Render();
+
+  Vector4            actualValue;
+  Vector4            actualActorColor;
+  TestGlAbstraction& gl = application.GetGlAbstraction();
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+  DALI_TEST_EQUALS(actualValue, Vector4::ONE * actorColor, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uActorColor", actualActorColor));
+  DALI_TEST_EQUALS(actualActorColor, Vector4::ONE * actorColor, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  Vector4 targetValue(0.2, 0.3f, 0.4f, 0.5f);
+  renderer.SetProperty(Dali::Renderer::Property::MIX_COLOR, targetValue);
+
+  application.SendNotification();
+  application.Render();
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uColor", actualValue));
+  DALI_TEST_EQUALS(actualValue, targetValue * actorColor, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(actualValue.r, targetValue.r * actorColor.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(actualValue.g, targetValue.g * actorColor.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(actualValue.b, targetValue.b * actorColor.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(actualValue.a, targetValue.a * actorColor.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  // Note : Renderer opacity doesn't apply to uActorColor.
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>("uActorColor", actualActorColor));
+  DALI_TEST_EQUALS(actualActorColor, Vector4::ONE * actorColor, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliRendererMixColorAnimation01(void)
+{
+  TestApplication application;
+
+  tet_infoline("Test MIX_COLOR property animation");
+
+  Geometry geometry = CreateQuadGeometry();
+  Shader   shader   = Shader::New("vertexSrc", "fragmentSrc");
+  Renderer renderer = Renderer::New(geometry, shader);
+
+  Vector4 actorColor(0.8f, 0.5f, 0.7f, 1.0f);
+
+  Actor actor = Actor::New();
+  actor.AddRenderer(renderer);
+  actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+  actor.SetProperty(Actor::Property::COLOR, actorColor);
+  application.GetScene().Add(actor);
+
+  application.SendNotification();
+  application.Render(0);
+
+  Property::Value value;
+  Vector4         mixColor;
+  float           mixColorRed;
+  float           mixColorGreen;
+  float           mixColorBlue;
+  float           opacity;
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, Vector4::ONE, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  Vector4   targetValue(0.2, 0.3f, 0.4f, 0.5f);
+  Animation animation = Animation::New(1.0f);
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::MIX_COLOR), targetValue);
+  animation.Play();
+
+  application.SendNotification();
+  application.Render(1000);
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  // Need to clear the animation before setting the property as the animation value is baked and will override any previous setters
+  animation.Clear();
+  Vector4 originValue(0.1f, 0.1f, 0.1f, 0.1f);
+  renderer.SetProperty(Dali::Renderer::Property::MIX_COLOR, originValue);
+
+  animation.AnimateBy(Property(renderer, Dali::Renderer::Property::MIX_COLOR), targetValue - originValue);
+  animation.Play();
+
+  application.SendNotification();
+  application.Render(1000);
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR).Get<Vector4>(), targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR_RED).Get<float>(), targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR_GREEN).Get<float>(), targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR_BLUE).Get<float>(), targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::OPACITY).Get<float>(), targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  END_TEST;
+}
+
+int UtcDaliRendererMixColorAnimation02(void)
+{
+  TestApplication application;
+
+  tet_infoline("Test MIX_COLOR_RED, MIX_COLOR_GREEN, MIX_COLOR_BLUE, OPACITY property animation");
+
+  Geometry geometry = CreateQuadGeometry();
+  Shader   shader   = Shader::New("vertexSrc", "fragmentSrc");
+  Renderer renderer = Renderer::New(geometry, shader);
+
+  Vector4 actorColor(0.8f, 0.5f, 0.7f, 1.0f);
+
+  Actor actor = Actor::New();
+  actor.AddRenderer(renderer);
+  actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
+  actor.SetProperty(Actor::Property::COLOR, actorColor);
+  application.GetScene().Add(actor);
+
+  application.SendNotification();
+  application.Render(0);
+
+  Property::Value value;
+  Vector4         mixColor;
+  float           mixColorRed;
+  float           mixColorGreen;
+  float           mixColorBlue;
+  float           opacity;
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, Vector4::ONE, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, 1.0f, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  Vector4   targetValue(0.2, 0.3f, 0.4f, 0.5f);
+  Animation animation = Animation::New(1.0f);
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::MIX_COLOR_RED), targetValue.r);
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::MIX_COLOR_GREEN), targetValue.g);
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::MIX_COLOR_BLUE), targetValue.b);
+  animation.AnimateTo(Property(renderer, Dali::Renderer::Property::OPACITY), targetValue.a);
+  animation.Play();
+
+  application.SendNotification();
+  application.Render(1000);
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  // Need to clear the animation before setting the property as the animation value is baked and will override any previous setters
+  animation.Clear();
+  Vector4 originValue(0.1f, 0.1f, 0.1f, 0.1f);
+  renderer.SetProperty(Dali::Renderer::Property::MIX_COLOR_RED, originValue.r);
+  renderer.SetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN, originValue.g);
+  renderer.SetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE, originValue.b);
+  renderer.SetProperty(Dali::Renderer::Property::OPACITY, originValue.a);
+
+  animation.AnimateBy(Property(renderer, Dali::Renderer::Property::MIX_COLOR_RED), targetValue.r - originValue.r);
+  animation.AnimateBy(Property(renderer, Dali::Renderer::Property::MIX_COLOR_GREEN), targetValue.g - originValue.g);
+  animation.AnimateBy(Property(renderer, Dali::Renderer::Property::MIX_COLOR_BLUE), targetValue.b - originValue.b);
+  animation.AnimateBy(Property(renderer, Dali::Renderer::Property::OPACITY), targetValue.a - originValue.a);
+  animation.Play();
+
+  application.SendNotification();
+  application.Render(1000);
+
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR);
+  DALI_TEST_CHECK(value.Get(mixColor));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_RED);
+  DALI_TEST_CHECK(value.Get(mixColorRed));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_GREEN);
+  DALI_TEST_CHECK(value.Get(mixColorGreen));
+  value = renderer.GetProperty(Dali::Renderer::Property::MIX_COLOR_BLUE);
+  DALI_TEST_CHECK(value.Get(mixColorBlue));
+  value = renderer.GetProperty(Dali::Renderer::Property::OPACITY);
+  DALI_TEST_CHECK(value.Get(opacity));
+  DALI_TEST_EQUALS(mixColor, targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorRed, targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorGreen, targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(mixColorBlue, targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(opacity, targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR).Get<Vector4>(), targetValue, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR_RED).Get<float>(), targetValue.r, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR_GREEN).Get<float>(), targetValue.g, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::MIX_COLOR_BLUE).Get<float>(), targetValue.b, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty(Dali::Renderer::Property::OPACITY).Get<float>(), targetValue.a, Dali::Math::MACHINE_EPSILON_1, TEST_LOCATION);
 
   END_TEST;
 }
@@ -3581,7 +3895,7 @@ int UtcDaliRendererRenderingBehavior(void)
   {
     // Render again and check the update status
     Animation animation = Animation::New(1.0f);
-    animation.AnimateTo(Property(renderer, DevelRenderer::Property::OPACITY), 0.0f, TimePeriod(0.5f, 0.5f));
+    animation.AnimateTo(Property(renderer, Dali::Renderer::Property::OPACITY), 0.0f, TimePeriod(0.5f, 0.5f));
     animation.Play();
 
     drawTrace.Reset();
@@ -4359,7 +4673,7 @@ int utcDaliRendererPartialUpdateAddRemoveRenderer(void)
   application.RenderWithPartialUpdate(damagedRects, clippingRect);
 
   // 3. Change a property value of the Renderer
-  renderer.SetProperty(DevelRenderer::Property::OPACITY, 0.5f);
+  renderer.SetProperty(Dali::Renderer::Property::MIX_COLOR, Vector4(0.5f, 0.5f, 0.5f, 0.5f));
   application.SendNotification();
 
   damagedRects.clear();
index a0d9f54a7278b6c2d363f735cc188698aa329911..c193b0559a66bf4d0c2c815e92b5a31e4364d446 100644 (file)
@@ -189,8 +189,8 @@ int UtcDaliVisualRendererDefaultProperties(void)
   VisualRenderer  renderer     = VisualRenderer::New(geometry, shader);
   Renderer        baseRenderer = Renderer::New(geometry, shader);
 
-  DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 28, TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetPropertyCount(), 28 + 8, TEST_LOCATION);
+  DALI_TEST_EQUALS(baseRenderer.GetPropertyCount(), 32, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetPropertyCount(), 32 + 8, TEST_LOCATION);
 
   TEST_RENDERER_PROPERTY(renderer, "transformOffset", Property::VECTOR2, true, true, true, VisualRenderer::Property::TRANSFORM_OFFSET, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "transformSize", Property::VECTOR2, true, true, true, VisualRenderer::Property::TRANSFORM_SIZE, TEST_LOCATION);
@@ -198,9 +198,8 @@ int UtcDaliVisualRendererDefaultProperties(void)
   TEST_RENDERER_PROPERTY(renderer, "transformAnchorPoint", Property::VECTOR2, true, false, false, VisualRenderer::Property::TRANSFORM_ANCHOR_POINT, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "transformOffsetSizeMode", Property::VECTOR4, true, false, false, VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE, TEST_LOCATION);
   TEST_RENDERER_PROPERTY(renderer, "extraSize", Property::VECTOR2, true, true, true, VisualRenderer::Property::EXTRA_SIZE, TEST_LOCATION);
-
-  TEST_RENDERER_PROPERTY(renderer, "visualMixColor", Property::VECTOR3, true, true, true, VisualRenderer::Property::VISUAL_MIX_COLOR, TEST_LOCATION);
-  TEST_RENDERER_PROPERTY(renderer, "preMultipliedAlpha", Property::FLOAT, true, false, false, VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "visualMixColor", Property::VECTOR3, true, false, true, VisualRenderer::Property::VISUAL_MIX_COLOR, TEST_LOCATION);
+  TEST_RENDERER_PROPERTY(renderer, "visualPreMultipliedAlpha", Property::FLOAT, true, false, false, VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, TEST_LOCATION);
 
   END_TEST;
 }
@@ -209,7 +208,7 @@ int UtcDaliVisualRendererAnimatedProperty01(void)
 {
   TestApplication application;
 
-  tet_infoline("Test that a visual renderer property can be animated");
+  tet_infoline("Test that a visual renderer property cannot be animated anymore");
 
   Shader         shader   = Shader::New("VertexSource", "FragmentSource");
   Geometry       geometry = CreateQuadGeometry();
@@ -231,20 +230,16 @@ int UtcDaliVisualRendererAnimatedProperty01(void)
   KeyFrames keyFrames = KeyFrames::New();
   keyFrames.Add(0.0f, Vector3(1.0f, 0.0f, 1.0f));
   keyFrames.Add(1.0f, Vector3(0.0f, 0.0f, 0.0f));
-  animation.AnimateBetween(Property(renderer, colorIndex), keyFrames);
-  animation.Play();
-
-  application.SendNotification();
-  application.Render(500);
-
-  DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector3>(colorIndex), Vector3(0.5f, 0.f, 0.5f), TEST_LOCATION);
-
-  application.Render(400);
-  DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector3>(colorIndex), Vector3(0.1f, 0.f, 0.1f), TEST_LOCATION);
-
-  application.Render(100);
-  DALI_TEST_EQUALS(renderer.GetCurrentProperty<Vector3>(colorIndex), Vector3(0.f, 0.f, 0.f), TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetProperty<Vector3>(colorIndex), Vector3(0.f, 0.f, 0.f), TEST_LOCATION);
+  try
+  {
+    animation.AnimateBetween(Property(renderer, colorIndex), keyFrames);
+    animation.Play();
+    tet_result(TET_FAIL);
+  }
+  catch(...)
+  {
+    tet_result(TET_PASS);
+  }
 
   // Can we test to see if the actor has stopped being drawn?
   END_TEST;
@@ -296,6 +291,8 @@ int UtcDaliVisualRendererAnimatedProperty02(void)
   END_TEST;
 }
 
+namespace
+{
 struct VisualProperties
 {
   VisualProperties() = default;
@@ -324,10 +321,12 @@ struct VisualProperties
   static VisualProperties GetPropsAt(float alpha, const VisualProperties& start, const VisualProperties& end)
   {
     VisualProperties progress;
-    progress.mTransformOffset         = start.mTransformOffset + (end.mTransformOffset - start.mTransformOffset) * alpha;
-    progress.mTransformSize           = start.mTransformSize + (end.mTransformSize - start.mTransformSize) * alpha;
-    progress.mExtraSize               = start.mExtraSize + (end.mExtraSize - start.mExtraSize) * alpha;
-    progress.mMixColor                = start.mMixColor + (end.mMixColor - start.mMixColor) * alpha;
+
+    progress.mTransformOffset = start.mTransformOffset + (end.mTransformOffset - start.mTransformOffset) * alpha;
+    progress.mTransformSize   = start.mTransformSize + (end.mTransformSize - start.mTransformSize) * alpha;
+    progress.mExtraSize       = start.mExtraSize + (end.mExtraSize - start.mExtraSize) * alpha;
+
+    progress.mMixColor                = end.mMixColor; ///< mMixColor is not animatable anymore.
     progress.mTransformOffsetSizeMode = end.mTransformOffsetSizeMode;
     progress.mTransformOrigin         = end.mTransformOrigin;
     progress.mTransformAnchorPoint    = end.mTransformAnchorPoint;
@@ -433,7 +432,7 @@ void CheckSceneGraphVisualProperties(VisualRenderer renderer, VisualProperties e
   actualProps.mTransformOffsetSizeMode = renderer.GetCurrentProperty<Vector4>(VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE);
   actualProps.mExtraSize               = renderer.GetCurrentProperty<Vector2>(VisualRenderer::Property::EXTRA_SIZE);
   actualProps.mMixColor                = renderer.GetCurrentProperty<Vector3>(VisualRenderer::Property::VISUAL_MIX_COLOR);
-  actualProps.mPreMultipliedAlpha      = renderer.GetProperty<float>(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA);
+  actualProps.mPreMultipliedAlpha      = renderer.GetCurrentProperty<float>(VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA);
 
   PrintVisualProperties(actualProps, "Actual update props");
 
@@ -452,34 +451,37 @@ void CheckUniforms(VisualRenderer renderer, VisualProperties props, std::vector<
   tet_infoline("CheckUniforms\n");
 
   TraceCallStack::NamedParams params;
+  uint32_t                    uniformIndex = 0;
 
   tet_printf("Callback trace: \n%s\n", callStack.GetTraceString().c_str());
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[0].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[0].name.c_str(), props.mTransformOffset));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformOffset));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[1].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[1].name.c_str(), props.mTransformSize));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformSize));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[2].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[2].name.c_str(), props.mTransformOrigin));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformOrigin));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[3].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[3].name.c_str(), props.mTransformAnchorPoint));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mTransformAnchorPoint));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[4].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[4].name.c_str(), props.mTransformOffsetSizeMode));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector4>(uniforms[uniformIndex].name.c_str(), props.mTransformOffsetSizeMode));
+  ++uniformIndex;
 
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[5].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[5].name.c_str(), props.mExtraSize));
-
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[6].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<Vector3>(uniforms[6].name.c_str(), props.mMixColor));
-
-  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[7].name, params));
-  DALI_TEST_CHECK(gl.GetUniformValue<float>(uniforms[7].name.c_str(), props.mPreMultipliedAlpha));
+  DALI_TEST_CHECK(callStack.FindMethodAndGetParameters(uniforms[uniformIndex].name, params));
+  DALI_TEST_CHECK(gl.GetUniformValue<Vector2>(uniforms[uniformIndex].name.c_str(), props.mExtraSize));
+  ++uniformIndex;
 }
 
+} // namespace
+
 int UtcDaliVisualRendererAnimatedProperty03(void)
 {
   TestApplication    application;
@@ -494,9 +496,7 @@ int UtcDaliVisualRendererAnimatedProperty03(void)
                                           {"origin", Property::VECTOR2},
                                           {"anchorPoint", Property::VECTOR2},
                                           {"offsetSizeMode", Property::VECTOR4},
-                                          {"extraSize", Property::VECTOR2},
-                                          {"mixColor", Property::VECTOR3},
-                                          {"preMultipliedAlpha", Property::FLOAT}};
+                                          {"extraSize", Property::VECTOR2}};
 
   application.GetGraphicsController().AddCustomUniforms(customUniforms);
 
@@ -525,7 +525,7 @@ int UtcDaliVisualRendererAnimatedProperty03(void)
   animation.AnimateTo(Property(renderer, VisualRenderer::Property::TRANSFORM_OFFSET), targetProps.mTransformOffset);
   animation.AnimateTo(Property(renderer, VisualRenderer::Property::TRANSFORM_SIZE), targetProps.mTransformSize);
   animation.AnimateTo(Property(renderer, VisualRenderer::Property::EXTRA_SIZE), targetProps.mExtraSize);
-  animation.AnimateTo(Property(renderer, VisualRenderer::Property::VISUAL_MIX_COLOR), targetProps.mMixColor);
+  renderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, targetProps.mMixColor); ///< visual mix color is not animatable.
   animation.Play();
 
   CheckEventVisualProperties(renderer, targetProps);
@@ -651,13 +651,13 @@ int UtcDaliVisualRendererAnimatedProperty06(void)
   actor.SetProperty(Actor::Property::SIZE, Vector2(400.0f, 400.0f));
   application.GetScene().Add(actor);
 
-  Property::Index index = DevelRenderer::Property::OPACITY;
+  Property::Index index = Dali::Renderer::Property::OPACITY;
   renderer.SetProperty(index, 1.0f);
 
   application.SendNotification();
   application.Render(0);
   DALI_TEST_EQUALS(renderer.GetProperty<float>(index), 1.0f, 0.001f, TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(DevelRenderer::Property::OPACITY), 1.0f, 0.0001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(Dali::Renderer::Property::OPACITY), 1.0f, 0.0001f, TEST_LOCATION);
 
   Animation animation = Animation::New(1.0f);
   KeyFrames keyFrames = KeyFrames::New();
@@ -669,22 +669,22 @@ int UtcDaliVisualRendererAnimatedProperty06(void)
   application.SendNotification();
 
   // Test that the event side properties are set to target value of 0
-  DALI_TEST_EQUALS(renderer.GetProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<float>(Dali::Renderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
 
   application.Render(500);
 
   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(index), 0.25f, 0.0001f, TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(DevelRenderer::Property::OPACITY), 0.25f, 0.0001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(Dali::Renderer::Property::OPACITY), 0.25f, 0.0001f, TEST_LOCATION);
 
   // Test that the event side properties are set to target value 0f 0
-  DALI_TEST_EQUALS(renderer.GetProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<float>(Dali::Renderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
 
   // Complete the animation
   application.Render(500);
 
   DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(index), 0.0f, 0.0001f, TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
-  DALI_TEST_EQUALS(renderer.GetProperty<float>(DevelRenderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetCurrentProperty<float>(Dali::Renderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(renderer.GetProperty<float>(Dali::Renderer::Property::OPACITY), 0.0f, 0.0001f, TEST_LOCATION);
   END_TEST;
 }
 
index 8d23214c349751cab22ded74373b3fff41abd8dd..6357927312db4652b29aaccbf9147d6ca0aeb98d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_RENDERER_DEVEL_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -127,24 +127,23 @@ enum Type
   STENCIL_OPERATION_ON_FAIL   = Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL,
   STENCIL_OPERATION_ON_Z_FAIL = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL,
   STENCIL_OPERATION_ON_Z_PASS = Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS,
-
-  /**
-   * @brief The opacity of the renderer.
-   * @details Name "opacity", type Property::FLOAT.
-   */
-  OPACITY = STENCIL_OPERATION_ON_Z_PASS + 1,
+  MIX_COLOR                   = Dali::Renderer::Property::MIX_COLOR,
+  MIX_COLOR_RED               = Dali::Renderer::Property::MIX_COLOR_RED,
+  MIX_COLOR_GREEN             = Dali::Renderer::Property::MIX_COLOR_GREEN,
+  MIX_COLOR_BLUE              = Dali::Renderer::Property::MIX_COLOR_BLUE,
+  OPACITY                     = Dali::Renderer::Property::OPACITY,
 
   /**
    * @brief The rendering behavior of the renderer.
    * @details Name "renderingBehavior", type Property::INTEGER.
    */
-  RENDERING_BEHAVIOR = STENCIL_OPERATION_ON_Z_PASS + 2,
+  RENDERING_BEHAVIOR = OPACITY + 1,
 
   /**
    * @brief name "blendEquation", type INTEGER
    * @note The default value is BlendEquation::ADD
    */
-  BLEND_EQUATION = STENCIL_OPERATION_ON_Z_PASS + 3,
+  BLEND_EQUATION = OPACITY + 2,
 
   /**
    * @brief Which vertex to render first from a vertex buffer without indices
@@ -163,7 +162,7 @@ enum Type
    * @note Overrides computed instance count on vertex buffer.
    * @details name "instanceCount", type INTEGER
    */
-  INSTANCE_COUNT = STENCIL_OPERATION_ON_Z_PASS + 4,
+  INSTANCE_COUNT = OPACITY + 3,
 };
 } // namespace Property
 
index 0132367c4999978bcc3c5a6e10fef7a64b8850b4..2a626fca6f357ba3b3c307317cbfaee83f560c16 100644 (file)
@@ -62,7 +62,11 @@ DALI_PROPERTY("stencilMask", INTEGER, true, false, false, Dali::Renderer::Proper
 DALI_PROPERTY("stencilOperationOnFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_FAIL)
 DALI_PROPERTY("stencilOperationOnZFail", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_FAIL)
 DALI_PROPERTY("stencilOperationOnZPass", INTEGER, true, false, false, Dali::Renderer::Property::STENCIL_OPERATION_ON_Z_PASS)
-DALI_PROPERTY("opacity", FLOAT, true, true, true, Dali::DevelRenderer::Property::OPACITY)
+DALI_PROPERTY("rendererMixColor", VECTOR4, true, true, true, Dali::Renderer::Property::MIX_COLOR)
+DALI_PROPERTY("rendererMixColorRed", FLOAT, true, true, true, Dali::Renderer::Property::MIX_COLOR_RED)
+DALI_PROPERTY("rendererMixColorGreen", FLOAT, true, true, true, Dali::Renderer::Property::MIX_COLOR_GREEN)
+DALI_PROPERTY("rendererMixColorBlue", FLOAT, true, true, true, Dali::Renderer::Property::MIX_COLOR_BLUE)
+DALI_PROPERTY("rendererOpacity", FLOAT, true, true, true, Dali::Renderer::Property::OPACITY)
 DALI_PROPERTY("renderingBehavior", INTEGER, true, false, false, Dali::DevelRenderer::Property::RENDERING_BEHAVIOR)
 DALI_PROPERTY("blendEquation", INTEGER, true, false, false, Dali::DevelRenderer::Property::BLEND_EQUATION)
 DALI_PROPERTY("instanceCount", INTEGER, true, false, false, Dali::DevelRenderer::Property::INSTANCE_COUNT)
@@ -658,16 +662,35 @@ void Renderer::SetDefaultProperty(Property::Index        index,
       }
       break;
     }
-    case Dali::DevelRenderer::Property::OPACITY:
+    case Dali::Renderer::Property::MIX_COLOR:
     {
-      float opacity;
-      if(propertyValue.Get(opacity))
+      Vector4 mixColor;
+      if(propertyValue.Get(mixColor))
       {
-        if(!Equals(mOpacity, opacity))
+        if(mMixColor != mixColor)
         {
-          mOpacity         = opacity;
+          mMixColor        = mixColor;
           auto sceneObject = const_cast<SceneGraph::Renderer*>(&GetRendererSceneObject());
-          SceneGraph::BakeOpacityMessage(GetEventThreadServices(), *sceneObject, mOpacity);
+          SceneGraph::BakeMixColorMessage(GetEventThreadServices(), *sceneObject, mMixColor);
+        }
+      }
+      break;
+    }
+    case Dali::Renderer::Property::MIX_COLOR_RED:
+    case Dali::Renderer::Property::MIX_COLOR_GREEN:
+    case Dali::Renderer::Property::MIX_COLOR_BLUE:
+    case Dali::Renderer::Property::OPACITY:
+    {
+      const uint8_t componentIndex = static_cast<uint8_t>(static_cast<uint32_t>(index) - static_cast<uint32_t>(Dali::Renderer::Property::MIX_COLOR_RED));
+
+      float mixColorComponentValue;
+      if(propertyValue.Get(mixColorComponentValue))
+      {
+        if(!Equals(mMixColor[componentIndex], mixColorComponentValue))
+        {
+          mMixColor[componentIndex] = mixColorComponentValue;
+          auto sceneObject          = const_cast<SceneGraph::Renderer*>(&GetRendererSceneObject());
+          SceneGraph::BakeMixColorComponentMessage(GetEventThreadServices(), *sceneObject, mixColorComponentValue, componentIndex);
         }
       }
       break;
@@ -733,9 +756,18 @@ void Renderer::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::
     {
       switch(index)
       {
-        case Dali::DevelRenderer::Property::OPACITY:
+        case Dali::Renderer::Property::MIX_COLOR:
+        {
+          value.Get(mMixColor);
+          break;
+        }
+        case Dali::Renderer::Property::MIX_COLOR_RED:
+        case Dali::Renderer::Property::MIX_COLOR_GREEN:
+        case Dali::Renderer::Property::MIX_COLOR_BLUE:
+        case Dali::Renderer::Property::OPACITY:
         {
-          value.Get(mOpacity);
+          const uint8_t componentIndex = static_cast<uint8_t>(static_cast<uint32_t>(index) - static_cast<uint32_t>(Dali::Renderer::Property::MIX_COLOR_RED));
+          value.Get(mMixColor[componentIndex]);
           break;
         }
       }
@@ -746,9 +778,18 @@ void Renderer::OnNotifyDefaultPropertyAnimation(Animation& animation, Property::
     {
       switch(index)
       {
-        case Dali::DevelRenderer::Property::OPACITY:
+        case Dali::Renderer::Property::MIX_COLOR:
         {
-          AdjustValue<float>(mOpacity, value);
+          AdjustValue<Vector4>(mMixColor, value);
+          break;
+        }
+        case Dali::Renderer::Property::MIX_COLOR_RED:
+        case Dali::Renderer::Property::MIX_COLOR_GREEN:
+        case Dali::Renderer::Property::MIX_COLOR_BLUE:
+        case Dali::Renderer::Property::OPACITY:
+        {
+          const uint8_t componentIndex = static_cast<uint8_t>(static_cast<uint32_t>(index) - static_cast<uint32_t>(Dali::Renderer::Property::MIX_COLOR_RED));
+          AdjustValue<float>(mMixColor[componentIndex], value);
           break;
         }
       }
@@ -761,10 +802,19 @@ const SceneGraph::PropertyBase* Renderer::GetSceneObjectAnimatableProperty(Prope
 {
   const SceneGraph::PropertyBase* property = nullptr;
 
-  if(index == DevelRenderer::Property::OPACITY)
+  switch(index)
   {
-    property = &GetRendererSceneObject().mOpacity;
+    case Dali::Renderer::Property::MIX_COLOR:
+    case Dali::Renderer::Property::MIX_COLOR_RED:
+    case Dali::Renderer::Property::MIX_COLOR_GREEN:
+    case Dali::Renderer::Property::MIX_COLOR_BLUE:
+    case Dali::Renderer::Property::OPACITY:
+    {
+      property = &GetRendererSceneObject().mMixColor;
+      break;
+    }
   }
+
   if(!property)
   {
     // not our property, ask base
@@ -780,6 +830,37 @@ const PropertyInputImpl* Renderer::GetSceneObjectInputProperty(Property::Index i
   return GetSceneObjectAnimatableProperty(index);
 }
 
+int32_t Renderer::GetPropertyComponentIndex(Property::Index index) const
+{
+  int32_t componentIndex = Property::INVALID_COMPONENT_INDEX;
+
+  switch(index)
+  {
+    case Dali::Renderer::Property::MIX_COLOR_RED:
+    case Dali::Renderer::Property::MIX_COLOR_GREEN:
+    case Dali::Renderer::Property::MIX_COLOR_BLUE:
+    case Dali::Renderer::Property::OPACITY:
+    {
+      componentIndex = static_cast<uint32_t>(index) - static_cast<uint32_t>(Dali::Renderer::Property::MIX_COLOR_RED);
+      break;
+    }
+
+    default:
+    {
+      // Do nothing
+      break;
+    }
+  }
+
+  if(Property::INVALID_COMPONENT_INDEX == componentIndex)
+  {
+    // ask base
+    componentIndex = Object::GetPropertyComponentIndex(index);
+  }
+
+  return componentIndex;
+}
+
 void Renderer::AddDrawCommand(const Dali::DevelRenderer::DrawCommand& command)
 {
   if(!mDrawCommands.capacity())
@@ -799,12 +880,12 @@ void Renderer::AddDrawCommand(const Dali::DevelRenderer::DrawCommand& command)
 
 Renderer::Renderer(const SceneGraph::Renderer* sceneObject)
 : Object(sceneObject),
+  mMixColor(Color::WHITE),
   mDepthIndex(0),
   mIndexedDrawFirstElement(0),
   mIndexedDrawElementCount(0),
   mStencilParameters(RenderMode::AUTO, StencilFunction::ALWAYS, 0xFF, 0x00, 0xFF, StencilOperation::KEEP, StencilOperation::KEEP, StencilOperation::KEEP),
   mBlendingOptions(),
-  mOpacity(1.0f),
   mDepthFunction(DepthFunction::LESS),
   mFaceCullingMode(FaceCullingMode::NONE),
   mBlendMode(BlendMode::AUTO),
@@ -983,9 +1064,17 @@ bool Renderer::GetCachedPropertyValue(Property::Index index, Property::Value& va
       value = mStencilParameters.stencilOperationOnZPass;
       break;
     }
-    case Dali::DevelRenderer::Property::OPACITY:
+    case Dali::Renderer::Property::MIX_COLOR:
     {
-      value = mOpacity;
+      value = mMixColor;
+      break;
+    }
+    case Dali::Renderer::Property::MIX_COLOR_RED:
+    case Dali::Renderer::Property::MIX_COLOR_GREEN:
+    case Dali::Renderer::Property::MIX_COLOR_BLUE:
+    case Dali::Renderer::Property::OPACITY:
+    {
+      value = mMixColor[static_cast<uint32_t>(index) - static_cast<uint32_t>(Dali::Renderer::Property::MIX_COLOR_RED)];
       break;
     }
     case Dali::DevelRenderer::Property::RENDERING_BEHAVIOR:
@@ -1170,9 +1259,17 @@ bool Renderer::GetCurrentPropertyValue(Property::Index index, Property::Value& v
       value                                                 = stencilParameters.stencilOperationOnZPass;
       break;
     }
-    case Dali::DevelRenderer::Property::OPACITY:
+    case Dali::Renderer::Property::MIX_COLOR:
+    {
+      value = sceneObject.GetMixColor(GetEventThreadServices().GetEventBufferIndex());
+      break;
+    }
+    case Dali::Renderer::Property::MIX_COLOR_RED:
+    case Dali::Renderer::Property::MIX_COLOR_GREEN:
+    case Dali::Renderer::Property::MIX_COLOR_BLUE:
+    case Dali::Renderer::Property::OPACITY:
     {
-      value = sceneObject.GetOpacity(GetEventThreadServices().GetEventBufferIndex());
+      value = sceneObject.GetMixColor(GetEventThreadServices().GetEventBufferIndex())[static_cast<uint32_t>(index) - static_cast<uint32_t>(Dali::Renderer::Property::MIX_COLOR_RED)];
       break;
     }
     case Dali::DevelRenderer::Property::RENDERING_BEHAVIOR:
index c29273033dd409851ccd878ea01bf86ca34e344b..b116fd5fe894b28c4516d2ffaac23b2ce824e39d 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_RENDERER_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -203,6 +203,11 @@ public: // Default property extensions from Object
    */
   const PropertyInputImpl* GetSceneObjectInputProperty(Property::Index index) const override;
 
+  /**
+   * @copydoc Dali::Internal::Object::GetPropertyComponentIndex()
+   */
+  int32_t GetPropertyComponentIndex(Property::Index index) const override;
+
   /**
    * @brief Adds a draw command to the Renderer.
    * DrawCommands override Renderer's default behaviour.
@@ -266,6 +271,8 @@ protected:
   TextureSetPtr mTextureSet; ///< Intrusive pointer to the texture set used by this renderer
   ShaderPtr     mShader;     ///< Intrusive pointer to the shader used by this renderer
 
+  Vector4 mMixColor; ///< Local copy of the mix color
+
   int32_t mDepthIndex;
 
   uint32_t mIndexedDrawFirstElement; ///< Offset of first element to draw from bound index buffer
@@ -275,7 +282,6 @@ protected:
   Render::Renderer::StencilParameters mStencilParameters; ///< Struct containing all stencil related options
   BlendingOptions                     mBlendingOptions;   ///< Local copy of blending options bitmask
 
-  float                          mOpacity;                      ///< Local copy of the opacity
   DepthFunction::Type            mDepthFunction : 4;            ///< Local copy of the depth function
   FaceCullingMode::Type          mFaceCullingMode : 3;          ///< Local copy of the mode of face culling
   BlendMode::Type                mBlendMode : 3;                ///< Local copy of the mode of blending
index 7a5c10a15fd7cf178e01f2c1ac6256300f45e41e..2b4dc5068b5a3ebb3a8ee6690a4069b43d4fb30a 100644 (file)
@@ -44,8 +44,8 @@ DALI_PROPERTY("transformOrigin", VECTOR2, true, false, false, Dali::VisualRender
 DALI_PROPERTY("transformAnchorPoint", VECTOR2, true, false, false, Dali::VisualRenderer::Property::TRANSFORM_ANCHOR_POINT)
 DALI_PROPERTY("transformOffsetSizeMode", VECTOR4, true, false, false, Dali::VisualRenderer::Property::TRANSFORM_OFFSET_SIZE_MODE)
 DALI_PROPERTY("extraSize", VECTOR2, true, true, true, Dali::VisualRenderer::Property::EXTRA_SIZE)
-DALI_PROPERTY("visualMixColor", VECTOR3, true, true, true, Dali::VisualRenderer::Property::VISUAL_MIX_COLOR)
-DALI_PROPERTY("preMultipliedAlpha", FLOAT, true, false, false, Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA)
+DALI_PROPERTY("visualMixColor", VECTOR3, true, false, true, Dali::VisualRenderer::Property::VISUAL_MIX_COLOR)
+DALI_PROPERTY("visualPreMultipliedAlpha", FLOAT, true, false, false, Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA)
 DALI_PROPERTY_TABLE_END(Dali::VisualRenderer::Property::DEFAULT_VISUAL_RENDERER_PROPERTY_START_INDEX, VisualRendererDefaultProperties)
 
 // Property string to enumeration tables:
@@ -193,32 +193,20 @@ void VisualRenderer::SetDefaultProperty(Property::Index        index,
       }
       case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
       {
-        if(propertyValue.Get(mPropertyCache.mMixColor))
+        Vector3 mixColorVec3;
+        if(propertyValue.Get(mixColorVec3))
         {
-          const SceneGraph::Renderer& sceneObject      = GetVisualRendererSceneObject();
-          auto                        visualProperties = sceneObject.GetVisualProperties();
-          if(visualProperties)
-          {
-            BakeMessage<Vector3>(GetEventThreadServices(), *mUpdateObject, visualProperties->mMixColor, mPropertyCache.mMixColor);
-          }
+          float opacity = Renderer::GetDefaultProperty(Dali::Renderer::Property::OPACITY).Get<float>();
+          Renderer::SetDefaultProperty(Dali::Renderer::Property::MIX_COLOR, Vector4(mixColorVec3.r, mixColorVec3.g, mixColorVec3.b, opacity));
         }
         break;
       }
       case Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA:
       {
-        float preMultipliedAlpha;
+        float preMultipliedAlpha = 0.0f;
         if(propertyValue.Get(preMultipliedAlpha))
         {
-          if(!Equals(mPropertyCache.mPreMultipliedAlpha, preMultipliedAlpha))
-          {
-            const SceneGraph::Renderer& sceneObject      = GetVisualRendererSceneObject();
-            auto                        visualProperties = sceneObject.GetVisualProperties();
-            if(visualProperties)
-            {
-              mPropertyCache.mPreMultipliedAlpha = preMultipliedAlpha;
-              BakeMessage<float>(GetEventThreadServices(), *mUpdateObject, visualProperties->mPreMultipliedAlpha, preMultipliedAlpha);
-            }
-          }
+          Renderer::SetDefaultProperty(Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA, !Dali::EqualsZero(preMultipliedAlpha));
         }
         break;
       }
@@ -270,12 +258,15 @@ Property::Value VisualRenderer::GetDefaultProperty(Property::Index index) const
       }
       case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
       {
-        value = mPropertyCache.mMixColor;
+        Vector4 mixColor     = Renderer::GetDefaultProperty(Dali::Renderer::Property::MIX_COLOR).Get<Vector4>();
+        Vector3 mixColorVec3 = Vector3(mixColor.r, mixColor.g, mixColor.b);
+        value                = mixColorVec3;
         break;
       }
       case Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA:
       {
-        value = mPropertyCache.mPreMultipliedAlpha;
+        bool blendPreMultipliedAlpha = Renderer::GetDefaultProperty(Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA).Get<bool>();
+        value                        = blendPreMultipliedAlpha ? 1.0f : 0.0f;
         break;
       }
       default:
@@ -358,20 +349,15 @@ Property::Value VisualRenderer::GetDefaultPropertyCurrentValue(Property::Index i
       }
       case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
       {
-        auto visualProperties = sceneObject.GetVisualProperties();
-        if(visualProperties)
-        {
-          value = visualProperties->mMixColor[GetEventThreadServices().GetEventBufferIndex()];
-        }
+        Vector4 mixColor     = Renderer::GetDefaultPropertyCurrentValue(Dali::Renderer::Property::MIX_COLOR).Get<Vector4>();
+        Vector3 mixColorVec3 = Vector3(mixColor.r, mixColor.g, mixColor.b);
+        value                = mixColorVec3;
         break;
       }
       case Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA:
       {
-        auto visualProperties = sceneObject.GetVisualProperties();
-        if(visualProperties)
-        {
-          value = visualProperties->mPreMultipliedAlpha[GetEventThreadServices().GetEventBufferIndex()];
-        }
+        bool blendPreMultipliedAlpha = Renderer::GetDefaultPropertyCurrentValue(Dali::Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA).Get<bool>();
+        value                        = blendPreMultipliedAlpha ? 1.0f : 0.0f;
         break;
       }
     }
@@ -409,11 +395,6 @@ void VisualRenderer::OnNotifyDefaultPropertyAnimation(Animation& animation, Prop
             value.Get(mPropertyCache.mExtraSize);
             break;
           }
-          case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
-          {
-            value.Get(mPropertyCache.mMixColor);
-            break;
-          }
         }
         break;
       }
@@ -437,11 +418,6 @@ void VisualRenderer::OnNotifyDefaultPropertyAnimation(Animation& animation, Prop
             AdjustValue<Vector2>(mPropertyCache.mExtraSize, value);
             break;
           }
-          case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
-          {
-            AdjustValue<Vector3>(mPropertyCache.mMixColor, value);
-            break;
-          }
         }
         break;
       }
@@ -484,11 +460,8 @@ const SceneGraph::PropertyBase* VisualRenderer::GetSceneObjectAnimatableProperty
     }
     case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
     {
-      auto visualProperties = GetVisualRendererSceneObject().GetVisualProperties();
-      if(visualProperties)
-      {
-        property = &visualProperties->mMixColor;
-      }
+      // We should use Dali::Renderer::Property::MIX_COLOR, instead of it.
+      property = Renderer::GetSceneObjectAnimatableProperty(Dali::Renderer::Property::MIX_COLOR);
       break;
     }
   }
@@ -533,14 +506,10 @@ const PropertyInputImpl* VisualRenderer::GetSceneObjectInputProperty(Property::I
       }
       break;
     }
-    case Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA:
+    case Dali::VisualRenderer::Property::VISUAL_MIX_COLOR:
     {
-      auto visualProperties = GetVisualRendererSceneObject().GetVisualProperties();
-      if(visualProperties)
-      {
-        return &visualProperties->mPreMultipliedAlpha;
-      }
-      break;
+      // We should use Dali::Renderer::Property::MIX_COLOR, instead of it.
+      return Renderer::GetSceneObjectInputProperty(Dali::Renderer::Property::MIX_COLOR);
     }
     default:
     {
@@ -558,8 +527,6 @@ void VisualRenderer::AddUniformMappings()
   AddUniformMapping(Dali::VisualRenderer::Property::TRANSFORM_ORIGIN, ConstString("origin"));
   AddUniformMapping(Dali::VisualRenderer::Property::TRANSFORM_ANCHOR_POINT, ConstString("anchorPoint"));
   AddUniformMapping(Dali::VisualRenderer::Property::EXTRA_SIZE, ConstString("extraSize"));
-  AddUniformMapping(Dali::VisualRenderer::Property::VISUAL_MIX_COLOR, ConstString("mixColor"));
-  AddUniformMapping(Dali::VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA, ConstString("preMultipliedAlpha"));
 }
 
 } // namespace Internal
index cbe3a6b165cb09e1dc8db9be33a84e746badc5d3..103c5770ec427c2aa5597515263d427bae9d8f5b 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_VISUAL_RENDERER_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -112,7 +112,7 @@ protected:
   ~VisualRenderer() override;
 
 private:
-  VisualRenderer(const VisualRenderer&)            = delete;
+  VisualRenderer(const VisualRenderer&) = delete;
   VisualRenderer& operator=(const VisualRenderer&) = delete;
 
 public:
@@ -124,7 +124,6 @@ public:
     Vector2 mTransformAnchorPoint{Vector2::ZERO};
     Vector4 mTransformOffsetSizeMode{Vector2::ZERO};
     Vector2 mExtraSize{Vector2::ZERO};
-    Vector3 mMixColor{Vector3::ONE};
     float   mPreMultipliedAlpha{0.0f};
   };
 
index e7774cb5c83ead466321e30cfa839d70df7f888c..10a3be8a81d34fc38e6a64f2eda83dcd9af528bb 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_RENDER_DATA_PROVIDER_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -79,11 +79,11 @@ public:
   virtual const Dali::Vector<Render::TextureKey>* GetTextures() const = 0;
 
   /**
-   * Get the opacity
+   * Get the mix color
    * @param[in] bufferIndex The current buffer index.
-   * @return The opacity
+   * @return The mix color
    */
-  virtual float GetOpacity(BufferIndex bufferIndex) const = 0;
+  virtual Vector4 GetMixColor(BufferIndex bufferIndex) const = 0;
 
   /**
    * @brief Retrieve if the render data is updated
index d7c5c4eda05ededc57aa2a0af448d18dd08a5446..cd95046673cd767b808676bb2e727d17a92d0e9b 100644 (file)
@@ -806,16 +806,15 @@ void Renderer::WriteUniformBuffer(
 
     WriteDefaultUniformV2(program->GetDefaultUniform(Program::DefaultUniformIndex::SCALE), uboViews, scale);
 
-    Vector4        finalColor;                               ///< Applied renderer's opacity color
-    const Vector4& color = node.GetRenderColor(bufferIndex); ///< Actor's original color
+    const Vector4& color      = node.GetRenderColor(bufferIndex);              ///< Actor's original color
+    const Vector4& mixColor   = mRenderDataProvider->GetMixColor(bufferIndex); ///< Renderer's mix color
+    Vector4        finalColor = color * mixColor;                              ///< Applied renderer's mix color
     if(mPremultipliedAlphaEnabled)
     {
-      const float& alpha = color.a * mRenderDataProvider->GetOpacity(bufferIndex);
-      finalColor         = Vector4(color.r * alpha, color.g * alpha, color.b * alpha, alpha);
-    }
-    else
-    {
-      finalColor = Vector4(color.r, color.g, color.b, color.a * mRenderDataProvider->GetOpacity(bufferIndex));
+      const float alpha = finalColor.a;
+      finalColor.r *= alpha;
+      finalColor.g *= alpha;
+      finalColor.b *= alpha;
     }
     WriteDefaultUniformV2(program->GetDefaultUniform(Program::DefaultUniformIndex::COLOR), uboViews, finalColor);
     WriteDefaultUniformV2(program->GetDefaultUniform(Program::DefaultUniformIndex::ACTOR_COLOR), uboViews, color);
index a821d29d453ebe5c73e699bc4cc20ad3aaaf2a16..5a99df2805c07886eabe029721241b615615cfa6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_RENDERER_MESSAGES_H
 
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -253,18 +253,34 @@ inline void SetStencilOperationOnZPassMessage(EventThreadServices& eventThreadSe
   new(slot) LocalType(&renderer, &Renderer::SetStencilOperationOnZPass, stencilOperation);
 }
 
-inline void BakeOpacityMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float opacity)
+inline void BakeMixColorMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, Vector4 mixColor)
 {
-  using LocalType = MessageDoubleBuffered1<Renderer, float>;
+  using LocalType = MessageDoubleBuffered1<Renderer, Vector4>;
 
   // Reserve some memory inside the message queue
   uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
-  new(slot) LocalType(&renderer, &Renderer::BakeOpacity, opacity);
+  new(slot) LocalType(&renderer, &Renderer::BakeMixColor, mixColor);
 
   OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
     new SceneGraph::BakerResetter(const_cast<Renderer*>(&renderer),
-                                  const_cast<AnimatableProperty<float>*>(&renderer.mOpacity),
+                                  const_cast<AnimatableProperty<Vector4>*>(&renderer.mMixColor),
+                                  SceneGraph::BakerResetter::Lifetime::BAKE));
+  SceneGraph::AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
+}
+
+inline void BakeMixColorComponentMessage(EventThreadServices& eventThreadServices, const Renderer& renderer, float componentValue, uint8_t componentIndex)
+{
+  using LocalType = MessageDoubleBuffered2<Renderer, float, uint8_t>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  new(slot) LocalType(&renderer, &Renderer::BakeMixColorComponent, componentValue, componentIndex);
+
+  OwnerPointer<SceneGraph::PropertyResetterBase> resetter(
+    new SceneGraph::BakerResetter(const_cast<Renderer*>(&renderer),
+                                  const_cast<AnimatableProperty<Vector4>*>(&renderer.mMixColor),
                                   SceneGraph::BakerResetter::Lifetime::BAKE));
   SceneGraph::AddResetterMessage(eventThreadServices.GetUpdateManager(), resetter);
 }
index 66d71a8c6c15395030edc6a7ccc2dd0b1105d54b..d600f750e4a6b4c2e4713c378b3f161050f6307e 100644 (file)
@@ -120,7 +120,7 @@ Renderer::Renderer()
   mVisualPropertiesDirtyFlags(CLEAN_FLAG),
   mRegenerateUniformMap(false),
   mPremultipledAlphaEnabled(false),
-  mOpacity(1.0f),
+  mMixColor(Color::WHITE),
   mDepthIndex(0)
 {
 }
@@ -633,16 +633,50 @@ const Render::Renderer::StencilParameters& Renderer::GetStencilParameters() cons
   return mStencilParameters;
 }
 
-void Renderer::BakeOpacity(BufferIndex updateBufferIndex, float opacity)
+void Renderer::BakeMixColor(BufferIndex updateBufferIndex, const Vector4& mixColor)
 {
-  mOpacity.Bake(updateBufferIndex, opacity);
+  mMixColor.Bake(updateBufferIndex, mixColor);
 
   SetUpdated(true);
 }
 
-float Renderer::GetOpacity(BufferIndex updateBufferIndex) const
+void Renderer::BakeMixColorComponent(BufferIndex updateBufferIndex, float componentValue, uint8_t componentIndex)
 {
-  return mOpacity[updateBufferIndex];
+  switch(componentIndex)
+  {
+    case 0:
+    {
+      mMixColor.BakeX(updateBufferIndex, componentValue);
+      break;
+    }
+    case 1:
+    {
+      mMixColor.BakeY(updateBufferIndex, componentValue);
+      break;
+    }
+    case 2:
+    {
+      mMixColor.BakeZ(updateBufferIndex, componentValue);
+      break;
+    }
+    case 3:
+    {
+      mMixColor.BakeW(updateBufferIndex, componentValue);
+      break;
+    }
+    default:
+    {
+      DALI_ASSERT_ALWAYS(0 && "Invalid mix color component comes!");
+      break;
+    }
+  }
+
+  SetUpdated(true);
+}
+
+Vector4 Renderer::GetMixColor(BufferIndex updateBufferIndex) const
+{
+  return mMixColor[updateBufferIndex];
 }
 
 void Renderer::SetRenderingBehavior(DevelRenderer::Rendering::Type renderingBehavior)
@@ -720,7 +754,7 @@ Renderer::OpacityType Renderer::GetOpacityType(BufferIndex updateBufferIndex, ui
     }
     case BlendMode::ON: // If the renderer should always be use blending
     {
-      float alpha = node.GetWorldColor(updateBufferIndex).a * mOpacity[updateBufferIndex];
+      float alpha = node.GetWorldColor(updateBufferIndex).a * mMixColor[updateBufferIndex].a;
       if(alpha <= FULLY_TRANSPARENT)
       {
         opacityType = Renderer::TRANSPARENT;
@@ -753,7 +787,7 @@ Renderer::OpacityType Renderer::GetOpacityType(BufferIndex updateBufferIndex, ui
       }
 
       // renderer should determine opacity using the actor color
-      float alpha = node.GetWorldColor(updateBufferIndex).a * mOpacity[updateBufferIndex];
+      float alpha = node.GetWorldColor(updateBufferIndex).a * mMixColor[updateBufferIndex].a;
       if(alpha <= FULLY_TRANSPARENT)
       {
         opacityType = Renderer::TRANSPARENT;
@@ -832,12 +866,12 @@ void Renderer::SetDrawCommands(Dali::DevelRenderer::DrawCommand* pDrawCommands,
 bool Renderer::IsDirty() const
 {
   // Check whether the opacity property has changed
-  return (Updated() || !mOpacity.IsClean());
+  return (Updated() || !mMixColor.IsClean());
 }
 
 void Renderer::RequestResetToBaseValues()
 {
-  mOpacity.RequestResetToBaseValue();
+  mMixColor.RequestResetToBaseValue();
   if(mVisualProperties)
   {
     mVisualProperties->RequestResetToBaseValues();
index 72cfa3397863c0884a18730486e0989fe43c0be8..46e9ebec610e1d07123131cf3d47e77c5177ed54 100644 (file)
@@ -365,16 +365,24 @@ public:
   const Render::Renderer::StencilParameters& GetStencilParameters() const;
 
   /**
-   * Bakes the opacity
+   * Bakes the mixColor
    * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] opacity The opacity
+   * @param[in] mixColor The mix color
    */
-  void BakeOpacity(BufferIndex updateBufferIndex, float opacity);
+  void BakeMixColor(BufferIndex updateBufferIndex, const Vector4& mixColor);
 
   /**
-   * @copydoc RenderDataProvider::GetOpacity()
+   * Bakes the component of mixColor
+   * @param[in] updateBufferIndex The current update buffer index.
+   * @param[in] componentValue The value of mix colorcomponent.
+   * @param[in] componentIndex The index of mix color component.
+   */
+  void BakeMixColorComponent(BufferIndex updateBufferIndex, float componentValue, uint8_t componentIndex);
+
+  /**
+   * @copydoc RenderDataProvider::GetMixColor()
    */
-  float GetOpacity(BufferIndex updateBufferIndex) const override;
+  Vector4 GetMixColor(BufferIndex updateBufferIndex) const override;
 
   /**
    * Sets the rendering behavior
@@ -613,8 +621,8 @@ private:
   Dali::RenderCallback*                         mRenderCallback{nullptr};
 
 public:
-  AnimatableProperty<float> mOpacity;    ///< The opacity value
-  int32_t                   mDepthIndex; ///< Used only in PrepareRenderInstructions
+  AnimatableProperty<Vector4> mMixColor;   ///< The mix color value
+  int32_t                     mDepthIndex; ///< Used only in PrepareRenderInstructions
 };
 
 } // namespace SceneGraph
index 156949a634e48406c6f15baac6e4d410ef537488..0c75faa041748af04835ecf213635e27f315ad9a 100644 (file)
@@ -36,7 +36,6 @@ void AnimatableVisualProperties::RequestResetToBaseValues()
   mTransformAnchorPoint.RequestResetToBaseValue();
   mTransformOffsetSizeMode.RequestResetToBaseValue();
   mExtraSize.RequestResetToBaseValue();
-  mMixColor.RequestResetToBaseValue();
   mPreMultipliedAlpha.RequestResetToBaseValue();
   if(mExtendedProperties)
   {
index bf976505d31530190866ba78f0e392ca7c2ea947..70de3614e1f4dd9453d04a4208a87455340b1181 100644 (file)
@@ -102,7 +102,6 @@ struct AnimatableVisualProperties
     mTransformAnchorPoint(Vector2::ZERO),
     mTransformOffsetSizeMode(Vector4::ZERO),
     mExtraSize(Vector2::ZERO),
-    mMixColor(Vector3::ONE),
     mPreMultipliedAlpha(0.0f),
     mExtendedProperties(nullptr)
   {
@@ -174,8 +173,7 @@ public: // Default properties
   PROPERTY_WRAPPER(mTransformOffsetSizeMode, VisualRendererProperty, Vector2, mExtraSize);
 
   // Properties that don't give any effort to coefficient.
-  AnimatableProperty<Vector3> mMixColor;
-  AnimatableProperty<float>   mPreMultipliedAlpha;
+  AnimatableProperty<float> mPreMultipliedAlpha;
 
 public: // Extended properties for decorated visual properties
   AnimatableDecoratedVisualProperties* mExtendedProperties{nullptr};
index 3dfd9eaabb8ce1f6a4881ec531e81bb85d34e69a..217ca617a424dff9a5368885cd5b96f35e502e69 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_RENDERER_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -62,11 +62,11 @@ namespace BlendMode
  */
 enum Type
 {
-  OFF,               ///< Blending is disabled.                                                    @SINCE_1_1.43
-  AUTO,              ///< Blending is enabled if there is alpha channel. This is the default mode. @SINCE_1_1.43
-  ON,                ///< Blending is enabled.                                                     @SINCE_1_1.43
-  ON_WITHOUT_CULL,   ///< Blending is enabled, and don't cull the renderer                         @SINCE_2_0.43
-  USE_ACTOR_OPACITY  ///< Blending is enabled when the actor is not opaque                         @SINCE_2_2.7
+  OFF,              ///< Blending is disabled.                                                    @SINCE_1_1.43
+  AUTO,             ///< Blending is enabled if there is alpha channel. This is the default mode. @SINCE_1_1.43
+  ON,               ///< Blending is enabled.                                                     @SINCE_1_1.43
+  ON_WITHOUT_CULL,  ///< Blending is enabled, and don't cull the renderer                         @SINCE_2_0.43
+  USE_ACTOR_OPACITY ///< Blending is enabled when the actor is not opaque                         @SINCE_2_2.7
 };
 
 } // namespace BlendMode
@@ -415,6 +415,42 @@ public:
        * @note The default value is StencilOperation::KEEP.
        */
       STENCIL_OPERATION_ON_Z_PASS,
+
+      /**
+       * @brief The mix color of the renderer, include opacity.
+       * The final color of this renderer will be multiplied by this value.
+       * @SINCE_2_3.41
+       * @details name "rendererMixColor", type VECTOR4
+       */
+      MIX_COLOR,
+
+      /**
+       * @brief The red component of mix color of the renderer.
+       * @SINCE_2_3.41
+       * @details name "rendererMixColorRed", type FLOAT
+       */
+      MIX_COLOR_RED,
+
+      /**
+       * @brief The green component of mix color of the renderer.
+       * @SINCE_2_3.41
+       * @details name "rendererMixColorGreen", type FLOAT
+       */
+      MIX_COLOR_GREEN,
+
+      /**
+       * @brief The blue component of mix color of the renderer.
+       * @SINCE_2_3.41
+       * @details name "rendererMixColorBlue", type FLOAT
+       */
+      MIX_COLOR_BLUE,
+
+      /**
+       * @brief The opacity of the renderer. It is alpha component of the mix color property.
+       * @SINCE_2_3.41
+       * @details Name "rendererOpacity", type FLOAT.
+       */
+      OPACITY,
     };
   };
 
index 5924aabf7d1be9d97a5bb1b6ff05424b87cefcdc..6493991d737ae5e2736406b404dfdf3df8b41f82 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_VISUAL_RENDERER_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -133,15 +133,17 @@ public:
 
       /**
        * @brief Mix color is a generic color for any visual.
-       * @details Name "visualMixColor", type Property::VECTOR3, animatable
+       * @details Name "visualMixColor", type Property::VECTOR3
        * @SINCE_2_1.13
+       * @DEPRECATED_2_3.41 Use Renderer::Property::MIX_COLOR instead.
        */
       VISUAL_MIX_COLOR,
 
       /**
        * @brief PremultipliedAlpha is a float representing a bool, and is either 0.0f, or 1.0f
-       * @details Name "preMultipliedAlpha", type Property::FLOAT
+       * @details Name "visualPreMultipliedAlpha", type Property::FLOAT
        * @SINCE_2_1.13
+       * @DEPRECATED_2_3.41 Not be added as uniform anymore. Use Renderer::Property::BLEND_PRE_MULTIPLIED_ALPHA instead.
        */
       VISUAL_PRE_MULTIPLIED_ALPHA,
     };