Merge changes I776588c1,I7292a2fb into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / controls / scene-view / scene-view-impl.h
index cf117f9..647df5e 100644 (file)
@@ -35,6 +35,7 @@
 #include <dali-scene3d/internal/common/environment-map-load-task.h>
 #include <dali-scene3d/internal/common/light-observer.h>
 #include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
+#include <dali-scene3d/public-api/loader/shader-manager.h>
 
 namespace Dali
 {
@@ -149,6 +150,22 @@ public:
   void RemoveLight(Scene3D::Light light);
 
   /**
+   * @brief Set a shadow to this scene by input light.
+   * Currently, SceneView supports only one shadow.
+   *
+   * @param[in] light Light object to make shadow.
+   * @note The shadow will be drawn if the input light is turn on in current scene.
+   */
+  void SetShadow(Scene3D::Light light);
+
+  /**
+   * @brief Removes Shadow from this SceneView.
+   *
+   * @param[in] light Light object to be removed.
+   */
+  void RemoveShadow(Scene3D::Light light);
+
+  /**
    * @copydoc SceneView::GetActivatedLightCount()
    */
   uint32_t GetActivatedLightCount() const;
@@ -203,6 +220,18 @@ public:
    */
   Quaternion GetSkyboxOrientation() const;
 
+  /**
+   * @brief Retrieves ShaderManager of this SceneView.
+   * @return ShaderManager of this SceneView.
+   */
+  Dali::Scene3D::Loader::ShaderManagerPtr GetShaderManager() const;
+
+  /**
+   * @brief Update shader uniforms about shadow.
+   * @param[in] light Light that makes shadow.
+   */
+  void UpdateShadowUniform(Scene3D::Light light);
+
 protected:
   /**
    * @brief Constructs a new SceneView.
@@ -316,20 +345,10 @@ private:
   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;
+   * @brief Update shadowMap framebuffer when the size should be changed.
+   * @param[in] shadowMapSize The size of shadowMap texture. The texture's width and hight is equal.
    */
-  int32_t RemoveLightInternal(Scene3D::Light light);
+  void UpdateShadowMapBuffer(uint32_t shadowMapSize);
 
 private:
   Toolkit::Visual::Base mVisual;
@@ -352,10 +371,14 @@ private:
   float                                          mSkyboxIntensity{1.0f};
   uint8_t                                        mFrameBufferMultiSamplingLevel{0u};
 
+  // Shader Factory
+  Dali::Scene3D::Loader::ShaderManagerPtr mShaderManager;
+
   // 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};
+  Dali::FrameBuffer                            mShadowFrameBuffer;
+  Dali::RenderTask                             mShadowMapRenderTask;
+  Scene3D::Light                               mShadowLight;
 
   // Asynchronous Loading.
   EnvironmentMapLoadTaskPtr mSkyboxLoadTask;
@@ -378,8 +401,6 @@ private:
   bool                        mSkyboxDirty{false};
   bool                        mIblDiffuseDirty{false};
   bool                        mIblSpecularDirty{false};
-
-  // TODO : Light Source
 };
 
 } // namespace Internal