07196ecae2663fbf3a93eec2b0c2d968a2205226
[platform/core/uifw/dali-core.git] / dali / public-api / modeling / bone.h
1 #ifndef __DALI_BONE_H__
2 #define __DALI_BONE_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 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/vector-wrapper.h>
26 #include <dali/public-api/math/matrix.h>
27
28 namespace Dali
29 {
30
31 class Matrix;
32
33 class Bone;
34 typedef std::vector< Bone >           BoneContainer; ///< Container for bones
35 typedef BoneContainer::iterator       BoneIter;      ///< @ref Dali::BoneContainer iterator
36 typedef BoneContainer::const_iterator BoneConstIter; ///< @ref Dali::BoneContainer const iterator
37
38 /**
39  * @brief A single bone in a mesh.
40  *
41  * A Bone is a named actor that can be used to deform a mesh. @see Dali::MeshData for more
42  * information.
43  */
44 class DALI_IMPORT_API Bone
45 {
46 public:
47   /**
48    * @brief Default constructor.
49    */
50   Bone ();
51
52   /**
53    * @brief Constructor.
54    *
55    * @param name of the bone
56    * @param offsetMatrix for the bone
57    */
58   Bone( const std::string& name, const Matrix& offsetMatrix );
59
60   /**
61    * @brief Destructor.
62    */
63   ~Bone();
64
65   /**
66    * @brief Copy constructor.
67    */
68   Bone( const Bone& rhs );
69
70   /**
71    * @brief Assignment operator.
72    */
73   Bone& operator=(const Bone& rhs);
74
75   /**
76    * @brief Get name.
77    *
78    * @return returns the name of the bone
79    */
80   const std::string& GetName() const;
81
82   /**
83    * @brief Get offset matrix.
84    *
85    * @return returns the offset matrix for this bone
86    */
87    const Matrix& GetOffsetMatrix() const;
88
89 private:
90   // Attributes
91   std::string   mName;         ///< Name of bone
92   Matrix        mOffsetMatrix; ///< Transform from mesh space to bone space in bind pose.
93
94 }; // struct Bone
95
96 } // namespace Dali
97
98 #endif // __DALI_BONE_H__