7ea6d3f70431e85119a703c70f9fcb7fcd3e35f5
[platform/core/uifw/dali-toolkit.git] / dali-scene-loader / public-api / blend-shape-details.h
1 #ifndef DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
2 #define DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H
3 /*
4  * Copyright (c) 2020 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
23 // EXTERNAL INCLUDES
24 #include "dali/public-api/rendering/shader.h"
25 #include "dali/public-api/actors/actor.h"
26 #include <string>
27
28 namespace Dali
29 {
30 namespace SceneLoader
31 {
32
33 struct MeshDefinition;
34 struct MeshGeometry;
35
36 struct DALI_SCENE_LOADER_API BlendShapes
37 {
38   enum class Version
39   {
40     VERSION_1_0,
41     VERSION_2_0,
42     INVALID
43   };
44
45   struct Component
46   {
47     enum
48     {
49       POSITIONS = 0x1,
50       NORMALS = 0x2,
51       TANGENTS = 0x4
52     };
53   };
54
55   // shader properties - animatable (uniforms)
56   static const std::string NUMBER_OF_BLEND_SHAPES;  ///< Integer number of blend shapes loaded.
57   static const std::string UNNORMALIZE_FACTOR;  ///< Scalar(s) for position components of blend shapes; Version 1.0: float array (1 per blend shape); Version 2.0: single float.
58   static const std::string COMPONENT_SIZE;  ///< Integer offset from one component (positions / normals / tangents) of a blend shape to the next.
59
60   // shader properties - read-only (not available as uniforms)
61   static const std::string COMPONENTS;  ///< Integer bitmask of the blend shape components that the shader uses; refer to the Components enum.
62
63   // actor property (instance) - animatable (uniforms)
64   static const std::string WEIGHTS_UNIFORM;  ///< The weight of each blend shape in a float array
65
66   /**
67    * @brief Registers properties based on the mesh definition (and geometry) and identified by the above string constants,
68    *  on the given @a shader and @a actor.
69    */
70   static void ConfigureProperties(const std::pair<MeshDefinition, MeshGeometry>& mesh, Shader shader, Actor actor);
71 };
72
73 }
74 }
75
76 #endif // DALI_SCENE_LOADER_BLEND_SHAPE_DETAILS_H