Castor3D 0.16.0
Multiplatform 3D engine
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
castor3d::SceneNode Class Reference

#include <SceneNode.hpp>

Inheritance diagram for castor3d::SceneNode:
Inheritance graph
[legend]
Collaboration diagram for castor3d::SceneNode:
Collaboration graph
[legend]

Public Types

using SceneNodeMap = castor::StringMap< SceneNodeRPtr >
 
using MovableArray = castor::List< castor::ReferenceWrapper< MovableObject > >
 

Public Member Functions

C3D_API SceneNode (castor::String const &name, Scene &scene, SceneNode *parent, castor::Point3f position, castor::Quaternion orientation, castor::Point3f scale, bool isStatic=true)
 Constructor.
 
C3D_API SceneNode (castor::String const &name, Scene &scene)
 Constructor.
 
C3D_API ~SceneNode () override
 Destructor.
 
C3D_API void update ()
 Updates the scene node matrices.
 
Attached objects management.
C3D_API void attachObject (MovableObject &object)
 Attaches a MovableObject to the node.
 
C3D_API void detachObject (MovableObject const &object)
 Detaches a MovableObject from the node.
 
Children management.
C3D_API void attachTo (SceneNode &parent)
 Sets the parent node.
 
C3D_API void detach (bool cleanup) noexcept
 Detaches the node from it's parent.
 
C3D_API bool hasChild (castor::String const &name) const
 
C3D_API void addChild (SceneNode &child)
 add the given node to my childs if it isn't already
 
C3D_API void detachChild (SceneNode const &child) noexcept
 Detaches a child from my child's list, if it is one of my childs.
 
C3D_API void detachChild (castor::String const &childName) noexcept
 Detaches a child from my child's list, if it is one of my childs.
 
C3D_API void detachChildren (bool cleanup) noexcept
 Detaches all my childs.
 
C3D_API void markDirty ()
 Marks this scene node as dirty.
 
Local transformations.
C3D_API void yaw (castor::Angle const &angle)
 Rotates around Y axis.
 
C3D_API void pitch (castor::Angle const &angle)
 Rotates around Z axis.
 
C3D_API void roll (castor::Angle const &angle)
 Rotates around X axis.
 
C3D_API void rotate (castor::Quaternion const &quat)
 Rotate the node with the given orientation.
 
C3D_API void translate (castor::Point3f const &t)
 Translates the node.
 
C3D_API void scale (castor::Point3f const &s)
 Scales the node.
 
C3D_API SceneNodeAnimationcreateAnimation (castor::String const &name)
 Creates an animation.
 
C3D_API void removeAnimation (castor::String const &name)
 Removes an animation.
 
Absolute value getters.
C3D_API castor::Point3f getDerivedPosition () const
 
C3D_API castor::Quaternion getDerivedOrientation () const
 
C3D_API castor::Point3f getDerivedScale () const
 
C3D_API castor::Matrix4x4f const & getTransformationMatrix () const
 
C3D_API castor::Matrix4x4f const & getDerivedTransformationMatrix () const
 
Local value getters.
castor::Point3f const & getPosition () const
 
castor::Quaternion const & getOrientation () const
 
castor::Point3f const & getScale () const
 
void getAxisAngle (castor::Point3f &axis, castor::Angle &angle) const
 
Other getters.
C3D_API SceneNodeMap const & getChildren () const
 
C3D_API SceneNodeRPtr getChild (castor::String const &name) const
 
C3D_API MovableArray const & getObjects () const
 
C3D_API bool isVisible () const noexcept
 
bool isDisplayable () const noexcept
 
SceneNodegetParent () const noexcept
 
ScenegetScene () const noexcept
 
bool isSerialisable () const noexcept
 
bool isStatic () const noexcept
 
bool isModified () const noexcept
 
uint64_t getId () const noexcept
 
Setters.
C3D_API void setOrientation (castor::Quaternion const &orientation)
 
C3D_API void setPosition (castor::Point3f const &position)
 
C3D_API void setScale (castor::Point3f const &scale)
 
C3D_API void setTransformationMatrix (castor::Matrix4x4f const &transform)
 
C3D_API void setVisible (bool visible)
 
void setSerialisable (bool value) noexcept
 
- Public Member Functions inherited from castor3d::AnimableT< Engine >
virtual C3D_API ~AnimableT () noexcept=default
 
void cleanupAnimations ()
 Empties the animations map.
 
bool hasAnimation () const
 
bool hasAnimation (castor::String const &name) const
 
Animation const & getAnimation (castor::String const &name) const
 Retrieves an animation.
 
AnimationgetAnimation (castor::String const &name)
 Retrieves an animation.
 
void addAnimation (AnimationPtr animation)
 Adds an animation.
 
AnimationsMap const & getAnimations () const
 
- Public Member Functions inherited from castor::OwnedBy< Owner >
Owner * getOwner () const
 
- Public Member Functions inherited from castor::NamedBaseT< T >
 NamedBaseT (T name) noexcept
 Constructor.
 
T const & getName () const noexcept
 Retrieves the name.
 
void rename (T name) noexcept
 

Public Attributes

OnSceneNodeReparent onParentChanged
 

Static Public Attributes

static uint64_t Count
 

Additional Inherited Members

- Protected Types inherited from castor3d::AnimableT< Engine >
using Animation
 
using AnimationPtr
 
using AnimationsMap
 
- Protected Member Functions inherited from castor3d::AnimableT< Engine >
void doRemoveAnimation (castor::String const &name)
 Removes an animation.
 
AnimationTypedoGetAnimation (castor::String const &name)
 Retrieves an animation.
 
AnimationType const & doGetAnimation (castor::String const &name) const
 Retrieves an animation.
 
 AnimableT (Engine &owner)
 
C3D_API AnimableT (AnimableT &&rhs) noexcept=default
 
C3D_API AnimableT (AnimableT const &rhs)=delete
 
C3D_API AnimableToperator= (AnimableT &&rhs) noexcept=delete
 
C3D_API AnimableToperator= (AnimableT const &rhs)=delete
 
- Protected Member Functions inherited from castor::OwnedBy< Owner >
 OwnedBy (Owner &owner)
 Constructor.
 
- Protected Attributes inherited from castor3d::AnimableT< Engine >
AnimationsMap m_animations
 
- Protected Attributes inherited from castor::NamedBaseT< T >
m_name
 

Member Typedef Documentation

◆ MovableArray

◆ SceneNodeMap

Constructor & Destructor Documentation

◆ SceneNode() [1/2]

C3D_API castor3d::SceneNode::SceneNode ( castor::String const & name,
Scene & scene,
SceneNode * parent,
castor::Point3f position,
castor::Quaternion orientation,
castor::Point3f scale,
bool isStatic = true )

Constructor.

Parameters
[in]nameThe node's name.
[in]sceneThe parent scene.
[in]parentThe parent node.
[in]positionThe initial position.
[in]orientationThe initial orientation.
[in]scaleThe initial scale.
[in]isStatictrue for a static node.

◆ SceneNode() [2/2]

C3D_API castor3d::SceneNode::SceneNode ( castor::String const & name,
Scene & scene )

Constructor.

Parameters
[in]nameThe node's name.
[in]sceneThe parent scene.

◆ ~SceneNode()

C3D_API castor3d::SceneNode::~SceneNode ( )
override

Destructor.

Member Function Documentation

◆ addChild()

C3D_API void castor3d::SceneNode::addChild ( SceneNode & child)

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

Parameters
[in]childThe node to add

◆ attachObject()

C3D_API void castor3d::SceneNode::attachObject ( MovableObject & object)

Attaches a MovableObject to the node.

Parameters
[in]objectThe object to attach

Referenced by castor3d::MovableAttacherT< CacheT >::operator()().

Here is the caller graph for this function:

◆ attachTo()

C3D_API void castor3d::SceneNode::attachTo ( SceneNode & parent)

Sets the parent node.

Parameters
[in]parentThe new parent

◆ createAnimation()

C3D_API SceneNodeAnimation & castor3d::SceneNode::createAnimation ( castor::String const & name)

Creates an animation.

Parameters
[in]nameThe animation name
Returns
The animation

◆ detach()

C3D_API void castor3d::SceneNode::detach ( bool cleanup)
noexcept

Detaches the node from it's parent.

◆ detachChild() [1/2]

C3D_API void castor3d::SceneNode::detachChild ( castor::String const & childName)
noexcept

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

Parameters
[in]childNameThe name of the child to detach

◆ detachChild() [2/2]

C3D_API void castor3d::SceneNode::detachChild ( SceneNode const & child)
noexcept

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

Parameters
[in]childThe child to detach

◆ detachChildren()

C3D_API void castor3d::SceneNode::detachChildren ( bool cleanup)
noexcept

Detaches all my childs.

◆ detachObject()

C3D_API void castor3d::SceneNode::detachObject ( MovableObject const & object)

Detaches a MovableObject from the node.

Parameters
[in]objectThe object to detach

◆ getAxisAngle()

void castor3d::SceneNode::getAxisAngle ( castor::Point3f & axis,
castor::Angle & angle ) const
inline

References castor::QuaternionT< T >::toAxisAngle().

Here is the call graph for this function:

◆ getChild()

C3D_API SceneNodeRPtr castor3d::SceneNode::getChild ( castor::String const & name) const

◆ getChildren()

C3D_API SceneNodeMap const & castor3d::SceneNode::getChildren ( ) const

◆ getDerivedOrientation()

C3D_API castor::Quaternion castor3d::SceneNode::getDerivedOrientation ( ) const

◆ getDerivedPosition()

C3D_API castor::Point3f castor3d::SceneNode::getDerivedPosition ( ) const

◆ getDerivedScale()

C3D_API castor::Point3f castor3d::SceneNode::getDerivedScale ( ) const

◆ getDerivedTransformationMatrix()

C3D_API castor::Matrix4x4f const & castor3d::SceneNode::getDerivedTransformationMatrix ( ) const

◆ getId()

uint64_t castor3d::SceneNode::getId ( ) const
inlinenoexcept

◆ getObjects()

C3D_API MovableArray const & castor3d::SceneNode::getObjects ( ) const

◆ getOrientation()

castor::Quaternion const & castor3d::SceneNode::getOrientation ( ) const
inline

◆ getParent()

SceneNode * castor3d::SceneNode::getParent ( ) const
inlinenoexcept

◆ getPosition()

castor::Point3f const & castor3d::SceneNode::getPosition ( ) const
inline

◆ getScale()

castor::Point3f const & castor3d::SceneNode::getScale ( ) const
inline

◆ getScene()

Scene * castor3d::SceneNode::getScene ( ) const
inlinenoexcept

◆ getTransformationMatrix()

C3D_API castor::Matrix4x4f const & castor3d::SceneNode::getTransformationMatrix ( ) const

◆ hasChild()

C3D_API bool castor3d::SceneNode::hasChild ( castor::String const & name) const
Parameters
[in]nameThe name of the node
Returns
true if one of my child has the given name

◆ isDisplayable()

bool castor3d::SceneNode::isDisplayable ( ) const
inlinenoexcept

◆ isModified()

bool castor3d::SceneNode::isModified ( ) const
inlinenoexcept

◆ isSerialisable()

bool castor3d::SceneNode::isSerialisable ( ) const
inlinenoexcept

◆ isStatic()

bool castor3d::SceneNode::isStatic ( ) const
inlinenoexcept

◆ isVisible()

C3D_API bool castor3d::SceneNode::isVisible ( ) const
noexcept

◆ markDirty()

C3D_API void castor3d::SceneNode::markDirty ( )

Marks this scene node as dirty.

◆ pitch()

C3D_API void castor3d::SceneNode::pitch ( castor::Angle const & angle)

Rotates around Z axis.

Parameters
[in]angleThe rotation angle

◆ removeAnimation()

C3D_API void castor3d::SceneNode::removeAnimation ( castor::String const & name)

Removes an animation.

Parameters
[in]nameThe animation name

◆ roll()

C3D_API void castor3d::SceneNode::roll ( castor::Angle const & angle)

Rotates around X axis.

Parameters
[in]angleThe rotation angle

◆ rotate()

C3D_API void castor3d::SceneNode::rotate ( castor::Quaternion const & quat)

Rotate the node with the given orientation.

Parameters
[in]quatThe orientation to add to current one

◆ scale()

C3D_API void castor3d::SceneNode::scale ( castor::Point3f const & s)

Scales the node.

Parameters
[in]sThe scale value

◆ setOrientation()

C3D_API void castor3d::SceneNode::setOrientation ( castor::Quaternion const & orientation)

◆ setPosition()

C3D_API void castor3d::SceneNode::setPosition ( castor::Point3f const & position)

◆ setScale()

C3D_API void castor3d::SceneNode::setScale ( castor::Point3f const & scale)

◆ setSerialisable()

void castor3d::SceneNode::setSerialisable ( bool value)
inlinenoexcept

◆ setTransformationMatrix()

C3D_API void castor3d::SceneNode::setTransformationMatrix ( castor::Matrix4x4f const & transform)

◆ setVisible()

C3D_API void castor3d::SceneNode::setVisible ( bool visible)

◆ translate()

C3D_API void castor3d::SceneNode::translate ( castor::Point3f const & t)

Translates the node.

Parameters
[in]tThe translation value

◆ update()

C3D_API void castor3d::SceneNode::update ( )

Updates the scene node matrices.

◆ yaw()

C3D_API void castor3d::SceneNode::yaw ( castor::Angle const & angle)

Rotates around Y axis.

Parameters
[in]angleThe rotation angle

Member Data Documentation

◆ Count

uint64_t castor3d::SceneNode::Count
static

The total number of scene nodes.

◆ onParentChanged

OnSceneNodeReparent castor3d::SceneNode::onParentChanged

Signal used to notify that the node has been attached to another one.


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