A scene graph node. More...
#include <SceneNode.h>
Public Types | |
typedef SetIterator< string > | FlagIterator |
An iterator to iterate over a set of flags. | |
typedef MapIterator< string, ptr< Value > > | ValueIterator |
An iterator to iterate over a map of Value. | |
typedef MapIterator< string, ptr< Module > > | ModuleIterator |
An iterator to iterate over a map of Module. | |
typedef MapIterator< string, ptr< MeshBuffers > > | MeshIterator |
An iterator to iterate over a map of Mesh. | |
typedef MapIterator< string, ptr< Object > > | FieldIterator |
An iterator to iterate over a map of SceneNode fields. | |
typedef MapIterator< string, ptr< Method > > | MethodIterator |
An iterator to iterate over a map of SceneNode Method. | |
Public Member Functions | |
SceneNode () | |
Creates an empty SceneNode. | |
virtual | ~SceneNode () |
Deletes this SceneNode. | |
ptr< SceneManager > | getOwner () |
Returns the SceneManager that manages the scene graph to which this node belongs. | |
mat4d | getLocalToParent () |
Returns the transformation from this node to its parent node. | |
void | setLocalToParent (const mat4d &t) |
Sets the transformation from this node to its parent node. | |
mat4d | getLocalToWorld () |
Returns the transformation from this node to the root node. | |
mat4d | getWorldToLocal () |
Returns the transformation from the root node to this node. | |
mat4d | getLocalToCamera () |
Returns the transformation from this node to the camera node. | |
mat4d | getLocalToScreen () |
Returns the tranformation from this node to the screen. | |
box3d | getLocalBounds () |
Returns the bounding box of this node in local coordinates. | |
void | setLocalBounds (const box3d &bounds) |
Sets the bounding box of this node in local coordinates. | |
box3d | getWorldBounds () |
Returns the bounding box of this node in world coordinates. | |
vec3d | getWorldPos () |
Returns the origin of the local reference frame in world coordinates. | |
FlagIterator | getFlags () |
Returns the flags of this node. | |
bool | hasFlag (const string &flag) |
Returns true is this node has the given flag. | |
void | addFlag (const string &flag) |
Adds the given flag to the flags of this node. | |
void | removeFlag (const string &flag) |
Removes the given flag from the flags of this node. | |
ValueIterator | getValues () |
Returns the values of this node. | |
ptr< Value > | getValue (const string &name) |
Returns the value of this node whose local name is given. | |
void | addValue (ptr< Value > value) |
Adds a value to this node under the given local name. | |
void | removeValue (const string &name) |
Removes the value whose local name is given from this node. | |
ModuleIterator | getModules () |
Returns the modules of this node. | |
ptr< Module > | getModule (const string &name) |
Returns the module of this node whose local name is given. | |
void | addModule (const string &name, ptr< Module > s) |
Adds a module to this node under the given local name. | |
void | removeModule (const string &name) |
Removes the module whose local name is given from this node. | |
MeshIterator | getMeshes () |
Returns the meshes of this node. | |
ptr< MeshBuffers > | getMesh (const string &name) |
Returns the mesh of this node whose local name is given. | |
void | addMesh (const string &name, ptr< MeshBuffers > m) |
Adds a mesh to this node under the given local name. | |
void | removeMesh (const string &name) |
Removes the mesh whose local name is given from this node. | |
FieldIterator | getFields () |
Returns the fields of this node. | |
ptr< Object > | getField (const string &name) |
Returns the field of this node whose name is given. | |
void | addField (const string &name, ptr< Object > f) |
Adds a field to this node under the given name. | |
void | removeField (const string &name) |
Removes the field whose name is given from this node. | |
MethodIterator | getMethods () |
Returns the methods of this node. | |
ptr< Method > | getMethod (const string &name) |
Returns the method of this node whose name is given. | |
void | addMethod (const string &name, ptr< Method > m) |
Adds a method to this node under the given name. | |
void | removeMethod (const string &name) |
Removes the method whose name is given from this node. | |
unsigned int | getChildrenCount () |
Returns the number of child node of this node. | |
ptr< SceneNode > | getChild (unsigned int index) |
Returns the child node of this node whose index is given. | |
void | addChild (ptr< SceneNode > child) |
Adds a child node to this node. | |
void | removeChild (unsigned int index) |
Removes a child node from this node. | |
Public Attributes | |
bool | isVisible |
True if this scene node is visible, false otherwise. | |
Protected Member Functions | |
void | swap (ptr< SceneNode > n) |
Swaps this scene node with the given one. |
A scene graph node.
A scene graph is a tree of generic scene nodes, where each node can be seen as an object with a state (fields) and a behavior (methods). The state is made of a reference frame (relatively to the parent node), some meshes, modules and uniforms (that can reference textures), and any other user defined values. The behavior is made of methods, completely defined by the user by combining basic tasks (draw a mesh, set a projection matrix, etc) with control structures (sequences, loops, etc).
typedef MapIterator<string, ptr<Object> > ork::SceneNode::FieldIterator |
An iterator to iterate over a map of SceneNode fields.
typedef SetIterator<string> ork::SceneNode::FlagIterator |
An iterator to iterate over a set of flags.
typedef MapIterator<string, ptr<MeshBuffers> > ork::SceneNode::MeshIterator |
An iterator to iterate over a map of Mesh.
typedef MapIterator<string, ptr<Method> > ork::SceneNode::MethodIterator |
typedef MapIterator<string, ptr<Module> > ork::SceneNode::ModuleIterator |
An iterator to iterate over a map of Module.
typedef MapIterator<string, ptr<Value> > ork::SceneNode::ValueIterator |
An iterator to iterate over a map of Value.
ork::SceneNode::SceneNode | ( | ) |
Creates an empty SceneNode.
virtual ork::SceneNode::~SceneNode | ( | ) | [virtual] |
Deletes this SceneNode.
Adds a child node to this node.
child | a child node. |
Adds a field to this node under the given name.
name | the field name. | |
f | the field value. |
void ork::SceneNode::addFlag | ( | const string & | flag | ) |
Adds the given flag to the flags of this node.
flag | the flag to be added to this node. |
void ork::SceneNode::addMesh | ( | const string & | name, | |
ptr< MeshBuffers > | m | |||
) |
Adds a mesh to this node under the given local name.
name | a local name. | |
m | a MeshBuffers. |
Adds a method to this node under the given name.
name | the method name. | |
m | the method. |
Adds a module to this node under the given local name.
name | a local name. | |
s | a Module. |
Adds a value to this node under the given local name.
value | a value. |
Returns the child node of this node whose index is given.
index | a child node index between 0 and getChildrenCount - 1. |
unsigned int ork::SceneNode::getChildrenCount | ( | ) |
Returns the number of child node of this node.
Returns the field of this node whose name is given.
name | the name of a field. |
FieldIterator ork::SceneNode::getFields | ( | ) |
Returns the fields of this node.
FlagIterator ork::SceneNode::getFlags | ( | ) |
Returns the flags of this node.
box3d ork::SceneNode::getLocalBounds | ( | ) |
Returns the bounding box of this node in local coordinates.
mat4d ork::SceneNode::getLocalToCamera | ( | ) |
Returns the transformation from this node to the camera node.
mat4d ork::SceneNode::getLocalToParent | ( | ) |
Returns the transformation from this node to its parent node.
mat4d ork::SceneNode::getLocalToScreen | ( | ) |
Returns the tranformation from this node to the screen.
This is the transformation from this node to the camera node, followed by the transformation from the camera space to the screen space (defined by the cameraToScreen mat4 uniform of the camera node).
mat4d ork::SceneNode::getLocalToWorld | ( | ) |
Returns the transformation from this node to the root node.
ptr<MeshBuffers> ork::SceneNode::getMesh | ( | const string & | name | ) |
Returns the mesh of this node whose local name is given.
name | the local name of a mesh. |
MeshIterator ork::SceneNode::getMeshes | ( | ) |
Returns the meshes of this node.
Returns the method of this node whose name is given.
name | the name of a method. |
MethodIterator ork::SceneNode::getMethods | ( | ) |
Returns the methods of this node.
Returns the module of this node whose local name is given.
name | the local name of a module. |
ModuleIterator ork::SceneNode::getModules | ( | ) |
Returns the modules of this node.
ptr<SceneManager> ork::SceneNode::getOwner | ( | ) |
Returns the SceneManager that manages the scene graph to which this node belongs.
Returns the value of this node whose local name is given.
name | the local name of a value. |
ValueIterator ork::SceneNode::getValues | ( | ) |
Returns the values of this node.
box3d ork::SceneNode::getWorldBounds | ( | ) |
Returns the bounding box of this node in world coordinates.
vec3d ork::SceneNode::getWorldPos | ( | ) |
Returns the origin of the local reference frame in world coordinates.
mat4d ork::SceneNode::getWorldToLocal | ( | ) |
Returns the transformation from the root node to this node.
bool ork::SceneNode::hasFlag | ( | const string & | flag | ) |
Returns true is this node has the given flag.
flag | a flag. |
void ork::SceneNode::removeChild | ( | unsigned int | index | ) |
Removes a child node from this node.
index | a child node index between 0 and getChildrenCount - 1. |
void ork::SceneNode::removeField | ( | const string & | name | ) |
Removes the field whose name is given from this node.
name | the name of the field. |
void ork::SceneNode::removeFlag | ( | const string & | flag | ) |
Removes the given flag from the flags of this node.
flag | the flag to be removed from this node. |
void ork::SceneNode::removeMesh | ( | const string & | name | ) |
Removes the mesh whose local name is given from this node.
name | the local name of the mesh. |
void ork::SceneNode::removeMethod | ( | const string & | name | ) |
Removes the method whose name is given from this node.
name | the name of the method. |
void ork::SceneNode::removeModule | ( | const string & | name | ) |
Removes the module whose local name is given from this node.
name | the local name of the module. |
void ork::SceneNode::removeValue | ( | const string & | name | ) |
Removes the value whose local name is given from this node.
name | the local name of the value. |
void ork::SceneNode::setLocalBounds | ( | const box3d & | bounds | ) |
Sets the bounding box of this node in local coordinates.
void ork::SceneNode::setLocalToParent | ( | const mat4d & | t | ) |
Sets the transformation from this node to its parent node.
t | the new localToParent transformation. |
Swaps this scene node with the given one.
True if this scene node is visible, false otherwise.