Basic Renderer
|
A helper class to efficiently draw and queue models with one function call. More...
#include <ModelRenderer.h>
Public Member Functions | |
ModelRenderer () | |
Constructor. More... | |
ModelRenderer (ObjectManagerPtr o) | |
Constructor. More... | |
virtual | ~ModelRenderer () |
Virtual destructor. More... | |
ObjectManagerPtr | getObjectManager () |
Returns a pointer to the object manager used to get the models, cameras and lights from. More... | |
void | setObjectManager (ObjectManagerPtr o) |
Set the object manager to get the models, cameras and lights from. More... | |
RenderQueuePtr | getRenderQueue () |
Returns a pointer to the render queue. More... | |
virtual void | drawModel (const std::string &modelName, const std::string &cameraName, const vmml::Matrix4f &modelMatrix, const std::vector< std::string > &lightNames, bool doFrustumCulling=true, bool cullIndividualGeometry=false) |
Draw specified model into the current framebuffer. More... | |
virtual void | drawModel (ModelPtr model, const vmml::Matrix4f &modelMatrix, const vmml::Matrix4f &viewMatrix, const vmml::Matrix4f &projectionMatrix, const std::vector< std::string > &lightNames, bool doFrustumCulling=true, bool cullIndividualGeometry=false) |
Draw specified model into the current framebuffer. More... | |
virtual void | queueModelInstance (const std::string &modelName, const std::string &instanceName, const std::string &cameraName, const vmml::Matrix4f &modelMatrix, const std::vector< std::string > &lightNames, bool doFrustumCulling=true, bool cullIndividualGeometry=false, bool isTransparent=false, GLenum blendSfactor=GL_SRC_ALPHA, GLenum blendDfactor=GL_ONE_MINUS_SRC_ALPHA, GLfloat customDistance=10000.0f) |
Queue specified model into the render queue. More... | |
virtual void | queueModelInstance (ModelPtr model, const std::string &instanceName, const vmml::Matrix4f &modelMatrix, const vmml::Matrix4f &viewMatrix, const vmml::Matrix4f &projectionMatrix, const std::vector< std::string > &lightNames, bool doFrustumCulling=true, bool cullIndividualGeometry=false, bool isTransparent=false, GLenum blendSfactor=GL_SRC_ALPHA, GLenum blendDfactor=GL_ONE_MINUS_SRC_ALPHA, GLfloat customDistance=10000.0f) |
Queue specified model into the render queue. More... | |
virtual void | drawText (const std::string &textSpriteName, const std::string &cameraName, const vmml::Matrix4f &modelMatrix, const std::vector< std::string > &lightNames, bool doFrustumCulling=false) |
Draw specified text sprite into the current framebuffer. More... | |
virtual void | queueTextInstance (const std::string &textSpriteName, const std::string &instanceName, const std::string &cameraName, const vmml::Matrix4f &modelMatrix, const std::vector< std::string > &lightNames, bool doFrustumCulling=true, GLenum blendSfactor=GL_SRC_ALPHA, GLenum blendDfactor=GL_ONE_MINUS_SRC_ALPHA, GLfloat customDistance=10000.0f) |
Queue specified text sprite into the render queue. More... | |
void | drawQueue (GLenum mode=GL_TRIANGLES) |
Draws the render queue into the current framebuffer. More... | |
void | clearQueue () |
Clears the render queue. More... | |
vmml::Visibility | viewFrustumCulling (const vmml::AABBf &aabbObjectSpace, const vmml::Matrix4f &modelViewProjectionMatrix) |
Tests an axis-aligned bounding box against the view frustum. More... | |
A helper class to efficiently draw and queue models with one function call.
ModelRenderer::ModelRenderer | ( | ) |
Constructor.
ModelRenderer::ModelRenderer | ( | ObjectManagerPtr | o | ) |
Constructor.
[in] | o | Pointer to the object manager |
|
inlinevirtual |
Virtual destructor.
void ModelRenderer::clearQueue | ( | ) |
Clears the render queue.
|
virtual |
Draw specified model into the current framebuffer.
[in] | modelName | Name of the model |
[in] | cameraName | Name of the camera |
[in] | modelMatrix | |
[in] | lightNames | Names of the lights in a vector |
[in] | doFrustumCulling | Set true if the model should be tested against the view frustum (optional) |
[in] | cullIndividualGeometry | Set true if all the geometry should be tested against the view frustum (optional) |
|
virtual |
Draw specified model into the current framebuffer.
[in] | model | The model to be drawn |
[in] | modelMatrix | |
[in] | viewMatrix | |
[in] | projectionMatrix | |
[in] | lightNames | Names of the lights in a vector |
[in] | doFrustumCulling | Set true if the model should be tested against the view frustum (optional) |
[in] | cullIndividualGeometry | Set true if all the geometry should be tested against the view frustum (optional) |
void ModelRenderer::drawQueue | ( | GLenum | mode = GL_TRIANGLES | ) |
Draws the render queue into the current framebuffer.
[in] | mode |
|
virtual |
Draw specified text sprite into the current framebuffer.
[in] | textSpriteName | Name of the text sprite |
[in] | cameraName | Name of the camera |
[in] | modelMatrix | |
[in] | lightNames | Names of the lights in a vector |
[in] | doFrustumCulling | Set true if the text sprite should be tested against the view frustum (optional) |
ObjectManagerPtr ModelRenderer::getObjectManager | ( | ) |
Returns a pointer to the object manager used to get the models, cameras and lights from.
RenderQueuePtr ModelRenderer::getRenderQueue | ( | ) |
Returns a pointer to the render queue.
|
virtual |
Queue specified model into the render queue.
[in] | modelName | Name of the model |
[in] | instanceName | The name of the model instance to be queued (instance is created automatically if not present) |
[in] | cameraName | Name of the camera |
[in] | modelMatrix | |
[in] | lightNames | Names of the lights in a vector |
[in] | doFrustumCulling | Set true if the model should be tested against the view frustum (optional) |
[in] | cullIndividualGeometry | Set true if all the geometry should be tested against the view frustum (optional) |
[in] | isTransparent | Set true if the model is (partially) transparent and sorting according to distance should occur (optional) |
[in] | blendSfactor | Specifies how the red, green, blue, and alpha source blending factors are computed (optional) |
[in] | blendDfactor | Specifies how the red, green, blue, and alpha destination blending factors are computed (optional) |
[in] | customDistance | If the function should not determine the distance to the camera a custom distance can be set (optional) |
|
virtual |
Queue specified model into the render queue.
[in] | model | The model to be drawn |
[in] | instanceName | The name of the model instance to be queued (instance is created automatically if not present) |
[in] | modelMatrix | |
[in] | viewMatrix | |
[in] | projectionMatrix | |
[in] | lightNames | Names of the lights in a vector |
[in] | doFrustumCulling | Set true if the model should be tested against the view frustum (optional) |
[in] | cullIndividualGeometry | Set true if all the geometry should be tested against the view frustum (optional) |
[in] | isTransparent | Set true if the model is (partially) transparent and sorting according to distance should occur (optional) |
[in] | blendSfactor | Specifies how the red, green, blue, and alpha source blending factors are computed (optional) |
[in] | blendDfactor | Specifies how the red, green, blue, and alpha destination blending factors are computed (optional) |
[in] | customDistance | If the function should not determine the distance to the camera a custom distance can be set (optional) |
|
virtual |
Queue specified text sprite into the render queue.
[in] | textSpriteName | Name of the text sprite |
[in] | instanceName | The name of the text sprite instance to be queued (instance is created automatically if not present) |
[in] | cameraName | Name of the camera |
[in] | modelMatrix | |
[in] | lightNames | Names of the lights in a vector |
[in] | doFrustumCulling | Set true if the text sprite should be tested against the view frustum (optional) |
[in] | blendSfactor | Specifies how the red, green, blue, and alpha source blending factors are computed (optional) |
[in] | blendDfactor | Specifies how the red, green, blue, and alpha destination blending factors are computed (optional) |
[in] | customDistance | If the function should not determine the distance to the camera a custom distance can be set (optional) |
void ModelRenderer::setObjectManager | ( | ObjectManagerPtr | o | ) |
Set the object manager to get the models, cameras and lights from.
[in] | o | Pointer to the object manager |
vmml::Visibility ModelRenderer::viewFrustumCulling | ( | const vmml::AABBf & | aabbObjectSpace, |
const vmml::Matrix4f & | modelViewProjectionMatrix | ||
) |
Tests an axis-aligned bounding box against the view frustum.
[in] | aabbObjectSpace | The axis-aligned bounding box in object space |
[in] | modelViewProjectionMatrix | The model view projection matrix (projection * view * model) |