[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / environment-definition.h
index 3c4ceee..39aa53a 100644 (file)
 namespace Dali::Scene3D::Loader
 {
 /**
- * @brief Defines an environment map with either or both of radiance
- *  and irradiance maps.
+ * @brief Defines an environment map with either or both of radiance and irradiance maps.
+ * @SINCE_2_0.7
  */
 struct DALI_SCENE3D_API EnvironmentDefinition
 {
   struct Textures
   {
-    Texture mDiffuse;  // irradiance
-    Texture mSpecular; // radiance
-    Texture mBrdf;     // pre-computed brdf
+    Texture  mDiffuse;  // irradiance
+    Texture  mSpecular; // radiance
+    Texture  mBrdf;     // pre-computed brdf
+    uint32_t mSpecularMipmapLevels{1u};
 
     bool IsLoaded() const
     {
@@ -64,25 +65,36 @@ struct DALI_SCENE3D_API EnvironmentDefinition
   EnvironmentDefinition(EnvironmentDefinition&&) = default;
   EnvironmentDefinition& operator=(EnvironmentDefinition&&) = default;
 
+  static Dali::Texture GetBrdfTexture();
+
   /**
    * @brief Loads raw pixel data for the given diffuse and specular maps.
+   * @SINCE_2_0.7
+   * @return The raw data for the given diffuse and specular maps
    * @note This can be done on any thread.
    */
-  RawData LoadRaw(const std::string& environmentsPath) const;
+  RawData LoadRaw(const std::string& environmentsPath);
 
   /**
-   * @brief Creates DALi cubemap Textures from the pixel data in @a raw, then
-   *  returns them in a Textures object.
+   * @brief Creates DALi cubemap Textures from the pixel data in @a raw, then returns them in a Textures object.
+   * @SINCE_2_0.7
+   * @return DALi cubemap Textures
    * @note This must only be called from the event thread.
    */
-  Textures Load(RawData&& raw) const;
+  Textures Load(RawData&& raw);
 
   /**
    * @brief Get default intensity value.
+   * @SINCE_2_2.1
    * @return Default intensity. (1.0f)
    */
   static float GetDefaultIntensity();
 
+private:
+  /// @cond internal
+  static void LoadBrdfTexture();
+  /// @endcond internal
+
 public: // DATA
   std::string              mDiffuseMapPath;
   std::string              mSpecularMapPath;
@@ -91,6 +103,11 @@ public: // DATA
   Vector3                  mYDirection      = Vector3::ONE;
   float                    mIblIntensity    = 1.0f;
   bool                     mUseBrdfTexture  = false;
+
+private:
+  static PixelData mBrdfPixelData;
+  static Texture   mBrdfTexture;
+  static bool      mIsBrdfLoaded;
 };
 
 } // namespace Dali::Scene3D::Loader