1 #ifndef __DALI_ANIMATABLE_VERTEX__H__
2 #define __DALI_ANIMATABLE_VERTEX__H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
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>
28 namespace Dali DALI_IMPORT_API
32 namespace Internal DALI_INTERNAL
38 * @brief Represents a vertex in an AnimatableMesh.
40 * It is used by AnimatableMesh to offer an array interface for
44 * AnimatableMesh mesh = AnimatableMesh(numVerts, faces);
45 * mesh[vertex].SetColor(color);
48 class AnimatableVertex
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
63 * @brief Set the position of the vertex.
65 * @param[in] position (note, -0.5 - +0.5 are inside the actor's boundaries)
67 void SetPosition(const Vector3& position);
70 * @brief Set the vertex color.
71 * @param[in] color The vertex color
73 void SetColor(const Vector4& color);
76 * @brief Set the texture coordinates.
78 * @param[in] textureCoords The texture coordinates
80 void SetTextureCoords(const Vector2& textureCoords);
83 * @brief Get the current position of the vertex.
87 Vector3 GetCurrentPosition();
90 * @brief Get the current vertex color.
92 * @return The vertex color
94 Vector4 GetCurrentColor();
97 * @brief Get the current texture coordinates.
99 * @return textureCoords The texture coordinates
101 Vector2 GetCurrentTextureCoords();
104 // Only allow AnimatableMesh to construct this object.
105 friend class Dali::AnimatableMesh;
108 * @brief Constructor.
110 * @param[in] vertex The index of the vertex in the parent mesh
111 * @param[in] mesh The parent mesh
113 AnimatableVertex( unsigned int vertex, AnimatableMesh mesh );
116 * @brief Undefined Copy Constructor
118 AnimatableVertex(const AnimatableVertex& vertex);
121 * @brief Undefined Assignment Operator
123 AnimatableVertex& operator=(const AnimatableVertex& vertex);
125 int mVertex; ///< The index of this vertex in the parent mesh
126 Internal::AnimatableMesh& mMesh; ///< The parent mesh