Castor3D  ..
Classes | Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Attributes | List of all members
Castor3D::SceneNode Class Reference

The scene node handler class. More...

+ Inheritance diagram for Castor3D::SceneNode:
+ Collaboration diagram for Castor3D::SceneNode:

Classes

class  BinaryParser
 Sampler loader. More...
 
class  TextLoader
 SceneNode loader. More...
 

Public Types

typedef SceneNodePtrStrMap::iterator node_iterator
 
typedef SceneNodePtrStrMap::const_iterator node_const_iterator
 
typedef MovableObjectPtrArray::iterator object_iterator
 
typedef MovableObjectPtrArray::const_iterator object_const_iterator
 

Public Member Functions

C3D_API SceneNode (Castor::String const &p_name, Scene &p_scene)
 Constructor. More...
 
virtual C3D_API ~SceneNode ()
 Destructor. More...
 
C3D_API void AttachObject (MovableObjectSPtr p_object)
 Attaches a MovableObject to the node. More...
 
C3D_API void DetachObject (MovableObjectSPtr p_object)
 Detaches a MovableObject from the node. More...
 
C3D_API void AttachTo (SceneNodeSPtr p_parent)
 Sets the parent node. More...
 
C3D_API void Detach ()
 Detaches the node from it's parent. More...
 
C3D_API bool HasChild (Castor::String const &p_name)
 
C3D_API void AddChild (SceneNodeSPtr p_child)
 Add the given node to my childs if it isn't already. More...
 
C3D_API void DetachChild (SceneNodeSPtr p_child)
 Detaches a child from my child's list, if it is one of my childs. More...
 
C3D_API void DetachChild (Castor::String const &p_childName)
 Detaches a child from my child's list, if it is one of my childs. More...
 
C3D_API void DetachAllChilds ()
 Detaches all my childs. More...
 
C3D_API void Yaw (Castor::Angle const &p_angle)
 Rotates around Y axis. More...
 
C3D_API void Pitch (Castor::Angle const &p_angle)
 Rotates around Z axis. More...
 
C3D_API void Roll (Castor::Angle const &p_angle)
 Rotates around X axis. More...
 
C3D_API void Rotate (Castor::Quaternion const &p_quat)
 Rotate the node with the given orientation. More...
 
C3D_API void Translate (Castor::Point3r const &p_t)
 Translates the node. More...
 
C3D_API void Scale (Castor::Point3r const &p_s)
 Scales the node. More...
 
C3D_API void SetOrientation (Castor::Quaternion const &p_orientation)
 Sets the orientation. More...
 
C3D_API void SetPosition (Castor::Point3r const &p_position)
 Sets the relative position from a Point3r. More...
 
C3D_API void SetScale (Castor::Point3r const &p_scale)
 Sets the relative scale from a Point3r. More...
 
C3D_API GeometrySPtr GetNearestGeometry (Ray *p_ray, real &p_distance, FaceSPtr *p_nearestFace, SubmeshSPtr *p_nearestSubmesh)
 Gets the nearest geometry held by this node or it's children nodes, which is hit by the ray. More...
 
C3D_API Castor::Point3r GetDerivedPosition ()
 Retrieves the absolute position. More...
 
C3D_API Castor::Quaternion GetDerivedOrientation ()
 Retrieves the absolute orientation. More...
 
C3D_API Castor::Point3r GetDerivedScale ()
 Retrieves the absolute scale. More...
 
C3D_API Castor::Matrix4x4r const & GetTransformationMatrix ()
 Retrieves the relative transformation matrix. More...
 
C3D_API Castor::Matrix4x4r const & GetDerivedTransformationMatrix ()
 Retrieves the absolute transformation matrix. More...
 
Castor::Point3r const & GetPosition () const
 Retrieves the relative position. More...
 
Castor::Quaternion const & GetOrientation () const
 Retrieves the relative orientation. More...
 
Castor::Point3r const & GetScale () const
 Retrieves the relative scale. More...
 
void GetAxisAngle (Castor::Point3r &p_axis, Castor::Angle &p_angle)
 Retrieves the orientation in axis and angle terms. More...
 
bool IsVisible () const
 Retrieves the visibility status. More...
 
bool IsDisplayable () const
 Retrieves the displayable status. More...
 
SceneNodeSPtr GetParent () const
 Retrieves the parent node. More...
 
SceneNodePtrStrMap const & GetChilds () const
 Retrieves the childs map. More...
 
node_iterator ChildsBegin ()
 Retrieves an iterator to the first child. More...
 
node_const_iterator ChildsBegin () const
 Retrieves an iterator to the first child. More...
 
node_iterator ChildsEnd ()
 Retrieves an iterator to after the last child. More...
 
node_const_iterator ChildsEnd () const
 Retrieves an iterator to after the last child. More...
 
MovableObjectPtrArray const & GetObjects () const
 Retrieves the objects map. More...
 
object_iterator ObjectsBegin ()
 Retrieves an iterator to the first attached object. More...
 
object_const_iterator ObjectsBegin () const
 Retrieves an iterator to the first attached object. More...
 
object_iterator ObjectsEnd ()
 Retrieves an iterator to after the last attached object. More...
 
object_const_iterator ObjectsEnd () const
 Retrieves an iterator to after the last attached object. More...
 
SceneNodeSPtr GetChild (Castor::String const &p_name)
 Retrieves the child with given name. More...
 
bool IsModified () const
 Retrieves the transformations matrices modify status. More...
 
void SetVisible (bool p_visible)
 Sets the node visibility status. More...
 
uint32_t RegisterObject (NodeChangedNotifyFunction p_function)
 Registers an object to be notified on changes. More...
 
void UnregisterObject (uint32_t p_index)
 Unregisters an object from the changes notification. More...
 

Static Public Attributes

static uint64_t Count
 The total number of scene nodes. More...
 

Protected Types

using SceneNodePtrStrMap = std::map< Castor::String, SceneNodeWPtr >
 
using MovableObjectPtrArray = std::list< MovableObjectWPtr >
 

Protected Attributes

bool m_displayable
 Tells if it is displayable. A node is displayable if his parent is either displayable or the root node. More...
 
bool m_visible
 The visible status. If a node is hidden, all objects attached to it are hidden. More...
 
Castor::Quaternion m_orientation
 The relative orientation of the node. More...
 
Castor::Point3r m_position
 The relative position of the node. More...
 
Castor::Point3r m_scale
 The relative scale transform value of the node. More...
 
Castor::Matrix4x4r m_transform
 The reative transformation matrix. More...
 
bool m_mtxChanged
 Tells the relative transformation matrix needs recomputation. More...
 
Castor::Matrix4x4r m_derivedTransform
 The absolute transformation matrix. More...
 
bool m_derivedMtxChanged
 Tells the absolute transformation matrix needs recomputation. More...
 
SceneNodeWPtr m_parent
 This node's parent. More...
 
SceneNodePtrStrMap m_childs
 This node's childs. More...
 
MovableObjectPtrArray m_objects
 This node's attached objects. More...
 
Castor::Signal< NodeChangedNotifyFunction > m_signalChanged
 Signal used to notify attached objects that the node has changed. More...
 

Detailed Description

The scene node handler class.

Author
Sylvain DOREMUS
Version
0.1
Date
09/02/2010
Remarks
A scene node is a parent for nearly every object in a scene : geometry, camera, ...

Member Typedef Documentation

◆ MovableObjectPtrArray

using Castor3D::SceneNode::MovableObjectPtrArray = std::list< MovableObjectWPtr >
protected

◆ node_const_iterator

typedef SceneNodePtrStrMap::const_iterator Castor3D::SceneNode::node_const_iterator

◆ node_iterator

typedef SceneNodePtrStrMap::iterator Castor3D::SceneNode::node_iterator

◆ object_const_iterator

typedef MovableObjectPtrArray::const_iterator Castor3D::SceneNode::object_const_iterator

◆ object_iterator

typedef MovableObjectPtrArray::iterator Castor3D::SceneNode::object_iterator

◆ SceneNodePtrStrMap

using Castor3D::SceneNode::SceneNodePtrStrMap = std::map< Castor::String, SceneNodeWPtr >
protected

Constructor & Destructor Documentation

◆ SceneNode()

C3D_API Castor3D::SceneNode::SceneNode ( Castor::String const &  p_name,
Scene p_scene 
)

Constructor.

Parameters
[in]p_nameThe node's name.
[in]p_sceneThe parent scene.

◆ ~SceneNode()

virtual C3D_API Castor3D::SceneNode::~SceneNode ( )
virtual

Destructor.

Member Function Documentation

◆ AddChild()

C3D_API void Castor3D::SceneNode::AddChild ( SceneNodeSPtr  p_child)

Add the given node to my childs if it isn't already.

Parameters
[in]p_childThe node to add

◆ AttachObject()

C3D_API void Castor3D::SceneNode::AttachObject ( MovableObjectSPtr  p_object)

Attaches a MovableObject to the node.

Parameters
[in]p_objectThe object to attach

◆ AttachTo()

C3D_API void Castor3D::SceneNode::AttachTo ( SceneNodeSPtr  p_parent)

Sets the parent node.

Parameters
[in]p_parentThe new parent

◆ ChildsBegin() [1/2]

node_iterator Castor3D::SceneNode::ChildsBegin ( )
inline

Retrieves an iterator to the first child.

Returns
The value

References m_childs.

◆ ChildsBegin() [2/2]

node_const_iterator Castor3D::SceneNode::ChildsBegin ( ) const
inline

Retrieves an iterator to the first child.

Returns
The value

References m_childs.

◆ ChildsEnd() [1/2]

node_iterator Castor3D::SceneNode::ChildsEnd ( )
inline

Retrieves an iterator to after the last child.

Returns
The value

References m_childs.

◆ ChildsEnd() [2/2]

node_const_iterator Castor3D::SceneNode::ChildsEnd ( ) const
inline

Retrieves an iterator to after the last child.

Returns
The value

References m_childs.

◆ Detach()

C3D_API void Castor3D::SceneNode::Detach ( )

Detaches the node from it's parent.

◆ DetachAllChilds()

C3D_API void Castor3D::SceneNode::DetachAllChilds ( )

Detaches all my childs.

◆ DetachChild() [1/2]

C3D_API void Castor3D::SceneNode::DetachChild ( SceneNodeSPtr  p_child)

Detaches a child from my child's list, if it is one of my childs.

Parameters
[in]p_childThe child to detach

◆ DetachChild() [2/2]

C3D_API void Castor3D::SceneNode::DetachChild ( Castor::String const &  p_childName)

Detaches a child from my child's list, if it is one of my childs.

Parameters
[in]p_childNameThe name of the child to detach

◆ DetachObject()

C3D_API void Castor3D::SceneNode::DetachObject ( MovableObjectSPtr  p_object)

Detaches a MovableObject from the node.

Parameters
[in]p_objectThe object to detach

◆ GetAxisAngle()

void Castor3D::SceneNode::GetAxisAngle ( Castor::Point3r &  p_axis,
Castor::Angle &  p_angle 
)
inline

Retrieves the orientation in axis and angle terms.

Parameters
[out]p_axisReceives the axis
[out]p_angleReceives the angle

References m_orientation.

◆ GetChild()

SceneNodeSPtr Castor3D::SceneNode::GetChild ( Castor::String const &  p_name)
inline

Retrieves the child with given name.

Parameters
[in]p_nameThe child name
Returns
The value, nullptr if not found

References m_childs.

◆ GetChilds()

SceneNodePtrStrMap const& Castor3D::SceneNode::GetChilds ( ) const
inline

Retrieves the childs map.

Returns
The value

References m_childs.

◆ GetDerivedOrientation()

C3D_API Castor::Quaternion Castor3D::SceneNode::GetDerivedOrientation ( )

Retrieves the absolute orientation.

Returns
The value

◆ GetDerivedPosition()

C3D_API Castor::Point3r Castor3D::SceneNode::GetDerivedPosition ( )

Retrieves the absolute position.

Returns
The value

◆ GetDerivedScale()

C3D_API Castor::Point3r Castor3D::SceneNode::GetDerivedScale ( )

Retrieves the absolute scale.

Returns
The value

◆ GetDerivedTransformationMatrix()

C3D_API Castor::Matrix4x4r const& Castor3D::SceneNode::GetDerivedTransformationMatrix ( )

Retrieves the absolute transformation matrix.

Returns
The value

◆ GetNearestGeometry()

C3D_API GeometrySPtr Castor3D::SceneNode::GetNearestGeometry ( Ray p_ray,
real &  p_distance,
FaceSPtr *  p_nearestFace,
SubmeshSPtr *  p_nearestSubmesh 
)

Gets the nearest geometry held by this node or it's children nodes, which is hit by the ray.

Parameters
[in]p_rayThe ray
[out]p_distanceReceives the distance of the met geometry
[out]p_nearestFaceReceives the face of the met geometry
[out]p_nearestSubmeshReceives the submesh of the met geometry
Returns
The geometry, nullptr if none

◆ GetObjects()

MovableObjectPtrArray const& Castor3D::SceneNode::GetObjects ( ) const
inline

Retrieves the objects map.

Returns
The value

References m_objects.

◆ GetOrientation()

Castor::Quaternion const& Castor3D::SceneNode::GetOrientation ( ) const
inline

Retrieves the relative orientation.

Returns
The value

References m_orientation.

◆ GetParent()

SceneNodeSPtr Castor3D::SceneNode::GetParent ( ) const
inline

Retrieves the parent node.

Returns
The value

References m_parent.

◆ GetPosition()

Castor::Point3r const& Castor3D::SceneNode::GetPosition ( ) const
inline

Retrieves the relative position.

Returns
The value

References m_position.

◆ GetScale()

Castor::Point3r const& Castor3D::SceneNode::GetScale ( ) const
inline

Retrieves the relative scale.

Returns
The value

References m_scale.

◆ GetTransformationMatrix()

C3D_API Castor::Matrix4x4r const& Castor3D::SceneNode::GetTransformationMatrix ( )

Retrieves the relative transformation matrix.

Returns
The value

◆ HasChild()

C3D_API bool Castor3D::SceneNode::HasChild ( Castor::String const &  p_name)
Parameters
[in]p_nameThe name of the node
Returns
true if one of my child has the given name

◆ IsDisplayable()

bool Castor3D::SceneNode::IsDisplayable ( ) const
inline

Retrieves the displayable status.

Returns
The value

References m_displayable.

◆ IsModified()

bool Castor3D::SceneNode::IsModified ( ) const
inline

Retrieves the transformations matrices modify status.

Returns
The value

References m_derivedMtxChanged, and m_mtxChanged.

◆ IsVisible()

bool Castor3D::SceneNode::IsVisible ( ) const
inline

Retrieves the visibility status.

Returns
The value

References m_visible.

◆ ObjectsBegin() [1/2]

object_iterator Castor3D::SceneNode::ObjectsBegin ( )
inline

Retrieves an iterator to the first attached object.

Returns
The value

References m_objects.

◆ ObjectsBegin() [2/2]

object_const_iterator Castor3D::SceneNode::ObjectsBegin ( ) const
inline

Retrieves an iterator to the first attached object.

Returns
The value

References m_objects.

◆ ObjectsEnd() [1/2]

object_iterator Castor3D::SceneNode::ObjectsEnd ( )
inline

Retrieves an iterator to after the last attached object.

Returns
The value

References m_objects.

◆ ObjectsEnd() [2/2]

object_const_iterator Castor3D::SceneNode::ObjectsEnd ( ) const
inline

Retrieves an iterator to after the last attached object.

Returns
The value

References m_objects.

◆ Pitch()

C3D_API void Castor3D::SceneNode::Pitch ( Castor::Angle const &  p_angle)

Rotates around Z axis.

Parameters
[in]p_angleThe rotation angle

◆ RegisterObject()

uint32_t Castor3D::SceneNode::RegisterObject ( NodeChangedNotifyFunction  p_function)
inline

Registers an object to be notified on changes.

Parameters
[in]p_functionThe object notification function.
Returns
The connection index.

References m_signalChanged.

◆ Roll()

C3D_API void Castor3D::SceneNode::Roll ( Castor::Angle const &  p_angle)

Rotates around X axis.

Parameters
[in]p_angleThe rotation angle

◆ Rotate()

C3D_API void Castor3D::SceneNode::Rotate ( Castor::Quaternion const &  p_quat)

Rotate the node with the given orientation.

Parameters
[in]p_quatThe orientation to add to current one

◆ Scale()

C3D_API void Castor3D::SceneNode::Scale ( Castor::Point3r const &  p_s)

Scales the node.

Parameters
[in]p_sThe scale value

◆ SetOrientation()

C3D_API void Castor3D::SceneNode::SetOrientation ( Castor::Quaternion const &  p_orientation)

Sets the orientation.

Parameters
[in]p_orientationThe new orientation

◆ SetPosition()

C3D_API void Castor3D::SceneNode::SetPosition ( Castor::Point3r const &  p_position)

Sets the relative position from a Point3r.

Parameters
[in]p_positionThe new position

◆ SetScale()

C3D_API void Castor3D::SceneNode::SetScale ( Castor::Point3r const &  p_scale)

Sets the relative scale from a Point3r.

Parameters
[in]p_scaleThe new scale

◆ SetVisible()

void Castor3D::SceneNode::SetVisible ( bool  p_visible)
inline

Sets the node visibility status.

Parameters
[in]p_visibleThe new value

References m_visible.

◆ Translate()

C3D_API void Castor3D::SceneNode::Translate ( Castor::Point3r const &  p_t)

Translates the node.

Parameters
[in]p_tThe translation value

◆ UnregisterObject()

void Castor3D::SceneNode::UnregisterObject ( uint32_t  p_index)
inline

Unregisters an object from the changes notification.

Parameters
[in]p_indexThe connection index.

References m_signalChanged.

◆ Yaw()

C3D_API void Castor3D::SceneNode::Yaw ( Castor::Angle const &  p_angle)

Rotates around Y axis.

Parameters
[in]p_angleThe rotation angle

Member Data Documentation

◆ Count

uint64_t Castor3D::SceneNode::Count
static

The total number of scene nodes.

◆ m_childs

SceneNodePtrStrMap Castor3D::SceneNode::m_childs
protected

This node's childs.

Referenced by ChildsBegin(), ChildsEnd(), GetChild(), and GetChilds().

◆ m_derivedMtxChanged

bool Castor3D::SceneNode::m_derivedMtxChanged
protected

Tells the absolute transformation matrix needs recomputation.

Referenced by IsModified().

◆ m_derivedTransform

Castor::Matrix4x4r Castor3D::SceneNode::m_derivedTransform
protected

The absolute transformation matrix.

◆ m_displayable

bool Castor3D::SceneNode::m_displayable
protected

Tells if it is displayable. A node is displayable if his parent is either displayable or the root node.

Referenced by IsDisplayable().

◆ m_mtxChanged

bool Castor3D::SceneNode::m_mtxChanged
protected

Tells the relative transformation matrix needs recomputation.

Referenced by IsModified().

◆ m_objects

MovableObjectPtrArray Castor3D::SceneNode::m_objects
protected

This node's attached objects.

Referenced by GetObjects(), ObjectsBegin(), and ObjectsEnd().

◆ m_orientation

Castor::Quaternion Castor3D::SceneNode::m_orientation
protected

The relative orientation of the node.

Referenced by GetAxisAngle(), and GetOrientation().

◆ m_parent

SceneNodeWPtr Castor3D::SceneNode::m_parent
protected

This node's parent.

Referenced by GetParent().

◆ m_position

Castor::Point3r Castor3D::SceneNode::m_position
protected

The relative position of the node.

Referenced by GetPosition().

◆ m_scale

Castor::Point3r Castor3D::SceneNode::m_scale
protected

The relative scale transform value of the node.

Referenced by GetScale().

◆ m_signalChanged

Castor::Signal< NodeChangedNotifyFunction > Castor3D::SceneNode::m_signalChanged
protected

Signal used to notify attached objects that the node has changed.

Referenced by RegisterObject(), and UnregisterObject().

◆ m_transform

Castor::Matrix4x4r Castor3D::SceneNode::m_transform
protected

The reative transformation matrix.

◆ m_visible

bool Castor3D::SceneNode::m_visible
protected

The visible status. If a node is hidden, all objects attached to it are hidden.

Referenced by IsVisible(), and SetVisible().


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