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.
44 * @param[in] modelUrl Url of the model file to be loaded
45 * @param[in] resourceDirectoryUrl Url of directory that contains resources.
46 * @param[out] loadResult Loaded result that includes scene tree and resources.
48 ModelLoader(const std::string& modelUrl, const std::string& resourceDirectoryUrl, Dali::Scene3D::Loader::LoadResult& loadResult);
51 * @brief Request to load model from model url.
52 * @param[in] pathProvider Path provider that defines resource paths.
53 * @param[in] loadOnlyRawResource If true, load Raw resource only, and do not create Dali::Handle
54 * If false, this loader load Raw resource and create Dali::Handle too.
55 * Default value is false;
56 * @return True if model loading is successfully finished.
58 bool LoadModel(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource = false);
61 * @brief Set InputParameter.
62 * Thie method store only a pointer of InputParameter.
63 * The object of InputParameter should not be deleted until it is no longer used.
64 * @param[in] inputParameter Input parameters that can be used in loading time.
66 void SetInputParameter(InputParameter& inputParameter);
69 * @brief Retrieves loaded scene
70 * @return SceneDefinition that is loaded from file
72 Dali::Scene3D::Loader::SceneDefinition& GetScene();
75 * @brief Retrieves resource bundle that includes resource information
76 * @return ResourceBundle for model resources
78 Dali::Scene3D::Loader::ResourceBundle& GetResources();
81 * @brief Retrieves loaded AnimationDefinition
82 * @return AnimationDefinition that is loaded from file
84 std::vector<Dali::Scene3D::Loader::AnimationDefinition>& GetAnimations();
87 * @brief Retrieves loaded CameraParameters
88 * @return CameraParameters list that is loaded from file
90 std::vector<Dali::Scene3D::Loader::CameraParameters>& GetCameras();
93 * @brief Retrieves ResourceChoices
94 * @return Choices for loaded Resources
96 Dali::Scene3D::Loader::Customization::Choices& GetResourceChoices();
100 * @brief Create model loader for each file format.
102 void CreateModelLoader();
105 * @brief Load resource of the model.
107 void LoadResource(Dali::Scene3D::Loader::ResourceBundle::PathProvider& pathProvider, bool loadOnlyRawResource);
110 std::string mModelUrl;
111 std::string mResourceDirectoryUrl;
113 Dali::Scene3D::Loader::LoadResult mLoadResult;
114 Dali::Scene3D::Loader::Customization::Choices mResourceChoices;
116 std::shared_ptr<Internal::ModelLoaderImpl> mImpl;
118 } // namespace Dali::Scene3D::Loader
120 #endif // DALI_SCENE3D_LOADER_MODEL_LOADER_H