A manager to manage a scene graph. More...
#include <SceneManager.h>
Public Types | |
enum | visibility { FULLY_VISIBLE, PARTIALLY_VISIBLE, INVISIBLE } |
The visibility of a bounding box in a frustum. More... | |
typedef MultiMapIterator < string, ptr< SceneNode > > | NodeIterator |
An iterator over a map of SceneNode. | |
Public Member Functions | |
SceneManager () | |
Creates an empty SceneManager. | |
virtual | ~SceneManager () |
Deletes this SceneManager. | |
ptr< SceneNode > | getRoot () |
Returns the root node of the scene graph managed by this manager. | |
void | setRoot (ptr< SceneNode > root) |
Sets the root node of the scene graph managed by this manager. | |
ptr< SceneNode > | getCameraNode () |
Returns the camera node of the scene graph managed by this manager. | |
void | setCameraNode (const string &node) |
Sets the camera node of the scene graph managed by this manager. | |
string | getCameraMethod () |
Returns the name of the camera node method to be called to draw the scene. | |
void | setCameraMethod (const string &method) |
Sets the name of the camera node method to be called to draw the scene. | |
NodeIterator | getNodes (const string &flag) |
Returns the nodes of the scene graph that have the given flag. | |
ptr< SceneNode > | getNodeVar (const string &name) |
Returns the SceneNode currently bound to the given loop variable. | |
void | setNodeVar (const string &name, ptr< SceneNode > node) |
Sets the node currently bound to the given loop variable. | |
ptr< ResourceManager > | getResourceManager () |
Returns the ResourceManager used to manage the resources of the scene graph. | |
void | setResourceManager (ptr< ResourceManager > resourceManager) |
Sets the ResourceManager used to manage the resources of the scene graph. | |
ptr< Scheduler > | getScheduler () |
Returns the Scheduler used to schedule the Task to draw the scene. | |
void | setScheduler (ptr< Scheduler > scheduler) |
Sets the Scheduler to schedule the Task to draw the scene. | |
mat4d | getCameraToScreen () |
Returns the transformation from camera space to screen space. | |
void | setCameraToScreen (const mat4d &cameraToScreen) |
Sets the transformation from camera space to screen space. | |
mat4d | getWorldToScreen () |
Returns the transformation from world space to screen space. | |
bool | isVisible (const vec3d &worldPoint) |
Returns true if the given point is visible from the camera node. | |
visibility | getVisibility (const box3d &worldBounds) |
Returns the visibility of the given bounding box from the camera node. | |
void | update (double t, double dt) |
Updates all the transformation matrices in the scene graph. | |
void | draw () |
Executes the getCameraMethod of the getCameraNode node. | |
unsigned int | getFrameNumber () |
Returns the current frame number. | |
double | getTime () |
Returns the time of the current frame in micro-seconds. | |
double | getElapsedTime () |
Returns the elapsed time of between the two previous frames. | |
Static Public Member Functions | |
static visibility | getVisibility (const vec4d frustumPlanes[6], const box3d &b) |
Returns the visibility of the given bounding box in the given frustum. | |
static void | getFrustumPlanes (const mat4d &toScreen, vec4d frustumPlanes[6]) |
Returns the frustum plane equations from a projection matrix. | |
static ptr< FrameBuffer > | getCurrentFrameBuffer () |
Returns the current FrameBuffer. | |
static void | setCurrentFrameBuffer (ptr< FrameBuffer > fb) |
Sets the current FrameBuffer. | |
static ptr< Program > | getCurrentProgram () |
Returns the current Program. | |
static void | setCurrentProgram (ptr< Program > prog) |
Sets the current GLSL Program. |
A manager to manage a scene graph.
typedef MultiMapIterator<string, ptr<SceneNode> > ork::SceneManager::NodeIterator |
An iterator over a map of SceneNode.
ork::SceneManager::SceneManager | ( | ) |
Creates an empty SceneManager.
virtual ork::SceneManager::~SceneManager | ( | ) | [virtual] |
Deletes this SceneManager.
void ork::SceneManager::draw | ( | ) |
Executes the getCameraMethod of the getCameraNode node.
string ork::SceneManager::getCameraMethod | ( | ) |
Returns the name of the camera node method to be called to draw the scene.
Returns the camera node of the scene graph managed by this manager.
mat4d ork::SceneManager::getCameraToScreen | ( | ) |
Returns the transformation from camera space to screen space.
static ptr<FrameBuffer> ork::SceneManager::getCurrentFrameBuffer | ( | ) | [static] |
Returns the current FrameBuffer.
double ork::SceneManager::getElapsedTime | ( | ) |
Returns the elapsed time of between the two previous frames.
This time is the one passed as argument to the last call to update.
unsigned int ork::SceneManager::getFrameNumber | ( | ) |
Returns the current frame number.
This number is incremented after each call to draw.
static void ork::SceneManager::getFrustumPlanes | ( | const mat4d & | toScreen, | |
vec4d | frustumPlanes[6] | |||
) | [static] |
Returns the frustum plane equations from a projection matrix.
toScreen | a camera to screen projection matrix. | |
[out] | frustumPlanes | the frustum plane equations in camera space. |
NodeIterator ork::SceneManager::getNodes | ( | const string & | flag | ) |
Returns the nodes of the scene graph that have the given flag.
flag | a SceneNode flag. |
Returns the SceneNode currently bound to the given loop variable.
name | a loop variable. |
ptr<ResourceManager> ork::SceneManager::getResourceManager | ( | ) |
Returns the ResourceManager used to manage the resources of the scene graph.
Returns the root node of the scene graph managed by this manager.
double ork::SceneManager::getTime | ( | ) |
Returns the time of the current frame in micro-seconds.
This time is the one passed as argument to the last call to update.
static visibility ork::SceneManager::getVisibility | ( | const vec4d | frustumPlanes[6], | |
const box3d & | b | |||
) | [static] |
Returns the visibility of the given bounding box in the given frustum.
frustumPlanes | the frustum plane equations. | |
b | a bounding box, in the same reference frame as the frustum planes. |
visibility ork::SceneManager::getVisibility | ( | const box3d & | worldBounds | ) |
Returns the visibility of the given bounding box from the camera node.
worldBounds | a bounding box in world space. |
mat4d ork::SceneManager::getWorldToScreen | ( | ) |
Returns the transformation from world space to screen space.
bool ork::SceneManager::isVisible | ( | const vec3d & | worldPoint | ) |
Returns true if the given point is visible from the camera node.
worldPoint | a point in world space. |
void ork::SceneManager::setCameraMethod | ( | const string & | method | ) |
Sets the name of the camera node method to be called to draw the scene.
method | a method name. |
void ork::SceneManager::setCameraNode | ( | const string & | node | ) |
Sets the camera node of the scene graph managed by this manager.
This camera node must have a UniformMatrix4f defining the projection from camera space to screen space.
node | a SceneNode flag that identifies the camera node. |
void ork::SceneManager::setCameraToScreen | ( | const mat4d & | cameraToScreen | ) |
Sets the transformation from camera space to screen space.
static void ork::SceneManager::setCurrentFrameBuffer | ( | ptr< FrameBuffer > | fb | ) | [static] |
Sets the current FrameBuffer.
This can then be used in any module to retrieve a target on which the user wants to render to.
Sets the node currently bound to the given loop variable.
name | a loop variable. | |
node | the new node bound to this loop variable. |
void ork::SceneManager::setResourceManager | ( | ptr< ResourceManager > | resourceManager | ) |
Sets the ResourceManager used to manage the resources of the scene graph.
resourceManager | a resource manager. |
Sets the root node of the scene graph managed by this manager.
void ork::SceneManager::update | ( | double | t, | |
double | dt | |||
) |
Updates all the transformation matrices in the scene graph.
t | the current time in micro-seconds. | |
dt | the elapsed time in micro-seconds since the last call to update. |