Skylicht Engine
Loading...
Searching...
No Matches
irr::scene::ISceneNode Class Referenceabstract

Scene node interface. More...

#include <C:/Projects/skylicht-engine/Projects/Irrlicht/Include/ISceneNode.h>

Inheritance diagram for irr::scene::ISceneNode:
irr::io::IAttributeExchangingObject irr::IReferenceCounted irr::scene::ICameraSceneNode irr::scene::ILightSceneNode irr::scene::IMeshSceneNode

Public Member Functions

 ISceneNode (ISceneNode *parent, ISceneManager *mgr, s32 id=-1, const core::vector3df &position=core::vector3df(0, 0, 0), const core::vector3df &rotation=core::vector3df(0, 0, 0), const core::vector3df &scale=core::vector3df(1.0f, 1.0f, 1.0f))
 Constructor.
virtual ~ISceneNode ()
 Destructor.
virtual void OnRegisterSceneNode ()
 This method is called just before the rendering process of the whole scene.
virtual void CheckCount (int &count)
virtual void OnAnimate (u32 timeMs)
 OnAnimate() is called just before rendering the whole scene.
virtual void render ()=0
 Renders the node.
virtual const c8getName () const
 Returns the name of the node.
virtual void setName (const c8 *name)
 Sets the name of the node.
virtual void setName (const core::stringc &name)
 Sets the name of the node.
virtual const core::aabbox3d< f32 > & getBoundingBox () const =0
 Get the axis aligned, not transformed bounding box of this node.
virtual const core::aabbox3d< f32getTransformedBoundingBox () const
 Get the axis aligned, transformed and animated absolute bounding box of this node.
virtual const core::matrix4getAbsoluteTransformation () const
 Get the absolute transformation of the node. Is recalculated every OnAnimate()-call.
virtual core::matrix4 getRelativeTransformation () const
 Returns the relative transformation of the scene node.
virtual bool isVisible () const
 Returns whether the node should be visible (if all of its parents are visible).
virtual bool isTrulyVisible () const
 Check whether the node is truly visible, taking into accounts its parents' visibility.
virtual void setVisible (bool isVisible)
 Sets if the node should be visible or not.
virtual void setStaticNode (bool s)
virtual bool isStaticNode ()
virtual s32 getID () const
 Get the id of the scene node.
virtual void setID (s32 id)
 Sets the id of the scene node.
virtual void addChild (ISceneNode *child)
 Adds a child to this scene node.
virtual bool removeChild (ISceneNode *child)
 Removes a child from this scene node.
virtual void removeAll ()
 Removes all children of this scene node.
virtual void remove ()
 Removes this scene node from the scene.
virtual void addAnimator (ISceneNodeAnimator *animator)
 Adds an animator which should animate this node.
const core::list< ISceneNodeAnimator * > & getAnimators () const
 Get a list of all scene node animators.
virtual void removeAnimator (ISceneNodeAnimator *animator)
 Removes an animator from this scene node.
virtual void removeAnimators ()
 Removes all animators from this scene node.
virtual video::SMaterialgetMaterial (u32 num)
 Returns the material based on the zero based index i.
virtual u32 getMaterialCount () const
 Get amount of materials used by this scene node.
void setMaterialFlag (video::E_MATERIAL_FLAG flag, bool newvalue)
 Sets all material flags at once to a new value.
void setMaterialTexture (u32 textureLayer, video::ITexture *texture)
 Sets the texture of the specified layer in all materials of this scene node to the new texture.
void setMaterialType (s32 newType)
 Sets the material type of all materials in this scene node to a new material type.
virtual const core::vector3dfgetScale () const
 Gets the scale of the scene node relative to its parent.
virtual void setScale (const core::vector3df &scale)
 Sets the relative scale of the scene node.
virtual const core::vector3dfgetRotation () const
 Gets the rotation of the node relative to its parent.
virtual void setRotation (const core::vector3df &rotation)
 Sets the rotation of the node relative to its parent.
virtual const core::vector3dfgetPosition () const
 Gets the position of the node relative to its parent.
virtual void setPosition (const core::vector3df &newpos)
 Sets the position of the node relative to its parent.
virtual core::vector3df getAbsolutePosition () const
 Gets the absolute position of the node in world coordinates.
void setAutomaticCulling (u32 state)
 Enables or disables automatic culling based on the bounding box.
u32 getAutomaticCulling () const
 Gets the automatic culling state.
virtual void setDebugDataVisible (u32 state)
 Sets if debug data like bounding boxes should be drawn.
u32 isDebugDataVisible () const
 Returns if debug data like bounding boxes are drawn.
void setIsDebugObject (bool debugObject)
 Sets if this scene node is a debug object.
bool isDebugObject () const
 Returns if this scene node is a debug object.
const core::list< ISceneNode * > & getChildren () const
 Returns a const reference to the list of all children.
virtual void setParent (ISceneNode *newParent)
 Changes the parent of the scene node.
virtual ITriangleSelectorgetTriangleSelector () const
 Returns the triangle selector attached to this scene node.
virtual void setTriangleSelector (ITriangleSelector *selector)
 Sets the triangle selector of the scene node.
virtual void updateAbsolutePosition ()
 Updates the absolute position based on the relative and the parents position.
scene::ISceneNodegetParent () const
 Returns the parent of this scene node.
virtual ESCENE_NODE_TYPE getType () const
 Returns type of the scene node.
virtual void serializeAttributes (io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const
 Writes attributes of the scene node.
virtual void deserializeAttributes (io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)
 Reads attributes of the scene node.
virtual ISceneNodeclone (ISceneNode *newParent=0, ISceneManager *newManager=0)
 Creates a clone of this scene node and its children.
virtual ISceneManagergetSceneManager (void) const
 Retrieve the scene manager for this node.
Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor.
virtual ~IReferenceCounted ()
 Destructor.
void grab () const
 Grabs the object. Increments the reference counter by one.
bool drop () const
 Drops the object. Decrements the reference counter by one.
s32 getReferenceCount () const
 Get the reference count.
const c8getDebugName () const
 Returns the debug name of the object.

Protected Member Functions

void cloneMembers (ISceneNode *toCopyFrom, ISceneManager *newManager)
 A clone function for the ISceneNode members.
void setSceneManager (ISceneManager *newManager)
Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object.

Protected Attributes

core::stringc Name
 Name of the scene node.
core::matrix4 AbsoluteTransformation
 Absolute transformation of the node.
core::vector3df RelativeTranslation
 Relative translation of the scene node.
core::vector3df RelativeRotation
 Relative rotation of the scene node.
core::vector3df RelativeScale
 Relative scale of the scene node.
ISceneNodeParent
 Pointer to the parent.
core::list< ISceneNode * > Children
 List of all children of this node.
core::list< ISceneNodeAnimator * > Animators
 List of all animator nodes.
ISceneManagerSceneManager
 Pointer to the scene manager.
ITriangleSelectorTriangleSelector
 Pointer to the triangle selector.
s32 ID
 ID of the node.
u32 AutomaticCullingState
 Automatic culling state.
u32 DebugDataVisible
 Flag if debug data should be drawn, such as Bounding Boxes.
bool IsVisible
 Is the node visible?
bool IsStaticObject
bool IsDebugObject
 Is debug object?

Detailed Description

Scene node interface.

A scene node is a node in the hierarchical scene graph. Every scene node may have children, which are also scene nodes. Children move relative to their parent's position. If the parent of a node is not visible, its children won't be visible either. In this way, it is for example easily possible to attach a light to a moving car, or to place a walking character on a moving platform on a moving ship.

Member Function Documentation

◆ addAnimator()

virtual void irr::scene::ISceneNode::addAnimator ( ISceneNodeAnimator * animator)
inlinevirtual

Adds an animator which should animate this node.

Parameters
animatorA pointer to the new animator.

◆ addChild()

virtual void irr::scene::ISceneNode::addChild ( ISceneNode * child)
inlinevirtual

Adds a child to this scene node.

If the scene node already has a parent it is first removed from the other parent.

Parameters
childA pointer to the new child.

◆ clone()

virtual ISceneNode * irr::scene::ISceneNode::clone ( ISceneNode * newParent = 0,
ISceneManager * newManager = 0 )
inlinevirtual

Creates a clone of this scene node and its children.

Parameters
newParentAn optional new parent.
newManagerAn optional new scene manager.
Returns
The newly created clone of this node.

◆ cloneMembers()

void irr::scene::ISceneNode::cloneMembers ( ISceneNode * toCopyFrom,
ISceneManager * newManager )
inlineprotected

A clone function for the ISceneNode members.

This method can be used by clone() implementations of derived classes

Parameters
toCopyFromThe node from which the values are copied
newManagerThe new scene manager.

◆ deserializeAttributes()

virtual void irr::scene::ISceneNode::deserializeAttributes ( io::IAttributes * in,
io::SAttributeReadWriteOptions * options = 0 )
inlinevirtual

Reads attributes of the scene node.

Implement this to set the attributes of your scene node for scripting languages, editors, debuggers or xml deserialization purposes.

Parameters
inThe attribute container to read from.
optionsAdditional options which might influence the deserialization.

Reimplemented from irr::io::IAttributeExchangingObject.

Reimplemented in irr::scene::ICameraSceneNode.

◆ getAbsolutePosition()

virtual core::vector3df irr::scene::ISceneNode::getAbsolutePosition ( ) const
inlinevirtual

Gets the absolute position of the node in world coordinates.

If you want the position of the node relative to its parent, use getPosition() instead. NOTE: For speed reasons the absolute position is not automatically recalculated on each change of the relative position or by a position change of an parent. Instead the update usually happens once per frame in OnAnimate. You can enforce an update with updateAbsolutePosition().

Returns
The current absolute position of the scene node (updated on last call of updateAbsolutePosition).

◆ getAbsoluteTransformation()

virtual const core::matrix4 & irr::scene::ISceneNode::getAbsoluteTransformation ( ) const
inlinevirtual

Get the absolute transformation of the node. Is recalculated every OnAnimate()-call.

NOTE: For speed reasons the absolute transformation is not automatically recalculated on each change of the relative transformation or by a transformation change of an parent. Instead the update usually happens once per frame in OnAnimate. You can enforce an update with updateAbsolutePosition().

Returns
The absolute transformation matrix.

◆ getAnimators()

const core::list< ISceneNodeAnimator * > & irr::scene::ISceneNode::getAnimators ( ) const
inline

Get a list of all scene node animators.

Returns
The list of animators attached to this node.

◆ getAutomaticCulling()

u32 irr::scene::ISceneNode::getAutomaticCulling ( ) const
inline

Gets the automatic culling state.

Returns
The automatic culling state.

◆ getBoundingBox()

virtual const core::aabbox3d< f32 > & irr::scene::ISceneNode::getBoundingBox ( ) const
pure virtual

Get the axis aligned, not transformed bounding box of this node.

This means that if this node is an animated 3d character, moving in a room, the bounding box will always be around the origin. To get the box in real world coordinates, just transform it with the matrix you receive with getAbsoluteTransformation() or simply use getTransformedBoundingBox(), which does the same.

Returns
The non-transformed bounding box.

◆ getChildren()

const core::list< ISceneNode * > & irr::scene::ISceneNode::getChildren ( ) const
inline

Returns a const reference to the list of all children.

Returns
The list of all children of this node.

◆ getID()

virtual s32 irr::scene::ISceneNode::getID ( ) const
inlinevirtual

Get the id of the scene node.

This id can be used to identify the node.

Returns
The id.

◆ getMaterial()

virtual video::SMaterial & irr::scene::ISceneNode::getMaterial ( u32 num)
inlinevirtual

Returns the material based on the zero based index i.

To get the amount of materials used by this scene node, use getMaterialCount(). This function is needed for inserting the node into the scene hierarchy at an optimal position for minimizing renderstate changes, but can also be used to directly modify the material of a scene node.

Parameters
numZero based index. The maximal value is getMaterialCount() - 1.
Returns
The material at that index.

◆ getMaterialCount()

virtual u32 irr::scene::ISceneNode::getMaterialCount ( ) const
inlinevirtual

Get amount of materials used by this scene node.

Returns
Current amount of materials of this scene node.

◆ getName()

virtual const c8 * irr::scene::ISceneNode::getName ( ) const
inlinevirtual

Returns the name of the node.

Returns
Name as character string.

◆ getParent()

scene::ISceneNode * irr::scene::ISceneNode::getParent ( ) const
inline

Returns the parent of this scene node.

Returns
A pointer to the parent.

◆ getPosition()

virtual const core::vector3df & irr::scene::ISceneNode::getPosition ( ) const
inlinevirtual

Gets the position of the node relative to its parent.

Note that the position is relative to the parent. If you want the position in world coordinates, use getAbsolutePosition() instead.

Returns
The current position of the node relative to the parent.

◆ getRelativeTransformation()

virtual core::matrix4 irr::scene::ISceneNode::getRelativeTransformation ( ) const
inlinevirtual

Returns the relative transformation of the scene node.

The relative transformation is stored internally as 3 vectors: translation, rotation and scale. To get the relative transformation matrix, it is calculated from these values.

Returns
The relative transformation matrix.

◆ getRotation()

virtual const core::vector3df & irr::scene::ISceneNode::getRotation ( ) const
inlinevirtual

Gets the rotation of the node relative to its parent.

Note that this is the relative rotation of the node. If you want the absolute rotation, use getAbsoluteTransformation().getRotation()

Returns
Current relative rotation of the scene node.

◆ getScale()

virtual const core::vector3df & irr::scene::ISceneNode::getScale ( ) const
inlinevirtual

Gets the scale of the scene node relative to its parent.

This is the scale of this node relative to its parent. If you want the absolute scale, use getAbsoluteTransformation().getScale()

Returns
The scale of the scene node.

◆ getSceneManager()

virtual ISceneManager * irr::scene::ISceneNode::getSceneManager ( void ) const
inlinevirtual

Retrieve the scene manager for this node.

Returns
The node's scene manager.

◆ getTransformedBoundingBox()

virtual const core::aabbox3d< f32 > irr::scene::ISceneNode::getTransformedBoundingBox ( ) const
inlinevirtual

Get the axis aligned, transformed and animated absolute bounding box of this node.

Returns
The transformed bounding box.

◆ getTriangleSelector()

virtual ITriangleSelector * irr::scene::ISceneNode::getTriangleSelector ( ) const
inlinevirtual

Returns the triangle selector attached to this scene node.

The Selector can be used by the engine for doing collision detection. You can create a TriangleSelector with ISceneManager::createTriangleSelector() or ISceneManager::createOctreeTriangleSelector and set it with ISceneNode::setTriangleSelector(). If a scene node got no triangle selector, but collision tests should be done with it, a triangle selector is created using the bounding box of the scene node.

Returns
A pointer to the TriangleSelector or 0, if there is none.

◆ getType()

virtual ESCENE_NODE_TYPE irr::scene::ISceneNode::getType ( ) const
inlinevirtual

Returns type of the scene node.

Returns
The type of this node.

◆ isDebugDataVisible()

u32 irr::scene::ISceneNode::isDebugDataVisible ( ) const
inline

Returns if debug data like bounding boxes are drawn.

Returns
A bitwise OR of the debug data values from irr::scene::E_DEBUG_SCENE_TYPE that are currently visible.

◆ isDebugObject()

bool irr::scene::ISceneNode::isDebugObject ( ) const
inline

Returns if this scene node is a debug object.

Debug objects have some special properties, for example they can be easily excluded from collision detection or from serialization, etc.

Returns
If this node is a debug object, true is returned.

◆ isTrulyVisible()

virtual bool irr::scene::ISceneNode::isTrulyVisible ( ) const
inlinevirtual

Check whether the node is truly visible, taking into accounts its parents' visibility.

Returns
true if the node and all its parents are visible, false if this or any parent node is invisible.

◆ isVisible()

virtual bool irr::scene::ISceneNode::isVisible ( ) const
inlinevirtual

Returns whether the node should be visible (if all of its parents are visible).

This is only an option set by the user, but has nothing to do with geometry culling

Returns
The requested visibility of the node, true means visible (if all parents are also visible).

◆ OnAnimate()

virtual void irr::scene::ISceneNode::OnAnimate ( u32 timeMs)
inlinevirtual

OnAnimate() is called just before rendering the whole scene.

Nodes may calculate or store animations here, and may do other useful things, depending on what they are. Also, OnAnimate() should be called for all child scene nodes here. This method will be called once per frame, independent of whether the scene node is visible or not.

Parameters
timeMsCurrent time in milliseconds.

◆ OnRegisterSceneNode()

virtual void irr::scene::ISceneNode::OnRegisterSceneNode ( )
inlinevirtual

This method is called just before the rendering process of the whole scene.

Nodes may register themselves in the render pipeline during this call, precalculate the geometry which should be renderered, and prevent their children from being able to register themselves if they are clipped by simply not calling their OnRegisterSceneNode method. If you are implementing your own scene node, you should overwrite this method with an implementation code looking like this:

SceneManager->registerNodeForRendering(this);
ISceneManager * SceneManager
Pointer to the scene manager.
Definition ISceneNode.h:861
bool IsVisible
Is the node visible?
Definition ISceneNode.h:876
virtual void OnRegisterSceneNode()
This method is called just before the rendering process of the whole scene.
Definition ISceneNode.h:91

◆ remove()

virtual void irr::scene::ISceneNode::remove ( )
inlinevirtual

Removes this scene node from the scene.

If no other grab exists for this node, it will be deleted.

◆ removeAll()

virtual void irr::scene::ISceneNode::removeAll ( )
inlinevirtual

Removes all children of this scene node.

The scene nodes found in the children list are also dropped and might be deleted if no other grab exists on them.

◆ removeAnimator()

virtual void irr::scene::ISceneNode::removeAnimator ( ISceneNodeAnimator * animator)
inlinevirtual

Removes an animator from this scene node.

If the animator is found, it is also dropped and might be deleted if not other grab exists for it.

Parameters
animatorA pointer to the animator to be deleted.

◆ removeAnimators()

virtual void irr::scene::ISceneNode::removeAnimators ( )
inlinevirtual

Removes all animators from this scene node.

The animators might also be deleted if no other grab exists for them.

◆ removeChild()

virtual bool irr::scene::ISceneNode::removeChild ( ISceneNode * child)
inlinevirtual

Removes a child from this scene node.

If found in the children list, the child pointer is also dropped and might be deleted if no other grab exists.

Parameters
childA pointer to the child which shall be removed.
Returns
True if the child was removed, and false if not, e.g. because it couldn't be found in the children list.

◆ serializeAttributes()

virtual void irr::scene::ISceneNode::serializeAttributes ( io::IAttributes * out,
io::SAttributeReadWriteOptions * options = 0 ) const
inlinevirtual

Writes attributes of the scene node.

Implement this to expose the attributes of your scene node for scripting languages, editors, debuggers or xml serialization purposes.

Parameters
outThe attribute container to write into.
optionsAdditional options which might influence the serialization.

Reimplemented from irr::io::IAttributeExchangingObject.

Reimplemented in irr::scene::ICameraSceneNode.

◆ setAutomaticCulling()

void irr::scene::ISceneNode::setAutomaticCulling ( u32 state)
inline

Enables or disables automatic culling based on the bounding box.

Automatic culling is enabled by default. Note that not all SceneNodes support culling and that some nodes always cull their geometry because it is their only reason for existence, for example the OctreeSceneNode.

Parameters
stateThe culling state to be used.

◆ setDebugDataVisible()

virtual void irr::scene::ISceneNode::setDebugDataVisible ( u32 state)
inlinevirtual

Sets if debug data like bounding boxes should be drawn.

A bitwise OR of the types from irr::scene::E_DEBUG_SCENE_TYPE. Please note that not all scene nodes support all debug data types.

Parameters
stateThe debug data visibility state to be used.

◆ setID()

virtual void irr::scene::ISceneNode::setID ( s32 id)
inlinevirtual

Sets the id of the scene node.

This id can be used to identify the node.

Parameters
idThe new id.

◆ setIsDebugObject()

void irr::scene::ISceneNode::setIsDebugObject ( bool debugObject)
inline

Sets if this scene node is a debug object.

Debug objects have some special properties, for example they can be easily excluded from collision detection or from serialization, etc.

◆ setMaterialFlag()

void irr::scene::ISceneNode::setMaterialFlag ( video::E_MATERIAL_FLAG flag,
bool newvalue )
inline

Sets all material flags at once to a new value.

Useful, for example, if you want the whole mesh to be affected by light.

Parameters
flagWhich flag of all materials to be set.
newvalueNew value of that flag.

◆ setMaterialTexture()

void irr::scene::ISceneNode::setMaterialTexture ( u32 textureLayer,
video::ITexture * texture )
inline

Sets the texture of the specified layer in all materials of this scene node to the new texture.

Parameters
textureLayerLayer of texture to be set. Must be a value smaller than MATERIAL_MAX_TEXTURES.
textureNew texture to be used.

◆ setMaterialType()

void irr::scene::ISceneNode::setMaterialType ( s32 newType)
inline

Sets the material type of all materials in this scene node to a new material type.

Parameters
newTypeNew type of material to be set.

◆ setName() [1/2]

virtual void irr::scene::ISceneNode::setName ( const c8 * name)
inlinevirtual

Sets the name of the node.

Parameters
nameNew name of the scene node.

◆ setName() [2/2]

virtual void irr::scene::ISceneNode::setName ( const core::stringc & name)
inlinevirtual

Sets the name of the node.

Parameters
nameNew name of the scene node.

◆ setParent()

virtual void irr::scene::ISceneNode::setParent ( ISceneNode * newParent)
inlinevirtual

Changes the parent of the scene node.

Parameters
newParentThe new parent to be used.

◆ setPosition()

virtual void irr::scene::ISceneNode::setPosition ( const core::vector3df & newpos)
inlinevirtual

Sets the position of the node relative to its parent.

Note that the position is relative to the parent.

Parameters
newposNew relative position of the scene node.

◆ setRotation()

virtual void irr::scene::ISceneNode::setRotation ( const core::vector3df & rotation)
inlinevirtual

Sets the rotation of the node relative to its parent.

This only modifies the relative rotation of the node.

Parameters
rotationNew rotation of the node in degrees.

Reimplemented in irr::scene::ICameraSceneNode.

◆ setScale()

virtual void irr::scene::ISceneNode::setScale ( const core::vector3df & scale)
inlinevirtual

Sets the relative scale of the scene node.

Parameters
scaleNew scale of the node, relative to its parent.

◆ setSceneManager()

void irr::scene::ISceneNode::setSceneManager ( ISceneManager * newManager)
inlineprotected

Sets the new scene manager for this node and all children. Called by addChild when moving nodes between scene managers

◆ setTriangleSelector()

virtual void irr::scene::ISceneNode::setTriangleSelector ( ITriangleSelector * selector)
inlinevirtual

Sets the triangle selector of the scene node.

The Selector can be used by the engine for doing collision detection. You can create a TriangleSelector with ISceneManager::createTriangleSelector() or ISceneManager::createOctreeTriangleSelector(). Some nodes may create their own selector by default, so it would be good to check if there is already a selector in this node by calling ISceneNode::getTriangleSelector().

Parameters
selectorNew triangle selector for this scene node.

◆ setVisible()

virtual void irr::scene::ISceneNode::setVisible ( bool isVisible)
inlinevirtual

Sets if the node should be visible or not.

All children of this node won't be visible either, when set to false. Invisible nodes are not valid candidates for selection by collision manager bounding box methods.

Parameters
isVisibleIf the node shall be visible.

Reimplemented in irr::scene::ILightSceneNode.

◆ updateAbsolutePosition()

virtual void irr::scene::ISceneNode::updateAbsolutePosition ( )
inlinevirtual

Updates the absolute position based on the relative and the parents position.

Note: This does not recursively update the parents absolute positions, so if you have a deeper hierarchy you might want to update the parents first.


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