12#ifndef RENDERQUEUE_H_6014714286
13#define RENDERQUEUE_H_6014714286
15#include <Carna/Carna.h>
62template<
typename RenderableCompare >
68 std::vector< Renderable > renderables;
69 std::size_t nextRenderableIndex;
150template<
typename RenderableCompare >
154template<
typename RenderableCompare >
156 : geometryType( geometryType )
157 , geometryTypeMask( geometryTypeMask )
162template<
typename RenderableCompare >
167 if( renderables.size() >= 2 && ( RenderableCompare::isViewDependent || !
skipIfViewDependent ) )
176struct RenderableSort< void >
178 static void sort( std::vector< Renderable >& renderables,
bool skipIfViewDependent )
184template<
typename RenderableCompare >
188 nextRenderableIndex = 0;
195 if(
geom !=
nullptr && (
geom->geometryType & geometryTypeMask ) == geometryType )
205 RenderableSort< RenderableCompare >::sort( renderables,
false );
209template<
typename RenderableCompare >
212 nextRenderableIndex = 0;
216template<
typename RenderableCompare >
221 std::for_each( renderables.begin(), renderables.end(),
224 r.setModelViewTransform( viewTransform * r.geometry().worldTransform() );
230 RenderableSort< RenderableCompare >::sort( renderables,
true );
234template<
typename RenderableCompare >
237 return nextRenderableIndex >= renderables.size();
241template<
typename RenderableCompare >
245 return renderables[ nextRenderableIndex++ ];
249template<
typename RenderableCompare >
253 return renderables.front();
257template<
typename RenderableCompare >
261 return renderables.back();
Defines Carna::base::CarnaException, Carna::base::AssertionFailure.
#define CARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Defines Carna::base::Geometry.
Defines Carna::base::Node.
Defines Carna::base::Renderable.
Represents an association.
Defines scene graph leafs. Instances of this class represent visible geometry that can be rendered....
Defines the inner node of a scene graph. Implements a spatial scene element that is allowed to have c...
void visitChildren(bool recursively, const MutableVisitor &visit)
Invokes visit once on each child of this node recursively.
Gathers renderable geometry nodes from scene graph and provides those in a particular order,...
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 ...
const Renderable & last() const
References the last element of the queue. The referenced object stays alive until the queue is delete...
const unsigned int geometryTypeMask
Holds the mask that this queue uses for matching geometry nodes.
const Renderable & poll()
References the next element of the queue and moves ahead. The referenced object stays alive until the...
bool isEmpty() const
Tells whether this queue has reached it's end.
static const unsigned int EXACT_MATCH_GEOMETRY_TYPE_MASK
Holds the mask that makes this queue only accept such geometry nodes whose geometry type matches the ...
void build(const Node &root, const math::Matrix4f &viewTransform)
Rebuilds this queue by gathering matching geometry nodes from children of root recursively....
const Renderable & first() const
References the next element of the queue, but does not move ahead. The referenced object stays alive ...
void updateModelViewTransforms(const math::Matrix4f &viewTransform)
Recomputes the model-view transforms of all enqueued renderables. This only is neccessary in certain ...
const unsigned int geometryType
Holds the geometry type that this queue uses for matching geometry nodes.
void rewind()
Rewinds this queue. This is an operation in contrast to build, so prefer it whenever possible....
Represents a Geometry object that has been queued into a RenderQueue. The object's model-view transfo...
Represents a spatial scene element. It's location is determined relatively to another spatial that is...
Defines Carna::base::math namespace and CARNA_FOR_VECTOR3UI.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
#define NON_COPYABLE
Features class it is placed in as non-copyable.