#include <Scene.h>
List of all members.
Public Member Functions |
const char * | getId () const |
void | setId (const char *id) |
Node * | findNode (const char *id, bool recursive=true, bool exactMatch=true) const |
unsigned int | findNodes (const char *id, std::vector< Node * > &nodes, bool recursive=true, bool exactMatch=true) const |
Node * | addNode (const char *id=NULL) |
void | addNode (Node *node) |
void | removeNode (Node *node) |
void | removeAllNodes () |
unsigned int | getNodeCount () const |
Node * | getFirstNode () const |
Camera * | getActiveCamera () |
void | setActiveCamera (Camera *camera) |
void | bindAudioListenerToCamera (bool bind) |
const Vector3 & | getAmbientColor () const |
void | setAmbientColor (float red, float green, float blue) |
void | update (float elapsedTime) |
template<class T > |
void | visit (T *instance, bool(T::*visitMethod)(Node *)) |
template<class T , class C > |
void | visit (T *instance, bool(T::*visitMethod)(Node *, C), C cookie) |
void | visit (const char *visitMethod) |
Node * | getNext () |
void | reset () |
Static Public Member Functions |
static Scene * | create (const char *id=NULL) |
static Scene * | load (const char *filePath) |
static Scene * | getScene (const char *id=NULL) |
Detailed Description
Member Function Documentation
Creates and adds a new node to the scene.
- Parameters:
-
- Returns:
- The new node.
Adds the specified node to the scene.
- Parameters:
-
node | The node to be added to the scene. |
Sets the audio listener to transform along with the active camera if set to true. If you have a 2D game that doesn't require it, then set to false. This is on by default for the scene.
- Parameters:
-
bind | true if you want to the audio listener to follow the active camera's transform. |
Creates a new empty scene.
- Parameters:
-
id | ID of the new scene, or NULL to use an empty string for the ID (default). |
- Returns:
- The newly created empty scene.
Returns the first node in the scene that matches the given ID.
- Parameters:
-
id | The ID of the node to find. |
recursive | true if a recursive search should be performed, false otherwise. |
exactMatch | true if only nodes whose ID exactly matches the specified ID are returned, or false if nodes that start with the given ID are returned. |
- Returns:
- The first node found that matches the given ID.
Returns all nodes in the scene that match the given ID.
- Parameters:
-
id | The ID of the node to find. |
nodes | Vector of nodes to be populated with matches. |
recursive | true if a recursive search should be performed, false otherwise. |
exactMatch | true if only nodes who's ID exactly matches the specified ID are returned, or false if nodes that start with the given ID are returned. |
- Returns:
- The number of matches found.
Gets the active camera for the scene.
- Returns:
- The active camera for the scene.
- See also:
- VisibleSet::getActiveCamera
Returns the ambient color of the scene.
The default ambient light color is black (0,0,0).
This value can be bound to materials using the SCENE_LIGHT_AMBIENT_COLOR auto binding.
- Returns:
- The scene's ambient color.
Returns the first node in the scene.
- Returns:
- The first node in the scene.
Gets the identifier for the scene.
- Returns:
- The scene identifier.
- See also:
- VisibleSet::getNext
Returns the number of nodes at the root level of the scene.
- Returns:
- The node count.
Gets a currently active scene.
If id is an NULL, the first active scene is returned.
- Parameters:
-
id | ID of the scene to retrieve, or NULL to retrieve the first active scene. |
- Returns:
- The scene that matches the specified ID, or NULL if no matching scene could be found.
Loads a scene from the given '.scene' or '.gpb' file.
- Parameters:
-
filePath | The path to the '.scene' or '.gpb' file to load from. |
- Returns:
- The loaded scene or
NULL
if the scene could not be loaded from the given file.
Removes all nodes from the scene.
Removes the specified node from the scene.
- Parameters:
-
- See also:
- VisibleSet::reset
Sets the active camera on the scene.
- Parameters:
-
camera | The active camera to be set on the scene. |
Sets the ambient color of the scene.
- Parameters:
-
red | The red channel between 0.0 and 1.0. |
green | The green channel between 0.0 and 1.0. |
blue | The blue channel between 0.0 and 1.0. |
- See also:
- getAmbientColor()
Sets the identifier for the scene.
- Parameters:
-
id | The identifier to set for the scene. |
Updates all active nodes in the scene.
This method is recursively calls the Node::update(float) method on all nodes that are active within the scene. A Node is considered active if Node::isActive() returns true.
- Parameters:
-
elapsedTime | Elapsed time in milliseconds. |
Visits each node in the scene and calls the specified method pointer.
Calling this method invokes the specified method pointer for each node in the scene hierarchy.
The visitMethod parameter must be a pointer to a method that has a bool return type and accepts a single parameter of type Node*.
A depth-first traversal of the scene continues while the visit method returns true. Returning false will stop traversing further children for the given node and the traversal will continue at the next sibling.
- Parameters:
-
instance | The pointer to an instance of the object that contains visitMethod. |
visitMethod | The pointer to the class method to call for each node in the scene. |
template<class T , class C >
Visits each node in the scene and calls the specified method pointer.
Calling this method invokes the specified method pointer for each node in the scene hierarchy, passing the Node and the specified cookie value.
The visitMethod parameter must be a pointer to a method that has a bool return type and accepts two parameters: a Node pointer and a cookie of a user-specified type.
A depth-first traversal of the scene continues while the visit method returns true. Returning false will stop traversing further children for the given node and the traversal will continue at the next sibling.
- Parameters:
-
instance | The pointer to an instance of the object that contains visitMethod. |
visitMethod | The pointer to the class method to call for each node in the scene. |
cookie | An optional user-defined parameter that will be passed to each invocation of visitMethod. |
Visits each node in the scene and calls the specified Lua function.
Calling this method invokes the specified Lua function for each node in the scene hierarchy.
The visitMethod parameter must be a string containing the name of a valid Lua function that has a boolean return type and accepts a single parameter of type Node*.
A depth-first traversal of the scene continues while the visit method returns true. Returning false will stop traversing further children for the given node and the traversal will continue at the next sibling.
- Parameters:
-
visitMethod | The name of the Lua function to call for each node in the scene. |