Makes Models use common shader manager
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / shader-option.h
1 #ifndef DALI_SCENE3D_LOADER_SHADER_OPTION_H_
2 #define DALI_SCENE3D_LOADER_SHADER_OPTION_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 INCLUDER
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <memory>
23 #include <string_view>
24
25 // INTERNAL INCLUDES
26 #include <dali-scene3d/public-api/api.h>
27
28 namespace Dali::Scene3D::Loader
29 {
30
31 class DALI_SCENE3D_API ShaderOption
32 {
33 public:
34   enum class Type
35   {
36     GLTF_CHANNELS = 0,
37     THREE_TEXTURE,
38     BASE_COLOR_TEXTURE,
39     METALLIC_ROUGHNESS_TEXTURE,
40     NORMAL_TEXTURE,
41     OCCLUSION,
42     EMISSIVE,
43     ALPHA_TEST,
44     SUBSURFACE,
45     SPECULAR,
46     SPECULAR_COLOR,
47     SKINNING,
48     FLIP_UVS_VERTICAL,
49     COLOR_ATTRIBUTE,
50     VEC4_TANGENT,
51     MORPH_POSITION,
52     MORPH_NORMAL,
53     MORPH_TANGENT,
54     MORPH_VERSION_2_0
55   };
56
57 public:
58   /**
59    * @brief Sets transparency option.
60    */
61   void SetTransparency();
62
63   /**
64    * @brief Adds new shader definition option.
65    * If the option is already added, nothin is changed.
66    *
67    * @param[in] shaderOptionType Option to be added,
68    */
69   void AddOption(Type shaderOptionType);
70
71   /**
72    * @brief Retrieves current shader option hash
73    *
74    * @return Hash value of currently added options.
75    */
76   uint64_t GetOptionHash() const;
77
78   /**
79    * @brief Retrieves a list of define keywords.
80    *
81    * @param[out] defines A list of define keywords those are used in this option.
82    */
83   void GetDefines(std::vector<std::string>& defines) const;
84
85   /**
86    * @brief Retrieves a single shader define keyword of input type.
87    *
88    * @param[in] shaderOptionType Shader definition option type to know its keyword.
89    * @return string keyword of shader define.
90    */
91   static std::string_view GetDefineKeyword(Type shaderOptionType);
92
93 private:
94   uint64_t mOptionHash{0u};
95 };
96
97 } // namespace Dali::Scene3D::Loader
98
99 #endif // DALI_SCENE3D_LOADER_SHADER_OPTION_H_