RTFX  0.3
Real time special effects collaborative visualization and production library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
RTFXPropertyMatrix4x4.h
Go to the documentation of this file.
1 #ifndef __RTFX_PROPERTY_MATRIX4X4__
2 #define __RTFX_PROPERTY_MATRIX4X4__
3 
4 
5 
6 #include "RTFXBoostIncludes.h"
7 
8 #include "RTFXMath.h"
9 #include "RTFXRecorder.h"
10 #include "RTFXHelpers.h"
11 
20 using namespace std;
21 
22 namespace RTFX
23 {
31  class RTFXAPI RTFXPropertyMatrix4x4 : public RTFXProperty
32  {
33  public:
36  {
37  SetType( RTFXProperty::MATRIX4 );
38  value = I;
39  }
40 
43 
45  void SetValue( Matrix4x4 _value )
46  {
47  boost::lock_guard<boost::mutex> lock( *dataLock );
48  value = _value;
49  SetChanged( true );
50 
51  }
52 
54  Matrix4x4 GetValue()
55  {
56  boost::lock_guard<boost::mutex> lock( *dataLock );
57  SetChanged( false );
58  return value;
59  }
60 
62  double * GetValueAsArray()
63  {
64  boost::lock_guard<boost::mutex> lock( *dataLock );
65  SetChanged( false );
66  return value.data();
67  }
68 
71  bool EqualTo( RTFXProperty * _other )
72  {
73  // Check if Property types match (just in case)
74  if ( GetType() == _other->GetType() )
75  {
76  if ( value == (( RTFXPropertyMatrix4x4 * )_other)->value )
77  return true;
78  }
79  return false;
80  }
81 
83  void ChangeFrame( AXISFRAME _frameA, AXISFRAME _frameB )
84  {
85  if ( GetBasis() )
86  {
87  Matrix4x4 t = RTFXMath::GetFrameTransformMatrix( _frameA, _frameB );
88  value = t * value;
89  }
90  }
92  void Copy( RTFXProperty * _p )
93  {
94  SetID( _p->GetID() );
95  SetName( _p->GetName() );
96  SetDescription( _p->GetDescription() );
97  SetOwner( _p->GetOwner() );
98  SetChanged( _p->GetChanged() );
99  SetType( _p->GetType() );
100  SetDelete( _p->GetDelete() );
101 
103  SetValue( ptr->GetValue() );
104  }
105 
106  private:
107 
110 
112  friend class boost::serialization::access;
113 
114  template<class Archive>
115  void serialize( Archive &_ar, const unsigned int _version )
116  {
117  _ar & boost::serialization::base_object<RTFXProperty>( *this );
118  _ar & value;
119  };
120  };
121 }
122 
123 BOOST_CLASS_EXPORT_KEY( RTFX::RTFXPropertyMatrix4x4 )
124 
125 #endif