[dali_2.2.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / controls / scene-view / scene-view-impl.h
index db3c33e..d9377ff 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_INTERNAL_SCENE_VIEW_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -31,6 +31,7 @@
 #include <dali/public-api/rendering/texture.h>
 
 // INTERNAL INCLUDES
+#include <dali-scene3d/internal/common/environment-map-load-task.h>
 #include <dali-scene3d/internal/common/image-based-light-observer.h>
 #include <dali-scene3d/public-api/controls/scene-view/scene-view.h>
 
@@ -138,11 +139,26 @@ public:
   bool IsUsingFramebuffer() const;
 
   /**
+   * @copydoc SceneView::SetFramebufferMultiSamplingLevel()
+   */
+  void SetFramebufferMultiSamplingLevel(uint8_t multiSamplingLevel);
+
+  /**
+   * @copydoc SceneView::GetFramebufferMultiSamplingLevel()
+   */
+  uint8_t GetFramebufferMultiSamplingLevel() const;
+
+  /**
    * @copydoc SceneView::SetSkybox()
    */
   void SetSkybox(const std::string& skyboxUrl);
 
   /**
+   * @copydoc SceneView::SetSkyboxEnvironmentMapType()
+   */
+  void SetSkyboxEnvironmentMapType(Scene3D::EnvironmentMapType skyboxEnvironmentMapType);
+
+  /**
    * @copydoc SceneView::SetSkyboxIntensity()
    */
   void SetSkyboxIntensity(float intensity);
@@ -237,20 +253,54 @@ private:
   void OnWindowResized(Window window, Window::WindowSize size);
 
   /**
-   * @brief Update camera's projection orientation according to the screen orientation.
+   * @brief Updates camera's projection orientation according to the screen orientation.
    */
   void RotateCamera();
 
+  /**
+   * @brief UpdateSkybox with skybox url and skybox environment map type.
+   *
+   * @param[in] skyboxUrl image url for skybox.
+   * @param[in] skyboxEnvironmentMapType The environment type of skybox.
+   */
+  void UpdateSkybox(const std::string& skyboxUrl, Scene3D::EnvironmentMapType skyboxEnvironmentMapType);
+
+  /**
+   * @brief Asynchronously skybox loading finished.
+   */
+  void OnSkyboxLoadComplete();
+
+  /**
+   * @brief Asynchronously ibl diffusel image loading finished.
+   */
+  void OnIblDiffuseLoadComplete();
+
+  /**
+   * @brief Asynchronously ibl specular image loading finished.
+   */
+  void OnIblSpecularLoadComplete();
+
+  /**
+   * @brief Asynchronously ibl loading finished.
+   */
+  void OnIblLoadComplete();
+
+  /**
+   * @brief Notify the changes of Ibl textures to the child items.
+   */
+  void NotifyImageBasedLightTextureChange();
+
 private:
   Toolkit::Visual::Base mVisual;
 
   /////////////////////////////////////////////////////////////
   // FrameBuffer and Rendertask to render child objects as a 3D Scene
+  Dali::WeakHandle<Dali::Window>                           mWindow;
   CameraActor                                              mDefaultCamera;
   CameraActor                                              mSelectedCamera;
   std::vector<CameraActor>                                 mCameras;
   std::vector<Scene3D::Internal::ImageBasedLightObserver*> mItems;
-  Dali::FrameBuffer                                        mRenderTarget;
+  Dali::FrameBuffer                                        mFrameBuffer;
   Dali::Texture                                            mTexture;
   Dali::RenderTask                                         mRenderTask;
   Layer                                                    mRootLayer;
@@ -258,13 +308,29 @@ private:
   Dali::Actor                                              mSkybox;
   Quaternion                                               mSkyboxOrientation;
   float                                                    mSkyboxIntensity{1.0f};
-
-  Dali::Texture mSpecularTexture;
-  Dali::Texture mDiffuseTexture;
-  float         mIblScaleFactor{1.0f};
-  bool          mUseFrameBuffer{false};
-  bool          mIBLResourceReady{true};
-  bool          mSkyboxResourceReady{true};
+  uint8_t                                                  mFrameBufferMultiSamplingLevel{0u};
+
+  // Asynchronous Loading.
+  EnvironmentMapLoadTaskPtr mSkyboxLoadTask;
+  EnvironmentMapLoadTaskPtr mIblDiffuseLoadTask;
+  EnvironmentMapLoadTaskPtr mIblSpecularLoadTask;
+  std::string               mSkyboxUrl;
+  std::string               mDiffuseIblUrl;
+  std::string               mSpecularIblUrl;
+
+  Scene3D::EnvironmentMapType mSkyboxEnvironmentMapType{Scene3D::EnvironmentMapType::AUTO};
+  Dali::Texture               mSkyboxTexture;
+  Dali::Texture               mDiffuseTexture;
+  Dali::Texture               mSpecularTexture;
+  float                       mIblScaleFactor{1.0f};
+  uint32_t                    mSpecularMipmapLevels{1u};
+  bool                        mUseFrameBuffer{false};
+  bool                        mSkyboxResourceReady{true};
+  bool                        mIblDiffuseResourceReady{true};
+  bool                        mIblSpecularResourceReady{true};
+  bool                        mSkyboxDirty{false};
+  bool                        mIblDiffuseDirty{false};
+  bool                        mIblSpecularDirty{false};
 
   // TODO : Light Source
 };