5#ifndef JPP_I_SCENE_NODE_HPP_INCLUDED
6#define JPP_I_SCENE_NODE_HPP_INCLUDED
8#include <jimcpp/core/engine/IAttributeExchangingObject.hpp>
9#include <jimcpp/core/engine/ESceneNodeTypes.hpp>
10#include <jimcpp/core/engine/ESceneNodeUpdateAbs.hpp>
11#include <jimcpp/core/engine/ECullingTypes.hpp>
12#include <jimcpp/core/engine/EDebugSceneTypes.hpp>
13#include <jimcpp/core/engine/ISceneNodeAnimator.hpp>
14#include <jimcpp/core/engine/ITriangleSelector.hpp>
15#include <jimcpp/core/engine/SMaterial.hpp>
16#include <jimcpp/core/engine/irrString.hpp>
17#include <jimcpp/core/engine/aabbox3d.hpp>
18#include <jimcpp/core/engine/matrix4.hpp>
19#include <jimcpp/core/engine/irrList.hpp>
20#include <jimcpp/core/engine/IAttributes.hpp>
71 ISceneNodeAnimatorList::Iterator ait =
Animators.begin();
98 ISceneNodeList::Iterator it =
Children.begin();
100 (*it)->OnRegisterSceneNode();
117 ISceneNodeAnimatorList::Iterator ait =
Animators.begin();
125 if ( anim->isEnabled() )
136 ISceneNodeList::Iterator it =
Children.begin();
138 (*it)->OnAnimate(timeMs);
202 for (
u32 i=0; i<8; ++i )
300 if (child && (child !=
this))
322 ISceneNodeList::Iterator it =
Children.begin();
342 ISceneNodeList::Iterator it =
Children.begin();
389 ISceneNodeAnimatorList::Iterator it =
Animators.begin();
392 if ((*it) == animator)
407 ISceneNodeAnimatorList::Iterator it =
Animators.begin();
824 ISceneNodeList::Iterator it = toCopyFrom->
Children.begin();
825 for (; it != toCopyFrom->
Children.end(); ++it)
826 (*it)->clone(
this, newManager);
830 ISceneNodeAnimatorList::Iterator ait = toCopyFrom->
Animators.begin();
831 for (; ait != toCopyFrom->
Animators.end(); ++ait)
848 ISceneNodeList::Iterator it =
Children.begin();
850 (*it)->setSceneManager(newManager);
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.hpp:96
bool drop() const
Drops the object. Decrements the reference counter by one.
Definition IReferenceCounted.hpp:126
4x4 matrix. Mostly used as transformation matrix for 3d calculations.
Definition matrix4.hpp:49
CMatrix4< T > & setTranslation(const vector3d< T > &translation)
Set the translation of the current matrix. Will erase any previous values.
Definition matrix4.hpp:821
vector3d< T > getTranslation() const
Gets the current translation.
Definition matrix4.hpp:814
CMatrix4< T > & setScale(const vector3d< T > &scale)
Set Scale.
Definition matrix4.hpp:845
CMatrix4< T > & setRotationDegrees(const vector3d< T > &rotation)
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
Definition matrix4.hpp:881
void transformVect(vector3df &vect) const
Transforms the vector by this matrix.
Definition matrix4.hpp:1224
void transformBoxEx(core::aabbox3d< f32 > &box) const
Transforms a axis aligned bounding box.
Definition matrix4.hpp:1314
Axis aligned bounding box in 3d dimensional space.
Definition aabbox3d.hpp:22
void getEdges(vector3d< T > *edges) const
Stores all 8 edges of the box into an array.
Definition aabbox3d.hpp:150
Self reallocating template array (like stl vector) with additional features.
Definition irrArray.hpp:23
An object which is able to serialize and deserialize its attributes into an attributes object.
Definition IAttributeExchangingObject.hpp:54
Provides a generic interface for attributes and their values and the possibility to serialize them.
Definition IAttributes.hpp:42
virtual const c8 * getAttributeAsEnumeration(const c8 *attributeName, const c8 *defaultNotFound=0) const =0
virtual s32 getAttributeAsInt(const c8 *attributeName, jpp::s32 defaultNotFound=0) const =0
virtual void addInt(const c8 *attributeName, s32 value)=0
Adds an attribute as integer.
virtual bool existsAttribute(const c8 *attributeName) const =0
Returns if an attribute with a name exists.
virtual bool getAttributeAsBool(const c8 *attributeName, bool defaultNotFound=false) const =0
virtual void addVector3d(const c8 *attributeName, const core::vector3df &value)=0
Adds an attribute as 3d vector.
virtual void addString(const c8 *attributeName, const c8 *value)=0
Adds an attribute as string.
virtual core::vector3df getAttributeAsVector3d(const c8 *attributeName, const core::vector3df &defaultNotFound=core::vector3df(0, 0, 0)) const =0
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
virtual void addEnum(const c8 *attributeName, const c8 *enumValue, const c8 *const *enumerationLiterals)=0
Adds an attribute as enum.
virtual core::stringc getAttributeAsString(const c8 *attributeName, const core::stringc &defaultNotFound=core::stringc()) const =0
class holding data describing options
Definition IAttributeExchangingObject.hpp:35
The Scene Manager manages scene nodes, mesh resources, cameras and all the other stuff.
Definition ISceneManager.hpp:160
Animates a scene node. Can animate position, rotation, material, and so on.
Definition ISceneNodeAnimator.hpp:32
virtual void animateNode(ISceneNode *node, u32 timeMs)=0
Animates a scene node.
virtual ISceneNodeAnimator * createClone(ISceneNode *node, ISceneManager *newManager=0)=0
Creates a clone of this animator.
Scene node interface.
Definition ISceneNode.hpp:43
virtual void setParent(ISceneNode *newParent)
Changes the parent of the scene node.
Definition ISceneNode.hpp:624
u32 isDebugDataVisible() const
Returns if debug data like bounding boxes are drawn.
Definition ISceneNode.hpp:589
virtual const c8 * getName() const
Returns the name of the node.
Definition ISceneNode.hpp:149
void setUpdateAbsolutePosBehavior(ESCENE_NODE_UPDATE_ABS behavior)
Set how updateAbsolutePosition calculates the absolute transformation matrix.
Definition ISceneNode.hpp:565
virtual bool isTrulyVisible() const
Check whether the node is truly visible, taking into accounts its parents' visibility.
Definition ISceneNode.hpp:254
virtual const core::matrix4 & getAbsoluteTransformation() const
Get the absolute transformation of the node. Is recalculated every OnAnimate()-call.
Definition ISceneNode.hpp:213
virtual s32 getID() const
Get the id of the scene node.
Definition ISceneNode.hpp:279
virtual void setID(s32 id)
Sets the id of the scene node.
Definition ISceneNode.hpp:288
virtual void setPosition(const core::vector3df &newpos)
Sets the position of the node relative to its parent.
Definition ISceneNode.hpp:524
core::vector3df RelativeRotation
Relative rotation of the scene node.
Definition ISceneNode.hpp:863
virtual void removeAll()
Removes all children of this scene node.
Definition ISceneNode.hpp:340
const core::list< ISceneNode * > & getChildren() const
Returns a const reference to the list of all children.
Definition ISceneNode.hpp:616
virtual const core::vector3df & getScale() const
Gets the scale of the scene node relative to its parent.
Definition ISceneNode.hpp:477
core::matrix4 AbsoluteTransformation
Absolute transformation of the node.
Definition ISceneNode.hpp:857
virtual void removeAnimators()
Removes all animators from this scene node.
Definition ISceneNode.hpp:405
virtual ESCENE_NODE_TYPE getType() const
Returns type of the scene node.
Definition ISceneNode.hpp:711
ITriangleSelector * TriangleSelector
Pointer to the triangle selector.
Definition ISceneNode.hpp:881
void setSceneManager(ISceneManager *newManager)
Definition ISceneNode.hpp:844
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.
Definition ISceneNode.hpp:47
const core::list< ISceneNodeAnimator * > & getAnimators() const
Get a list of all scene node animators.
Definition ISceneNode.hpp:377
virtual ISceneManager * getSceneManager(void) const
Retrieve the scene manager for this node.
Definition ISceneNode.hpp:793
virtual void render()=0
Renders the node.
virtual void OnRegisterSceneNode()
This method is called just before the rendering process of the whole scene.
Definition ISceneNode.hpp:94
void setIsDebugObject(bool debugObject)
Sets if this scene node is a debug object.
Definition ISceneNode.hpp:598
virtual ITriangleSelector * getTriangleSelector() const
Returns the triangle selector attached to this scene node.
Definition ISceneNode.hpp:648
virtual video::SMaterial & getMaterial(u32 num)
Returns the material based on the zero based index i.
Definition ISceneNode.hpp:423
scene::ISceneNode * getParent() const
Returns the parent of this scene node.
Definition ISceneNode.hpp:703
ESCENE_NODE_UPDATE_ABS UpdateAbsolutePosBehavior
How updateAbsolutePosition calculates AbsoluteTransformation.
Definition ISceneNode.hpp:887
u32 DebugDataVisible
Flag if debug data should be drawn, such as Bounding Boxes.
Definition ISceneNode.hpp:893
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const override
Writes attributes of the scene node.
Definition ISceneNode.hpp:724
virtual void setName(const c8 *name)
Sets the name of the node.
Definition ISceneNode.hpp:157
virtual void setVisible(bool isVisible)
Sets if the node should be visible or not.
Definition ISceneNode.hpp:270
virtual void setDebugDataVisible(u32 state)
Sets if debug data like bounding boxes should be drawn.
Definition ISceneNode.hpp:581
virtual ISceneNode * clone(ISceneNode *newParent=0, ISceneManager *newManager=0)
Creates a clone of this scene node and its children.
Definition ISceneNode.hpp:786
virtual u32 getMaterialCount() const
Get amount of materials used by this scene node.
Definition ISceneNode.hpp:431
virtual const core::aabbox3d< f32 > & getBoundingBox() const =0
Get the axis aligned, not transformed bounding box of this node.
virtual void updateAbsolutePosition()
Updates the absolute tranformation or position based on the relative and the parents transformation.
Definition ISceneNode.hpp:681
virtual void addChild(ISceneNode *child)
Adds a child to this scene node.
Definition ISceneNode.hpp:298
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) override
Reads attributes of the scene node.
Definition ISceneNode.hpp:750
u32 getAutomaticCulling() const
Gets the automatic culling state.
Definition ISceneNode.hpp:559
ESCENE_NODE_UPDATE_ABS getUpdateAbsolutePosBehavior() const
Get how updateAbsolutePosition calculates the absolute transformation matrix.
Definition ISceneNode.hpp:571
virtual core::matrix4 getRelativeTransformation() const
Returns the relative transformation of the scene node.
Definition ISceneNode.hpp:224
virtual void setTriangleSelector(ITriangleSelector *selector)
Sets the triangle selector of the scene node.
Definition ISceneNode.hpp:663
core::vector3df RelativeScale
Relative scale of the scene node.
Definition ISceneNode.hpp:866
virtual const core::vector3df & getRotation() const
Gets the rotation of the node relative to its parent.
Definition ISceneNode.hpp:496
virtual const core::vector3df & getPosition() const
Gets the position of the node relative to its parent.
Definition ISceneNode.hpp:515
void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
Sets all material flags at once to a new value.
Definition ISceneNode.hpp:442
u32 AutomaticCullingState
Automatic culling state.
Definition ISceneNode.hpp:890
virtual void remove()
Removes this scene node from the scene.
Definition ISceneNode.hpp:356
core::list< ISceneNodeAnimator * > Animators
List of all animator nodes.
Definition ISceneNode.hpp:875
void setAutomaticCulling(u32 state)
Set a culling style or disable culling completely.
Definition ISceneNode.hpp:551
void cloneMembers(ISceneNode *toCopyFrom, ISceneManager *newManager)
A clone function for the ISceneNode members.
Definition ISceneNode.hpp:802
s32 ID
ID of the node.
Definition ISceneNode.hpp:884
bool IsDebugObject
Is debug object?
Definition ISceneNode.hpp:899
virtual const core::aabbox3d< f32 > getTransformedBoundingBox() const
Get the axis aligned, transformed and animated absolute bounding box of this node.
Definition ISceneNode.hpp:186
virtual void getTransformedBoundingBoxEdges(core::array< core::vector3d< f32 > > &edges) const
Definition ISceneNode.hpp:198
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.
Definition ISceneNode.hpp:453
virtual void OnAnimate(u32 timeMs)
OnAnimate() is called just before rendering the whole scene.
Definition ISceneNode.hpp:111
core::list< ISceneNode * > Children
List of all children of this node.
Definition ISceneNode.hpp:872
virtual void addAnimator(ISceneNodeAnimator *animator)
Adds an animator which should animate this node.
Definition ISceneNode.hpp:365
virtual ~ISceneNode()
Destructor.
Definition ISceneNode.hpp:65
virtual void removeAnimator(ISceneNodeAnimator *animator)
Removes an animator from this scene node.
Definition ISceneNode.hpp:387
ISceneNode * Parent
Pointer to the parent.
Definition ISceneNode.hpp:869
void setMaterialType(video::E_MATERIAL_TYPE newType)
Sets the material type of all materials in this scene node to a new material type.
Definition ISceneNode.hpp:465
core::vector3df RelativeTranslation
Relative translation of the scene node.
Definition ISceneNode.hpp:860
ISceneManager * SceneManager
Pointer to the scene manager.
Definition ISceneNode.hpp:878
virtual bool isVisible() const
Returns whether the node should be visible (if all of its parents are visible).
Definition ISceneNode.hpp:246
bool isDebugObject() const
Returns if this scene node is a debug object.
Definition ISceneNode.hpp:608
virtual bool removeChild(ISceneNode *child)
Removes a child from this scene node.
Definition ISceneNode.hpp:320
virtual void setName(const core::stringc &name)
Sets the name of the node.
Definition ISceneNode.hpp:165
virtual void setScale(const core::vector3df &scale)
Sets the relative scale of the scene node.
Definition ISceneNode.hpp:485
virtual void setRotation(const core::vector3df &rotation)
Sets the rotation of the node relative to its parent.
Definition ISceneNode.hpp:505
bool IsVisible
Is the node visible?
Definition ISceneNode.hpp:896
virtual core::vector3df getAbsolutePosition() const
Gets the absolute position of the node in world coordinates.
Definition ISceneNode.hpp:539
core::stringc Name
Name of the scene node.
Definition ISceneNode.hpp:854
Interface to return triangles with specific properties.
Definition ITriangleSelector.hpp:74
Interface of a Video Driver dependent Texture.
Definition ITexture.hpp:186
Class for holding parameters for a material renderer.
Definition SMaterial.hpp:304
E_MATERIAL_TYPE MaterialType
Type of the material. Specifies how everything is blended together.
Definition SMaterial.hpp:324
void setFlag(E_MATERIAL_FLAG flag, bool value)
Sets the Material flag to the given value.
Definition SMaterial.hpp:548
void setTexture(u32 i, ITexture *tex)
Sets the i-th texture.
Definition SMaterial.hpp:538
const c8 *const AutomaticCullingNames[]
Names for culling type.
Definition ECullingTypes.hpp:26
@ EDS_OFF
No Debug Data ( Default )
Definition EDebugSceneTypes.hpp:17
const c8 *const SceneNodeUpdateAbsNames[]
Names for culling type.
Definition ESceneNodeUpdateAbs.hpp:24
ESCENE_NODE_UPDATE_ABS
Options how ISceneNode::updateAbsolutePosition calculates the AbsoluteTransformation.
Definition ESceneNodeUpdateAbs.hpp:13
@ ESNUA_TRANSFORM_POSITION
Definition ESceneNodeUpdateAbs.hpp:20
@ ESNUA_TRANSFORM_MATRIX
Node and parent transformation matrices are multiplied (default)
Definition ESceneNodeUpdateAbs.hpp:15
ESCENE_NODE_TYPE
An enumeration for all types of built-in scene nodes.
Definition ESceneNodeTypes.hpp:20
@ ESNT_UNKNOWN
Unknown scene node.
Definition ESceneNodeTypes.hpp:96
JIMCPP_API SMaterial IdentityMaterial
global const identity Material
E_MATERIAL_FLAG
Material flags.
Definition EMaterialFlags.hpp:15
E_MATERIAL_TYPE
Abstracted and easy to use fixed function/programmable pipeline material modes.
Definition EMaterialTypes.hpp:15
const u32 MATERIAL_MAX_TEXTURES
Maximum number of texture an SMaterial can have.
Definition SMaterial.hpp:283
As of Jimcpp 1.6, position2d is a synonym for vector2d.
Definition vector3d.hpp:11
signed int s32
32 bit signed variable.
Definition irrTypes.hpp:72
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.hpp:64
char c8
8 bit character variable.
Definition irrTypes.hpp:37