Texture size reduction on the fly for 3D model using metadata
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / load-scene-metadata.h
1 #ifndef DALI_SCENE3D_LOADER_LOAD_SCENE_METADATA_H_\r
2 #define DALI_SCENE3D_LOADER_LOAD_SCENE_METADATA_H_\r
3 /*\r
4  * Copyright (c) 2022 Samsung Electronics Co., Ltd.\r
5  *\r
6  * Licensed under the Apache License, Version 2.0 (the "License");\r
7  * you may not use this file except in compliance with the License.\r
8  * You may obtain a copy of the License at\r
9  *\r
10  * http://www.apache.org/licenses/LICENSE-2.0\r
11  *\r
12  * Unless required by applicable law or agreed to in writing, software\r
13  * distributed under the License is distributed on an "AS IS" BASIS,\r
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
15  * See the License for the specific language governing permissions and\r
16  * limitations under the License.\r
17  *\r
18  */\r
19 \r
20 // EXTERNAL INCLUDES\r
21 #include <dali/public-api/images/image-operations.h>\r
22 #include <string>\r
23 #include <unordered_map>\r
24 \r
25 // INTERNAL INCLUDES\r
26 #include <dali-scene3d/public-api/api.h>\r
27 \r
28 namespace Dali::Scene3D::Loader\r
29 {\r
30 /**\r
31  * @brief Defines the matadata for an image.\r
32  */\r
33 struct ImageMetadata\r
34 {\r
35   ImageDimensions    mMinSize{};                                   ///< The minimum required image size for rendering\r
36   SamplingMode::Type mSamplingMode{SamplingMode::BOX_THEN_LINEAR}; ///< The sampling mode used to resize the image\r
37 };\r
38 \r
39 /**\r
40  * @brief Stores the metadata for a scene.\r
41  *\r
42  * @note The supported format is the following:\r
43  *  {\r
44  *    "images": (optional) [ {\r
45  *      "uri": name of the image file,\r
46  *      "minWidth": minimum width required for rendering,\r
47  *      "minHeight": minimum height required for rendering.\r
48  *      "samplingMode": sampling mode used to resize the image (@see Dali::SamplingMode). (optional)\r
49  *    } ]\r
50  *  }\r
51  */\r
52 struct SceneMetadata\r
53 {\r
54   std::unordered_map<std::string, ImageMetadata> mImageMetadata{}; ///< The container of image metadata (i.e. the pairs of image URI and image metadata)\r
55 };\r
56 \r
57 /**\r
58  * @brief Attempts to load and process a json file specifying scene metadata\r
59  * for pre-processing the scene resources: e.g. the minimum size required for rendering images, etc.\r
60  * @note Will fail quietly if the file is not present.\r
61  */\r
62 DALI_SCENE3D_API void LoadSceneMetadata(const std::string& url, SceneMetadata& sceneMetadata);\r
63 \r
64 } // namespace Dali::Scene3D::Loader\r
65 \r
66 #endif // DALI_SCENE3D_LOADER_LOAD_SCENE_METADATA_H_\r