License conversion from Flora to Apache 2.0
[platform/core/uifw/dali-core.git] / capi / dali / public-api / geometry / animatable-vertex.h
1 #ifndef __DALI_ANIMATABLE_VERTEX__H__
2 #define __DALI_ANIMATABLE_VERTEX__H__
3
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 /**
22  * @addtogroup CAPI_DALI_GEOMETRY_MODULE
23  * @{
24  */
25
26 // INTERNAL INCLUDES
27 #include <dali/public-api/common/dali-common.h>
28 #include <dali/public-api/object/property.h>
29 #include <dali/public-api/math/vector2.h>
30 #include <dali/public-api/math/vector3.h>
31 #include <dali/public-api/math/vector4.h>
32
33 namespace Dali DALI_IMPORT_API
34 {
35 class AnimatableMesh;
36
37 namespace Internal DALI_INTERNAL
38 {
39 class AnimatableMesh;
40 }
41
42 /**
43  * @brief Represents a vertex in an AnimatableMesh.
44  *
45  * It is used by AnimatableMesh to offer an array interface for
46  * setting properties:
47  *
48  * @code
49  * AnimatableMesh mesh = AnimatableMesh(numVerts, faces);
50  * mesh[vertex].SetColor(color);
51  * @endcode
52  */
53 class AnimatableVertex
54 {
55 public:
56
57   // Default Properties
58   static const Property::Index POSITION;        ///< Property 0, name prefix "position-",        type VECTOR3
59   static const Property::Index COLOR;           ///< Property 1, name prefix "color-",           type VECTOR4
60   static const Property::Index TEXTURE_COORDS;  ///< Property 2, name prefix "texture-coords-",  type VECTOR2
61
62   /**
63    * @brief Destructor
64    */
65   ~AnimatableVertex();
66
67   /**
68    * @brief Set the position of the vertex.
69    *
70    * @param[in] position (note, -0.5 - +0.5 are inside the actor's boundaries)
71    */
72   void SetPosition(const Vector3& position);
73
74   /**
75    * @brief Set the vertex color.
76    * @param[in] color The vertex color
77    */
78   void SetColor(const Vector4& color);
79
80   /**
81    * @brief Set the texture coordinates.
82    *
83    * @param[in] textureCoords The texture coordinates
84    */
85   void SetTextureCoords(const Vector2& textureCoords);
86
87   /**
88    * @brief Get the current position of the vertex.
89    *
90    * @return position
91    */
92   Vector3 GetCurrentPosition();
93
94   /**
95    * @brief Get the current vertex color.
96    *
97    * @return The vertex color
98    */
99   Vector4 GetCurrentColor();
100
101   /**
102    * @brief Get the current texture coordinates.
103    *
104    * @return textureCoords The texture coordinates
105    */
106   Vector2 GetCurrentTextureCoords();
107
108 private:
109   // Only allow AnimatableMesh to construct this object.
110   friend class Dali::AnimatableMesh;
111
112   /**
113    * @brief Constructor.
114    *
115    * @param[in] vertex The index of the vertex in the parent mesh
116    * @param[in] mesh   The parent mesh
117    */
118   AnimatableVertex( unsigned int vertex, AnimatableMesh mesh );
119
120   /**
121    * @brief Undefined Copy Constructor
122    */
123   AnimatableVertex(const AnimatableVertex& vertex);
124
125   /**
126    * @brief Undefined Assignment Operator
127    */
128   AnimatableVertex& operator=(const AnimatableVertex& vertex);
129
130   int mVertex; ///< The index of this vertex in the parent mesh
131   Internal::AnimatableMesh& mMesh;  ///< The parent mesh
132 };
133
134
135 }//Dali
136
137 /**
138  * @}
139  */
140 #endif