arsa
2.7
|
Scene node interface. More...
#include <ISceneNode.h>
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. More... | |
virtual | ~ISceneNode () |
Destructor. More... | |
virtual void | OnRegisterSceneNode () |
This method is called just before the rendering process of the whole scene. More... | |
virtual void | OnAnimate (u32 timeMs) |
OnAnimate() is called just before rendering the whole scene. More... | |
virtual void | render ()=0 |
Renders the node. More... | |
virtual const c8 * | getName () const |
Returns the name of the node. More... | |
virtual void | setName (const c8 *name) |
Sets the name of the node. More... | |
virtual void | setName (const core::stringc &name) |
Sets the name of the node. More... | |
virtual const core::aabbox3d< f32 > & | getBoundingBox () const =0 |
Get the axis aligned, not transformed bounding box of this node. More... | |
virtual const core::aabbox3d< f32 > | getTransformedBoundingBox () const |
Get the axis aligned, transformed and animated absolute bounding box of this node. More... | |
virtual void | getTransformedBoundingBoxEdges (core::array< core::vector3d< f32 > > &edges) const |
virtual const core::matrix4 & | getAbsoluteTransformation () const |
Get the absolute transformation of the node. Is recalculated every OnAnimate()-call. More... | |
virtual core::matrix4 | getRelativeTransformation () const |
Returns the relative transformation of the scene node. More... | |
virtual bool | isVisible () const |
Returns whether the node should be visible (if all of its parents are visible). More... | |
virtual bool | isTrulyVisible () const |
Check whether the node is truly visible, taking into accounts its parents' visibility. More... | |
virtual void | setVisible (bool isVisible) |
Sets if the node should be visible or not. More... | |
virtual s32 | getID () const |
Get the id of the scene node. More... | |
virtual void | setID (s32 id) |
Sets the id of the scene node. More... | |
virtual void | addChild (ISceneNode *child) |
Adds a child to this scene node. More... | |
virtual bool | removeChild (ISceneNode *child) |
Removes a child from this scene node. More... | |
virtual void | removeAll () |
Removes all children of this scene node. More... | |
virtual void | remove () |
Removes this scene node from the scene. More... | |
virtual void | addAnimator (ISceneNodeAnimator *animator) |
Adds an animator which should animate this node. More... | |
const core::list< ISceneNodeAnimator * > & | getAnimators () const |
Get a list of all scene node animators. More... | |
virtual void | removeAnimator (ISceneNodeAnimator *animator) |
Removes an animator from this scene node. More... | |
virtual void | removeAnimators () |
Removes all animators from this scene node. More... | |
virtual video::SMaterial & | getMaterial (u32 num) |
Returns the material based on the zero based index i. More... | |
virtual u32 | getMaterialCount () const |
Get amount of materials used by this scene node. More... | |
void | setMaterialFlag (video::E_MATERIAL_FLAG flag, bool newvalue) |
Sets all material flags at once to a new value. More... | |
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. More... | |
void | setMaterialType (video::E_MATERIAL_TYPE newType) |
Sets the material type of all materials in this scene node to a new material type. More... | |
virtual const core::vector3df & | getScale () const |
Gets the scale of the scene node relative to its parent. More... | |
virtual void | setScale (const core::vector3df &scale) |
Sets the relative scale of the scene node. More... | |
virtual const core::vector3df & | getRotation () const |
Gets the rotation of the node relative to its parent. More... | |
virtual void | setRotation (const core::vector3df &rotation) |
Sets the rotation of the node relative to its parent. More... | |
virtual const core::vector3df & | getPosition () const |
Gets the position of the node relative to its parent. More... | |
virtual void | setPosition (const core::vector3df &newpos) |
Sets the position of the node relative to its parent. More... | |
virtual core::vector3df | getAbsolutePosition () const |
Gets the absolute position of the node in world coordinates. More... | |
void | setAutomaticCulling (u32 state) |
Set a culling style or disable culling completely. More... | |
u32 | getAutomaticCulling () const |
Gets the automatic culling state. More... | |
virtual void | setDebugDataVisible (u32 state) |
Sets if debug data like bounding boxes should be drawn. More... | |
u32 | isDebugDataVisible () const |
Returns if debug data like bounding boxes are drawn. More... | |
void | setIsDebugObject (bool debugObject) |
Sets if this scene node is a debug object. More... | |
bool | isDebugObject () const |
Returns if this scene node is a debug object. More... | |
const core::list< ISceneNode * > & | getChildren () const |
Returns a const reference to the list of all children. More... | |
virtual void | setParent (ISceneNode *newParent) |
Changes the parent of the scene node. More... | |
virtual ITriangleSelector * | getTriangleSelector () const |
Returns the triangle selector attached to this scene node. More... | |
virtual void | setTriangleSelector (ITriangleSelector *selector) |
Sets the triangle selector of the scene node. More... | |
virtual void | updateAbsolutePosition () |
Updates the absolute position based on the relative and the parents position. More... | |
scene::ISceneNode * | getParent () const |
Returns the parent of this scene node. More... | |
virtual ESCENE_NODE_TYPE | getType () const |
Returns type of the scene node. More... | |
virtual void | serializeAttributes (io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const _IRR_OVERRIDE_ |
Writes attributes of the scene node. More... | |
virtual void | deserializeAttributes (io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) _IRR_OVERRIDE_ |
Reads attributes of the scene node. More... | |
virtual ISceneNode * | clone (ISceneNode *newParent=0, ISceneManager *newManager=0) |
Creates a clone of this scene node and its children. More... | |
virtual ISceneManager * | getSceneManager (void) const |
Retrieve the scene manager for this node. More... | |
Public Member Functions inherited from irr::IReferenceCounted | |
IReferenceCounted () | |
Constructor. More... | |
virtual | ~IReferenceCounted () |
Destructor. More... | |
void | grab () const |
Grabs the object. Increments the reference counter by one. More... | |
bool | drop () const |
Drops the object. Decrements the reference counter by one. More... | |
s32 | getReferenceCount () const |
Get the reference count. More... | |
const c8 * | getDebugName () const |
Returns the debug name of the object. More... | |
Protected Member Functions | |
void | cloneMembers (ISceneNode *toCopyFrom, ISceneManager *newManager) |
A clone function for the ISceneNode members. More... | |
void | setSceneManager (ISceneManager *newManager) |
Protected Member Functions inherited from irr::IReferenceCounted | |
void | setDebugName (const c8 *newName) |
Sets the debug name of the object. More... | |
Protected Attributes | |
core::stringc | Name |
Name of the scene node. More... | |
core::matrix4 | AbsoluteTransformation |
Absolute transformation of the node. More... | |
core::vector3df | RelativeTranslation |
Relative translation of the scene node. More... | |
core::vector3df | RelativeRotation |
Relative rotation of the scene node. More... | |
core::vector3df | RelativeScale |
Relative scale of the scene node. More... | |
ISceneNode * | Parent |
Pointer to the parent. More... | |
core::list< ISceneNode * > | Children |
List of all children of this node. More... | |
core::list< ISceneNodeAnimator * > | Animators |
List of all animator nodes. More... | |
ISceneManager * | SceneManager |
Pointer to the scene manager. More... | |
ITriangleSelector * | TriangleSelector |
Pointer to the triangle selector. More... | |
s32 | ID |
ID of the node. More... | |
u32 | AutomaticCullingState |
Automatic culling state. More... | |
u32 | DebugDataVisible |
Flag if debug data should be drawn, such as Bounding Boxes. More... | |
bool | IsVisible |
Is the node visible? More... | |
bool | IsDebugObject |
Is debug object? More... | |
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.
Definition at line 40 of file ISceneNode.h.
|
inline |
Constructor.
Definition at line 45 of file ISceneNode.h.
|
inlinevirtual |
Destructor.
Definition at line 62 of file ISceneNode.h.
|
inlinevirtual |
Adds an animator which should animate this node.
animator | A pointer to the new animator. |
Definition at line 362 of file ISceneNode.h.
|
inlinevirtual |
Adds a child to this scene node.
If the scene node already has a parent it is first removed from the other parent.
child | A pointer to the new child. |
Definition at line 295 of file ISceneNode.h.
|
inlinevirtual |
Creates a clone of this scene node and its children.
newParent | An optional new parent. |
newManager | An optional new scene manager. |
Reimplemented in irr::scene::IAnimatedMeshSceneNode, irr::arsa::CAVSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, and irr::arsa::CARSAPsd.
Definition at line 757 of file ISceneNode.h.
|
inlineprotected |
A clone function for the ISceneNode members.
This method can be used by clone() implementations of derived classes
toCopyFrom | The node from which the values are copied |
newManager | The new scene manager. |
Definition at line 773 of file ISceneNode.h.
|
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.
in | The attribute container to read from. |
options | Additional options which might influence the deserialization. |
Reimplemented from irr::io::IAttributeExchangingObject.
Reimplemented in irr::scene::IParticleSystemSceneNode, irr::arsa::CAVSceneNode, irr::scene::ICameraSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, and irr::arsa::CARSAPsd.
Definition at line 725 of file ISceneNode.h.
|
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().
Definition at line 536 of file ISceneNode.h.
|
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().
Definition at line 210 of file ISceneNode.h.
|
inline |
Get a list of all scene node animators.
Definition at line 374 of file ISceneNode.h.
|
inline |
Gets the automatic culling state.
Definition at line 556 of file ISceneNode.h.
|
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.
Implemented in irr::arsa::CAVSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, irr::scene::IBoneSceneNode, irr::arsa::CARSAPsd, irr::scene::ITerrainSceneNode, and irr::arsa::CARSADPad.
|
inline |
Returns a const reference to the list of all children.
Definition at line 601 of file ISceneNode.h.
|
inlinevirtual |
Get the id of the scene node.
This id can be used to identify the node.
Definition at line 276 of file ISceneNode.h.
|
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.
num | Zero based index. The maximal value is getMaterialCount() - 1. |
Reimplemented in irr::arsa::CAVSceneNode.
Definition at line 420 of file ISceneNode.h.
|
inlinevirtual |
Get amount of materials used by this scene node.
Reimplemented in irr::arsa::CAVSceneNode.
Definition at line 428 of file ISceneNode.h.
Returns the name of the node.
Definition at line 146 of file ISceneNode.h.
|
inline |
Returns the parent of this scene node.
Definition at line 679 of file ISceneNode.h.
|
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.
Definition at line 512 of file ISceneNode.h.
|
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.
Definition at line 221 of file ISceneNode.h.
|
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()
Definition at line 493 of file ISceneNode.h.
|
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()
Definition at line 474 of file ISceneNode.h.
|
inlinevirtual |
Retrieve the scene manager for this node.
Definition at line 764 of file ISceneNode.h.
|
inlinevirtual |
Get the axis aligned, transformed and animated absolute bounding box of this node.
Note: The result is still an axis-aligned bounding box, so it's size changes with rotation.
Definition at line 183 of file ISceneNode.h.
|
inlinevirtual |
Get a the 8 corners of the original bounding box transformed and animated by the absolute transformation. Note: The result is not identical to getTransformedBoundingBox().getEdges(), but getting an aabbox3d of these edges would then be identical.
edges | Receives an array with the transformed edges |
Definition at line 195 of file ISceneNode.h.
|
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.
Definition at line 633 of file ISceneNode.h.
|
inlinevirtual |
Returns type of the scene node.
Reimplemented in irr::arsa::CAVSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, irr::arsa::CARSAPsd, irr::arsa::CARSADPad, and irr::scene::IVolumeLightSceneNode.
Definition at line 687 of file ISceneNode.h.
|
inline |
Returns if debug data like bounding boxes are drawn.
Definition at line 574 of file ISceneNode.h.
|
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.
Definition at line 593 of file ISceneNode.h.
|
inlinevirtual |
Check whether the node is truly visible, taking into accounts its parents' visibility.
Definition at line 251 of file ISceneNode.h.
|
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
Definition at line 243 of file ISceneNode.h.
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.
timeMs | Current time in milliseconds. |
Reimplemented in irr::arsa::CAVSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, irr::scene::IBoneSceneNode, irr::arsa::CARSAPsd, and irr::arsa::CARSADPad.
Definition at line 108 of file ISceneNode.h.
|
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:
Reimplemented in irr::arsa::CAVSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, irr::arsa::CARSAPsd, and irr::arsa::CARSADPad.
Definition at line 91 of file ISceneNode.h.
|
inlinevirtual |
Removes this scene node from the scene.
If no other grab exists for this node, it will be deleted.
Definition at line 353 of file ISceneNode.h.
|
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.
Definition at line 337 of file ISceneNode.h.
|
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.
animator | A pointer to the animator to be deleted. |
Definition at line 384 of file ISceneNode.h.
|
inlinevirtual |
Removes all animators from this scene node.
The animators might also be deleted if no other grab exists for them.
Definition at line 402 of file ISceneNode.h.
|
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.
child | A pointer to the child which shall be removed. |
Definition at line 317 of file ISceneNode.h.
|
pure virtual |
Renders the node.
Implemented in irr::arsa::CAVSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, irr::scene::IBoneSceneNode, irr::arsa::CARSAPsd, and irr::arsa::CARSADPad.
|
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.
out | The attribute container to write into. |
options | Additional options which might influence the serialization. |
Reimplemented from irr::io::IAttributeExchangingObject.
Reimplemented in irr::scene::IParticleSystemSceneNode, irr::arsa::CAVSceneNode, irr::scene::ICameraSceneNode, irr::arsa::CARSAJson, irr::arsa::CARSASpine, and irr::arsa::CARSAPsd.
Definition at line 700 of file ISceneNode.h.
Set a culling style or disable culling completely.
Box cullling (EAC_BOX) is set 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.
state | The culling state to be used. Check E_CULLING_TYPE for possible values. |
Definition at line 548 of file ISceneNode.h.
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.
state | The debug data visibility state to be used. |
Definition at line 566 of file ISceneNode.h.
Sets the id of the scene node.
This id can be used to identify the node.
id | The new id. |
Definition at line 285 of file ISceneNode.h.
|
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.
Definition at line 583 of file ISceneNode.h.
|
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.
flag | Which flag of all materials to be set. |
newvalue | New value of that flag. |
Definition at line 439 of file ISceneNode.h.
|
inline |
Sets the texture of the specified layer in all materials of this scene node to the new texture.
textureLayer | Layer of texture to be set. Must be a value smaller than MATERIAL_MAX_TEXTURES. |
texture | New texture to be used. |
Definition at line 450 of file ISceneNode.h.
|
inline |
Sets the material type of all materials in this scene node to a new material type.
newType | New type of material to be set. |
Definition at line 462 of file ISceneNode.h.
Sets the name of the node.
name | New name of the scene node. |
Definition at line 154 of file ISceneNode.h.
|
inlinevirtual |
Sets the name of the node.
name | New name of the scene node. |
Definition at line 162 of file ISceneNode.h.
|
inlinevirtual |
Changes the parent of the scene node.
newParent | The new parent to be used. |
Definition at line 609 of file ISceneNode.h.
|
inlinevirtual |
Sets the position of the node relative to its parent.
Note that the position is relative to the parent.
newpos | New relative position of the scene node. |
Definition at line 521 of file ISceneNode.h.
|
inlinevirtual |
Sets the rotation of the node relative to its parent.
This only modifies the relative rotation of the node.
rotation | New rotation of the node in degrees. |
Reimplemented in irr::scene::ICameraSceneNode.
Definition at line 502 of file ISceneNode.h.
|
inlinevirtual |
Sets the relative scale of the scene node.
scale | New scale of the node, relative to its parent. |
Definition at line 482 of file ISceneNode.h.
|
inlineprotected |
Sets the new scene manager for this node and all children. Called by addChild when moving nodes between scene managers
Definition at line 814 of file ISceneNode.h.
|
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().
selector | New triangle selector for this scene node. |
Definition at line 648 of file ISceneNode.h.
|
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.
isVisible | If the node shall be visible. |
Reimplemented in irr::arsa::CAVSceneNode, and irr::scene::ILightSceneNode.
Definition at line 267 of file ISceneNode.h.
|
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.
Definition at line 665 of file ISceneNode.h.
|
protected |
Absolute transformation of the node.
Definition at line 827 of file ISceneNode.h.
|
protected |
List of all animator nodes.
Definition at line 845 of file ISceneNode.h.
|
protected |
Automatic culling state.
Definition at line 857 of file ISceneNode.h.
|
protected |
List of all children of this node.
Definition at line 842 of file ISceneNode.h.
|
protected |
Flag if debug data should be drawn, such as Bounding Boxes.
Definition at line 860 of file ISceneNode.h.
|
protected |
ID of the node.
Definition at line 854 of file ISceneNode.h.
|
protected |
Is debug object?
Definition at line 866 of file ISceneNode.h.
|
protected |
Is the node visible?
Definition at line 863 of file ISceneNode.h.
|
protected |
Name of the scene node.
Definition at line 824 of file ISceneNode.h.
|
protected |
Pointer to the parent.
Definition at line 839 of file ISceneNode.h.
|
protected |
Relative rotation of the scene node.
Definition at line 833 of file ISceneNode.h.
|
protected |
Relative scale of the scene node.
Definition at line 836 of file ISceneNode.h.
|
protected |
Relative translation of the scene node.
Definition at line 830 of file ISceneNode.h.
|
protected |
Pointer to the scene manager.
Definition at line 848 of file ISceneNode.h.
|
protected |
Pointer to the triangle selector.
Definition at line 851 of file ISceneNode.h.