#include <dali-scene3d/public-api/controls/model/model.h>
#include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
#include <dali-scene3d/public-api/light/light.h>
+#include <dali/public-api/object/property.h>
#include <toolkit-event-thread-callback.h>
using namespace Dali;
int UtcDaliLightAdd01(void)
{
ToolkitTestApplication application;
- Scene3D::SceneView sceneView = Scene3D::SceneView::New();
+ Scene3D::SceneView sceneView = Scene3D::SceneView::New();
sceneView.SetProperty(Dali::Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER);
sceneView.SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
sceneView.SetProperty(Dali::Actor::Property::WIDTH_RESIZE_POLICY, ResizePolicy::FILL_TO_PARENT);
Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
+ Shader shader = renderer.GetShader();
+ DALI_TEST_CHECK(shader);
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- auto countPropertyIndex = renderer.GetPropertyIndex("uLightCount");
- DALI_TEST_CHECK(countPropertyIndex != DALI_KEY_INVALID);
- DALI_TEST_EQUALS(1, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
- auto colorPropertyIndex = renderer.GetPropertyIndex("uLightColor[0]");
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
- auto directionPropertyIndex = renderer.GetPropertyIndex("uLightDirection[0]");
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
+ auto countPropertyIndex = shader.GetPropertyIndex("uLightCount");
+ DALI_TEST_CHECK(countPropertyIndex != Dali::Property::INVALID_INDEX);
+ DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ auto colorPropertyIndex = shader.GetPropertyIndex("uLightColor[0]");
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex = shader.GetPropertyIndex("uLightDirection[0]");
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
light.Enable(false);
DALI_TEST_EQUALS(0u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(0, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
END_TEST;
}
Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
+ Shader shader = renderer.GetShader();
+ DALI_TEST_CHECK(shader);
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- auto countPropertyIndex = renderer.GetPropertyIndex("uLightCount");
+ auto countPropertyIndex = shader.GetPropertyIndex("uLightCount");
DALI_TEST_CHECK(countPropertyIndex != DALI_KEY_INVALID);
- DALI_TEST_EQUALS(1, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
- auto colorPropertyIndex = renderer.GetPropertyIndex("uLightColor[0]");
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
- auto directionPropertyIndex = renderer.GetPropertyIndex("uLightDirection[0]");
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ auto colorPropertyIndex = shader.GetPropertyIndex("uLightColor[0]");
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex = shader.GetPropertyIndex("uLightDirection[0]");
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
light.Enable(false);
DALI_TEST_EQUALS(0u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(0, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
END_TEST;
}
Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
+ Shader shader = renderer.GetShader();
+ DALI_TEST_CHECK(shader);
DALI_TEST_EQUALS(0u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- auto countPropertyIndex = renderer.GetPropertyIndex("uLightCount");
+ auto countPropertyIndex = shader.GetPropertyIndex("uLightCount");
DALI_TEST_CHECK(countPropertyIndex != DALI_KEY_INVALID);
- DALI_TEST_EQUALS(0, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
light.Enable(true);
application.Render();
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(1, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
- auto colorPropertyIndex = renderer.GetPropertyIndex("uLightColor[0]");
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
- auto directionPropertyIndex = renderer.GetPropertyIndex("uLightDirection[0]");
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ auto colorPropertyIndex = shader.GetPropertyIndex("uLightColor[0]");
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex = shader.GetPropertyIndex("uLightDirection[0]");
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
light.Enable(false);
application.Render();
DALI_TEST_EQUALS(0u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(0, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(0, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
END_TEST;
}
Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
+ Shader shader = renderer.GetShader();
+ DALI_TEST_CHECK(shader);
DALI_TEST_EQUALS(2u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- auto countPropertyIndex = renderer.GetPropertyIndex("uLightCount");
+ auto countPropertyIndex = shader.GetPropertyIndex("uLightCount");
DALI_TEST_CHECK(countPropertyIndex != DALI_KEY_INVALID);
- DALI_TEST_EQUALS(2, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
- auto colorPropertyIndex1 = renderer.GetPropertyIndex("uLightColor[0]");
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex1), 0.01f, TEST_LOCATION);
- auto directionPropertyIndex1 = renderer.GetPropertyIndex("uLightDirection[0]");
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex1), 0.01f, TEST_LOCATION);
- auto colorPropertyIndex2 = renderer.GetPropertyIndex("uLightColor[1]");
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex2), 0.01f, TEST_LOCATION);
- auto directionPropertyIndex2 = renderer.GetPropertyIndex("uLightDirection[1]");
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, -1.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex2), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(2, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ auto colorPropertyIndex1 = shader.GetPropertyIndex("uLightColor[0]");
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex1), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex1 = shader.GetPropertyIndex("uLightDirection[0]");
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex1), 0.01f, TEST_LOCATION);
+ auto colorPropertyIndex2 = shader.GetPropertyIndex("uLightColor[1]");
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex2), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex2 = shader.GetPropertyIndex("uLightDirection[1]");
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, -1.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex2), 0.01f, TEST_LOCATION);
light1.Enable(false);
application.Render();
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(1, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
// After light1 is disable, shader uniforms of lights are reordered.
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex1), 0.01f, TEST_LOCATION);
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, -1.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex1), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex1), 0.01f, TEST_LOCATION);
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, -1.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex1), 0.01f, TEST_LOCATION);
END_TEST;
}
Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
-
- std::vector<int32_t> enableAnswers;
- enableAnswers.assign(maxLightCount, 1);
+ Shader shader = renderer.GetShader();
+ DALI_TEST_CHECK(shader);
DALI_TEST_EQUALS(maxLightCount, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- auto countPropertyIndex = renderer.GetPropertyIndex("uLightCount");
+ auto countPropertyIndex = shader.GetPropertyIndex("uLightCount");
DALI_TEST_CHECK(countPropertyIndex != DALI_KEY_INVALID);
- DALI_TEST_EQUALS(static_cast<int32_t>(maxLightCount), renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<int32_t>(maxLightCount), shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
for(uint32_t i = 0; i < maxLightCount; ++i)
{
std::string colorStringKey = std::string("uLightColor[") + std::to_string(i) + "]";
- auto colorPropertyIndex = renderer.GetPropertyIndex(colorStringKey);
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
+ auto colorPropertyIndex = shader.GetPropertyIndex(colorStringKey);
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
std::string directionStringKey = std::string("uLightDirection[") + std::to_string(i) + "]";
- auto directionPropertyIndex = renderer.GetPropertyIndex(directionStringKey);
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex = shader.GetPropertyIndex(directionStringKey);
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
}
lightList[2].Enable(false);
application.Render();
DALI_TEST_EQUALS(maxLightCount, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(static_cast<int32_t>(maxLightCount), renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(static_cast<int32_t>(maxLightCount), shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
for(uint32_t i = 0; i < maxLightCount; ++i)
{
+ tet_printf("i : %d\n", i);
Vector3 color, direction;
- if(i == 2)
+ if(i == maxLightCount - 1)
{
color = Vector3(1.0f, 0.0f, 0.0f);
direction = Vector3(0.0f, 0.0f, -1.0f);
direction = Vector3(1.0f, 0.0f, 0.0f);
}
std::string colorStringKey = std::string("uLightColor[") + std::to_string(i) + "]";
- auto colorPropertyIndex = renderer.GetPropertyIndex(colorStringKey);
- DALI_TEST_EQUALS(color, renderer.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
+ auto colorPropertyIndex = shader.GetPropertyIndex(colorStringKey);
+ DALI_TEST_EQUALS(color, shader.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
std::string directionStringKey = std::string("uLightDirection[") + std::to_string(i) + "]";
- auto directionPropertyIndex = renderer.GetPropertyIndex(directionStringKey);
- DALI_TEST_EQUALS(direction, renderer.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex = shader.GetPropertyIndex(directionStringKey);
+ DALI_TEST_EQUALS(direction, shader.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
}
for(uint32_t i = 0; i < lightList.size(); ++i)
Renderer renderer = model.FindChildByName("node2").GetRendererAt(0u);
DALI_TEST_CHECK(renderer);
+ Shader shader = renderer.GetShader();
+ DALI_TEST_CHECK(shader);
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- auto countPropertyIndex = renderer.GetPropertyIndex("uLightCount");
+ auto countPropertyIndex = shader.GetPropertyIndex("uLightCount");
DALI_TEST_CHECK(countPropertyIndex != DALI_KEY_INVALID);
- DALI_TEST_EQUALS(1, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
+ DALI_TEST_EQUALS(1, shader.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
- auto colorPropertyIndex = renderer.GetPropertyIndex("uLightColor[0]");
- DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), renderer.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
- auto directionPropertyIndex = renderer.GetPropertyIndex("uLightDirection[0]");
- DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), renderer.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
+ auto colorPropertyIndex = shader.GetPropertyIndex("uLightColor[0]");
+ DALI_TEST_EQUALS(Vector3(0.0f, 0.0f, 1.0f), shader.GetCurrentProperty<Vector3>(colorPropertyIndex), 0.01f, TEST_LOCATION);
+ auto directionPropertyIndex = shader.GetPropertyIndex("uLightDirection[0]");
+ DALI_TEST_EQUALS(Vector3(1.0f, 0.0f, 0.0f), shader.GetCurrentProperty<Vector3>(directionPropertyIndex), 0.01f, TEST_LOCATION);
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
model.Unparent();
DALI_TEST_EQUALS(1u, sceneView.GetActivatedLightCount(), TEST_LOCATION);
- DALI_TEST_EQUALS(0, renderer.GetProperty<int32_t>(countPropertyIndex), TEST_LOCATION);
END_TEST;
}
} // namespace
-int UtcDaliShaderDefinitionFactoryProduceShader(void)
+int UtcDaliShaderManagerProduceShader(void)
{
Context ctx;
ctx.resources.mMaterials.push_back({});
}
END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliShaderManagerAddAndRemoveLights(void)
+{
+ TestApplication app;
+ ShaderManager shaderManager;
+
+ ShaderOption option1;
+ option1.AddOption(ShaderOption::Type::THREE_TEXTURE);
+ Dali::Shader shader1 = shaderManager.ProduceShader(option1);
+
+ ShaderOption option2;
+ option2.AddOption(ShaderOption::Type::BASE_COLOR_TEXTURE);
+ Dali::Shader shader2 = shaderManager.ProduceShader(option2);
+
+ DALI_TEST_NOT_EQUALS(shader1, shader2, 0.1f, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader1.GetProperty<int>(shader1.GetPropertyIndex("uLightCount")), 0, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader2.GetProperty<int>(shader2.GetPropertyIndex("uLightCount")), 0, TEST_LOCATION);
+
+ Scene3D::Light light = Scene3D::Light::New();
+ shaderManager.AddLight(light);
+
+ DALI_TEST_EQUALS(shader1.GetProperty<int>(shader1.GetPropertyIndex("uLightCount")), 1, TEST_LOCATION);
+ DALI_TEST_EQUALS(shader2.GetProperty<int>(shader2.GetPropertyIndex("uLightCount")), 1, TEST_LOCATION);
+
+ ShaderOption option3;
+ option3.AddOption(ShaderOption::Type::METALLIC_ROUGHNESS_TEXTURE);
+ Dali::Shader shader3 = shaderManager.ProduceShader(option3);
+
+ DALI_TEST_NOT_EQUALS(shader1, shader3, 0.1f, TEST_LOCATION);
+ DALI_TEST_NOT_EQUALS(shader2, shader3, 0.1f, TEST_LOCATION);
+
+ DALI_TEST_EQUALS(shader3.GetProperty<int>(shader3.GetPropertyIndex("uLightCount")), 1, TEST_LOCATION);
+
+ END_TEST;
+}
* @param[in] scaleFactor scale factor that controls light source intensity in [0.0f, 1.0f].
*/
virtual void NotifyImageBasedLightScaleFactor(float scaleFactor) = 0;
-
- /**
- * @brief Notifies new light is added on SceneView
- *
- * @param[in] lightIndex Index of added light.
- * @param[in] light Added light.
- */
- virtual void NotifyLightAdded(uint32_t lightIndex, Scene3D::Light light) = 0;
-
- /**
- * @brief Notifies a light is removed from SceneView
- *
- * @param[in] lightIndex Index of light to be removed.
- */
- virtual void NotifyLightRemoved(uint32_t lightIndex) = 0;
};
} // namespace Internal
}
}
-void AddLightRecursively(Scene3D::ModelNode node, Scene3D::Light light, uint32_t lightIndex)
-{
- if(!node)
- {
- return;
- }
- GetImplementation(node).AddLight(light, lightIndex);
-
- uint32_t childrenCount = node.GetChildCount();
- for(uint32_t i = 0; i < childrenCount; ++i)
- {
- Scene3D::ModelNode childNode = Scene3D::ModelNode::DownCast(node.GetChildAt(i));
- if(childNode)
- {
- AddLightRecursively(childNode, light, lightIndex);
- }
- }
-}
-
-void RemoveLightRecursively(Scene3D::ModelNode node, uint32_t lightIndex)
-{
- if(!node)
- {
- return;
- }
-
- GetImplementation(node).RemoveLight(lightIndex);
-
- uint32_t childrenCount = node.GetChildCount();
- for(uint32_t i = 0; i < childrenCount; ++i)
- {
- Scene3D::ModelNode childNode = Scene3D::ModelNode::DownCast(node.GetChildAt(i));
- if(childNode)
- {
- RemoveLightRecursively(childNode, lightIndex);
- }
- }
-}
-
void UpdateBlendShapeNodeMapRecursively(Model::BlendShapeModelNodeMap& resultMap, const Scene3D::ModelNode& node)
{
if(!node)
UpdateImageBasedLightScaleFactor();
}
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mLights[i])
- {
- AddLightRecursively(modelNode, mLights[i], i);
- }
- }
-
if(Self().GetProperty<bool>(Dali::Actor::Property::CONNECTED_TO_SCENE))
{
NotifyResourceReady();
if(mModelRoot)
{
UpdateShaderRecursively(modelNode, nullptr);
-
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mLights[i])
- {
- RemoveLightRecursively(modelNode, i);
- }
- }
mModelRoot.Remove(modelNode);
}
}
{
// Make ParentOrigin as Center.
Self().SetProperty(Dali::Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);
- mLights.resize(Scene3D::Internal::Light::GetMaximumEnabledLightCount());
}
void Model::OnSceneConnection(int depth)
}
}
-void Model::NotifyLightAdded(uint32_t lightIndex, Scene3D::Light light)
-{
- mLights[lightIndex] = light;
- AddLightRecursively(mModelRoot, light, lightIndex);
-}
-
-void Model::NotifyLightRemoved(uint32_t lightIndex)
-{
- if(mLights[lightIndex])
- {
- RemoveLightRecursively(mModelRoot, lightIndex);
- mLights[lightIndex].Reset();
- }
-}
-
void Model::OnModelLoadComplete()
{
if(!mModelLoadTask->HasSucceeded())
mDefaultSpecularTexture = resources.mEnvironmentMaps.front().second.mSpecular;
}
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mLights[i])
- {
- AddLightRecursively(mModelRoot, mLights[i], i);
- }
- }
-
UpdateImageBasedLightTexture();
UpdateImageBasedLightScaleFactor();
Self().SetProperty(Dali::Actor::Property::ANCHOR_POINT, Vector3(mModelPivot.x, 1.0f - mModelPivot.y, mModelPivot.z));
*/
void NotifyImageBasedLightScaleFactor(float scaleFactor) override;
- /**
- * @copydoc Dali::Scene3D::Internal::LightObserver::NotifyLightAdded()
- */
- void NotifyLightAdded(uint32_t lightIndex, Scene3D::Light light) override;
-
- /**
- * @copydoc Dali::Scene3D::Internal::LightObserver::NotifyLightRemoved()
- */
- void NotifyLightRemoved(uint32_t lightIndex) override;
-
private:
/**
* @brief Asynchronously model loading finished.
Dali::Scene3D::Loader::ShaderManagerPtr mShaderManager;
- // Light
- std::vector<Scene3D::Light> mLights;
-
// List of ModelNode for name of blend shape.
BlendShapeModelNodeMap mBlendShapeModelNodeMap;
#include <dali-scene3d/internal/graphics/builtin-shader-extern-gen.h>
#include <dali-scene3d/internal/light/light-impl.h>
+#include <dali/integration-api/debug.h>
+
using namespace Dali;
namespace Dali
if(item)
{
item->NotifyImageBasedLightTexture(mDiffuseTexture, mSpecularTexture, mIblScaleFactor, mSpecularMipmapLevels);
-
- if(mActivatedLightCount > 0)
- {
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mActivatedLights[i])
- {
- item->NotifyLightAdded(i, mActivatedLights[i]);
- }
- }
- }
mItems.push_back(item);
}
}
{
if(mItems[i] == item)
{
- if(mActivatedLightCount > 0)
- {
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mActivatedLights[i])
- {
- item->NotifyLightRemoved(i);
- }
- }
- }
mItems.erase(mItems.begin() + i);
break;
}
void SceneView::AddLight(Scene3D::Light light)
{
- bool enabled = AddLightInternal(light);
+ bool enabled = mShaderManager->AddLight(light);
mLights.push_back(std::make_pair(light, enabled));
}
void SceneView::RemoveLight(Scene3D::Light light)
{
- if(mActivatedLights.empty())
- {
- return;
- }
-
- bool needToDisable = false;
+ mShaderManager->RemoveLight(light);
for(uint32_t i = 0; i < mLights.size(); ++i)
{
if(mLights[i].first == light)
{
- // If mLights[i].second is true, it means the light is currently activated in Scene.
- // Then it should be removed from mActivatedLights list too.
- needToDisable = mLights[i].second;
mLights.erase(mLights.begin() + i);
break;
}
}
- uint32_t maxNumberOfLight = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- if(needToDisable)
+ if(mLights.size() > mShaderManager->GetLightCount())
{
- uint32_t removedIndex = RemoveLightInternal(light);
- if(mActivatedLightCount < maxNumberOfLight && mLights.size() >= maxNumberOfLight)
+ for(auto && waitingLight : mLights)
{
- for(auto&& lightItem : mLights)
+ if(waitingLight.second)
{
- if(lightItem.second == false)
- {
- lightItem.second = AddLightInternal(lightItem.first);
- break;
- }
+ continue;
}
- }
- // To remove empty entity of mActivatedLights, moves last object to empty position.
- // Because one Light is removed, mActivatedLights[mActivatedLightCount] is current last object of the list.
- if(!mActivatedLights[removedIndex] && mActivatedLightCount > 0 && removedIndex < mActivatedLightCount)
- {
- Scene3D::Light reorderingLight = mActivatedLights[mActivatedLightCount];
- RemoveLightInternal(reorderingLight);
- AddLightInternal(reorderingLight);
+ waitingLight.second = mShaderManager->AddLight(waitingLight.first);
+ break;
}
}
}
uint32_t SceneView::GetActivatedLightCount() const
{
- return mActivatedLightCount;
+ return mShaderManager->GetLightCount();
}
void SceneView::UseFramebuffer(bool useFramebuffer)
}
}
-bool SceneView::AddLightInternal(Scene3D::Light light)
-{
- uint32_t maxNumberOfLight = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- if(mActivatedLightCount == 0)
- {
- mActivatedLights.resize(maxNumberOfLight);
- }
-
- bool enabled = false;
- if(mActivatedLightCount < maxNumberOfLight)
- {
- uint32_t newLightIndex = 0u;
- for(; newLightIndex < maxNumberOfLight; ++newLightIndex)
- {
- if(!mActivatedLights[newLightIndex])
- {
- mActivatedLights[newLightIndex] = light;
- break;
- }
- }
-
- for(auto&& item : mItems)
- {
- if(item)
- {
- item->NotifyLightAdded(newLightIndex, light);
- }
- }
-
- mActivatedLightCount++;
- enabled = true;
- }
- return enabled;
-}
-
-int32_t SceneView::RemoveLightInternal(Scene3D::Light light)
-{
- int32_t removedIndex = INVALID_INDEX;
- uint32_t maxNumberOfLight = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxNumberOfLight; ++i)
- {
- if(mActivatedLights[i] == light)
- {
- for(auto&& item : mItems)
- {
- if(item)
- {
- item->NotifyLightRemoved(i);
- }
- }
- mActivatedLights[i].Reset();
- mActivatedLightCount--;
- removedIndex = i;
- break;
- }
- }
-
- return removedIndex;
-}
-
} // namespace Internal
} // namespace Scene3D
} // namespace Dali
*/
void NotifyImageBasedLightTextureChange();
- /**
- * @brief Internal method to add an Light object to this SceneView.
- *
- * @param[in] light Light object to be added.
- * @return True if successed to enable.
- */
- bool AddLightInternal(Scene3D::Light light);
-
- /**
- * @brief Internal method to remove an Light object to this SceneView.
- *
- * @param[in] light Light object to be added.
- * @return Index of removed light in enabled light list. If failed to remove it returns negative value;
- */
- int32_t RemoveLightInternal(Scene3D::Light light);
-
private:
Toolkit::Visual::Base mVisual;
// Light
std::vector<std::pair<Scene3D::Light, bool>> mLights; // Pair of Light object and flag that denotes the light is currently activated or not.
- std::vector<Scene3D::Light> mActivatedLights;
- uint32_t mActivatedLightCount{0u};
// Asynchronous Loading.
EnvironmentMapLoadTaskPtr mSkyboxLoadTask;
renderer.RegisterProperty(Scene3D::Loader::NodeDefinition::GetIblScaleFactorUniformName().data(), 1.0f);
renderer.RegisterProperty(Scene3D::Loader::NodeDefinition::GetIblYDirectionUniformName().data(), Vector3(1.0f, -1.0, 1.0));
- std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
- renderer.RegisterProperty(lightCountPropertyName, 0);
-
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- std::string lightDirectionPropertyName(Scene3D::Internal::Light::GetLightDirectionUniformName());
- lightDirectionPropertyName += "[" + std::to_string(i) + "]";
- renderer.RegisterProperty(lightDirectionPropertyName, Vector3::ZAXIS);
-
- std::string lightColorPropertyName(Scene3D::Internal::Light::GetLightColorUniformName());
- lightColorPropertyName += "[" + std::to_string(i) + "]";
- renderer.RegisterProperty(lightColorPropertyName, Vector3(Color::WHITE));
- }
-
Scene3D::Loader::RendererState::Apply(mRendererState, renderer);
}
void ModelNode::Initialize()
{
OnInitialize();
- mLights.resize(Scene3D::Internal::Light::GetMaximumEnabledLightCount());
}
void ModelNode::OnInitialize()
GetImplementation(modelPrimitive).SetImageBasedLightTexture(mDiffuseTexture, mSpecularTexture, mIblScaleFactor, mSpecularMipmapLevels);
}
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mLights[i])
- {
- GetImplementation(modelPrimitive).AddLight(mLights[i], i);
- }
- }
-
GetImplementation(modelPrimitive).UpdateShader(mShaderManager);
Dali::Renderer renderer = GetImplementation(modelPrimitive).GetRenderer();
GetImplementation(mModelPrimitiveContainer[index]).UpdateShader(nullptr);
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mLights[i])
- {
- GetImplementation(mModelPrimitiveContainer[index]).RemoveLight(i);
- }
- }
-
Actor self = Self();
GetImplementation(mModelPrimitiveContainer[index]).RemovePrimitiveObserver(this);
}
}
-void ModelNode::AddLight(Scene3D::Light light, uint32_t lightIndex)
-{
- mLights[lightIndex] = light;
- for(auto&& primitive : mModelPrimitiveContainer)
- {
- GetImplementation(primitive).AddLight(light, lightIndex);
- }
-}
-
-void ModelNode::RemoveLight(uint32_t lightIndex)
-{
- for(auto&& primitive : mModelPrimitiveContainer)
- {
- GetImplementation(primitive).RemoveLight(lightIndex);
- }
- mLights[lightIndex].Reset();
-}
-
void ModelNode::UpdateShader(Scene3D::Loader::ShaderManagerPtr shaderManager)
{
if(mShaderManager != shaderManager)
void SetImageBasedLightScaleFactor(float iblScaleFactor);
/**
- * @brief Adds new Light.
- *
- * @param[in] light Newly added light.
- * @param[in] lightIndex index of this light.
- */
- void AddLight(Scene3D::Light light, uint32_t lightIndex);
-
- /**
- * @brief Removes new Light.
- *
- * @param[in] lightIndex index of light that will be removed.
- */
- void RemoveLight(uint32_t lightIndex);
-
- /**
* @brief Updates shaders by using current material
*
* @param[in] shaderManager Shader manager to create shader.
Dali::Texture mDiffuseTexture;
float mIblScaleFactor{1.0f};
uint32_t mSpecularMipmapLevels{1u};
-
- // Light
- std::vector<Scene3D::Light> mLights;
/// @endcond
};
void ModelPrimitive::Initialize()
{
- mLights.resize(Scene3D::Internal::Light::GetMaximumEnabledLightCount());
}
void ModelPrimitive::SetRenderer(Dali::Renderer renderer)
}
}
-void ModelPrimitive::AddLight(Scene3D::Light light, uint32_t lightIndex)
-{
- if(mLights[lightIndex])
- {
- RemoveLight(lightIndex);
- }
-
- mLights[lightIndex] = light;
- // TODO Remove light at lightIndex if it is already set.
- if(mRenderer && mMaterial)
- {
- mLightCount++;
- std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
- mRenderer.RegisterProperty(lightCountPropertyName, mLightCount);
-
- std::string lightDirectionPropertyName(Scene3D::Internal::Light::GetLightDirectionUniformName());
- lightDirectionPropertyName += "[" + std::to_string(lightIndex) + "]";
- auto lightDirectionPropertyIndex = mRenderer.RegisterProperty(lightDirectionPropertyName, Vector3::ZAXIS);
- Dali::Constraint lightDirectionConstraint = Dali::Constraint::New<Vector3>(mRenderer, lightDirectionPropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs)
- { output = inputs[0]->GetQuaternion().Rotate(Vector3::ZAXIS); });
- lightDirectionConstraint.AddSource(Source{light, Dali::Actor::Property::WORLD_ORIENTATION});
- lightDirectionConstraint.ApplyPost();
- lightDirectionConstraint.SetTag(INDEX_FOR_LIGHT_CONSTRAINT_TAG + lightIndex);
-
- std::string lightColorPropertyName(Scene3D::Internal::Light::GetLightColorUniformName());
- lightColorPropertyName += "[" + std::to_string(lightIndex) + "]";
- auto lightColorPropertyIndex = mRenderer.RegisterProperty(lightColorPropertyName, Vector3(Color::WHITE));
- Dali::Constraint lightColorConstraint = Dali::Constraint::New<Vector3>(mRenderer, lightColorPropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs)
- { output = Vector3(inputs[0]->GetVector4()); });
- lightColorConstraint.AddSource(Source{light, Dali::Actor::Property::COLOR});
- lightColorConstraint.ApplyPost();
- lightColorConstraint.SetTag(INDEX_FOR_LIGHT_CONSTRAINT_TAG + lightIndex);
- }
-}
-
-void ModelPrimitive::RemoveLight(uint32_t lightIndex)
-{
- mLightCount--;
- std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
- mRenderer.RegisterProperty(lightCountPropertyName, mLightCount);
-
- mRenderer.RemoveConstraints(INDEX_FOR_LIGHT_CONSTRAINT_TAG + lightIndex);
-
- mLights[lightIndex].Reset();
-}
-
void ModelPrimitive::UpdateShader(Scene3D::Loader::ShaderManagerPtr shaderManager)
{
if(mShaderManager != shaderManager)
mRenderer.SetTextures(mTextureSet);
UpdateRendererUniform();
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- if(mLights[i])
- {
- AddLight(mLights[i], i);
- }
- }
-
for(auto* observer : mObservers)
{
observer->OnRendererCreated(mRenderer);
void SetImageBasedLightScaleFactor(float iblScaleFactor);
/**
- * @brief Adds a Light on this medel primitive
- *
- * @param[in] light Added light.
- * @param[in] lightIndex Index of added light.
- */
- void AddLight(Scene3D::Light light, uint32_t lightIndex);
-
- /**
- * @brief Removes a light at the lightIndex of this model primitive
- *
- * @param[in] lightIndex Index of added light.
- */
- void RemoveLight(uint32_t lightIndex);
-
- /**
* @brief Updates shaders by using current material
*
* @param[in] shaderManager Shader manager to create shader.
Scene3D::Loader::ShaderManagerPtr mShaderManager;
- // Light
- std::vector<Scene3D::Light> mLights;
- int32_t mLightCount{0};
-
// For IBL
Dali::Texture mSpecularTexture;
Dali::Texture mDiffuseTexture;
renderer.RegisterProperty(IBL_INTENSITY_STRING.data(), resources.mEnvironmentMaps[envIndex].first.mIblIntensity);
renderer.RegisterProperty(IBL_Y_DIRECTION.data(), resources.mEnvironmentMaps[envIndex].first.mYDirection);
- std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
- renderer.RegisterProperty(lightCountPropertyName, 0);
-
- uint32_t maxLightCount = Scene3D::Internal::Light::GetMaximumEnabledLightCount();
- for(uint32_t i = 0; i < maxLightCount; ++i)
- {
- std::string lightDirectionPropertyName(Scene3D::Internal::Light::GetLightDirectionUniformName());
- lightDirectionPropertyName += "[" + std::to_string(i) + "]";
- renderer.RegisterProperty(lightDirectionPropertyName, Vector3::ZAXIS);
-
- std::string lightColorPropertyName(Scene3D::Internal::Light::GetLightColorUniformName());
- lightColorPropertyName += "[" + std::to_string(i) + "]";
- renderer.RegisterProperty(lightColorPropertyName, Vector3(Color::WHITE));
- }
-
node.SetProperty(Actor::Property::COLOR, mColor);
// If user uses customshader, the properties of the shader could not be changed by Material.
// EXTERNAL INCLUDES
#include <dali/devel-api/common/map-wrapper.h>
+#include <dali/public-api/animation/constraint.h>
#include <cstring>
// INTERNAL INCLUDES
+#include <dali-scene3d/internal/light/light-impl.h>
#include <dali-scene3d/internal/loader/hash.h>
#include <dali-scene3d/public-api/loader/blend-shape-details.h>
#include <dali-scene3d/public-api/loader/node-definition.h>
{
namespace
{
+static constexpr uint32_t INDEX_FOR_LIGHT_CONSTRAINT_TAG = 10;
ShaderOption MakeOption(const MaterialDefinition& materialDef, const MeshDefinition& meshDef)
{
struct ShaderManager::Impl
{
- std::map<uint64_t, Index> mShaderMap;
- std::vector<Dali::Shader> mShaders;
+ std::map<uint64_t, Index> mShaderMap;
+ std::vector<Dali::Shader> mShaders;
+ std::vector<Scene3D::Light> mLights;
};
ShaderManager::ShaderManager()
auto raw = shaderDef.LoadRaw("");
mImpl->mShaders.emplace_back(shaderDef.Load(std::move(raw)));
result = mImpl->mShaders.back();
+
+ std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
+ result.RegisterProperty(lightCountPropertyName, static_cast<int32_t>(mImpl->mLights.size()));
+
+ for(uint32_t index = 0; index < mImpl->mLights.size(); ++index)
+ {
+ SetLightConstraintToShader(index, result);
+ }
}
return result;
return rendererState;
}
+bool ShaderManager::AddLight(Scene3D::Light light)
+{
+ if(!light || mImpl->mLights.size() >= Scene3D::Internal::Light::GetMaximumEnabledLightCount())
+ {
+ return false;
+ }
+
+ int32_t lightIndex = mImpl->mLights.size();
+ mImpl->mLights.push_back(light);
+
+ for(auto&& shader : mImpl->mShaders)
+ {
+ std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
+ shader.RegisterProperty(lightCountPropertyName, static_cast<int32_t>(mImpl->mLights.size()));
+ }
+
+ SetLightConstraint(lightIndex);
+
+ return true;
+}
+
+void ShaderManager::RemoveLight(Scene3D::Light light)
+{
+ uint32_t lightCount = mImpl->mLights.size();
+ for(uint32_t index = 0; index < lightCount; ++index)
+ {
+ if(mImpl->mLights[index] != light)
+ {
+ continue;
+ }
+
+ RemoveLightConstraint(index);
+
+ if(!mImpl->mLights.empty() && light != mImpl->mLights.back())
+ {
+ RemoveLightConstraint(mImpl->mLights.size() - 1);
+ mImpl->mLights[index] = mImpl->mLights.back();
+ SetLightConstraint(index);
+ }
+
+ mImpl->mLights.pop_back();
+
+ for(auto&& shader : mImpl->mShaders)
+ {
+ std::string lightCountPropertyName(Scene3D::Internal::Light::GetLightCountUniformName());
+ shader.RegisterProperty(lightCountPropertyName, static_cast<int32_t>(mImpl->mLights.size()));
+ }
+ break;
+ }
+}
+
+uint32_t ShaderManager::GetLightCount() const
+{
+ return mImpl->mLights.size();
+}
+
+void ShaderManager::SetLightConstraint(uint32_t lightIndex)
+{
+ for(auto&& shader : mImpl->mShaders)
+ {
+ SetLightConstraintToShader(lightIndex, shader);
+ }
+}
+
+void ShaderManager::SetLightConstraintToShader(uint32_t lightIndex, Dali::Shader shader)
+{
+ std::string lightDirectionPropertyName(Scene3D::Internal::Light::GetLightDirectionUniformName());
+ lightDirectionPropertyName += "[" + std::to_string(lightIndex) + "]";
+ auto lightDirectionPropertyIndex = shader.RegisterProperty(lightDirectionPropertyName, Vector3::ZAXIS);
+ Dali::Constraint lightDirectionConstraint = Dali::Constraint::New<Vector3>(shader, lightDirectionPropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs)
+ { output = inputs[0]->GetQuaternion().Rotate(Vector3::ZAXIS); });
+ lightDirectionConstraint.AddSource(Source{mImpl->mLights[lightIndex], Dali::Actor::Property::WORLD_ORIENTATION});
+ lightDirectionConstraint.ApplyPost();
+ lightDirectionConstraint.SetTag(INDEX_FOR_LIGHT_CONSTRAINT_TAG + lightIndex);
+
+ std::string lightColorPropertyName(Scene3D::Internal::Light::GetLightColorUniformName());
+ lightColorPropertyName += "[" + std::to_string(lightIndex) + "]";
+ auto lightColorPropertyIndex = shader.RegisterProperty(lightColorPropertyName, Vector3(Color::WHITE));
+ Dali::Constraint lightColorConstraint = Dali::Constraint::New<Vector3>(shader, lightColorPropertyIndex, [](Vector3& output, const PropertyInputContainer& inputs)
+ { output = Vector3(inputs[0]->GetVector4()); });
+ lightColorConstraint.AddSource(Source{mImpl->mLights[lightIndex], Dali::Actor::Property::COLOR});
+ lightColorConstraint.ApplyPost();
+ lightColorConstraint.SetTag(INDEX_FOR_LIGHT_CONSTRAINT_TAG + lightIndex);
+}
+
+void ShaderManager::RemoveLightConstraint(uint32_t lightIndex)
+{
+ for(auto&& shader : mImpl->mShaders)
+ {
+ shader.RemoveConstraints(INDEX_FOR_LIGHT_CONSTRAINT_TAG + lightIndex);
+ }
+}
+
} // namespace Dali::Scene3D::Loader
#include <dali-scene3d/public-api/loader/mesh-definition.h>
#include <dali-scene3d/public-api/loader/renderer-state.h>
#include <dali-scene3d/public-api/loader/shader-option.h>
+#include <dali-scene3d/public-api/light/light.h>
namespace Dali::Scene3D::Loader
{
*/
RendererState::Type GetRendererState(const MaterialDefinition& materialDefinition);
+ /**
+ * @brief Adds new lights for each of shaders.
+ * @param[in] light Light object to be newly added.
+ * @return True when the new light object is added successfully.
+ */
+ bool AddLight(Scene3D::Light light);
+
+ /**
+ * @brief Removes light from each of shaders.
+ * @param[in] light Light object to be removed.
+ */
+ void RemoveLight(Scene3D::Light light);
+
+ /**
+ * @brief Retrieves added light counts.
+ * @return The number of added light count.
+ */
+ uint32_t GetLightCount() const;
+
+private:
+ /**
+ * @brief Sets constraint to the shaders with light of light index.
+ * @param[in] lightIndex index of light that will be connected with shaders by constraint.
+ */
+ DALI_INTERNAL void SetLightConstraint(uint32_t lightIndex);
+
+ /**
+ * @brief Sets constraint to a shader with light of light index.
+ * @param[in] lightIndex index of light that will be connected with input shader by constraint.
+ * @param[in] shader Shader that the constraint will be applied.
+ */
+ DALI_INTERNAL void SetLightConstraintToShader(uint32_t lightIndex, Dali::Shader shader);
+
+ /**
+ * @brief Removes constraint of shaders and light of light index.
+ * @param[in] lightIndex index of light that will be disconnected with shaders.
+ */
+ DALI_INTERNAL void RemoveLightConstraint(uint32_t lightIndex);
private:
struct Impl;
const std::unique_ptr<Impl> mImpl;