RenderQueue Class Reference

A render queue stores render calls and performs drawing in sorted order. More...

#include <RenderQueue.h>

Inherits IDrawable.

Public Types

typedef std::multimap< std::string, RenderCallRenderCallsOpaque
 
typedef std::multimap< GLfloat, RenderCallRenderCallsTransparent
 

Public Member Functions

 RenderQueue ()
 Constructor. More...
 
virtual ~RenderQueue ()
 Virtual destructor. More...
 
virtual void submitToRenderQueue (GLuint programID, const std::string &materialName, const std::string &drawableName, const std::string &instanceName, DrawablePtr drawable, GLfloat distanceToCamera=0.0, bool isTransparent=false, GLenum blendSfactor=GL_SRC_ALPHA, GLenum blendDfactor=GL_ONE_MINUS_SRC_ALPHA)
 Add a render call to the queue. More...
 
virtual void draw (GLenum mode=GL_TRIANGLES) override
 Draw all drawable in the queue in a sorted manner. More...
 
virtual void drawInstance (const std::string &instanceName, GLenum mode) override
 Draws an instance of the queue to the screen. More...
 
virtual void clear ()
 Remove all render calls. More...
 
- Public Member Functions inherited from IDrawable
virtual ~IDrawable ()
 Virtual destructor. More...
 

Detailed Description

A render queue stores render calls and performs drawing in sorted order.

Transparent objects are drawn in a back-to-front order whereas opaque objects are arranged in a manner that avoids state changes as much as possible.

Author
Benjamin Buergisser

Member Typedef Documentation

typedef std::multimap< std::string, RenderCall> RenderQueue::RenderCallsOpaque
typedef std::multimap< GLfloat, RenderCall> RenderQueue::RenderCallsTransparent

Constructor & Destructor Documentation

RenderQueue::RenderQueue ( )
inline

Constructor.

virtual RenderQueue::~RenderQueue ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

void RenderQueue::clear ( )
virtual

Remove all render calls.

void RenderQueue::draw ( GLenum  mode = GL_TRIANGLES)
overridevirtual

Draw all drawable in the queue in a sorted manner.

Implements IDrawable.

virtual void RenderQueue::drawInstance ( const std::string &  instanceName,
GLenum  mode 
)
inlineoverridevirtual

Draws an instance of the queue to the screen.

Parameters
[in]instanceName
[in]mode

Implements IDrawable.

void RenderQueue::submitToRenderQueue ( GLuint  programID,
const std::string &  materialName,
const std::string &  drawableName,
const std::string &  instanceName,
DrawablePtr  drawable,
GLfloat  distanceToCamera = 0.0,
bool  isTransparent = false,
GLenum  blendSfactor = GL_SRC_ALPHA,
GLenum  blendDfactor = GL_ONE_MINUS_SRC_ALPHA 
)
virtual

Add a render call to the queue.

Parameters
[in]programID
[in]materialName
[in]drawableName
[in]instanceName
[in]drawable
[in]distanceToCameraThe distance of the transparent drawable to the camera (optional)
[in]isTransparentSet true if the object is transparent (optional)
[in]blendSfactorSpecifies how the red, green, blue, and alpha source blending factors are computed (optional)
[in]blendDfactorSpecifies how the red, green, blue, and alpha destination blending factors are computed (optional)