[dali_2.3.24] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / internal / common / environment-map-load-task.h
index 8b1ac7c..6ca315a 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_SCENE3D_ENVIRONMENT_MAP_LOAD_TASK_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.
  */
 
 // EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/async-task-manager.h>
 #include <dali/public-api/common/intrusive-ptr.h>
 #include <dali/public-api/images/pixel-data.h>
-#include <dali/public-api/adaptor-framework/async-task-manager.h>
 #include <memory>
 
 // INTERNAL INCLUDES
+#include <dali-scene3d/public-api/common/environment-map.h>
+#include <dali-scene3d/public-api/loader/environment-map-data.h>
 #include <dali-scene3d/public-api/loader/load-result.h>
 #include <dali-scene3d/public-api/loader/scene-definition.h>
 
@@ -44,7 +46,7 @@ public:
    * @param[in] environmentMapUrl The url of the environment map image file.
    * @param[in] callback The callback that is called when the operation is completed.
    */
-  EnvironmentMapLoadTask(const std::string& environmentMapUrl, CallbackBase* callback);
+  EnvironmentMapLoadTask(const std::string& environmentMapUrl, Dali::Scene3D::EnvironmentMapType environmentMapType, CallbackBase* callback);
 
   /**
    * Destructor.
@@ -52,29 +54,48 @@ public:
   ~EnvironmentMapLoadTask();
 
   /**
-   * Process the task
+   * Whether the task has succeeded.
+   * @return True if the task has succeeded.
    */
-  void Process() override;
+  bool HasSucceeded() const;
 
   /**
-   * Whether the task is ready to process.
-   * @return True if the task is ready to process.
+   * Retrieves loaded Ibl Texture
+   * @return Texture that is loaded from url.
+   * @note Do not call this method in worker thread.
    */
-  bool IsReady() override;
+  Dali::Texture GetLoadedTexture();
 
   /**
-   * Whether the task has succeeded.
-   * @return True if the task has succeeded.
+   * Retrieves Mipmap levels of loaded Ibl texture
+   * @return mipmap levels of loaded Ibl texture
    */
-  bool HasSucceeded() const;
+  uint32_t GetMipmapLevels();
+
+  /**
+   * Retrieves EnvironmentMap type of the loaded texture
+   * @return EnvironmentMap type of the loaded texture
+   */
+  Dali::Scene3D::EnvironmentMapType GetEnvironmentMapType();
+
+public: // Implementation of AsyncTask
+  /**
+   * @copydoc Dali::AsyncTask::Process()
+   */
+  void Process();
+
+  /**
+   * @copydoc Dali::AsyncTask::IsReady()
+   */
+  bool IsReady();
 
   /**
-   * Retrieves loaded Environment Map
-   * @return CubeData loaded from url.
-   *
-   * TODO: Supports Equirectangular environment map
+   * @copydoc Dali::AsyncTask::GetTaskName()
    */
-  Dali::Scene3D::Loader::CubeData GetEnvironmentMap() const;
+  std::string_view GetTaskName() const override
+  {
+    return "EnvironmentMapLoadTask";
+  }
 
 private:
   // Undefined
@@ -84,8 +105,8 @@ private:
   EnvironmentMapLoadTask& operator=(const EnvironmentMapLoadTask& task) = delete;
 
 private:
-  std::string                     mEnvironmentMapUrl;
-  Dali::Scene3D::Loader::CubeData mEnvironmentMapPixelData;
+  std::string                               mEnvironmentMapUrl;
+  Dali::Scene3D::Loader::EnvironmentMapData mEnvironmentMapData;
 
   bool mIsReady;
   bool mHasSucceeded;