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>
36 class ModelLoaderImpl;
39 class DALI_SCENE3D_API ModelLoader
47 * @brief ModelLoader Constructor.
48 * @param[in] modelUrl Url of the model file to be loaded
49 * @param[in] resourceDirectoryUrl Url of directory that contains resources.
50 * @param[out] loadResult Loaded result that includes scene tree and resources.
52 ModelLoader(const std::string& modelUrl, const std::string& resourceDirectoryUrl, Dali::Scene3D::Loader::LoadResult& loadResult);
55 * @brief Request to load model from model url.
56 * @param[in] pathProvider Path provider that defines resource paths.
57 * @param[in] loadOnlyRawResource If true, load Raw resource only, and do not create Dali::Handle
58 * If false, this loader load Raw resource and create Dali::Handle too.
59 * Default value is false;
60 * @return True if model loading is successfully finished.
62 bool LoadModel(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource = false);
65 * @brief Set InputParameter.
66 * Thie method store only a pointer of InputParameter.
67 * 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
74 * @return SceneDefinition that is loaded from file
76 Dali::Scene3D::Loader::SceneDefinition& GetScene();
79 * @brief Retrieves resource bundle that includes resource information
80 * @return ResourceBundle for model resources
82 Dali::Scene3D::Loader::ResourceBundle& GetResources();
85 * @brief Retrieves loaded AnimationDefinition
86 * @return AnimationDefinition that is loaded from file
88 std::vector<Dali::Scene3D::Loader::AnimationDefinition>& GetAnimations();
91 * @brief Retrieves loaded CameraParameters
92 * @return CameraParameters list that is loaded from file
94 std::vector<Dali::Scene3D::Loader::CameraParameters>& GetCameras();
97 * @brief Retrieves ResourceChoices
98 * @return Choices for loaded Resources
100 Dali::Scene3D::Loader::Customization::Choices& GetResourceChoices();
104 * @brief Create model loader for each file format.
106 void CreateModelLoader();
109 * @brief Load resource of the model.
111 void LoadResource(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource);
114 std::string mModelUrl;
115 std::string mResourceDirectoryUrl;
117 Dali::Scene3D::Loader::LoadResult mLoadResult;
118 Dali::Scene3D::Loader::Customization::Choices mResourceChoices;
120 std::shared_ptr<Internal::ModelLoaderImpl> mImpl;
122 } // namespace Loader
123 } // namespace Scene3D
126 #endif // DALI_SCENE3D_LOADER_MODEL_LOADER_H