15 #include "cullBinFrontToBack.h" 16 #include "graphicsStateGuardianBase.h" 17 #include "geometricBoundingVolume.h" 18 #include "cullableObject.h" 19 #include "cullHandler.h" 20 #include "pStatTimer.h" 33 ~CullBinFrontToBack() {
35 for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
62 if (volume->is_empty()) {
68 DCAST_INTO_V(gbv, volume);
70 LPoint3 center = gbv->get_approx_center();
71 nassertv(object->_internal_transform != (
const TransformState *)NULL);
72 center = center *
object->_internal_transform->get_mat();
74 PN_stdfloat distance = _gsg->compute_distance_to(center);
75 _objects.push_back(ObjectData(
object, distance));
89 PStatTimer timer(_cull_this_pcollector, current_thread);
90 sort(_objects.begin(), _objects.end());
101 PStatTimer timer(_draw_this_pcollector, current_thread);
102 Objects::const_iterator oi;
103 for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
115 void CullBinFrontToBack::
116 fill_result_graph(CullBin::ResultGraphBuilder &builder) {
117 Objects::const_iterator oi;
118 for (oi = _objects.begin(); oi != _objects.end(); ++oi) {
120 builder.add_object(
object);
virtual void draw(bool force, Thread *current_thread)
Draws all the geoms in the bin, in the appropriate order.
A collection of Geoms and their associated state, for a particular scene.
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
static CullBin * make_bin(const string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector)
Factory constructor for passing to the CullBinManager.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
A lightweight class that represents a single element that may be timed and/or counted via stats...
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
static void draw(CullableObject *object, GraphicsStateGuardianBase *gsg, bool force, Thread *current_thread)
Draws the indicated CullableObject, with full support for decals if they are attached to the object...
A specific kind of CullBin that sorts geometry in order from nearest to furthest based on the center ...
The smallest atom of cull.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
This object holds the camera position, etc., and other general setup information for rendering a part...
virtual void finish_cull(SceneSetup *scene_setup, Thread *current_thread)
Called after all the geoms have been added, this indicates that the cull process is finished for this...
virtual void add_object(CullableObject *object, Thread *current_thread)
Adds a geom, along with its associated state, to the bin for rendering.