2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali/public-api/geometry/animatable-vertex.h>
19 #include <dali/public-api/geometry/animatable-mesh.h>
20 #include <dali/internal/event/modeling/animatable-mesh-impl.h>
25 AnimatableVertex::AnimatableVertex( unsigned int vertex, AnimatableMesh mesh)
27 mMesh(GetImplementation(mesh))
29 DALI_ASSERT_ALWAYS( mesh && "Mesh handle is empty" );
30 DALI_ASSERT_ALWAYS( vertex < mesh.GetNumberOfVertices() && "vertex is out of bounds" );
33 AnimatableVertex::~AnimatableVertex()
37 void AnimatableVertex::SetPosition(const Vector3& position)
39 mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::Position), Dali::Property::Value(position) );
42 void AnimatableVertex::SetColor(const Vector4& color)
44 mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::Color), Dali::Property::Value(color) );
47 void AnimatableVertex::SetTextureCoords(const Vector2& textureCoords)
49 mMesh.SetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::TextureCoords), Dali::Property::Value(textureCoords) );
52 Vector3 AnimatableVertex::GetCurrentPosition()
55 mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::Position) ).Get(position);
59 Vector4 AnimatableVertex::GetCurrentColor()
62 mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::Color) ).Get(color);
66 Vector2 AnimatableVertex::GetCurrentTextureCoords()
68 Vector2 textureCoords;
69 mMesh.GetProperty( mMesh.GetVertexPropertyIndex(mVertex, Property::TextureCoords) ).Get(textureCoords);