Carna  Version 3.3.2
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Carna::base::RenderQueue< RenderableCompare > Class Template Reference

Gathers renderable geometry nodes from scene graph and provides those in a particular order, if required. More...

#include <RenderQueue.h>

Public Member Functions

 RenderQueue (unsigned int geometryType, unsigned int geometryTypeMask=EXACT_MATCH_GEOMETRY_TYPE_MASK)
 Creates new instance that enqueues Geometry scene graph nodes if their geometry type AND-linked with geometryTypeMask equals the geometryType of this RenderQueue instance.
 
void build (const Node &root, const math::Matrix4f &viewTransform)
 Rebuilds this queue by gathering matching geometry nodes from children of root recursively. The argument viewTransform is required for the computation of the model-view matrix.
 
void rewind ()
 Rewinds this queue. This is an \(\mathcal O\left(1\right)\) operation in contrast to build, so prefer it whenever possible. You might also need to updateModelViewTransforms if you use this.
 
void updateModelViewTransforms (const math::Matrix4f &viewTransform)
 Recomputes the model-view transforms of all enqueued renderables. This only is neccessary in certain cases when you have rewinded this queue previously. Also recomputes the elements order of this queue if necessary.
 
bool isEmpty () const
 Tells whether this queue has reached it's end.
 
const Renderablepoll ()
 References the next element of the queue and moves ahead. The referenced object stays alive until the queue is deleted or rebuilt. More...
 
const Renderablefirst () const
 References the next element of the queue, but does not move ahead. The referenced object stays alive until the queue is deleted or rebuilt. More...
 
const Renderablelast () const
 References the last element of the queue. The referenced object stays alive until the queue is deleted or rebuilt. More...
 

Public Attributes

const unsigned int geometryType
 Holds the geometry type that this queue uses for matching geometry nodes.
 
const unsigned int geometryTypeMask
 Holds the mask that this queue uses for matching geometry nodes.
 

Static Public Attributes

static const unsigned int EXACT_MATCH_GEOMETRY_TYPE_MASK = std::numeric_limits< unsigned int >::max()
 Holds the mask that makes this queue only accept such geometry nodes whose geometry type matches the geometry type of this queue exactly.
 

Detailed Description

template<typename RenderableCompare>
class Carna::base::RenderQueue< RenderableCompare >

Gathers renderable geometry nodes from scene graph and provides those in a particular order, if required.

Parameters
RenderableCompareBinary function that establishes partial order on Renderable objects. Typical choices are Renderable::BackToFront, Renderable::FrontToBack or Renderable::VideoResourcesOrder. Use void if no particular order is required.

The geometry nodes are only enqueued if their geometry type matches. The matching is done as follows. First a bit-wise AND operation is applied to the node's geometry type and the mask of this RenderQueue instance. Than the result from this operation is compared to the geometryType of this instance. Only if they match, the Geometry node is enqueued.

Author
Leonid Kostrykin
Date
22.2.15 - 17.3.15

Definition at line 63 of file RenderQueue.h.

Member Function Documentation

◆ first()

template<typename RenderableCompare >
const Renderable & Carna::base::RenderQueue< RenderableCompare >::first ( ) const

References the next element of the queue, but does not move ahead. The referenced object stays alive until the queue is deleted or rebuilt.

Precondition
isEmpty() == false

Definition at line 250 of file RenderQueue.h.

◆ last()

template<typename RenderableCompare >
const Renderable & Carna::base::RenderQueue< RenderableCompare >::last ( ) const

References the last element of the queue. The referenced object stays alive until the queue is deleted or rebuilt.

Precondition
isEmpty() == false

Definition at line 258 of file RenderQueue.h.

◆ poll()

template<typename RenderableCompare >
const Renderable & Carna::base::RenderQueue< RenderableCompare >::poll ( )

References the next element of the queue and moves ahead. The referenced object stays alive until the queue is deleted or rebuilt.

Precondition
isEmpty() == false

Definition at line 242 of file RenderQueue.h.


The documentation for this class was generated from the following file: