Make API to set MultiSampling level for SceneView
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / controls / scene-view / scene-view-impl.h
index 480ffb0..8b175fe 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,7 +31,8 @@
 #include <dali/public-api/rendering/texture.h>
 
 // INTERNAL INCLUDES
-#include <dali-scene3d/public-api/controls/model/model.h>
+#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>
 
 namespace Dali
@@ -96,20 +97,21 @@ public:
   void SelectCamera(const std::string& name);
 
   /**
-   * @brief Register a Model.
-   * Some works like ibl setting should be applied on the only Model not the all child actors.
-   * SceneView contains child Model list to apply the works effectively.
+   * @brief Register an item.
    *
-   * @param[in] model Model to be registered.
+   * Some works(e.g, lighting) of SceneView should be propagated to the child 3D items.
+   * SceneView can avoid unnecessary tree traversal to find 3D items by storing only 3D items as a list.
+   *
+   * @param[in] item scene observer to be registered.
    */
-  void RegisterModel(Scene3D::Model model);
+  void RegisterSceneItem(Scene3D::Internal::ImageBasedLightObserver* item);
 
   /**
-   * @brief Unregister a Model
+   * @brief Unregister an item
    *
-   * @param[in] model Model to be unregistered.
+   * @param[in] item scene observer to be unregistered.
    */
-  void UnregisterModel(Scene3D::Model model);
+  void UnregisterSceneItem(Scene3D::Internal::ImageBasedLightObserver* item);
 
   /**
    * @copydoc SceneView::SetImageBasedLightSource()
@@ -137,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);
@@ -236,34 +253,83 @@ 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
-  CameraActor                 mDefaultCamera;
-  CameraActor                 mSelectedCamera;
-  std::vector<CameraActor>    mCameras;
-  std::vector<Scene3D::Model> mModels;
-  Dali::FrameBuffer           mRenderTarget;
-  Dali::Texture               mTexture;
-  Dali::RenderTask            mRenderTask;
-  Layer                       mRootLayer;
-  int32_t                     mWindowOrientation;
-  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};
+  Dali::WeakHandle<Dali::Window>                           mWindow;
+  CameraActor                                              mDefaultCamera;
+  CameraActor                                              mSelectedCamera;
+  std::vector<CameraActor>                                 mCameras;
+  std::vector<Scene3D::Internal::ImageBasedLightObserver*> mItems;
+  Dali::FrameBuffer                                        mFrameBuffer;
+  Dali::Texture                                            mTexture;
+  Dali::RenderTask                                         mRenderTask;
+  Layer                                                    mRootLayer;
+  int32_t                                                  mWindowOrientation;
+  Dali::Actor                                              mSkybox;
+  Quaternion                                               mSkyboxOrientation;
+  float                                                    mSkyboxIntensity{1.0f};
+  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};
+  bool                        mUseFrameBuffer{false};
+  bool                        mSkyboxResourceReady{true};
+  bool                        mIblDiffuseResourceReady{true};
+  bool                        mIblSpecularResourceReady{true};
+  bool                        mSkyboxDirty{false};
+  bool                        mIblDiffuseDirty{false};
+  bool                        mIblSpecularDirty{false};
 
   // TODO : Light Source
 };