Update copyright year to 2015 for public api: core
[platform/core/uifw/dali-core.git] / dali / public-api / geometry / animatable-mesh.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18
19 #include <dali/public-api/geometry/animatable-mesh.h>
20 #include <dali/internal/event/modeling/animatable-mesh-impl.h>
21
22 namespace Dali
23 {
24
25 AnimatableMesh::AnimatableMesh()
26 {
27 }
28
29 AnimatableMesh AnimatableMesh::New(
30   unsigned int numVertices,
31   const AnimatableMesh::Faces& faceIndices,
32   Dali::Material material )
33 {
34   Internal::AnimatableMeshPtr internal = Internal::AnimatableMesh::New( numVertices,
35                                                                         faceIndices,
36                                                                         material );
37   return AnimatableMesh(internal.Get());
38 }
39
40 AnimatableMesh AnimatableMesh::New( unsigned int numVertices,
41                                     const Faces& faceIndices )
42 {
43
44   Internal::AnimatableMeshPtr internal = Internal::AnimatableMesh::New( numVertices, faceIndices );
45   return AnimatableMesh(internal.Get());
46 }
47
48 AnimatableMesh AnimatableMesh::DownCast( BaseHandle handle )
49 {
50   return AnimatableMesh( dynamic_cast<Dali::Internal::AnimatableMesh*>(handle.GetObjectPtr()) );
51 }
52
53 AnimatableMesh::~AnimatableMesh()
54 {
55 }
56
57 AnimatableMesh::AnimatableMesh(const AnimatableMesh& handle)
58 : Handle(handle)
59 {
60 }
61
62 AnimatableMesh& AnimatableMesh::operator=(const AnimatableMesh& rhs)
63 {
64   BaseHandle::operator=(rhs);
65   return *this;
66 }
67
68 unsigned int AnimatableMesh::GetNumberOfVertices() const
69 {
70   return GetImplementation(*this).GetNumberOfVertices();
71 }
72
73 AnimatableVertex AnimatableMesh::operator[](const unsigned int index) const
74 {
75   DALI_ASSERT_ALWAYS( index < GetNumberOfVertices() && "Index out of bounds" );
76
77   return AnimatableVertex(index, *this);
78 }
79
80 Property::Index AnimatableMesh::GetPropertyIndex(
81   unsigned int index,
82   Property::Index property ) const
83 {
84   DALI_ASSERT_ALWAYS( index < GetNumberOfVertices() && "Index out of bounds" );
85
86   return GetImplementation(*this).GetVertexPropertyIndex( index, property );
87 }
88
89 Property AnimatableMesh::GetVertexProperty( unsigned int vertex, Property::Index property)
90 {
91   return Property( *this, GetPropertyIndex( vertex, property ) );
92 }
93
94
95 AnimatableMesh::AnimatableMesh( Internal::AnimatableMesh* internal )
96 : Handle(internal)
97 {
98 }
99
100 } // Dali