RTFX  0.3
Real time special effects collaborative visualization and production library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
RTFXSkeleton.h
1 #ifndef __RTFX_SKELETON__
2 #define __RTFX_SKELETON__
3 
14 #include <iostream>
15 #include <sstream>
16 #include <vector>
17 #include <map>
18 #include "RTFXObject.h"
19 #include "RTFXBoostIncludes.h"
20 
21 namespace RTFX
22 {
23 
28  class RTFXAPI RTFXBone : public RTFXObject
29  {
30  public:
32  RTFXBone();
33 
35  RTFXBone( bool _genID );
36 
38  RTFXBone( const RTFXBone &_p );
39 
41  ~RTFXBone();
42 
46  void Update( RTFXObject * _pt );
47 
49  void ToNative( AXISFRAME _frame );
50 
52  void FromNative( AXISFRAME _frame );
53 
55  void ChangeFrame( AXISFRAME _from, AXISFRAME _to );
56 
58  void SetPosition( Point3D _p );
59 
61  void SetPosition( double _x, double _y, double _z );
62 
64  Point3D GetPosition();
65 
67  double * GetPositionAsDoubles();
68 
70  void SetRotation( Vector3D _p );
71 
73  void SetRotation( double _x, double _y, double _z );
74 
76  Vector3D GetRotation();
77 
79  double * GetRotationAsDoubles();
80 
82  string GetParentBoneName();
83 
85  void SetParentBoneName( string _value );
86 
87  private:
89  void Init( bool _idGen );
90 
91  friend class boost::serialization::access;
92 
93  template<class Archive>
94  void serialize( Archive &_ar, const unsigned int _version )
95  {
96  _ar & boost::serialization::base_object<RTFXObject>( *this );
97  }
98  };
99 
100 
106  class RTFXAPI RTFXSkeleton : public RTFXObject
107  {
108  public:
118  RTFXSkeleton();
119 
121  RTFXSkeleton( bool _genID );
122 
123 
125  ~RTFXSkeleton();
126 
128  RTFXSkeleton( const RTFXSkeleton &_g );
129 
133  void Update( RTFXObject * _pt );
134 
139  bool EqualData( RTFXObject * _object );
140 
142  void ToNative( AXISFRAME _frame );
143 
145  void FromNative( AXISFRAME _frame );
146 
148  void ChangeFrame( AXISFRAME _from, AXISFRAME _to );
149 
151  void AddBone( RTFXBone * _bone );
152 
154  RTFXBone * GetBone( string _boneName );
155 
157  void DeleteBone( string _boneName );
158 
160  void SetPosition( Point3D _p );
161 
163  void SetPosition( double _x, double _y, double _z );
164 
166  Point3D GetPosition();
167 
169  double * GetPositionAsDoubles();
170 
172  void SetRotation( Point3D _p );
173 
175  void SetRotation( double _x, double _y, double _z );
176 
178  Point3D GetRotation();
179 
181  double * GetRotationAsDoubles();
182 
184  void SetScale( Point3D _p );
185 
187  void SetScale( double _x, double _y, double _z );
188 
190  Point3D GetScale();
191 
193  double * GetScaleAsDoubles();
194 
196  void SetTransform( Matrix4x4 _m );
197 
199  void SetTransform( double * _m );
200 
202  Matrix4x4 GetTransform();
203 
205  double * GetTransformAsDoubles();
206 
208  void DeleteAllBones();
209 
211  unsigned int GetBoneCount();
212 
215  std::vector<RTFXProperty *> GetChangedProperties();
216 
217  private:
219  void Init( bool _genID );
220 
222  unsigned int numberOfBones;
223 
225  map<string, RTFXBone *> boneMap;
226 
227  friend class boost::serialization::access;
228 
229  template<class Archive>
230  void serialize( Archive &_ar, const unsigned int _version )
231  {
232  _ar & boost::serialization::base_object<RTFXObject>( *this );
233  _ar & numberOfBones;
234  _ar & boneMap;
235  }
236  };
237 }
238 
239 BOOST_CLASS_EXPORT_KEY( RTFX::RTFXBone )
240 BOOST_CLASS_EXPORT_KEY( RTFX::RTFXSkeleton )
241 
242 #endif