[dali_2.3.21] Merge branch 'devel/master'
[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  * @SINCE_2_2.5\r
33  */\r
34 struct ImageMetadata\r
35 {\r
36   ImageDimensions    mMinSize{};                                   ///< The minimum required image size for rendering. @SINCE_2_2.5\r
37   SamplingMode::Type mSamplingMode{SamplingMode::BOX_THEN_LINEAR}; ///< The sampling mode used to resize the image. @SINCE_2_2.5\r
38 };\r
39 \r
40 /**\r
41  * @brief Stores the metadata for a scene.\r
42  *\r
43  * @SINCE_2_2.5\r
44  * @note The supported format is the following:\r
45  *  {\r
46  *    "images": (optional) [ {\r
47  *      "uri": name of the image file,\r
48  *      "minWidth": minimum width required for rendering,\r
49  *      "minHeight": minimum height required for rendering.\r
50  *      "samplingMode": sampling mode used to resize the image (@see Dali::SamplingMode). (optional)\r
51  *    } ]\r
52  *  }\r
53  */\r
54 struct SceneMetadata\r
55 {\r
56   std::unordered_map<std::string, ImageMetadata> mImageMetadata{}; ///< The container of image metadata (i.e. the pairs of image URI and image metadata)\r
57 };\r
58 \r
59 /**\r
60  * @brief Attempts to load and process a json file specifying scene metadata for pre-processing the scene resources.\r
61  *\r
62  * e.g. the minimum size required for rendering images, etc.\r
63  * @SINCE_2_2.5\r
64  * @note Will fail quietly if the file is not present.\r
65  */\r
66 DALI_SCENE3D_API void LoadSceneMetadata(const std::string& url, SceneMetadata& sceneMetadata);\r
67 \r
68 } // namespace Dali::Scene3D::Loader\r
69 \r
70 #endif // DALI_SCENE3D_LOADER_LOAD_SCENE_METADATA_H_\r