CAPI removal
[platform/core/uifw/dali-core.git] / 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 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/object/property.h>
24 #include <dali/public-api/math/vector2.h>
25 #include <dali/public-api/math/vector3.h>
26 #include <dali/public-api/math/vector4.h>
27
28 namespace Dali DALI_IMPORT_API
29 {
30 class AnimatableMesh;
31
32 namespace Internal DALI_INTERNAL
33 {
34 class AnimatableMesh;
35 }
36
37 /**
38  * @brief Represents a vertex in an AnimatableMesh.
39  *
40  * It is used by AnimatableMesh to offer an array interface for
41  * setting properties:
42  *
43  * @code
44  * AnimatableMesh mesh = AnimatableMesh(numVerts, faces);
45  * mesh[vertex].SetColor(color);
46  * @endcode
47  */
48 class AnimatableVertex
49 {
50 public:
51
52   // Default Properties
53   static const Property::Index POSITION;        ///< Property 0, name prefix "position-",        type VECTOR3
54   static const Property::Index COLOR;           ///< Property 1, name prefix "color-",           type VECTOR4
55   static const Property::Index TEXTURE_COORDS;  ///< Property 2, name prefix "texture-coords-",  type VECTOR2
56
57   /**
58    * @brief Destructor
59    */
60   ~AnimatableVertex();
61
62   /**
63    * @brief Set the position of the vertex.
64    *
65    * @param[in] position (note, -0.5 - +0.5 are inside the actor's boundaries)
66    */
67   void SetPosition(const Vector3& position);
68
69   /**
70    * @brief Set the vertex color.
71    * @param[in] color The vertex color
72    */
73   void SetColor(const Vector4& color);
74
75   /**
76    * @brief Set the texture coordinates.
77    *
78    * @param[in] textureCoords The texture coordinates
79    */
80   void SetTextureCoords(const Vector2& textureCoords);
81
82   /**
83    * @brief Get the current position of the vertex.
84    *
85    * @return position
86    */
87   Vector3 GetCurrentPosition();
88
89   /**
90    * @brief Get the current vertex color.
91    *
92    * @return The vertex color
93    */
94   Vector4 GetCurrentColor();
95
96   /**
97    * @brief Get the current texture coordinates.
98    *
99    * @return textureCoords The texture coordinates
100    */
101   Vector2 GetCurrentTextureCoords();
102
103 private:
104   // Only allow AnimatableMesh to construct this object.
105   friend class Dali::AnimatableMesh;
106
107   /**
108    * @brief Constructor.
109    *
110    * @param[in] vertex The index of the vertex in the parent mesh
111    * @param[in] mesh   The parent mesh
112    */
113   AnimatableVertex( unsigned int vertex, AnimatableMesh mesh );
114
115   /**
116    * @brief Undefined Copy Constructor
117    */
118   AnimatableVertex(const AnimatableVertex& vertex);
119
120   /**
121    * @brief Undefined Assignment Operator
122    */
123   AnimatableVertex& operator=(const AnimatableVertex& vertex);
124
125   int mVertex; ///< The index of this vertex in the parent mesh
126   Internal::AnimatableMesh& mMesh;  ///< The parent mesh
127 };
128
129
130 }//Dali
131
132 #endif