Add RenderInputCallback worldColor value 45/322845/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Apr 2025 10:02:45 +0000 (19:02 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Wed, 16 Apr 2025 10:11:44 +0000 (19:11 +0900)
Let we include world color infomation of actor,
so native draw callback use the color infomation

Change-Id: Iccd1057e35fcbc925091fefbeee50ea65bb57ba0
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
automated-tests/src/dali/utc-Dali-DrawableActor.cpp
dali/internal/render/renderers/render-renderer.cpp
dali/public-api/signals/render-callback.h

index 33eb0a338a257b1823117f82ff4ac3aa5d579c52..4d2e123dc44e2043aba693b006dcee94bdfe8e04 100644 (file)
@@ -25,6 +25,7 @@ struct DrawableObject
     // Store the size and clipping box of rendered area
     size        = inputData.size;
     clippingBox = inputData.clippingBox;
+    worldColor  = inputData.worldColor;
 
     return false;
   }
@@ -34,6 +35,7 @@ struct DrawableObject
     // Store the size and clipping box of rendered area
     size        = inputData.size;
     clippingBox = inputData.clippingBox;
+    worldColor  = inputData.worldColor;
 
     auto count = inputData.textureBindings.size();
 
@@ -45,6 +47,7 @@ struct DrawableObject
 
   Size        size{};
   ClippingBox clippingBox{};
+  Vector4     worldColor{};
 };
 
 int UtcDaliRendererSetRenderCallbackP(void)
@@ -59,7 +62,9 @@ int UtcDaliRendererSetRenderCallbackP(void)
   Actor actor = Actor::New();
   application.GetScene().Add(actor);
 
+  const float opacity = 0.5f;
   actor.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
+  actor.SetProperty(Actor::Property::COLOR, Color::MAROON * Vector4(1.0f, 1.0f, 1.0f, opacity));
 
   auto renderer = Renderer::New(*callback);
   actor.AddRenderer(renderer);
@@ -68,9 +73,9 @@ int UtcDaliRendererSetRenderCallbackP(void)
   application.SendNotification();
   application.Render();
 
-  // Check the size (whether callback has been called)
-  auto size(drawable.size);
+  // Check the size ad color (whether callback has been called)
   DALI_TEST_EQUALS(drawable.size, Size(100, 100), TEST_LOCATION);
+  DALI_TEST_EQUALS(drawable.worldColor, Color::MAROON * Vector4(1.0f, 1.0f, 1.0f, opacity), TEST_LOCATION);
 
   // render once again, for line coverage
   application.SendNotification();
@@ -91,14 +96,17 @@ int UtcDaliDrawableActor1P(void)
   DrawableActor drawableActor = DrawableActor::New(*callback);
   application.GetScene().Add(drawableActor);
 
+  const float opacity = 0.5f;
   drawableActor.SetProperty(Actor::Property::SIZE, Vector2(100, 100));
+  drawableActor.SetProperty(Actor::Property::COLOR, Color::MAROON * Vector4(1.0f, 1.0f, 1.0f, opacity));
 
   // flush the queue and render once
   application.SendNotification();
   application.Render();
 
-  // Check the size (whether callback has been called)
+  // Check the size and color (whether callback has been called)
   DALI_TEST_EQUALS(drawable.size, Size(100, 100), TEST_LOCATION);
+  DALI_TEST_EQUALS(drawable.worldColor, Color::MAROON * Vector4(1.0f, 1.0f, 1.0f, opacity), TEST_LOCATION);
 
   END_TEST;
 }
@@ -139,7 +147,7 @@ int UtcRenderCallbackTextureBindingP(void)
 
 int UtcDaliDrawableActor2P(void)
 {
-  tet_infoline("Testing Renderer:LSetRenderCallback() and check clipping box");
+  tet_infoline("Testing Renderer:LSetRenderCallback() and check clipping box and color");
   TestApplication application;
 
   DrawableObject drawable{};
@@ -151,14 +159,17 @@ int UtcDaliDrawableActor2P(void)
   application.GetScene().Add(parentActor);
   parentActor.Add(actor);
 
+  const float opacity = 0.5f;
   parentActor.SetProperty(Actor::Property::POSITION, Vector2(20, 50));
   parentActor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
   parentActor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  parentActor.SetProperty(Actor::Property::COLOR, Color::DARK_OLIVE_GREEN * Vector4(1.0f, 1.0f, 1.0f, opacity));
 
   actor.SetProperty(Actor::Property::SIZE, Vector2(100, 200));
   actor.SetProperty(Actor::Property::POSITION, Vector2(50, 70));
   actor.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT);
   actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT);
+  actor.SetProperty(Actor::Property::COLOR, Color::MAROON * Vector4(1.0f, 1.0f, 1.0f, opacity));
 
   auto renderer = Renderer::New(*callback);
   actor.AddRenderer(renderer);
@@ -167,8 +178,9 @@ int UtcDaliDrawableActor2P(void)
   application.SendNotification();
   application.Render();
 
-  // Check the size (whether callback has been called)
+  // Check the size and color (whether callback has been called)
   DALI_TEST_EQUALS(drawable.size, Size(100, 200), TEST_LOCATION);
+  DALI_TEST_EQUALS(drawable.worldColor, Color::MAROON * Vector4(1.0f, 1.0f, 1.0f, opacity * opacity), TEST_LOCATION);
 
   // Check clippingBox. Note that clippingBox coordinate is in screen coordinates
   DALI_TEST_EQUALS(drawable.clippingBox, Rect<int32_t>(20 + 50, 800 - (50 + 70 + 200), 100, 200), TEST_LOCATION);
index 4d943a5b32b8dc79302ca2d9586ceb61256dc768..445d10da6f5b9b56bc0f05d525fea3e98cc70bfa 100644 (file)
@@ -581,6 +581,7 @@ bool Renderer::Render(Graphics::CommandBuffer&                             comma
     mRenderCallbackInput->size       = size;
     mRenderCallbackInput->view       = viewMatrix;
     mRenderCallbackInput->projection = projectionMatrix;
+    mRenderCallbackInput->worldColor = worldColor;
 
     MatrixUtils::MultiplyProjectionMatrix(mRenderCallbackInput->mvp, modelViewMatrix, projectionMatrix);
 
index 5166cf1aa758edfea22eba6f39a98a9b25ad78a2..41cb2af7dc219c3b257cc2c41255e5df635d0df5 100644 (file)
@@ -52,7 +52,8 @@ struct DALI_CORE_API RenderCallbackInput
   std::any eglContext;         ///< Storage for EGL Context
   bool     usingOwnEglContext; ///< Uses own EGL context (owns GL state), custom code should be aware of it
 
-  Matrix view; // Added at end to avoid abi break.
+  Matrix  view; // Added at end to avoid abi break.
+  Vector4 worldColor;
 };
 
 /**