Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

CullResult Class Reference

This stores the result of a BinCullHandler traversal: an ordered collection of CullBins, each of which holds a number of Geoms and RenderStates to be rendered in some defined order. More...

#include <cullResult.h>

Inheritance diagram for CullResult:

ReferenceCount List of all members.

Public Member Functions

 CullResult (GraphicsStateGuardianBase *gsg)
 ~CullResult ()
PointerTo< CullResult > make_next () const
 Returns a newly-allocated CullResult object that contains a copy of just the subset of the data from this CullResult object that is worth keeping around for next frame.

CullBinget_bin (int bin_index)
 Returns the CullBin associated with the indicated bin_index, or NULL if the bin_index is invalid.

void add_object (CullableObject *object)
 Adds the indicated CullableObject to the appropriate bin.

void finish_cull ()
 Called after all the geoms have been added, this indicates that the cull process is finished for this frame and gives the bins a chance to do any post-processing (like sorting) before moving on to draw.

void draw ()
 Asks all the bins to draw themselves in the correct order.

int get_ref_count () const
 Returns the current reference count.

int ref () const
 Explicitly increments the reference count.

int unref () const
 Explicitly decrements the reference count.

void test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus.


Static Public Member Functions

void bin_removed (int bin_index)
 Intended to be called by CullBinManager::remove_bin(), this informs all the CullResults in the world to remove the indicated bin_index from their cache if it has been cached.

TypeHandle get_class_type ()
void init_type ()

Private Types

typedef pvector< PointerTo<
CullBin > > 
Bins
typedef pset< CullResult * > CullResults

Private Member Functions

CullBinmake_new_bin (int bin_index)
 Allocates a new CullBin for the given bin_index and stores it for next time.


Static Private Member Functions

ConstPointerTo< RenderStateget_binary_state ()
 Returns a RenderState that applies the effects of M_binary.

ConstPointerTo< RenderStateget_dual_transparent_state ()
 Returns a RenderState that renders only the transparent parts of an object, in support of M_dual.

ConstPointerTo< RenderStateget_dual_transparent_state_decals ()
 Returns a RenderState that renders only the transparent parts of an object, but suitable for objects that contain decals.

ConstPointerTo< RenderStateget_dual_opaque_state ()
 Returns a RenderState that renders only the opaque parts of an object, in support of M_dual.


Private Attributes

GraphicsStateGuardianBase_gsg
Bins _bins

Static Private Attributes

CullResults _cull_results

Detailed Description

This stores the result of a BinCullHandler traversal: an ordered collection of CullBins, each of which holds a number of Geoms and RenderStates to be rendered in some defined order.

This is also used to keep the results of last frame's cull traversal around to make next frame's traversal of the same scene a little easier.

Definition at line 60 of file cullResult.h.


Member Typedef Documentation

typedef pvector< PointerTo< CullBin > > CullResult::Bins [private]
 

Definition at line 86 of file cullResult.h.

typedef pset<CullResult *> CullResult::CullResults [private]
 

Definition at line 89 of file cullResult.h.


Constructor & Destructor Documentation

CullResult::CullResult GraphicsStateGuardianBase gsg  )  [inline]
 

Definition at line 32 of file cullResult.I.

References INLINE.

CullResult::~CullResult  )  [inline]
 

Definition at line 46 of file cullResult.I.

References _bins, INLINE, make_new_bin(), and NULL.


Member Function Documentation

void CullResult::add_object CullableObject object  ) 
 

Adds the indicated CullableObject to the appropriate bin.

The bin becomes the owner of the object pointer, and will eventually delete it.

Definition at line 97 of file cullResult.cxx.

References CullableObject::_state, CullBin::add_object(), RenderState::compose(), CPT, get_bin(), RenderState::get_bin(), CullBinAttrib::get_bin_name(), get_dual_opaque_state(), get_dual_transparent_state(), get_dual_transparent_state_decals(), CullableObject::has_decals(), m_dual_opaque, nassertv, and NULL.

void CullResult::bin_removed int  bin_index  )  [static]
 

Intended to be called by CullBinManager::remove_bin(), this informs all the CullResults in the world to remove the indicated bin_index from their cache if it has been cached.

Definition at line 227 of file cullResult.cxx.

References CPT, RenderState::get_max_priority(), RenderAttrib::M_greater_equal, TransparencyAttrib::M_none, TransparencyAttrib::make(), AlphaTestAttrib::make(), RenderState::make(), and NULL.

void CullResult::draw  ) 
 

Asks all the bins to draw themselves in the correct order.

Definition at line 198 of file cullResult.cxx.

void CullResult::finish_cull  ) 
 

Called after all the geoms have been added, this indicates that the cull process is finished for this frame and gives the bins a chance to do any post-processing (like sorting) before moving on to draw.

Definition at line 178 of file cullResult.cxx.

References _bins, and NULL.

CullBin * CullResult::get_bin int  bin_index  )  [inline]
 

Returns the CullBin associated with the indicated bin_index, or NULL if the bin_index is invalid.

If there is the first time this bin_index has been requested for this CullResult, creates a new CullBin object on the fly.

Definition at line 66 of file cullResult.I.

Referenced by add_object().

ConstPointerTo< RenderState > CullResult::get_binary_state  )  [static, private]
 

Returns a RenderState that applies the effects of M_binary.

Definition at line 269 of file cullResult.cxx.

References RenderState::add_attrib(), CPT, ClockObject::get_global_clock(), ClockObject::get_real_time(), m_dual_flash_rate, RenderAttrib::M_less, AlphaTestAttrib::make(), ColorScaleAttrib::make(), and NULL.

TypeHandle ReferenceCount::get_class_type void   )  [inline, static, inherited]
 

Reimplemented in AnimBundle, AnimBundleNode, AnimChannel< SwitchType >, AnimChannelBase, AnimChannelFixed< SwitchType >, AnimChannelMatrixXfmTable, AnimChannelScalarTable, AnimControl, AnimGroup, MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, PartBundleNode, PartGroup, Character, CharacterJoint, CharacterJointBundle, CharacterSlider, ComputedVertices, CollisionEntry, CollisionHandler, CollisionHandlerEvent, CollisionHandlerFloor, CollisionHandlerPhysical, CollisionHandlerPusher, CollisionHandlerQueue, CollisionNode, CollisionPlane, CollisionPolygon, CollisionRay, CollisionSegment, CollisionSolid, CollisionSphere, CRGraphicsStateGuardian, CRSavedFrameBuffer, AnalogNode, ButtonNode, ClientAnalogDevice, ClientBase, ClientButtonDevice, ClientDevice, ClientDialDevice, ClientTrackerDevice, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, DataNode, GraphicsChannel, GraphicsLayer, GraphicsPipe, GraphicsStateGuardian, GraphicsWindow, HardwareChannel, SavedFrameBuffer, CylindricalLens, FisheyeLens, ProjectionScreen, PSphereLens, DXGraphicsStateGuardian7, DXSavedFrameBuffer7, wdxGraphicsPipe7, wdxGraphicsWindow7, DXGraphicsStateGuardian8, DXSavedFrameBuffer8, wdxGraphicsPipe8, wdxGraphicsWindow8, EggAnimData, EggBin, EggBinMaker, EggComment, EggCoordinateSystem, EggCurve, EggData, EggExternalReference, EggFilenameNode, EggGroup, EggGroupNode, EggGroupUniquifier, EggMaterial, EggNamedObject, EggNameUniquifier, EggNode, EggNurbsCurve, EggNurbsSurface, EggObject, EggPoint, EggPolygon, EggPoolUniquifier, EggPrimitive, EggSAnimData, EggSurface, EggSwitchCondition, EggSwitchConditionDistance, EggTable, EggTexture, EggVertex, EggVertexPool, EggXfmAnimData, EggXfmSAnim, Event, EventStoreValueBase, EventStoreValue< Type >, RefCountProxy< Base >, RefCountObj< Base >, ThatThingie, ThisThingie, WhatAThingie, Thread, TypedReferenceCount, VirtualFile, VirtualFileComposite, VirtualFileSimple, WindowFramework, GLGraphicsStateGuardian, GLSavedFrameBuffer, glxGraphicsPipe, glxGraphicsStateGuardian, glxGraphicsWindow, dDrawable, Geom, GeomLine, GeomLinestrip, GeomPoint, GeomPolygon, GeomQuad, GeomSphere, GeomSprite, GeomTri, GeomTrifan, GeomTristrip, ImageBuffer, Lens, Material, MatrixLens, OrthographicLens, PerspectiveLens, PixelBuffer, Texture, GraphicsStateGuardianBase, Lerp, AutonomousLerp, LerpBlendType, EaseInBlendType, EaseOutBlendType, EaseInOutBlendType, NoBlendType, LerpFunctor, SimpleLerpFunctor< value >, SimpleQueryLerpFunctor< value >, MultiLerpFunctor, BoundingHexahedron, BoundingLine, BoundingSphere, BoundingVolume, FiniteBoundingVolume, GeometricBoundingVolume, OmniBoundingVolume, ClassicNurbsCurve, CubicCurveseg, HermiteCurve, NurbsPPCurve, ParametricCurve, PiecewiseCurve, RopeNode, AlphaTestAttrib, AmbientLight, BillboardEffect, Camera, ClipPlaneAttrib, ColorAttrib, ColorBlendAttrib, ColorScaleAttrib, ColorWriteAttrib, CompassEffect, CullBin, CullBinAttrib, CullBinBackToFront, CullBinFixed, CullBinFrontToBack, CullBinUnsorted, CullFaceAttrib, DecalEffect, DepthOffsetAttrib, DepthTestAttrib, DepthWriteAttrib, DirectionalLight, Fog, FogAttrib, GeomNode, LensNode, Light, LightAttrib, LightLensNode, LightNode, LODNode, MaterialAttrib, ModelNode, ModelRoot, NodePathComponent, PosLerpFunctor, HprLerpFunctor, ScaleLerpFunctor, ColorLerpFunctor, PosHprLerpFunctor, HprScaleLerpFunctor, PosHprScaleLerpFunctor, ColorScaleLerpFunctor, PandaNode, PlaneNode, PointLight, RenderAttrib, RenderEffect, RenderEffects, RenderModeAttrib, RenderState, SelectiveChildNode, SequenceNode, ShowBoundsEffect, Spotlight, SwitchNode, TexMatrixAttrib, TextureApplyAttrib, TextureAttrib, TransformState, EventStoreTransform, TransparencyAttrib, PGButton, PGEntry, PGItem, PGMouseWatcherBackground, PGMouseWatcherGroup, PGMouseWatcherParameter, PGMouseWatcherRegion, PGTop, PGWaitBar, ActorNode, AngularForce, AngularVectorForce, BaseForce, ForceNode, LinearCylinderVortexForce, LinearDistanceForce, LinearForce, LinearFrictionForce, LinearJitterForce, LinearNoiseForce, LinearRandomForce, LinearSinkForce, LinearSourceForce, LinearUserDefinedForce, LinearVectorForce, Physical, PhysicalNode, PhysicsObject, BamReaderParam, ButtonEventList, FactoryParam, Person, Parent, Child, TypedWritableReferenceCount, WritableParam, RIBGraphicsWindow, RIBGraphicsStateGuardian, CasterShader, OutlineShader, PlanarReflector, ProjtexShader, ProjtexShadower, Shader, FrustumShader, SpheretexHighlighter, SpheretexReflector, SpheretexShader, SpotlightShader, TextFont, TextNode, ButtonThrower, DriveInterface, MouseWatcher, MouseWatcherGroup, MouseWatcherRegion, Trackball, Transform2SG, VrpnAnalogDevice, VrpnButtonDevice, VrpnClient, VrpnDialDevice, VrpnTrackerDevice, wcrGraphicsWindow, wglGraphicsPipe, wglGraphicsStateGuardian, wglGraphicsWindow, WinGraphicsPipe, WinGraphicsWindow, AnimChannel< ACScalarSwitchType >, AnimChannel< ACMatrixSwitchType >, MovingPart< ACScalarSwitchType >, MovingPart< ACMatrixSwitchType >, SimpleLerpFunctor< LPoint3f >, SimpleLerpFunctor< LVecBase3f >, and SimpleLerpFunctor< LVecBase4f >.

Definition at line 66 of file referenceCount.h.

ConstPointerTo< RenderState > CullResult::get_dual_opaque_state  )  [static, private]
 

Returns a RenderState that renders only the opaque parts of an object, in support of M_dual.

Definition at line 383 of file cullResult.cxx.

Referenced by add_object().

ConstPointerTo< RenderState > CullResult::get_dual_transparent_state  )  [static, private]
 

Returns a RenderState that renders only the transparent parts of an object, in support of M_dual.

This state is suitable only for objects that do not contain decals.

Definition at line 298 of file cullResult.cxx.

Referenced by add_object().

ConstPointerTo< RenderState > CullResult::get_dual_transparent_state_decals  )  [static, private]
 

Returns a RenderState that renders only the transparent parts of an object, but suitable for objects that contain decals.

Definition at line 344 of file cullResult.cxx.

Referenced by add_object().

int ReferenceCount::get_ref_count  )  const [inline, inherited]
 

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

Referenced by RenderState::determine_bin_index(), RenderEffects::determine_show_bounds(), FontPool::ns_garbage_collect(), TexturePool::ns_garbage_collect(), MaterialPool::ns_get_material(), and TexturePool::ns_release_texture().

void ReferenceCount::init_type void   )  [inline, static, inherited]
 

Reimplemented in AnimBundle, AnimBundleNode, AnimChannel< SwitchType >, AnimChannelBase, AnimChannelFixed< SwitchType >, AnimChannelMatrixXfmTable, AnimChannelScalarTable, AnimControl, AnimGroup, MovingPart< SwitchType >, MovingPartBase, MovingPartMatrix, MovingPartScalar, PartBundle, PartBundleNode, PartGroup, Character, CharacterJoint, CharacterJointBundle, CharacterSlider, ComputedVertices, CollisionEntry, CollisionHandler, CollisionHandlerEvent, CollisionHandlerFloor, CollisionHandlerPhysical, CollisionHandlerPusher, CollisionHandlerQueue, CollisionNode, CollisionPlane, CollisionPolygon, CollisionRay, CollisionSegment, CollisionSolid, CollisionSphere, CRGraphicsStateGuardian, CRSavedFrameBuffer, AnalogNode, ButtonNode, ClientAnalogDevice, ClientBase, ClientButtonDevice, ClientDevice, ClientDialDevice, ClientTrackerDevice, DialNode, MouseAndKeyboard, TrackerNode, VirtualMouse, DataNode, GraphicsChannel, GraphicsLayer, GraphicsPipe, GraphicsStateGuardian, GraphicsWindow, HardwareChannel, SavedFrameBuffer, CylindricalLens, FisheyeLens, ProjectionScreen, PSphereLens, DXGraphicsStateGuardian7, DXSavedFrameBuffer7, wdxGraphicsPipe7, wdxGraphicsWindow7, DXGraphicsStateGuardian8, DXSavedFrameBuffer8, wdxGraphicsPipe8, wdxGraphicsWindow8, EggAnimData, EggBin, EggBinMaker, EggComment, EggCoordinateSystem, EggCurve, EggData, EggExternalReference, EggFilenameNode, EggGroup, EggGroupNode, EggGroupUniquifier, EggMaterial, EggNamedObject, EggNameUniquifier, EggNode, EggNurbsCurve, EggNurbsSurface, EggObject, EggPoint, EggPolygon, EggPoolUniquifier, EggPrimitive, EggSAnimData, EggSurface, EggSwitchCondition, EggSwitchConditionDistance, EggTable, EggTexture, EggVertex, EggVertexPool, EggXfmAnimData, EggXfmSAnim, Event, EventStoreValueBase, RefCountProxy< Base >, RefCountObj< Base >, ThatThingie, ThisThingie, WhatAThingie, Thread, TypedReferenceCount, VirtualFile, VirtualFileComposite, VirtualFileSimple, WindowFramework, GLGraphicsStateGuardian, GLSavedFrameBuffer, glxGraphicsPipe, glxGraphicsStateGuardian, glxGraphicsWindow, dDrawable, Geom, GeomLine, GeomLinestrip, GeomPoint, GeomPolygon, GeomQuad, GeomSphere, GeomSprite, GeomTri, GeomTrifan, GeomTristrip, ImageBuffer, Lens, Material, MatrixLens, OrthographicLens, PerspectiveLens, PixelBuffer, Texture, GraphicsStateGuardianBase, Lerp, AutonomousLerp, LerpBlendType, EaseInBlendType, EaseOutBlendType, EaseInOutBlendType, NoBlendType, LerpFunctor, SimpleLerpFunctor< value >, SimpleQueryLerpFunctor< value >, MultiLerpFunctor, BoundingHexahedron, BoundingLine, BoundingSphere, BoundingVolume, FiniteBoundingVolume, GeometricBoundingVolume, OmniBoundingVolume, ClassicNurbsCurve, CubicCurveseg, HermiteCurve, NurbsPPCurve, ParametricCurve, PiecewiseCurve, RopeNode, AlphaTestAttrib, AmbientLight, BillboardEffect, Camera, ClipPlaneAttrib, ColorAttrib, ColorBlendAttrib, ColorScaleAttrib, ColorWriteAttrib, CompassEffect, CullBin, CullBinAttrib, CullBinBackToFront, CullBinFixed, CullBinFrontToBack, CullBinUnsorted, CullFaceAttrib, DecalEffect, DepthOffsetAttrib, DepthTestAttrib, DepthWriteAttrib, DirectionalLight, Fog, FogAttrib, GeomNode, LensNode, Light, LightAttrib, LightLensNode, LightNode, LODNode, MaterialAttrib, ModelNode, ModelRoot, NodePathComponent, PosLerpFunctor, HprLerpFunctor, ScaleLerpFunctor, ColorLerpFunctor, PosHprLerpFunctor, HprScaleLerpFunctor, PosHprScaleLerpFunctor, ColorScaleLerpFunctor, PandaNode, PlaneNode, PointLight, RenderAttrib, RenderEffect, RenderEffects, RenderModeAttrib, RenderState, SelectiveChildNode, SequenceNode, ShowBoundsEffect, Spotlight, SwitchNode, TexMatrixAttrib, TextureApplyAttrib, TextureAttrib, TransformState, EventStoreTransform, TransparencyAttrib, PGButton, PGEntry, PGItem, PGMouseWatcherBackground, PGMouseWatcherGroup, PGMouseWatcherParameter, PGMouseWatcherRegion, PGTop, PGWaitBar, ActorNode, AngularForce, AngularVectorForce, BaseForce, ForceNode, LinearCylinderVortexForce, LinearDistanceForce, LinearForce, LinearFrictionForce, LinearJitterForce, LinearNoiseForce, LinearRandomForce, LinearSinkForce, LinearSourceForce, LinearUserDefinedForce, LinearVectorForce, Physical, PhysicalNode, PhysicsObject, BamReaderParam, ButtonEventList, FactoryParam, Person, Parent, Child, TypedWritableReferenceCount, WritableParam, RIBGraphicsWindow, RIBGraphicsStateGuardian, CasterShader, OutlineShader, PlanarReflector, ProjtexShader, ProjtexShadower, Shader, FrustumShader, SpheretexHighlighter, SpheretexReflector, SpheretexShader, SpotlightShader, TextFont, TextNode, ButtonThrower, DriveInterface, MouseWatcher, MouseWatcherGroup, MouseWatcherRegion, Trackball, Transform2SG, VrpnAnalogDevice, VrpnButtonDevice, VrpnClient, VrpnDialDevice, VrpnTrackerDevice, wcrGraphicsWindow, wglGraphicsPipe, wglGraphicsStateGuardian, wglGraphicsWindow, WinGraphicsPipe, WinGraphicsWindow, AnimChannel< ACScalarSwitchType >, AnimChannel< ACMatrixSwitchType >, MovingPart< ACScalarSwitchType >, MovingPart< ACMatrixSwitchType >, SimpleLerpFunctor< LPoint3f >, SimpleLerpFunctor< LVecBase3f >, and SimpleLerpFunctor< LVecBase4f >.

Definition at line 69 of file referenceCount.h.

References INLINE.

Referenced by ConfigureFn(), and ThatThingie::get_class_type().

CullBin * CullResult::make_new_bin int  bin_index  )  [private]
 

Allocates a new CullBin for the given bin_index and stores it for next time.

Definition at line 243 of file cullResult.cxx.

References CPT, RenderState::get_max_priority(), TransparencyAttrib::M_alpha, RenderAttrib::M_greater, TransparencyAttrib::make(), AlphaTestAttrib::make(), RenderState::make(), and NULL.

Referenced by ~CullResult().

PointerTo< CullResult > CullResult::make_next  )  const
 

Returns a newly-allocated CullResult object that contains a copy of just the subset of the data from this CullResult object that is worth keeping around for next frame.

Definition at line 68 of file cullResult.cxx.

int ReferenceCount::ref  )  const [inline, inherited]
 

Explicitly increments the reference count.

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 225 of file referenceCount.I.

Referenced by ClientDevice::ClientDevice(), EggGroupNode::find_textures(), EggGroupNode::r_apply_texmats(), EggGroupNode::r_flatten_transforms(), and EggGroupNode::reverse_vertex_ordering().

void ReferenceCount::test_ref_count_integrity  )  const [inline, inherited]
 

Does some easy checks to make sure that the reference count isn't completely bogus.

Definition at line 328 of file referenceCount.I.

References INLINE.

Referenced by EggNode::determine_bin(), and ReferenceCount::~ReferenceCount().

int ReferenceCount::unref  )  const [inline, inherited]
 

Explicitly decrements the reference count.

Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete().

User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.

This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

The return value is the new reference count.

Definition at line 293 of file referenceCount.I.

References INLINE.

Referenced by RenderState::determine_bin_index(), and RenderEffects::determine_show_bounds().


Member Data Documentation

Bins CullResult::_bins [private]
 

Definition at line 87 of file cullResult.h.

Referenced by finish_cull(), and ~CullResult().

CullResults CullResult::_cull_results [static, private]
 

Definition at line 90 of file cullResult.h.

GraphicsStateGuardianBase* CullResult::_gsg [private]
 

Definition at line 84 of file cullResult.h.


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:05 2003 for Panda by doxygen1.3