#include <PhSceneManager.h>
Public Member Functions | |
PhSceneManager (PhRenderSystem *s) | |
Constructor. | |
~PhSceneManager () | |
Destructor. | |
PhRenderSystem * | getRenderSystem () |
Get render system call. | |
void | addNode (PhSceneNode *ptr) |
Adds a scene node to the list. | |
void | removeNode (PhSceneNode *ptr) |
Removes a node from the list. | |
void | registerForRendering (PhSceneNode *ptr) |
Register a node to be rendered. | |
void | drawAll () |
Does one step for all the nodes. | |
PhPolygonCollisionHandler * | getCollisionHandler () |
Gets the collision handler. | |
void | setCollisionHandler (PhPolygonCollisionHandler *a) |
Sets a collision handler. | |
PhView * | getView () |
Gets the current view. | |
void | setView (PhView *a) |
Sets the current view. | |
void | setView (int x, int y) |
Sets the current view. | |
Protected Attributes | |
PhRenderSystem * | system |
Pointer to phoenix::PhRenderSystem. | |
std::vector< PhSceneNode * > | nodes |
Vector containing all the nodes. | |
std::vector< PhSceneNode * > | rendernodes |
List of nodes to be rendered. | |
PhPolygonCollisionHandler * | colhandle |
Pointer to the collision handler. | |
int | nodecount |
Number of nodes. | |
int | rnodecount |
Number of nodes to be rendered. | |
PhView * | defview |
The default view. |
This is the phoenix scene manager. This allows for a representation of all objects in the game through the use of nodes. All objects are nodes and all nodes are dervied from phoenix::PhSceneNode. This class organizes and manages all scene nodes.
phoenix::PhSceneManager::PhSceneManager | ( | PhRenderSystem * | s | ) |
Constructor.
Simply makes a new scenemanager that uses the defined rendersystem
s | A pointer to the rendersystem that every object will use. |
phoenix::PhSceneManager::~PhSceneManager | ( | ) |
Destructor.
Deletes all nodes in the list.
PhRenderSystem* phoenix::PhSceneManager::getRenderSystem | ( | ) |
Get render system call.
Returns a pointer to the render system used by this scenemanger.
void phoenix::PhSceneManager::addNode | ( | PhSceneNode * | ptr | ) |
Adds a scene node to the list.
Pushes a scene node onto the list.
ptr | A pointer to phoenix::PhSceneNode. |
void phoenix::PhSceneManager::removeNode | ( | PhSceneNode * | ptr | ) |
Removes a node from the list.
Finds and removes the node given from the list. Does not actually delete the node.
ptr | A pointer to phoenix::PhSceneNode. |
void phoenix::PhSceneManager::registerForRendering | ( | PhSceneNode * | ptr | ) |
Register a node to be rendered.
Registers a scene node to the lists of nodes to be rendered. This list is depth sorted after the pre render pass and then only the nodes in this list have their phoenix::PhSceneNode::onRender() function called.
ptr | A pointer to phoenix::PhSceneNode. |
void phoenix::PhSceneManager::drawAll | ( | ) |
Does one step for all the nodes.
This function's name is a bit misleading (change in future versions?). This call is the main point of the scene manager. It does the following: 1) Calls onPreRender() for all the nodes 2) If applicable, check for collisions 3) Sorts all the nodes to be "drawn" 4) Calls onRender() for the sorted nodes in order 5) Calls onPostRender() for all nodes.
PhPolygonCollisionHandler* phoenix::PhSceneManager::getCollisionHandler | ( | ) |
Gets the collision handler.
This gets the currently collision handler that the scene manager is using to test collisions with.
void phoenix::PhSceneManager::setCollisionHandler | ( | PhPolygonCollisionHandler * | a | ) |
Sets a collision handler.
This sets the collision manager that the scene manager will use to check for collisions. If this is set, then phoenix::PhPolygonCollisionHandler::testCollisions() is called after every prerender pass. If it is null then of course nothing happens.
a | A pointer to phoenix::PhPolygonCollisionHandler. |
PhView* phoenix::PhSceneManager::getView | ( | ) |
Gets the current view.
Simply returns a pointer to the current view used by the scene manager.
void phoenix::PhSceneManager::setView | ( | PhView * | a | ) |
Sets the current view.
Sets the current view to the given view.
a | a pointer to the new view |
void phoenix::PhSceneManager::setView | ( | int | x, | |
int | y | |||
) |
Sets the current view.
Lazy version that simply changes the x and y of the current view.
x | The new X coordinate of the view. | |
y | The new Y coordinate of the view. |
PhRenderSystem* phoenix::PhSceneManager::system [protected] |
Pointer to phoenix::PhRenderSystem.
Stores a pointer the render system used to draw all the nodes.
std::vector<PhSceneNode*> phoenix::PhSceneManager::nodes [protected] |
Vector containing all the nodes.
This is a vector that contains pointers to every node in the scene graph.
std::vector<PhSceneNode*> phoenix::PhSceneManager::rendernodes [protected] |
List of nodes to be rendered.
This is a list of all nodes that call registerForRendering(), it is sorted and used to call phoenix::PhSceneNode::onRender() in order.
Pointer to the collision handler.
This holds a pointer to phoenix::PhPolygonCollisionHanlder. When this is not null, the scene manager takes care of checking for collisions and does it after the pre-render sweep and before the render sweep.
int phoenix::PhSceneManager::nodecount [protected] |
Number of nodes.
A simple count of all the nodes, probably not needed. (Could use std::vector::size())
int phoenix::PhSceneManager::rnodecount [protected] |
Number of nodes to be rendered.
A simple count of all the nodes to be rendered, probably not needed. (Could use std::vector::size())
PhView* phoenix::PhSceneManager::defview [protected] |