RTFX  0.3
Real time special effects collaborative visualization and production library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
RTFXGeometry.h
1 #ifndef __RTFX_GEOMETRY__
2 #define __RTFX_GEOMETRY__
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 
33  class RTFXAPI RTFXPoint : public RTFXObject
34  {
35  public:
37  RTFXPoint();
38 
40  RTFXPoint( bool _genID );
41 
43  RTFXPoint( const RTFXPoint &_p );
44 
46  ~RTFXPoint();
47 
51  void Update( RTFXObject * _pt );
52 
54  void ToNative( AXISFRAME _frame );
55 
57  void FromNative( AXISFRAME _frame );
58 
60  void ChangeFrame( AXISFRAME _from, AXISFRAME _to );
61 
63  void SetPosition( Point3D _p );
64 
66  void SetPosition( double _x, double _y, double _z );
67 
69  Point3D GetPosition();
70 
72  double * GetPositionAsDoubles();
73 
75  void SetNormal( Vector3D _p );
76 
78  void SetNormal( double _x, double _y, double _z );
79 
81  Vector3D GetNormal();
82 
84  double * GetNormalAsDoubles();
85 
87  void SetUV( double _u, double _v );
88 
90  double * GetUV();
91 
93  void SetIndex( unsigned int _idx );
94 
96  unsigned int GetIndex();
97 
98  private:
100  void Init( bool _idGen );
101 
102  friend class boost::serialization::access;
103 
104  template<class Archive>
105  void serialize( Archive &_ar, const unsigned int _version )
106  {
107  _ar & boost::serialization::base_object<RTFXObject>( *this );
108  }
109  };
110 
117  class RTFXAPI RTFXFace : public RTFXObject
118  {
119  public:
122  RTFXFace();
123 
125  RTFXFace( bool _genID );
126 
128  RTFXFace( const RTFXFace &_f );
129 
131  ~RTFXFace();
132 
136  void Update( RTFXObject * _pt );
137 
139  void ToNative( AXISFRAME _frame );
140 
142  void FromNative( AXISFRAME _frame );
143 
145  void ChangeFrame( AXISFRAME _from, AXISFRAME _to );
146 
148  void SetNormal( Vector3D _p );
149 
151  void SetNormal( double _x, double _y, double _z );
152 
154  Vector3D GetNormal();
155 
157  double * GetNormalAsDoubles();
158 
160  void SetPoints( std::vector<unsigned int> _pts );
161 
163  void AddPoint( unsigned int _pt );
164 
166  std::vector<unsigned int> * GetPoints();
167 
169  unsigned int GetPointAt( unsigned int _idx );
170 
172  void SetIndex( unsigned int _idx );
173 
175  unsigned int GetIndex();
176 
177  private:
179  void Init( bool _genID );
180 
181  friend class boost::serialization::access;
182 
183  template<class Archive>
184  void serialize( Archive &_ar, const unsigned int _version )
185  {
186  _ar & boost::serialization::base_object<RTFXObject>( *this );
187  }
188  };
189 
195  class RTFXAPI RTFXGeometry : public RTFXObject
196  {
197  public:
207  RTFXGeometry();
208 
210  RTFXGeometry( bool _genID );
211 
212 
214  ~RTFXGeometry();
215 
217  RTFXGeometry( const RTFXGeometry &_g );
218 
222  void Update( RTFXObject * _pt );
223 
228  bool EqualData( RTFXObject * _object );
229 
231  void ToNative( AXISFRAME _frame );
232 
234  void FromNative( AXISFRAME _frame );
235 
237  void ChangeFrame( AXISFRAME _from, AXISFRAME _to );
238 
240  void AddPoint( RTFXPoint * _pt );
241 
243  RTFXPoint * GetPoint( unsigned int _idx );
244 
246  void DeletePoint( unsigned int _idx );
247 
249  void AddFace( RTFXFace * _f );
250 
252  RTFXFace * GetFace( unsigned int _idx );
253 
255  void DeleteFace( unsigned int _idx );
256 
258  void SetPosition( Point3D _p );
259 
261  void SetPosition( double _x, double _y, double _z );
262 
264  Point3D GetPosition();
265 
267  double * GetPositionAsDoubles();
268 
270  void SetRotation( Point3D _p );
271 
273  void SetRotation( double _x, double _y, double _z );
274 
276  Point3D GetRotation();
277 
279  double * GetRotationAsDoubles();
280 
282  void SetScale( Point3D _p );
283 
285  void SetScale( double _x, double _y, double _z );
286 
288  Point3D GetScale();
289 
291  double * GetScaleAsDoubles();
292 
294  void SetTransform( Matrix4x4 _m );
295 
297  void SetTransform( double * _m );
298 
300  Matrix4x4 GetTransform();
301 
303  double * GetTransformAsDoubles();
304 
306  void DeleteAllPoints();
307 
309  void DeleteAllFaces();
310 
312  unsigned int GetPointCount();
313 
315  unsigned int GetFaceCount();
316 
319  std::vector<RTFXProperty *> GetChangedProperties();
320 
321  private:
323  void Init( bool _genID );
324 
326  unsigned int numberOfPoints;
327 
329  unsigned int numberOfFaces;
330 
332  map<unsigned int, RTFXPoint *> pointMap;
333 
335  map<unsigned int, RTFXFace *> faceMap;
336 
337  friend class boost::serialization::access;
338 
339  template<class Archive>
340  void serialize( Archive &_ar, const unsigned int _version )
341  {
342  _ar & boost::serialization::base_object<RTFXObject>( *this );
343  _ar & numberOfPoints;
344  _ar & numberOfFaces;
345  _ar & pointMap;
346  _ar & faceMap;
347  }
348  };
349 }
350 
351 BOOST_CLASS_EXPORT_KEY( RTFX::RTFXPoint )
352 BOOST_CLASS_EXPORT_KEY( RTFX::RTFXFace )
353 BOOST_CLASS_EXPORT_KEY( RTFX::RTFXGeometry )
354 
355 #endif