Blender V2.61 - r43446
Public Member Functions | Protected Member Functions | Protected Attributes | Friends

SG_Spatial Class Reference

#include <SG_Spatial.h>

Inheritance diagram for SG_Spatial:
Inheritance graph
[legend]

List of all members.

Public Member Functions

void ClearModified ()
void SetModified ()
void ClearDirty ()
void SetParentRelation (SG_ParentRelation *relation)
SG_ParentRelationGetParentRelation ()
void RelativeTranslate (const MT_Vector3 &trans, const SG_Spatial *parent, bool local)
void SetLocalPosition (const MT_Point3 &trans)
void SetWorldPosition (const MT_Point3 &trans)
void RelativeRotate (const MT_Matrix3x3 &rot, bool local)
void SetLocalOrientation (const MT_Matrix3x3 &rot)
void SetLocalOrientation (const float *rot)
void SetWorldOrientation (const MT_Matrix3x3 &rot)
void RelativeScale (const MT_Vector3 &scale)
void SetLocalScale (const MT_Vector3 &scale)
void SetWorldScale (const MT_Vector3 &scale)
const MT_Point3GetLocalPosition () const
const MT_Matrix3x3GetLocalOrientation () const
const MT_Vector3GetLocalScale () const
const MT_Point3GetWorldPosition () const
const MT_Matrix3x3GetWorldOrientation () const
const MT_Vector3GetWorldScaling () const
void SetWorldFromLocalTransform ()
MT_Transform GetWorldTransform () const
bool ComputeWorldTransforms (const SG_Spatial *parent, bool &parentUpdated)
SG_BBoxBBox ()
void SetBBox (SG_BBox &bbox)
bool inside (const MT_Point3 &point) const
void getBBox (MT_Point3 *box) const
void getAABBox (MT_Point3 *box) const
MT_Scalar Radius () const
void SetRadius (MT_Scalar radius)
bool IsModified ()
bool IsDirty ()

Protected Member Functions

 SG_Spatial (void *clientobj, void *clientinfo, SG_Callbacks &callbacks)
 SG_Spatial (const SG_Spatial &other)
virtual ~SG_Spatial ()
bool UpdateSpatialData (const SG_Spatial *parent, double time, bool &parentUpdated)

Protected Attributes

MT_Point3 m_localPosition
MT_Matrix3x3 m_localRotation
MT_Vector3 m_localScaling
MT_Point3 m_worldPosition
MT_Matrix3x3 m_worldRotation
MT_Vector3 m_worldScaling
SG_ParentRelationm_parent_relation
SG_BBox m_bbox
MT_Scalar m_radius
bool m_modified
bool m_ogldirty

Friends

class SG_Controller
class KX_BoneParentRelation
class KX_VertexParentRelation
class KX_SlowParentRelation
class KX_NormalParentRelation

Detailed Description

SG_Spatial contains spatial information (local & world position, rotation and scaling) for a Scene graph node. It also contains a link to the node's parent.

Definition at line 51 of file SG_Spatial.h.


Constructor & Destructor Documentation

SG_Spatial::SG_Spatial ( void *  clientobj,
void *  clientinfo,
SG_Callbacks callbacks 
) [protected]

Protected constructor this class is not designed for direct instantiation

Definition at line 39 of file SG_Spatial.cpp.

SG_Spatial::SG_Spatial ( const SG_Spatial other) [protected]

Definition at line 64 of file SG_Spatial.cpp.

References m_parent_relation, and SG_ParentRelation::NewCopy().

SG_Spatial::~SG_Spatial ( ) [protected, virtual]

Definition at line 88 of file SG_Spatial.cpp.

References m_parent_relation.


Member Function Documentation

SG_BBox& SG_Spatial::BBox ( ) [inline]

Bounding box functions.

Definition at line 231 of file SG_Spatial.h.

References m_bbox.

Referenced by KX_Scene::AddReplicaObject(), BL_ConvertBlenderObjects(), KX_Scene::DupliGroupRecurse(), SG_Tree::Find(), and SG_Tree::SG_Tree().

void SG_Spatial::ClearDirty ( ) [inline]

Definition at line 81 of file SG_Spatial.h.

References m_ogldirty.

Referenced by KX_GameObject::GetOpenGLMatrix().

void SG_Spatial::ClearModified ( ) [inline]
bool SG_Spatial::ComputeWorldTransforms ( const SG_Spatial parent,
bool &  parentUpdated 
) [inline]

Definition at line 222 of file SG_Spatial.h.

References m_parent_relation, and SG_ParentRelation::UpdateChildCoordinates().

Referenced by UpdateSpatialData().

void SG_Spatial::getAABBox ( MT_Point3 box) const

Definition at line 211 of file SG_Spatial.cpp.

References SG_BBox::getaa(), GetWorldTransform(), and m_bbox.

void SG_Spatial::getBBox ( MT_Point3 box) const

Definition at line 206 of file SG_Spatial.cpp.

References SG_BBox::get(), GetWorldTransform(), and m_bbox.

Referenced by KX_Scene::MarkVisible().

const MT_Matrix3x3& SG_Spatial::GetLocalOrientation ( ) const [inline]
const MT_Point3& SG_Spatial::GetLocalPosition ( ) const [inline]
const MT_Vector3& SG_Spatial::GetLocalScale ( ) const [inline]
SG_ParentRelation* SG_Spatial::GetParentRelation ( ) [inline]

Definition at line 104 of file SG_Spatial.h.

References m_parent_relation.

const MT_Matrix3x3& SG_Spatial::GetWorldOrientation ( ) const [inline]
const MT_Point3& SG_Spatial::GetWorldPosition ( ) const [inline]
const MT_Vector3& SG_Spatial::GetWorldScaling ( ) const [inline]
MT_Transform SG_Spatial::GetWorldTransform ( ) const
bool SG_Spatial::inside ( const MT_Point3 point) const
bool SG_Spatial::IsDirty ( ) [inline]

Definition at line 249 of file SG_Spatial.h.

References m_ogldirty.

bool SG_Spatial::IsModified ( ) [inline]
MT_Scalar SG_Spatial::Radius ( ) const [inline]
void SG_Spatial::RelativeRotate ( const MT_Matrix3x3 rot,
bool  local 
)

Scaling methods. Orientation and rotation methods.

Definition at line 177 of file SG_Spatial.cpp.

References GetWorldOrientation(), m_localRotation, and SetModified().

Referenced by KX_GameObject::ApplyRotation().

void SG_Spatial::RelativeScale ( const MT_Vector3 scale) [inline]

Definition at line 164 of file SG_Spatial.h.

References m_localScaling, and SetModified().

Referenced by KX_GameObject::NodeSetRelativeScale().

void SG_Spatial::RelativeTranslate ( const MT_Vector3 trans,
const SG_Spatial parent,
bool  local 
)

Apply a translation relative to the current position. if local then the translation is assumed to be in the local coordinates of this object. If not then the translation is assumed to be in global coordinates. In this case you must provide a pointer to the parent of this object if it exists otherwise if there is no parent set it to NULL

Position and translation methods

Definition at line 147 of file SG_Spatial.cpp.

References GetWorldOrientation(), m_localPosition, m_localRotation, and SetModified().

Referenced by KX_GameObject::ApplyMovement().

void SG_Spatial::SetBBox ( SG_BBox bbox) [inline]
void SG_Spatial::SetLocalOrientation ( const MT_Matrix3x3 rot) [inline]
void SG_Spatial::SetLocalOrientation ( const float *  rot) [inline]

Definition at line 153 of file SG_Spatial.h.

References m_localRotation, and SetModified().

void SG_Spatial::SetLocalPosition ( const MT_Point3 trans) [inline]
void SG_Spatial::SetLocalScale ( const MT_Vector3 scale) [inline]
void SG_Spatial::SetModified ( ) [inline]
void SG_Spatial::SetParentRelation ( SG_ParentRelation relation)

Define the realtionship this node has with it's parent node. You should pass an unshared instance of an SG_ParentRelation allocated on the heap to this method. Ownership of this instance is assumed by this class. You may call this function several times in the lifetime of a node to change the relationship dynamically. You must call this method before the first call to UpdateSpatialData(). An assertion willl be fired at run-time in debug if this is not the case. The relation is activated only if no controllers of this object updated the coordinates of the child.

Definition at line 95 of file SG_Spatial.cpp.

References m_parent_relation, and SetModified().

Referenced by KX_Scene::AddNodeReplicaObject(), bl_ConvertBlenderObject_Single(), and KX_GameObject::KX_GameObject().

void SG_Spatial::SetRadius ( MT_Scalar  radius) [inline]
void SG_Spatial::SetWorldFromLocalTransform ( ) [inline]
void SG_Spatial::SetWorldOrientation ( const MT_Matrix3x3 rot) [inline]
void SG_Spatial::SetWorldPosition ( const MT_Point3 trans) [inline]
void SG_Spatial::SetWorldScale ( const MT_Vector3 scale) [inline]
bool SG_Spatial::UpdateSpatialData ( const SG_Spatial parent,
double  time,
bool &  parentUpdated 
) [protected]

Update the world coordinates of this spatial node. This also informs any controllers to update this object.

Update Spatial Data. Calculates WorldTransform., (either doing itsself or using the linked SGControllers)

Definition at line 112 of file SG_Spatial.cpp.

References ComputeWorldTransforms(), and SG_IObject::GetSGControllerList().

Referenced by SG_Node::UpdateWorldData().


Friends And Related Function Documentation

friend class KX_BoneParentRelation [friend]

Definition at line 253 of file SG_Spatial.h.

friend class KX_NormalParentRelation [friend]

Definition at line 256 of file SG_Spatial.h.

friend class KX_SlowParentRelation [friend]

Definition at line 255 of file SG_Spatial.h.

friend class KX_VertexParentRelation [friend]

Definition at line 254 of file SG_Spatial.h.

friend class SG_Controller [friend]

Definition at line 252 of file SG_Spatial.h.


Member Data Documentation

Definition at line 65 of file SG_Spatial.h.

Referenced by BBox(), getAABBox(), getBBox(), inside(), and SetBBox().

bool SG_Spatial::m_modified [protected]

Definition at line 67 of file SG_Spatial.h.

Referenced by ClearModified(), IsModified(), SetModified(), and SG_Node::SG_Node().

bool SG_Spatial::m_ogldirty [protected]

Definition at line 68 of file SG_Spatial.h.

Referenced by ClearDirty(), ClearModified(), and IsDirty().

Definition at line 66 of file SG_Spatial.h.

Referenced by inside(), Radius(), and SetRadius().


The documentation for this class was generated from the following files: