[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / loader / dli-input-parameter.h
1 #ifndef DALI_SCENE3D_LOADER_DLI_INPUT_PARAMETER_H
2 #define DALI_SCENE3D_LOADER_DLI_INPUT_PARAMETER_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 <string>
22
23 // INTERNAL INCLUDES
24 #include <dali-scene3d/public-api/api.h>
25 #include <dali-scene3d/public-api/loader/model-loader.h>
26
27 namespace Dali::Scene3D::Loader
28 {
29 class DliInputParameter : public ModelLoader::InputParameter
30 {
31 public:
32   using ConvertFontCode         = void (*)(const std::string& code, std::string& fontFamily, std::string& slant, std::string& weight, float& size);
33   using ConvertColorCode        = Vector4 (*)(const std::string& code);
34   using CategoryProcessor       = std::function<void(Property::Array&& categoryData, StringCallback onError)>;
35   using CategoryProcessorVector = std::vector<std::pair<std::string /*name*/, CategoryProcessor>>;
36   using NodeProcessor           = std::function<void(const Dali::Scene3D::Loader::NodeDefinition& nodeDef,
37                                            Property::Map&&                              nodeData,
38                                            StringCallback                               onError)>;
39   using AnimationProcessor      = std::function<void(const AnimationDefinition& animDef,
40                                                 Property::Map&&            animData,
41                                                 StringCallback             onError)>;
42
43 public:
44   /**
45    * @brief The absolute path of animation binaries referenced in the .dli.
46    * @SINCE_2_2.17
47    */
48   std::string mAnimationsPath;
49
50   /**
51    * @brief Provides a facility to determine a color from a code instead of RGB(A) values.
52    * @SINCE_2_2.17
53    */
54   ConvertColorCode mConvertColorCode{nullptr};
55
56   /**
57    * @brief A collection of handlers, mapped to the names of the top level (i.e. below
58    *  root) element, whom they will attempt to process. This will take place before
59    *  the parsing of scene Nodes and Animations, but after skeletons, environment, mesh,
60    *  shader and material resources.
61    * @SINCE_2_2.17
62    */
63   CategoryProcessorVector mPreNodeCategoryProcessors;
64
65   /**
66    * @brief A collection of handlers, mapped to the names of the top level (i.e. below
67    *  root) element, whom they will attempt to process. This will take place after
68    *  the parsing of the scene Nodes and Animations.
69    * @SINCE_2_2.17
70    */
71   CategoryProcessorVector mPostNodeCategoryProcessors;
72
73   /**
74    * @brief Provides an extension point to nodes. If provided, this function will be
75    *  called with each JSON element and definition, of a scene node.
76    * @SINCE_2_2.17
77    * @note Constraints rely on ID resolution (from .dli to scene definition), which
78    *  takes place after the parsing of the nodes; therefore AT THIS POINT the node
79    *  IDs seen in constraints will still be the .dli IDs - NOT to be relied on for
80    *  indexing into mScene.
81    */
82   NodeProcessor mNodePropertyProcessor{nullptr};
83
84   /**
85    * @brief Provides an extension point to animations. If provided, this function will be
86    *  called with each JSON element and fully processed definition, of an animation.
87    * @SINCE_2_2.17
88    */
89   AnimationProcessor mAnimationPropertyProcessor;
90 };
91
92 } // namespace Dali::Scene3D::Loader
93
94 #endif // DALI_SCENE3D_LOADER_DLI_INPUT_PARAMETER_H