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);
62 void Process() override;
65 * Whether the task is ready to process.
66 * @return True if the task is ready to process.
68 bool IsReady() override;
71 * Whether the task has succeeded.
72 * @return True if the task has succeeded.
74 bool HasSucceeded() const;
77 * @brief Retrieves loaded scene
78 * @return SceneDefinition that is loaded from file
80 Dali::Scene3D::Loader::SceneDefinition& GetScene() const;
83 * @brief Retrieves resource bunder that includes resource information
84 * @return ResourceBundle for model resources
86 Dali::Scene3D::Loader::ResourceBundle& GetResources() const;
89 * @brief Retrieves loaded AnimationDefinition
90 * @return AnimationDefinition that is loaded from file
92 std::vector<Dali::Scene3D::Loader::AnimationDefinition>& GetAnimations() const;
95 * @brief Retrieves loaded CameraParameters
96 * @return CameraParameters list that is loaded from file
98 std::vector<Dali::Scene3D::Loader::CameraParameters>& GetCameras() const;
101 * @brief Retrieves ResourceChoices
102 * @return Choices for loaded Resources
104 Dali::Scene3D::Loader::Customization::Choices& GetResourceChoices();
108 ModelLoadTask(const ModelLoadTask& task) = delete;
111 ModelLoadTask& operator=(const ModelLoadTask& task) = delete;
113 std::string mModelUrl;
114 std::string mResourceDirectoryUrl;
115 std::shared_ptr<Dali::Scene3D::Loader::ModelLoader> mModelLoader;
116 ModelCacheManager mModelCacheManager;
117 Dali::Scene3D::Loader::LoadResult mLoadResult;
121 } // namespace Internal
123 } // namespace Scene3D
127 #endif // DALI_SCENE3D_MODEL_LOAD_TASK_H