15#ifndef RENDERQUEUE_H_6014714286
16#define RENDERQUEUE_H_6014714286
65template<
typename RenderableCompare >
71 std::vector< Renderable > renderables;
72 std::size_t nextRenderableIndex;
153template<
typename RenderableCompare >
157template<
typename RenderableCompare >
159 : geometryType( geometryType )
160 , geometryTypeMask( geometryTypeMask )
165template<
typename RenderableCompare >
170 if( renderables.size() >= 2 && ( RenderableCompare::isViewDependent || !
skipIfViewDependent ) )
179struct RenderableSort< void >
181 static void sort( std::vector< Renderable >& renderables,
bool skipIfViewDependent )
187template<
typename RenderableCompare >
191 nextRenderableIndex = 0;
198 if(
geom !=
nullptr && (
geom->geometryType & geometryTypeMask ) == geometryType )
208 RenderableSort< RenderableCompare >::sort( renderables,
false );
212template<
typename RenderableCompare >
215 nextRenderableIndex = 0;
219template<
typename RenderableCompare >
224 std::for_each( renderables.begin(), renderables.end(),
227 r.setModelViewTransform( viewTransform * r.geometry().worldTransform() );
233 RenderableSort< RenderableCompare >::sort( renderables,
true );
237template<
typename RenderableCompare >
240 return nextRenderableIndex >= renderables.size();
244template<
typename RenderableCompare >
248 return renderables[ nextRenderableIndex++ ];
252template<
typename RenderableCompare >
256 return renderables.front();
260template<
typename RenderableCompare >
264 return renderables.back();
Defines LibCarna::base::Geometry.
Defines LibCarna::base::LibCarnaException and LibCarna::base::AssertionFailure.
#define LIBCARNA_ASSERT(expression)
If the given expression is false, a break point is raised in debug mode and an AssertionFailure throw...
Contains forward-declarations.
Defines LibCarna::base::Node.
Defines LibCarna::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,...
const Renderable & poll()
References the next element of the queue and moves ahead. The referenced object stays alive until the...
const unsigned int geometryTypeMask
Holds the mask that this queue uses for matching geometry nodes.
const Renderable & last() const
References the last element of the queue. The referenced object stays alive until the queue is delete...
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 rewind()
Rewinds this queue. This is an operation in contrast to build, so prefer it whenever possible....
const unsigned int geometryType
Holds the geometry type that this queue uses for matching geometry nodes.
void updateModelViewTransforms(const math::Matrix4f &viewTransform)
Recomputes the model-view transforms of all enqueued renderables. This only is neccessary in certain ...
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 ...
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 ...
bool isEmpty() const
Tells whether this queue has reached it's end.
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 LibCarna::base::math namespace and LIBCARNA_FOR_VECTOR3UI.
Eigen::Matrix< float, 4, 4, Eigen::ColMajor > Matrix4f
Defines matrix.
Defines LibCarna::base::noncopyable and NON_COPYABLE.
#define NON_COPYABLE
Marks the class that it is placed in as non-copyable.