Panda3D
|
This specialization of CullTraverser uses the graphics pipe itself to perform occlusion culling. More...
#include "pipeOcclusionCullTraverser.h"
Classes | |
class | PendingObject |
Public Member Functions | |
PipeOcclusionCullTraverser (GraphicsOutput *host) | |
PipeOcclusionCullTraverser (const PipeOcclusionCullTraverser ©) | |
virtual void | end_traverse () |
Should be called when the traverser has finished traversing its scene, this gives it a chance to do any necessary finalization. | |
virtual TypeHandle | force_init_type () |
GraphicsOutput * | get_buffer () const |
const DrawMask & | get_occlusion_mask () const |
Returns the DrawMask for occlusion polygons. | |
Texture * | get_texture () |
Returns a Texture that can be used to visualize the efforts of the occlusion cull. | |
virtual TypeHandle | get_type () const |
void | set_occlusion_mask (const DrawMask &occlusion_mask) |
Specifies the DrawMask that should be set on occlusion polygons for this scene. | |
virtual void | set_scene (SceneSetup *scene_setup, GraphicsStateGuardianBase *gsg, bool dr_incomplete_render) |
Sets the SceneSetup object that indicates the initial camera position, etc. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. | |
Protected Member Functions | |
virtual bool | is_in_view (CullTraverserData &data) |
Returns true if the current node is fully or partially within the viewing area and should be drawn, or false if it (and all of its children) should be pruned. | |
virtual void | record_object (CullableObject *object, const CullTraverser *traverser) |
This callback function is intended to be overridden by a derived class. | |
virtual void | traverse_below (CullTraverserData &data) |
Traverses all the children of the indicated node, with the given data, which has been converted into the node's space. |
This specialization of CullTraverser uses the graphics pipe itself to perform occlusion culling.
As such, it's likely to be inefficient (since it interferes with the pipe's normal mode of rendering), and is mainly useful to test other, CPU-based occlusion algorithms.
This cannot be used in a multithreaded pipeline environment where cull and draw are operating simultaneously.
It can't be defined in the cull subdirectory, because it needs access to GraphicsPipe and DisplayRegion and other classes in display. So we put it in grutil instead, for lack of any better ideas.
Definition at line 47 of file pipeOcclusionCullTraverser.h.
void PipeOcclusionCullTraverser::end_traverse | ( | ) | [virtual] |
Should be called when the traverser has finished traversing its scene, this gives it a chance to do any necessary finalization.
Reimplemented from CullHandler.
Definition at line 219 of file pipeOcclusionCullTraverser.cxx.
References GraphicsStateGuardian::end_scene(), CullTraverser::get_current_thread(), GraphicsStateGuardianBase::get_gsg(), and CullHandler::record_object().
const DrawMask & PipeOcclusionCullTraverser::get_occlusion_mask | ( | ) | const [inline] |
Returns the DrawMask for occlusion polygons.
See set_occlusion_mask().
Definition at line 47 of file pipeOcclusionCullTraverser.I.
Texture * PipeOcclusionCullTraverser::get_texture | ( | ) |
Returns a Texture that can be used to visualize the efforts of the occlusion cull.
Definition at line 279 of file pipeOcclusionCullTraverser.cxx.
static void PipeOcclusionCullTraverser::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from CullTraverser.
Definition at line 141 of file pipeOcclusionCullTraverser.h.
References CullTraverser::init_type().
bool PipeOcclusionCullTraverser::is_in_view | ( | CullTraverserData & | data | ) | [protected, virtual] |
Returns true if the current node is fully or partially within the viewing area and should be drawn, or false if it (and all of its children) should be pruned.
Reimplemented from CullTraverser.
Definition at line 305 of file pipeOcclusionCullTraverser.cxx.
References PandaNodePipelineReader::get_effects(), PandaNodePipelineReader::get_nested_vertices(), CullTraverserData::get_net_transform(), RenderEffects::has_show_bounds(), PandaNodePipelineReader::is_final(), PandaNode::is_geom_node(), CullTraverser::is_in_view(), CullTraverserData::node(), and CullTraverserData::node_reader().
void PipeOcclusionCullTraverser::record_object | ( | CullableObject * | object, |
const CullTraverser * | traverser | ||
) | [protected, virtual] |
This callback function is intended to be overridden by a derived class.
This is called as each Geom is discovered by the CullTraverser.
We do a sneaky trick in making PipeOcclusionCullTraverser inherit from both CullTraverser and CullHandler--the traverser is its own handler! This is the normal callback into the traverser for rendering objects. We respond to this by firing off an occlusion test, and queuing up the object until the end of the scene.
Reimplemented from CullHandler.
Definition at line 389 of file pipeOcclusionCullTraverser.cxx.
References CullTraverser::get_current_thread().
void PipeOcclusionCullTraverser::set_occlusion_mask | ( | const DrawMask & | occlusion_mask | ) | [inline] |
Specifies the DrawMask that should be set on occlusion polygons for this scene.
This identifies the polygons that are to be treated as occluders. Polygons that do not have this draw mask set will not be considered occluders.
Definition at line 36 of file pipeOcclusionCullTraverser.I.
void PipeOcclusionCullTraverser::set_scene | ( | SceneSetup * | scene_setup, |
GraphicsStateGuardianBase * | gsg, | ||
bool | dr_incomplete_render | ||
) | [virtual] |
Sets the SceneSetup object that indicates the initial camera position, etc.
This must be called before traversal begins.
Reimplemented from CullTraverser.
Definition at line 143 of file pipeOcclusionCullTraverser.cxx.
References GraphicsStateGuardian::begin_scene(), CullTraverser::get_cull_handler(), CullTraverser::get_current_thread(), GraphicsStateGuardianBase::get_gsg(), NodePath::get_parent(), NodePath::get_transform(), CullTraverser::get_view_frustum(), GraphicsStateGuardian::prepare_display_region(), CullTraverser::set_cull_handler(), and GraphicsStateGuardian::set_scene().
void PipeOcclusionCullTraverser::traverse_below | ( | CullTraverserData & | data | ) | [protected, virtual] |
Traverses all the children of the indicated node, with the given data, which has been converted into the node's space.
Reimplemented from CullTraverser.
Definition at line 358 of file pipeOcclusionCullTraverser.cxx.