00001 #ifndef __SG_SPATIAL_H 00002 #define __SG_SPATIAL_H 00003 00004 #include <MT_Vector3.h> 00005 #include <MT_Point3.h> 00006 #include <MT_Matrix3x3.h> // or Quaternion later ? 00007 00008 #include "SG_IObject.h" 00009 00010 class SG_Node; 00011 00012 class SG_Spatial : public SG_IObject 00013 { 00014 00015 protected: 00016 MT_Point3 m_localPosition; 00017 MT_Matrix3x3 m_localRotation; 00018 MT_Vector3 m_localScaling; 00019 00020 MT_Point3 m_worldPosition; 00021 MT_Matrix3x3 m_worldRotation; 00022 MT_Vector3 m_worldScaling; 00023 00024 SG_Node* m_SGparent; 00025 bool m_vertexparent; // temporarily, will add more modes later in a better way 00026 00027 public: 00028 00029 SG_Node* GetSGParent() { 00030 return m_SGparent; 00031 } 00032 00033 const SG_Node* GetRootSGParent(); 00034 00035 // set local transformations 00036 void RelativeTranslate(const MT_Vector3& trans,bool local); 00037 void SetLocalPosition(const MT_Point3& trans); 00038 00039 const MT_Point3& GetLocalPosition () const 00040 { 00041 return m_localPosition; 00042 } 00043 00044 void RelativeRotate(const MT_Matrix3x3& rot,bool local); 00045 void SetLocalOrientation(const MT_Matrix3x3& rot); 00046 00047 void RelativeScale(const MT_Vector3& scale); 00048 void SetLocalScale(const MT_Vector3& scale); 00049 00050 const MT_Point3& GetWorldPosition() const 00051 { 00052 return m_worldPosition; 00053 } 00054 const MT_Matrix3x3& GetWorldOrientation() const 00055 { 00056 return m_worldRotation; 00057 } 00058 const MT_Vector3& GetWorldScaling() const 00059 { 00060 return m_worldScaling; 00061 } 00062 void SetVertexParent(bool isvertexparent) 00063 { 00064 m_vertexparent = isvertexparent; 00065 } 00066 00067 protected: 00068 00069 friend SG_Node; 00070 friend SG_Controller; 00071 00072 SG_Spatial(void* clientobj,void* clientinfo,SG_Callbacks callbacks); 00073 virtual ~SG_Spatial(); 00074 00075 virtual void UpdateWorldData(double time); 00076 00077 public: // protected later ? 00078 virtual void UpdateGS(double time,bool bInitiator); 00079 virtual SG_IObject* GetSGReplica(); 00080 virtual void ProcessSGReplica(SG_IObject* replica); 00081 virtual void Destruct(); 00082 00083 }; 00084 #endif //__SG_SPATIAL_H