1 #ifndef DALI_SCENE3D_MODEL_LOAD_TASK_H
2 #define DALI_SCENE3D_MODEL_LOAD_TASK_H
5 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/public-api/adaptor-framework/async-task-manager.h>
22 #include <dali/public-api/common/intrusive-ptr.h>
23 #include <dali/public-api/common/vector-wrapper.h>
24 #include <dali/public-api/images/pixel-data.h>
28 #include <dali-scene3d/internal/common/model-cache-manager.h>
29 #include <dali-scene3d/public-api/loader/load-result.h>
30 #include <dali-scene3d/public-api/loader/model-loader.h>
31 #include <dali-scene3d/public-api/loader/scene-definition.h>
32 #include <dali/devel-api/threading/conditional-wait.h>
41 typedef IntrusivePtr<ModelLoadTask> ModelLoadTaskPtr;
43 class ModelLoadTask : public AsyncTask
48 * @param[in] modelUrl Model file path.(e.g., glTF, and DLI).
49 * @param[in] resourceDirectoryUrl Resource file path that includes binary, image etc.
50 * @param[in] callback The callback that is called when the operation is completed.
52 ModelLoadTask(const std::string& modelUrl, const std::string& resourceDirectoryUrl, CallbackBase* callback);
60 * Whether the task has succeeded.
61 * @return True if the task has succeeded.
63 bool HasSucceeded() const;
66 * @brief Retrieves loaded scene
67 * @return SceneDefinition that is loaded from file
69 Dali::Scene3D::Loader::SceneDefinition& GetScene() const;
72 * @brief Retrieves resource bunder that includes resource information
73 * @return ResourceBundle for model resources
75 Dali::Scene3D::Loader::ResourceBundle& GetResources() const;
78 * @brief Retrieves loaded AnimationDefinition
79 * @return AnimationDefinition that is loaded from file
81 std::vector<Dali::Scene3D::Loader::AnimationDefinition>& GetAnimations() const;
84 * @brief Retrieves loaded CameraParameters
85 * @return CameraParameters list that is loaded from file
87 std::vector<Dali::Scene3D::Loader::CameraParameters>& GetCameras() const;
90 * @brief Retrieves ResourceChoices
91 * @return Choices for loaded Resources
93 Dali::Scene3D::Loader::Customization::Choices& GetResourceChoices();
95 public: // Implementation of AsyncTask
97 * @copydoc Dali::AsyncTask::Process()
102 * @copydoc Dali::AsyncTask::IsReady()
107 * @copydoc Dali::AsyncTask::GetTaskName()
109 std::string_view GetTaskName() const override
111 return "ModelLoadTask";
116 ModelLoadTask(const ModelLoadTask& task) = delete;
119 ModelLoadTask& operator=(const ModelLoadTask& task) = delete;
121 std::string mModelUrl;
122 std::string mResourceDirectoryUrl;
123 std::shared_ptr<Dali::Scene3D::Loader::ModelLoader> mModelLoader;
124 ModelCacheManager mModelCacheManager;
125 Dali::Scene3D::Loader::LoadResult mLoadResult;
129 } // namespace Internal
131 } // namespace Scene3D
135 #endif // DALI_SCENE3D_MODEL_LOAD_TASK_H