SceneNode Class Reference
[Nodes]

Node used to represent an entire scene or world. More...

#include <SceneNode.h>

Inheritance diagram for SceneNode:

Inheritance graph
[legend]
Collaboration diagram for SceneNode:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SceneNode (bool manageMemory=false)
 Construct a new SceneNode.
void init ()
 Initialises the rendering state.
void updateScene (float delta)
 Steps the world forward in time by some amount.
void setActiveCamera (Camera *camera)
 Sets the active Camera.
CameragetActiveCamera ()
 Returns the active Camera or 0 if none.
void setInputSystem (InputSystem *input)
 Assign an InputSystem to this SceneNode.
InputSystemgetInputSystem ()
 Get the InputSystem used by this SceneNode or 0 for none.
Vector2f screenToWorld (const Vector2f &coord)
 Convert from screen to world coordinates.
Vector2f worldToScreen (const Vector2f &coord)
 Convert from world to screen coordinates.
void disablePhysics ()
 Disables physics stepping for this SceneNode.
void enablePhysics ()
 Enables physics stepping for this SceneNode.
void createPhysicsWorld (const Vector2f &minPoint, const Vector2f &maxPoint, const Vector2f &gravity)
 Creates a physics world for this SceneNode with given parameters.
void setPhysicsWorld (b2World *world)
 Assign a new physics world to this SceneNode.
b2World * getPhysicsWorld ()
 Get the physics world for this SceneNode.
void addPhysicsObject (Shape *shape)
 Add a physically controlled Shape to this scene.
void setBackgroundColour (const Colour4f &colour)
 Sets the background colour of the renderer.
Colour4f getBackgroundColour () const
 Gets the background colour of the renderer.
void draw ()
 Performs per-frame rendering initialisation and set up.


Detailed Description

Node used to represent an entire scene or world.

This Node should generally be used as the root node of the scene graph. It handles the InputSystem, physics simulation, the active camera, and other properties.


Constructor & Destructor Documentation

SceneNode::SceneNode ( bool  manageMemory = false  ) 

Construct a new SceneNode.

By default, SceneNodes do not enable automatic scene graph management. Setting the manageMemory parameter to true will change this. SceneNodes which manage memory will automatically delete Nodes and Controllers that have been disconnected or are no longer used.

Parameters:
manageMemory determines whether automatic scene graph management is enabled.


Member Function Documentation

void SceneNode::updateScene ( float  delta  ) 

Steps the world forward in time by some amount.

This method will update physics, update all Controllers, and delete any objects scheduled for deletion.

Parameters:
delta amount of time to step the world

void SceneNode::setActiveCamera ( Camera camera  ) 

Sets the active Camera.

The active Camera transforms the rendering state before other drawing operations take place.

Parameters:
camera Camera to set as active

void SceneNode::setInputSystem ( InputSystem input  ) 

Assign an InputSystem to this SceneNode.

The assigned InputSystem is updated in the updateScene(float) method.

Parameters:
input InputSystem for SceneNode to use

Vector2f SceneNode::screenToWorld ( const Vector2f coord  ) 

Convert from screen to world coordinates.

This method uses the currently active Camera to transform a point into world coordinates.

Parameters:
coord screen position to translate
Returns:
position in world coordinates

Vector2f SceneNode::worldToScreen ( const Vector2f coord  ) 

Convert from world to screen coordinates.

This method uses the currently active Camera to transform a point into screen coordinates.

Parameters:
coord world position to translate
Returns:
position in screen coordinates

void SceneNode::disablePhysics (  ) 

Disables physics stepping for this SceneNode.

This can be used to pause the physics in a game or application. Only applicable to SceneNodes which contain a physics world.

See also:
createPhysicsWorld(const Vector2f&,const Vector2f&,const Vector2f&)

void SceneNode::enablePhysics (  ) 

Enables physics stepping for this SceneNode.

This can be used to resume the physics in a game or application. Only applicable to SceneNodes which contain a physics world.

See also:
createPhysicsWorld(const Vector2f&,const Vector2f&,const Vector2f&)

void SceneNode::createPhysicsWorld ( const Vector2f minPoint,
const Vector2f maxPoint,
const Vector2f gravity 
)

Creates a physics world for this SceneNode with given parameters.

Creates a world using the Box2D API with specific bounds and gravity.

See also:
b2World
Parameters:
minPoint minimum point in the world's bounding box
maxPoint maximum point in the world's bounding box
gravity vector describing the direction and intensity of gravity

void SceneNode::addPhysicsObject ( Shape shape  ) 

Add a physically controlled Shape to this scene.

This method is a convenience method, it simply creates a PhysicsController for the specified Shape, adds the controller to the InputSystem and attaches the Shape to the scene graph.

See also:
PhysicsController
Parameters:
shape Shape to attach


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

Generated on Fri Feb 22 15:56:23 2008 for Scene2D by  doxygen 1.5.5