Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
scene::Node Class Reference

#include <Node.h>

Inheritance diagram for scene::Node:
engine::Object physics::Body render::Camera render::Light render::Renderable scene::GroupNode scene::RootNode sound::Listener sound::Sound

List of all members.

Public Member Functions

void addChild (Node *child)
 Adds a child node to this node.
NodecreateChild (const core::vector3d &pos=core::vector3d::ORIGIN_3D, const core::quaternion &rot=core::quaternion::IDENTITY, const core::vector3d &scale=core::vector3d::UNIT_SCALE)
 Creates a new node as a child of this node.
const core::vector3d getAbsoluteDirection ()
 Gets the nodes's direction vector,i.e. its absolute z-axis.
const core::quaterniongetAbsoluteOrientation ()
 Gets the orientation of the node as derived from all parents.
const core::vector3dgetAbsolutePosition ()
 Gets the position of the node as derived from all parents.
const core::vector3d getAbsoluteRight ()
 Retrieves the nodes's 'right' vector, i.e. its absolute x-axis.
const core::vector3dgetAbsoluteScale ()
 Gets the scaling factor of the node as derived from all parents.
const core::vector3d getAbsoluteUp ()
 Retrieves the nodes's 'up' vector, i.e. its absolute y-axis.
NodegetChild (const u32 &id) const
 Gets a pointer to a child node.
const std::map< u32, Node * > & getChildren ()
const core::vector3d getDirection ()
 Gets the node's direction vector,i.e. its local z-axis.
bool getInheritOrientation ()
 Returns true if this node is affected by orientation applied to the parent node.
bool getInheritScale ()
 Returns true if this node is affected by scaling factors applied to the parent node.
const NodeTypegetNodeType () const
 Gets node type.
u16 getNumberOfChildren ()
 Gets the number of child nodes under this one.
const core::quaterniongetOrientation ()
 Gets the orientation of this node.
NodegetParent ()
 Gets this node's parent.
const core::vector3dgetPosition ()
 Gets the position of the node relative to it's parent.
const core::vector3d getRight ()
 Retrieves the nodes's 'right' vector, i.e. its local x-axis.
const core::vector3dgetScale ()
 Gets the scaling factor of this node.
const core::vector3d getUp ()
 Retrieves the node's 'up' vector, i.e. its local y-axis.
 Node ()
 Node (const std::string &name)
void removeAllChildren ()
 Removes all child Nodes attached to this node. Does not delete the node, just detaches it from.
void removeChild (Node *child)
NoderemoveChild (const u32 &id)
virtual void rotate (const core::quaternion &q, TransformSpace relativeTo=TS_LOCAL)
virtual void rotate (const f32 &degrees, const core::vector3d &axis, TransformSpace relativeTo=TS_LOCAL)
virtual void rotateX (f32 degrees, TransformSpace relativeTo=TS_LOCAL)
virtual void rotateY (f32 degrees, TransformSpace relativeTo=TS_LOCAL)
virtual void rotateZ (f32 degrees, TransformSpace relativeTo=TS_LOCAL)
virtual void scale (const core::vector3d &scale)
void setInheritOrientation (bool inherit)
 Tells the node whether it should inherit orientation from it's parent node.
void setInheritScale (bool inherit)
 Tells the node whether it should inherit scaling factors from it's parent node.
virtual void setOrientation (const core::quaternion &q)
 Sets the orientation applied to this node.
void setParent (Node *parent)
 Sets this node's parent.
virtual void setPosition (f32 x, f32 y, f32 z)
 Sets the position of the node relative to it's parent.
virtual void setPosition (const core::vector3d &pos)
void setScale (f32 x, f32 y, f32 z)
 Sets the scaling factor applied to this node.
void setScale (const core::vector3d &scale)
virtual void translate (const core::vector3d &d, TransformSpace relativeTo=TS_LOCAL)
virtual ~Node ()

Protected Member Functions

void initProperties ()
virtual void updateImpl (f32 elapsedTime)
virtual void updateTransformImpl ()

Protected Attributes

core::quaternion mAbsoluteOrientation
core::vector3d mAbsolutePosition
 Cached combined position.
core::vector3d mAbsoluteScale
 Cached combined scale.
std::map< u32, Node * > mChildren
 Central list of children.
bool mInheritOrientation
 Stores whether this node inherits orientation from it's parent.
bool mInheritScale
 Stores whether this node inherits scale from it's parent.
bool mModifiedAbsoluteTransform
 Flag indicating derived transform was modified.
NodeType mNodeType
core::quaternion mOrientation
 Stores the orientation of the node relative to it's parent.
NodemParent
core::vector3d mPosition
 Stores the position/translation of the node relative to its parent.
core::vector3d mScale
 Stores the scaling factor applied to this node.

Static Protected Attributes

static u32 msNextGeneratedNodeIndex = 0
 Incremented count for next index.

Detailed Description

Class representing a node in the scene graph. A node in the scene graph is a node in a large tree containing all objects in the scene. A node contains information about the transformation which will apply to it and all of it's children.


Constructor & Destructor Documentation

scene::Node::Node ( )
scene::Node::Node ( const std::string &  name)
scene::Node::~Node ( ) [virtual]

Member Function Documentation

void scene::Node::addChild ( Node child)
Node * scene::Node::createChild ( const core::vector3d pos = core::vector3d::ORIGIN_3D,
const core::quaternion rot = core::quaternion::IDENTITY,
const core::vector3d scale = core::vector3d::UNIT_SCALE 
)

Creates a new node as a child of this node.

References engine::Object::getID(), mChildren, mParent, Node(), rotate(), scale(), translate(), and updateTransformImpl().

const core::vector3d scene::Node::getAbsoluteDirection ( )

Gets the nodes's direction vector,i.e. its absolute z-axis.

References mAbsoluteOrientation, and core::vector3d::NEGATIVE_UNIT_Z.

Referenced by render::ShaderParamData::getCurrentLightDirection().

const core::quaternion & scene::Node::getAbsoluteOrientation ( )

Gets the orientation of the node as derived from all parents.

References mAbsoluteOrientation.

Referenced by render::RenderManager::renderSingleRenderable(), rotate(), render::Camera::rotate(), translate(), and updateTransformImpl().

const core::vector3d & scene::Node::getAbsolutePosition ( )
const core::vector3d scene::Node::getAbsoluteRight ( )

Retrieves the nodes's 'right' vector, i.e. its absolute x-axis.

References mAbsoluteOrientation, and core::vector3d::UNIT_X.

const core::vector3d & scene::Node::getAbsoluteScale ( )

Gets the scaling factor of the node as derived from all parents.

References mAbsoluteScale.

Referenced by translate(), and updateTransformImpl().

const core::vector3d scene::Node::getAbsoluteUp ( )

Retrieves the nodes's 'up' vector, i.e. its absolute y-axis.

References mAbsoluteOrientation, and core::vector3d::UNIT_Y.

Node * scene::Node::getChild ( const u32 id) const

Gets a pointer to a child node.

References mChildren.

Referenced by scene::GroupNode::getNode().

const std::map< u32, Node * > & scene::Node::getChildren ( )

References mChildren.

const core::vector3d scene::Node::getDirection ( )

Gets the node's direction vector,i.e. its local z-axis.

References mOrientation, and core::vector3d::NEGATIVE_UNIT_Z.

bool scene::Node::getInheritOrientation ( )

Returns true if this node is affected by orientation applied to the parent node.

References mInheritOrientation.

bool scene::Node::getInheritScale ( )

Returns true if this node is affected by scaling factors applied to the parent node.

References mInheritScale.

const NodeType & scene::Node::getNodeType ( ) const

Gets node type.

References mNodeType.

Referenced by scene::Scene::removeAllNodes().

u16 scene::Node::getNumberOfChildren ( )

Gets the number of child nodes under this one.

References mChildren.

Referenced by scene::GroupNode::getNumberOfNodes().

const core::quaternion & scene::Node::getOrientation ( )

Gets the orientation of this node.

References mOrientation.

Node * scene::Node::getParent ( )

Gets this node's parent.

References mParent.

const core::vector3d & scene::Node::getPosition ( )

Gets the position of the node relative to it's parent.

References mPosition.

const core::vector3d scene::Node::getRight ( )

Retrieves the nodes's 'right' vector, i.e. its local x-axis.

References mOrientation, and core::vector3d::UNIT_X.

const core::vector3d & scene::Node::getScale ( )

Gets the scaling factor of this node.

References mScale.

const core::vector3d scene::Node::getUp ( )

Retrieves the node's 'up' vector, i.e. its local y-axis.

References mOrientation, and core::vector3d::UNIT_Y.

void scene::Node::initProperties ( ) [protected]
void scene::Node::removeAllChildren ( )

Removes all child Nodes attached to this node. Does not delete the node, just detaches it from.

References mChildren.

Referenced by scene::GroupNode::removeAllNodes(), and ~Node().

Node * scene::Node::removeChild ( const u32 id)

References mChildren, and mParent.

void scene::Node::removeChild ( Node child)
void scene::Node::rotate ( const core::quaternion q,
TransformSpace  relativeTo = TS_LOCAL 
) [virtual]
void scene::Node::rotate ( const f32 degrees,
const core::vector3d axis,
TransformSpace  relativeTo = TS_LOCAL 
) [virtual]

Reimplemented in render::Camera.

References core::quaternion::fromDegreeAxis(), and rotate().

void scene::Node::rotateX ( f32  degrees,
TransformSpace  relativeTo = TS_LOCAL 
) [virtual]

Reimplemented in render::Camera.

References rotate(), and core::vector3d::UNIT_X.

void scene::Node::rotateY ( f32  degrees,
TransformSpace  relativeTo = TS_LOCAL 
) [virtual]

Reimplemented in render::Camera.

References rotate(), and core::vector3d::UNIT_Y.

void scene::Node::rotateZ ( f32  degrees,
TransformSpace  relativeTo = TS_LOCAL 
) [virtual]

Reimplemented in render::Camera.

References rotate(), and core::vector3d::UNIT_Z.

void scene::Node::scale ( const core::vector3d scale) [virtual]
void scene::Node::setInheritOrientation ( bool  inherit)

Tells the node whether it should inherit orientation from it's parent node.

References mInheritOrientation.

void scene::Node::setInheritScale ( bool  inherit)

Tells the node whether it should inherit scaling factors from it's parent node.

References mInheritScale.

void scene::Node::setOrientation ( const core::quaternion q) [virtual]

Sets the orientation applied to this node.

References mModifiedAbsoluteTransform, and mOrientation.

void scene::Node::setParent ( Node parent)
void scene::Node::setPosition ( f32  x,
f32  y,
f32  z 
) [virtual]

Sets the position of the node relative to it's parent.

References mModifiedAbsoluteTransform, mPosition, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.

void scene::Node::setPosition ( const core::vector3d pos) [virtual]
void scene::Node::setScale ( f32  x,
f32  y,
f32  z 
)

Sets the scaling factor applied to this node.

References mModifiedAbsoluteTransform, mScale, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.

void scene::Node::setScale ( const core::vector3d scale)
void scene::Node::translate ( const core::vector3d d,
TransformSpace  relativeTo = TS_LOCAL 
) [virtual]
void scene::Node::updateImpl ( f32  elapsedTime) [protected, virtual]

Reimplemented from engine::Object.

Reimplemented in render::Camera, render::Model, and render::Overlay.

References updateTransformImpl().

void scene::Node::updateTransformImpl ( ) [protected, virtual]

Member Data Documentation

Cached combined orientation. This member is the orientation derived by combining the local transformations and those of it's parents.

Referenced by getAbsoluteDirection(), getAbsoluteOrientation(), getAbsoluteRight(), getAbsoluteUp(), initProperties(), render::Model::updateImpl(), updateTransformImpl(), render::Camera::updateView(), render::Overlay::updateWorldTransform(), and render::Model::updateWorldTransform().

std::map<u32, Node*> scene::Node::mChildren [protected]

Stores whether this node inherits orientation from it's parent.

Referenced by getInheritOrientation(), initProperties(), setInheritOrientation(), and updateTransformImpl().

bool scene::Node::mInheritScale [protected]

Stores whether this node inherits scale from it's parent.

Referenced by getInheritScale(), initProperties(), setInheritScale(), and updateTransformImpl().

Node* scene::Node::mParent [protected]

Stores the position/translation of the node relative to its parent.

Referenced by getPosition(), initProperties(), render::Camera::lookAt(), render::Light::operator=(), setPosition(), render::Overlay::setPosition(), translate(), and updateTransformImpl().

Stores the scaling factor applied to this node.

Referenced by getScale(), initProperties(), render::Light::operator=(), scale(), setScale(), and updateTransformImpl().

u32 scene::Node::msNextGeneratedNodeIndex = 0 [static, protected]

Incremented count for next index.


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:10 by Doxygen (1.7.4)