387984d6fc92655caa8b2660742bbf8dfba67141
[platform/core/uifw/dali-toolkit.git] / dali-scene-loader / public-api / shader-definition-factory.h
1 #ifndef DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
2 #define DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_
3 /*
4  * Copyright (c) 2021 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 // INTERNAL INCLUDES
21 #include "dali-scene-loader/public-api/api.h"
22 #include "dali-scene-loader/public-api/index.h"
23
24 // EXTERNAL INCLUDER
25 #include <memory>
26
27 namespace Dali
28 {
29 namespace SceneLoader
30 {
31 struct NodeDefinition;
32 class ResourceBundle;
33
34 class DALI_SCENE_LOADER_API ShaderDefinitionFactory
35 {
36 public:
37   ShaderDefinitionFactory();
38   ~ShaderDefinitionFactory();
39
40   /*
41    * @brief Input for meshes and materials, output for shaders.
42    */
43   void SetResources(ResourceBundle& resources);
44
45   /*
46    * @brief Produces the index of a shader, which should be used to index into the shaders
47    *  vector of the ResourceBundle which was provided for the factory. This shader will be
48    *  created if one with the given settings hasn't been created by the factory yet (shaders
49    *  already existing in the ResourceBundle are ignored), otherwise the index of the previously
50    *  created shader will be returned.
51    */
52   Index ProduceShader(const NodeDefinition& nodeDef);
53
54 private:
55   struct Impl;
56   const std::unique_ptr<Impl> mImpl;
57 };
58
59 } // namespace SceneLoader
60 } // namespace Dali
61
62 #endif //DALI_SCENE_LOADER_SHADER_DEFINITION_FACTORY_H_