Support glTF extention: KHR_texture_transform
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / customization.h
1 #ifndef DALI_SCENE3D_LOADER_CUSTOMIZATION_STATE_H_
2 #define DALI_SCENE3D_LOADER_CUSTOMIZATION_STATE_H_
3 /*
4  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 // EXTERNAL INCLUDES
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <memory>
23 #include <string>
24
25 // INTERNAL INCLUDES
26 #include <dali-scene3d/public-api/api.h>
27
28 namespace Dali::Scene3D::Loader
29 {
30 /**
31  * @brief Offers a description of an aspect of the scene that can be customized:
32  *     the number of options, and the name of the nodes that are registered
33  *     for the tag, whose children will be shown / hidden based on selection.
34  */
35 struct DALI_SCENE3D_API Customization
36 {
37   using Tag        = std::string;
38   using OptionType = uint32_t;
39
40   /**
41    * @brief A mapping of customizations to tags.
42    */
43   struct DALI_SCENE3D_API Map
44   {
45     Map();
46     ~Map();
47
48     /**
49      * @brief Maps the given @a customization to the given @a tag, overwriting any previous mapping to the same tag.
50      * @return Pointer to the inserted (or pre-existing) Customization instance.
51      */
52     Customization* Set(Tag tag, Customization&& customization);
53
54     /**
55      * @brief Attempts to retrieve a const Customization based on the given @a tag.
56      */
57     const Customization* Get(Tag tag) const;
58
59     /**
60      * @brief Attempts to retrieve a Customization based on the given @a tag.
61      */
62     Customization* Get(Tag tag);
63
64     /**
65      * @brief Returns the number of elements.
66      */
67     uint32_t Size() const;
68
69     /*
70      * @brief Removes every element from the Map.
71      */
72     void Clear();
73
74   private:
75     struct Impl;
76     const std::unique_ptr<Impl> mImpl;
77   };
78
79   /**
80    * @brief A mapping of choices - indices of children of customization nodes to use - to tags.
81    */
82   struct DALI_SCENE3D_API Choices
83   {
84     Choices();
85     ~Choices();
86
87     /**
88      * @brief Maps the given @a option to the given @a tag, overwriting any previous mapping to the same tag.
89      */
90     void Set(Tag tag, OptionType option);
91
92     /**
93      * @brief Attempts to retrieve a Customization based on the given @a tag. Returns NONE if @a tag is not known.
94      */
95     OptionType Get(Tag tag) const;
96
97     /**
98      * @brief Returns the number of elements.
99      */
100     uint32_t Size() const;
101
102     /*
103      * @brief Removes every element from the underlying map.
104      */
105     void Clear();
106
107   private:
108     struct Impl;
109     const std::unique_ptr<Impl> mImpl;
110   };
111
112   static const OptionType NONE = OptionType(-1);
113
114   OptionType               numOptions = 0;
115   std::vector<std::string> nodes; // to apply option to.
116 };
117
118 } // namespace Dali::Scene3D::Loader
119
120 #endif //DALI_SCENE3D_LOADER_CUSTOMIZATION_STATE_H_