[dali_2.3.16] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / light / light-impl.h
index 70b51f5..6f0ff24 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_LIGHT_IMPL_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.
@@ -19,7 +19,7 @@
  */
 
 // EXTERNAL INCLUDES
-#include <dali/public-api/actors/custom-actor-impl.h>
+#include <dali-toolkit/public-api/controls/control-impl.h>
 #include <dali/public-api/common/dali-common.h>
 #include <dali/public-api/object/weak-handle.h>
 #include <string_view>
@@ -44,7 +44,7 @@ namespace Internal
  *
  * @SINCE_2_2.32
  */
-class DALI_SCENE3D_API Light : public CustomActorImpl
+class DALI_SCENE3D_API Light : public Toolkit::Internal::Control
 {
 public:
   // Creation & Destruction
@@ -57,16 +57,6 @@ public:
    */
   static Scene3D::Light New();
 
-  /**
-   * @copydoc Scene3D::Light::Enable()
-   */
-  void Enable(bool enable);
-
-  /**
-   * @copydoc Scene3D::Light::IsEnabled()
-   */
-  bool IsEnabled() const;
-
 protected:
   /**
    * @brief Virtual destructor.
@@ -74,7 +64,13 @@ protected:
    */
   virtual ~Light();
 
-protected: // From CustomActorImpl
+public: // From Internal::Control.
+  /**
+   * @copydoc Dali::Toolkit::Internal::Control::OnInitialize()
+   */
+  void OnInitialize() override;
+
+protected: // From CustomActorImpl. Note that it will make we can ignore many codes what Internal::Control using now.
   /**
    * @copydoc CustomActorImpl::OnSceneConnection()
    * @note If overridden, then an up-call to Light::OnSceneConnection MUST be made at the end.
@@ -164,14 +160,64 @@ protected:
    */
   Light();
 
+public: // Public Method
+  /**
+   * @copydoc Scene3D::Light::Enable()
+   */
+  void Enable(bool enable);
+
+  /**
+   * @copydoc Scene3D::Light::IsEnabled()
+   */
+  bool IsEnabled() const;
+
   /**
-   * @brief Second phase initialization.
+   * @copydoc Scene3D::Light::EnableShadow()
    */
-  void Initialize();
+  void EnableShadow(bool enable);
 
-public: // Public Method
+  /**
+   * @copydoc Scene3D::Light::IsShadowEnabled()
+   */
+  bool IsShadowEnabled() const;
+
+  /**
+   * @copydoc Scene3D::Light::GetCamera()
+   */
+  CameraActor GetCamera() const;
+
+  /**
+   * @copydoc Scene3D::Light::EnableShadowSoftFiltering()
+   */
+  void EnableShadowSoftFiltering(bool useSoftFiltering);
+
+  /**
+   * @copydoc Scene3D::Light::IsShadowSoftFilteringEnabled()
+   */
+  bool IsShadowSoftFilteringEnabled() const;
+
+  /**
+   * @copydoc Scene3D::Light::SetShadowIntensity()
+   */
+  void SetShadowIntensity(float shadowIntensity);
+
+  /**
+   * @copydoc Scene3D::Light::GetShadowIntensity()
+   */
+  float GetShadowIntensity() const;
 
   /**
+   * @copydoc Scene3D::Light::SetShadowBias()
+   */
+  void SetShadowBias(float shadowBias);
+
+  /**
+   * @copydoc Scene3D::Light::GetShadowBias()
+   */
+  float GetShadowBias() const;
+
+public: // Public Static Method
+  /**
    * @copydoc Scene3D::Light::GetMaximumEnabledLightCount()
    */
   static uint32_t GetMaximumEnabledLightCount();
@@ -194,18 +240,38 @@ public: // Public Method
    */
   static std::string_view GetLightColorUniformName();
 
+  /**
+   * @brief Retrieves Uniform Name to define shadow is enabled or not.
+   * @return string_view for ShadowEnabledUniformName
+   */
+  static std::string_view GetShadowEnabledUniformName();
+
+  /**
+   * @brief Retrieves Uniform Name for View/Projection matrix of the Shadow.
+   * @return string_view for ShadowViewProjectionMatrixUniformName
+   */
+  static std::string_view GetShadowViewProjectionMatrixUniformName();
+
+private:
+  void UpdateShadowUniforms();
+
 private:
   /// @cond internal
 
   // Not copyable or movable
-  DALI_INTERNAL        Light(const Light&)     = delete; ///< Deleted copy constructor.
-  DALI_INTERNAL        Light(Light&&)          = delete; ///< Deleted move constructor.
+  DALI_INTERNAL Light(const Light&) = delete;            ///< Deleted copy constructor.
+  DALI_INTERNAL Light(Light&&)      = delete;            ///< Deleted move constructor.
   DALI_INTERNAL Light& operator=(const Light&) = delete; ///< Deleted copy assignment operator.
-  DALI_INTERNAL Light& operator=(Light&&)      = delete; ///< Deleted move assignment operator.
+  DALI_INTERNAL Light& operator=(Light&&) = delete;      ///< Deleted move assignment operator.
 
 private:
+  Dali::CameraActor              mLightSourceActor;
   WeakHandle<Scene3D::SceneView> mParentSceneView;
-  bool mIsEnabled{true};
+  bool                           mIsEnabled{true};
+  bool                           mIsShadowEnabled{false};
+  bool                           mUseSoftFiltering{false};
+  float                          mShadowIntensity{0.5f};
+  float                          mShadowBias{0.001f};
   /// @endcond
 };