43 VL_DEBUG_SET_OBJECT_NAME()
72 return in_render_queue;
107 Log::error(
"OcclusionCullRenderer::render(): no Renderer is wrapped!\n");
109 return in_render_queue;
159 for(
int i=0; i<in_render_queue->
size(); ++i)
166 bool occluded =
false;
174 GLint ready = GL_FALSE;
176 if (ready == GL_FALSE)
186 if (occluded ==
false)
190 *tok = *in_render_queue->
at(i);
207 glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &buffer);
226 glEnable(GL_SCISSOR_TEST);
229 glDisable(GL_SCISSOR_TEST);
257 for(
int i=0; i<non_occluded_render_queue->
size(); ++i)
268 if (cur_scissor != scissor)
270 cur_scissor = scissor;
279 VL_CHECK(glIsEnabled(GL_SCISSOR_TEST))
282 glDisable(GL_SCISSOR_TEST);
306 const float verts[] =
317 const unsigned quads[] = { 3,2,1,0, 2,6,5,1, 3,7,6,2, 7,3,0,4, 4,0,1,5, 6,7,4,5 };
321 glDrawElements(GL_QUADS, 6*4, GL_UNSIGNED_INT, quads);
VL_CHECK_OGL();
336 glDisable(GL_SCISSOR_TEST);
Associates a Renderable object to an Effect and Transform.
Renderer * mPrevWrapRenderer
const ProjViewTransfCallback * projViewTransfCallback() const
Transform * transform()
Returns the Transform bound tho an Actor.
GLuint occlusionQuery() const
For internal use only.
If enabled, do depth comparisons and update the depth buffer; Note that even if the depth buffer exis...
ref< Shader > mOcclusionShader
The Renderer class executes the actual rendering on the given RenderQueue.
void applyEnables(const EnableSet *cur)
Applies an EnableSet to an OpenGLContext - Typically for internal use only.
const T_Scalar & z() const
const FramebufferObject * framebuffer() const
Returns the wrapped Renderer's Framebuffer.
vl::ref< EnableSet > mDummyEnables
EnableSet * getEnableSet()
Represents an OpenGL context, possibly a widget or a pbuffer, which can also respond to keyboard...
OpenGLContext * openglContext()
The OpenGLContext bound to a render target.
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
void resetEnables()
Resets all the interanal enable-tables - For internal use only.
int mStatsOccludedObjects
Wraps a GLSL program to which you can bind vertex, fragment and geometry shaders. ...
void createOcclusionQuery()
For internal use only.
Internally used by the rendering engine.
void dispatchOnRendererFinished()
Dispatches the onRendererFinished() event to the registered RenderEventCallback objects.
void set(EFunction depthfunc)
If enabled, and if the polygon is rendered in GL_FILL mode, an offset is added to depth values of a p...
Viewport * viewport()
The viewport bound to a camera.
Visualization Library main namespace.
PolygonOffset * gocPolygonOffset()
virtual const RenderQueue * render(const RenderQueue *in_render_queue, Camera *camera, real frame_clock)
Renders using the wrapped renderer but also performing occlusion culling.
OcclusionCullRenderer()
Constructor.
DepthFunc * gocDepthFunc()
bool isOccludee() const
If is_occludee equals true an occlusion test will be performed before the rendering of the Actor (if ...
const Scissor * scissor() const
Returns the Scissor used when rendering an Actor.
The AABB class implements an axis-aligned bounding box using vl::real precision.
vl::ref< Renderer > mWrappedRenderer
const vec3 & maxCorner() const
Returns the corner of the AABB with the maximum x y z coordinates.
void render_pass1(const RenderQueue *in_render_queue)
Retrieves the occlusion culling query results from the previous rendering frame.
const mat4 & modelingMatrix() const
Returns the Camera's modelingMatrix() (inverse of the view matrix).
vl::ref< RenderStateSet > mDummyStateSet
void incrementRenderTick()
Increments the rendering tick count.
const T_Scalar & y() const
Base class providing all the basic funtionalities of a Renderer.
const AABB & boundingBox() const
Returns the bounding box (not guaranteed to be up to date) that contains this Actor.
void setOcclusionQueryTick(unsigned tick)
For internal use only.
void applyRenderStates(const RenderStateSet *cur, const Camera *camera)
Applies a RenderStateSet to an OpenGLContext - Typically for internal use only.
Manages most of the OpenGL rendering states responsible of the final aspect of the rendered objects...
const Scissor * scissor() const
Returns the Scissor to be used when rendering an Actor.
const vec3 & minCorner() const
Returns the corner of the AABB with the minimum x y z coordinates.
The RenderQueue class collects a list of RenderToken objects to be sorted and rendered.
Vector3< T_Scalar > getT() const
unsigned occlusionQueryTick() const
For internal use only.
void set(bool red, bool green, bool blue, bool alpha)
virtual void updateMatrices(bool cam_changed, bool transf_changed, const GLSLProgram *glsl_program, const Camera *camera, const Transform *transform)
Update matrices of the current GLSLProgram, if glsl_program == NULL then fixed function pipeline is a...
bool isInside(const vec3 &p, bool clipx, bool clipy, bool clipz) const
Returns true if the given point is inside the AABB.
ColorMask * gocColorMask()
Implements a framebuffer object to be used as a rendering target as specified by the ARB_framebuffer_...
RenderStateSet * getRenderStateSet()
int occlusionThreshold() const
The number of pixels visible for an actor to be considered occluded (default = 0) ...
const RenderToken * at(int i) const
const T_Scalar & x() const
void setWrappedRenderer(Renderer *renderer)
The renderer to be wrapped by this occlusion culling renderer.
void resetRenderStates()
Resets all the interanal render-states-tables - For internal use only.
Represents a virtual camera defining, among other things, the point of view from which scenes can be ...
const AABB & boundingBox() const
Returns the bounding box of a Renderable without recomputing the bounds if dirty. ...
The Scissor class wraps the OpenGL function glScissor(), see http://www.opengl.org/sdk/docs/man/xhtml...
const GLSLProgram * glslProgram() const
Returns the GLSLProgram associated to a Shader (if any)
ref< RenderQueue > mCulledRenderQueue
void enable(const Viewport *viewport) const
Enables the scissor test on the area specified by scissorRect() clipped against the given Viewport...
DepthMask * gocDepthMask()
void enable(EEnable capability)
unsigned int enableMask() const
Enable mask used to enable/disable the rendering of matching Actors.
void dispatchOnRendererStarted()
Dispatches the onRendererStarted() event to the registered RenderEventCallback objects.
void set(float factor, float units)
If enabled, cull polygons based on their winding in window coordinates, see also CullFace.
void render_pass2(const RenderQueue *in_render_queue, Camera *camera)
Performs a new set of occlusion culling queries to be tested the next frame.