1 #ifndef DALI_SCENE3D_LOADER_MODEL_LOADER_H
2 #define DALI_SCENE3D_LOADER_MODEL_LOADER_H
4 * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 #include <dali-scene3d/public-api/api.h>
22 #include <dali-scene3d/public-api/loader/load-result.h>
23 #include <dali-scene3d/public-api/loader/scene-definition.h>
28 namespace Dali::Scene3D::Loader
32 class ModelLoaderImpl;
35 class DALI_SCENE3D_API ModelLoader
43 * @brief ModelLoader Constructor.
45 * @param[in] modelUrl Url of the model file to be loaded
46 * @param[in] resourceDirectoryUrl Url of directory that contains resources.
47 * @param[out] loadResult Loaded result that includes scene tree and resources.
49 ModelLoader(const std::string& modelUrl, const std::string& resourceDirectoryUrl, Dali::Scene3D::Loader::LoadResult& loadResult);
52 * @brief Request to load model from model url.
54 * @param[in] pathProvider Path provider that defines resource paths.
55 * @param[in] loadOnlyRawResource If true, load Raw resource only, and do not create Dali::Handle
56 * If false, this loader load Raw resource and create Dali::Handle too.
57 * Default value is false;
58 * @return True if model loading is successfully finished.
60 bool LoadModel(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource = false);
63 * @brief Set InputParameter.
65 * This method store only a pointer of InputParameter.
66 * The object of InputParameter should not be deleted until it is no longer used.
68 * @param[in] inputParameter Input parameters that can be used in loading time.
70 void SetInputParameter(InputParameter& inputParameter);
73 * @brief Retrieves loaded scene.
75 * @return SceneDefinition that is loaded from file
77 Dali::Scene3D::Loader::SceneDefinition& GetScene();
80 * @brief Retrieves resource bundle that includes resource information.
82 * @return ResourceBundle for model resources
84 Dali::Scene3D::Loader::ResourceBundle& GetResources();
87 * @brief Retrieves loaded AnimationDefinition.
89 * @return AnimationDefinition that is loaded from file
91 std::vector<Dali::Scene3D::Loader::AnimationDefinition>& GetAnimations();
94 * @brief Retrieves loaded CameraParameters.
96 * @return CameraParameters list that is loaded from file
98 std::vector<Dali::Scene3D::Loader::CameraParameters>& GetCameras();
101 * @brief Retrieves ResourceChoices.
103 * @return Choices for loaded Resources
105 Dali::Scene3D::Loader::Customization::Choices& GetResourceChoices();
109 * @brief Create model loader for each file format.
112 void CreateModelLoader();
115 * @brief Load resource of the model.
118 void LoadResource(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource);
121 std::string mModelUrl;
122 std::string mResourceDirectoryUrl;
124 Dali::Scene3D::Loader::LoadResult mLoadResult;
125 Dali::Scene3D::Loader::Customization::Choices mResourceChoices;
127 std::shared_ptr<Internal::ModelLoaderImpl> mImpl;
129 } // namespace Dali::Scene3D::Loader
131 #endif // DALI_SCENE3D_LOADER_MODEL_LOADER_H