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

RenderState Class Reference

This represents a unique collection of RenderAttrib objects that correspond to a particular renderable state. More...

#include <renderState.h>

Inheritance diagram for RenderState:

TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject List of all members.

Public Member Functions

virtual ~RenderState ()
 The destructor is responsible for removing the RenderState from the global set if it is there.

bool operator< (const RenderState &other) const
 Provides an arbitrary ordering among all unique RenderStates, so we can store the essentially different ones in a big set and throw away the rest.

bool is_empty () const
 Returns true if the state is empty, false otherwise.

int get_num_attribs () const
 Returns the number of separate attributes indicated in the state.

const RenderAttribget_attrib (int n) const
 Returns the nth attribute in the state.

int get_override (int n) const
 Returns the override associated with the nth attribute in the state.

int find_attrib (TypeHandle type) const
 Searches for an attribute with the indicated type in the state, and returns its index if it is found, or -1 if it is not.

ConstPointerTo< RenderState > compose (const RenderState *other) const
 Returns a new RenderState object that represents the composition of this state with the other state.

ConstPointerTo< RenderState > invert_compose (const RenderState *other) const
 Returns a new RenderState object that represents the composition of this state's inverse with the other state.

ConstPointerTo< RenderState > add_attrib (const RenderAttrib *attrib, int override=0) const
 Returns a new RenderState object that represents the same as the source state, with the new RenderAttrib added.

ConstPointerTo< RenderState > remove_attrib (TypeHandle type) const
 Returns a new RenderState object that represents the same as the source state, with the indicated RenderAttrib removed.

ConstPointerTo< RenderState > adjust_all_priorities (int adjustment) const
 Returns a new RenderState object that represents the same as the source state, with all attributes' override values incremented (or decremented, if negative) by the indicated amount.

const RenderAttribget_attrib (TypeHandle type) const
 Looks for a RenderAttrib of the indicated type in the state, and returns it if it is found, or NULL if it is not.

void output (ostream &out) const
void write (ostream &out, int indent_level) const
int get_bin_index () const
 Returns the bin index indicated by the CullBinAttrib, if any, associated by this state (or the default bin index if there is no CullBinAttrib).

int get_draw_order () const
 Returns the draw order indicated by the CullBinAttrib, if any, associated by this state (or 0 if there is no CullBinAttrib).

const FogAttribget_fog () const
 This function is provided as an optimization, to speed up the render-time checking for the existance of a FogAttrib on this state.

const CullBinAttribget_bin () const
 This function is provided as an optimization, to speed up the render-time checking for the existance of a BinAttrib on this state.

const TransparencyAttribget_transparency () const
 This function is provided as an optimization, to speed up the render-time checking for the existance of a TransparencyAttrib on this state.

ConstPointerTo< RenderState > issue_delta_modify (const RenderState *other, GraphicsStateGuardianBase *gsg) const
 This is intended to be called only from GraphicsStateGuardian::modify_state().

ConstPointerTo< RenderState > issue_delta_set (const RenderState *other, GraphicsStateGuardianBase *gsg) const
 This is intended to be called only from GraphicsStateGuardian::set_state().

virtual void write_datagram (BamWriter *manager, Datagram &dg)
 Writes the contents of this object to the datagram for shipping out to a Bam file.

virtual int complete_pointers (TypedWritable **plist, BamReader *manager)
 Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

virtual void finalize ()
 Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

virtual TypeHandle get_type () const
virtual TypeHandle force_init_type ()
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type.

bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly.

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

ConstPointerTo< RenderState > make_empty ()
 Returns a RenderState with no attributes set.

ConstPointerTo< RenderState > make (const RenderAttrib *attrib, int override=0)
 Returns a RenderState with one attribute set.

ConstPointerTo< RenderState > make (const RenderAttrib *attrib1, const RenderAttrib *attrib2, int override=0)
 Returns a RenderState with two attributes set.

ConstPointerTo< RenderState > make (const RenderAttrib *attrib1, const RenderAttrib *attrib2, const RenderAttrib *attrib3, int override=0)
 Returns a RenderState with three attributes set.

ConstPointerTo< RenderState > make (const RenderAttrib *attrib1, const RenderAttrib *attrib2, const RenderAttrib *attrib3, const RenderAttrib *attrib4, int override=0)
 Returns a RenderState with four attributes set.

ConstPointerTo< RenderState > make (const RenderAttrib *const *attrib, int num_attribs, int override=0)
 Returns a RenderState with n attributes set.

int get_max_priority ()
 Returns the maximum priority number (sometimes called override) that may be set on any node.

int get_num_states ()
 Returns the total number of unique RenderState objects allocated in the world.

int get_num_unused_states ()
 Returns the total number of RenderState objects that have been allocated but have no references outside of the internal RenderState map.

int clear_cache ()
 Empties the cache of composed RenderStates.

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

void register_with_read_factory ()
 Tells the BamReader how to create objects of type RenderState.

TypedWritablechange_this (TypedWritable *old_ptr, BamReader *manager)
 Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointer if desired.

TypeHandle get_class_type ()
void init_type ()

Static Public Attributes

TypedWritable *const Null = (TypedWritable*)0L

Protected Member Functions

 RenderState ()
 Actually, this could be a private constructor, since no one inherits from RenderState, but gcc gives us a spurious warning if all constructors are private.

void fillin (DatagramIterator &scan, BamReader *manager)
 This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new RenderState.


Static Protected Member Functions

TypedWritablemake_from_bam (const FactoryParams &params)
 This function is called by the BamReader's factory when a new object of type RenderState is encountered in the Bam file.


Private Types

typedef pset< const RenderState *,
IndirectLess< RenderState > > 
States
typedef pmap< const RenderState *,
Composition
CompositionCache
typedef ov_set< AttributeAttributes
enum  Flags {
  F_checked_bin_index = 0x0001, F_checked_fog = 0x0002, F_checked_bin = 0x0004, F_checked_transparency = 0x0008,
  F_is_destructing = 0x8000
}

Private Member Functions

 RenderState (const RenderState &copy)
 RenderStates are not meant to be copied.

void operator= (const RenderState &copy)
 RenderStates are not meant to be copied.

ConstPointerTo< RenderState > do_compose (const RenderState *other) const
 The private implemention of compose(); this actually composes two RenderStates, without bothering with the cache.

ConstPointerTo< RenderState > do_invert_compose (const RenderState *other) const
 The private implemention of invert_compose().

void determine_bin_index ()
 This is the private implementation of get_bin_index() and get_draw_order().

void determine_fog ()
 This is the private implementation of get_fog().

void determine_bin ()
 This is the private implementation of get_bin().

void determine_transparency ()
 This is the private implementation of get_transparency().

void set_destructing ()
 This function should only be called from the destructor; it indicates that this RenderState object is beginning destruction.

bool is_destructing () const
 Returns true if the RenderState object is currently within its destructor (i.e.


Static Private Member Functions

ConstPointerTo< RenderState > return_new (RenderState *state)
 This function is used to share a common RenderState pointer for all equivalent RenderState objects.


Private Attributes

States::iterator _saved_entry
CompositionCache _composition_cache
CompositionCache _invert_composition_cache
const RenderState * _self_compose
Attributes _attributes
int _bin_index
int _draw_order
const FogAttrib_fog
const CullBinAttrib_bin
const TransparencyAttrib_transparency
unsigned short _flags

Static Private Attributes

States_states = NULL
ConstPointerTo< RenderState > _empty_state
TypeHandle _type_handle

Detailed Description

This represents a unique collection of RenderAttrib objects that correspond to a particular renderable state.

You should not attempt to create or modify a RenderState object directly. Instead, call one of the make() functions to create one for you. And instead of modifying a RenderState object, create a new one.

Definition at line 62 of file renderState.h.


Member Typedef Documentation

typedef ov_set<Attribute> RenderState::Attributes [private]
 

Definition at line 194 of file renderState.h.

typedef pmap<const RenderState *, Composition> RenderState::CompositionCache [private]
 

Definition at line 165 of file renderState.h.

typedef pset<const RenderState *, IndirectLess<RenderState> > RenderState::States [private]
 

Definition at line 143 of file renderState.h.


Member Enumeration Documentation

enum RenderState::Flags [private]
 

Enumeration values:
F_checked_bin_index 
F_checked_fog 
F_checked_bin 
F_checked_transparency 
F_is_destructing 

Definition at line 208 of file renderState.h.


Constructor & Destructor Documentation

RenderState::RenderState  )  [protected]
 

Actually, this could be a private constructor, since no one inherits from RenderState, but gcc gives us a spurious warning if all constructors are private.

Definition at line 53 of file renderState.cxx.

RenderState::RenderState const RenderState &  copy  )  [private]
 

RenderStates are not meant to be copied.

Definition at line 76 of file renderState.cxx.

RenderState::~RenderState  )  [virtual]
 

The destructor is responsible for removing the RenderState from the global set if it is there.

Definition at line 104 of file renderState.cxx.

References _composition_cache, and nassertv.


Member Function Documentation

ConstPointerTo< RenderState > RenderState::add_attrib const RenderAttrib attrib,
int  override = 0
const
 

Returns a new RenderState object that represents the same as the source state, with the new RenderAttrib added.

If there is already a RenderAttrib with the same type, it is replaced.

Definition at line 548 of file renderState.cxx.

Referenced by CullResult::get_binary_state().

ConstPointerTo< RenderState > RenderState::adjust_all_priorities int  adjustment  )  const
 

Returns a new RenderState object that represents the same as the source state, with all attributes' override values incremented (or decremented, if negative) by the indicated amount.

If the override would drop below zero, it is set to zero.

Definition at line 629 of file renderState.cxx.

References _states, and NULL.

void RenderState::bin_removed int  bin_index  )  [static]
 

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

Definition at line 1107 of file renderState.cxx.

TypedWritable * RenderState::change_this TypedWritable old_ptr,
BamReader manager
[static]
 

Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointer if desired.

Most objects don't change pointers after completion, but some need to.

Once this function has been called, the old pointer will no longer be accessed.

Definition at line 1498 of file renderState.cxx.

int RenderState::clear_cache  )  [static]
 

Empties the cache of composed RenderStates.

This makes every RenderState forget what results when it is composed with other RenderStates.

This will eliminate any RenderState objects that have been allocated but have no references outside of the internal RenderState map. It will not eliminate RenderState objects that are still in use.

Normally, RenderState objects will remove themselves from the interal map when their reference counts go to 0, but since circular references are possible there may be some cycles that cannot remove themselves. Calling this function from time to time will ensure there is no wasteful memory leakage, but calling it too often may result in decreased performance as the cache is forced to be recomputed.

The return value is the number of RenderStates freed by this operation.

Definition at line 892 of file renderState.cxx.

int RenderState::complete_pointers TypedWritable **  plist,
BamReader manager
[virtual]
 

Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().

Returns the number of pointers processed.

Reimplemented from TypedWritable.

Definition at line 1455 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::compose const RenderState *  other  )  const
 

Returns a new RenderState object that represents the composition of this state with the other state.

The result of this operation is cached, and will be retained as long as both this RenderState object and the other RenderState object continue to exist. Should one of them destruct, the cached entry will be removed, and its pointer will be allowed to destruct as well.

Definition at line 402 of file renderState.cxx.

Referenced by CullResult::add_object(), StaticTextFont::find_character_gsets(), StaticTextFont::get_glyph(), NodePath::get_transparency(), NodePath::has_transparency(), and NodePath::set_transparency().

void RenderState::determine_bin  )  [private]
 

This is the private implementation of get_bin().

Definition at line 1370 of file renderState.cxx.

void RenderState::determine_bin_index  )  [private]
 

This is the private implementation of get_bin_index() and get_draw_order().

Definition at line 1302 of file renderState.cxx.

References ReferenceCount::get_ref_count(), nassertv, and ReferenceCount::unref().

void RenderState::determine_fog  )  [private]
 

This is the private implementation of get_fog().

Definition at line 1352 of file renderState.cxx.

References _attributes.

void RenderState::determine_transparency  )  [private]
 

This is the private implementation of get_transparency().

Definition at line 1388 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::do_compose const RenderState *  other  )  const [private]
 

The private implemention of compose(); this actually composes two RenderStates, without bothering with the cache.

Definition at line 1173 of file renderState.cxx.

References _bin, _flags, DCAST, F_checked_bin, get_attrib(), CullBinAttrib::get_class_type(), and NULL.

ConstPointerTo< RenderState > RenderState::do_invert_compose const RenderState *  other  )  const [private]
 

The private implemention of invert_compose().

Definition at line 1244 of file renderState.cxx.

References RenderState::Attribute::_attrib, _attributes, RenderState::Attribute::_type, TypedWritable::complete_pointers(), DCAST, nassertr, NULL, and ov_set< Attribute >::sort().

void RenderState::fillin DatagramIterator scan,
BamReader manager
[protected]
 

This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new RenderState.

Reimplemented from TypedWritable.

Definition at line 1583 of file renderState.cxx.

void RenderState::finalize void   )  [virtual]
 

Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.

Reimplemented from TypedWritable.

Definition at line 1531 of file renderState.cxx.

int RenderState::find_attrib TypeHandle  type  )  const
 

Searches for an attribute with the indicated type in the state, and returns its index if it is found, or -1 if it is not.

Definition at line 252 of file renderState.cxx.

virtual TypeHandle RenderState::force_init_type void   )  [inline, virtual]
 

Reimplemented from TypedWritableReferenceCount.

Definition at line 240 of file renderState.h.

const RenderAttrib * RenderState::get_attrib TypeHandle  type  )  const
 

Looks for a RenderAttrib of the indicated type in the state, and returns it if it is found, or NULL if it is not.

Definition at line 656 of file renderState.cxx.

References _states, and NULL.

const RenderAttrib * RenderState::get_attrib int  n  )  const [inline]
 

Returns the nth attribute in the state.

Definition at line 218 of file renderState.I.

References _draw_order.

Referenced by do_compose().

const CullBinAttrib * RenderState::get_bin  )  const [inline]
 

This function is provided as an optimization, to speed up the render-time checking for the existance of a BinAttrib on this state.

It returns a pointer to the BinAttrib, if there is one, or NULL if there is not.

Definition at line 330 of file renderState.I.

Referenced by CullResult::add_object().

int RenderState::get_bin_index  )  const [inline]
 

Returns the bin index indicated by the CullBinAttrib, if any, associated by this state (or the default bin index if there is no CullBinAttrib).

This function is provided as an optimization for determining this at render time.

Definition at line 256 of file renderState.I.

References _bin.

TypeHandle RenderState::get_class_type void   )  [inline, static]
 

Reimplemented from TypedWritableReferenceCount.

Definition at line 229 of file renderState.h.

int RenderState::get_draw_order  )  const [inline]
 

Returns the draw order indicated by the CullBinAttrib, if any, associated by this state (or 0 if there is no CullBinAttrib).

See get_bin_index().

Definition at line 278 of file renderState.I.

References _flags, F_is_destructing, and INLINE.

const FogAttrib * RenderState::get_fog  )  const [inline]
 

This function is provided as an optimization, to speed up the render-time checking for the existance of a FogAttrib on this state.

It returns a pointer to the FogAttrib, if there is one, or NULL if there is not.

Definition at line 304 of file renderState.I.

References _flags, and F_is_destructing.

int RenderState::get_max_priority  )  [static]
 

Returns the maximum priority number (sometimes called override) that may be set on any node.

This may or may not be enforced, but the scene graph code assumes that no priority numbers will be larger than this, and some effects may not work properly if you use a larger number.

Definition at line 728 of file renderState.cxx.

Referenced by CullResult::bin_removed(), and CullResult::make_new_bin().

int RenderState::get_num_attribs  )  const [inline]
 

Returns the number of separate attributes indicated in the state.

Definition at line 205 of file renderState.I.

References _flags, F_checked_bin_index, and INLINE.

int RenderState::get_num_states  )  [static]
 

Returns the total number of unique RenderState objects allocated in the world.

This will go up and down during normal operations.

Definition at line 745 of file renderState.cxx.

References _states, and NULL.

int RenderState::get_num_unused_states  )  [static]
 

Returns the total number of RenderState objects that have been allocated but have no references outside of the internal RenderState map.

Definition at line 765 of file renderState.cxx.

References _states, and NULL.

int RenderState::get_override int  n  )  const [inline]
 

Returns the override associated with the nth attribute in the state.

Definition at line 234 of file renderState.I.

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

Returns the current reference count.

Definition at line 183 of file referenceCount.I.

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

const TransparencyAttrib * RenderState::get_transparency  )  const [inline]
 

This function is provided as an optimization, to speed up the render-time checking for the existance of a TransparencyAttrib on this state.

It returns a pointer to the TransparencyAttrib, if there is one, or NULL if there is not.

Definition at line 356 of file renderState.I.

virtual TypeHandle RenderState::get_type void   )  const [inline, virtual]
 

Reimplemented from TypedWritableReferenceCount.

Definition at line 237 of file renderState.h.

Referenced by RenderState::Composition::Composition().

int TypedObject::get_type_index  )  const [inline, inherited]
 

Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.

This is equivalent to get_type().get_index().

Definition at line 71 of file typedObject.I.

References TypeHandle::get_name(), TypedObject::get_type(), and INLINE.

void RenderState::init_type void   )  [inline, static]
 

Reimplemented from TypedWritableReferenceCount.

Definition at line 232 of file renderState.h.

References INLINE, and output().

ConstPointerTo< RenderState > RenderState::invert_compose const RenderState *  other  )  const
 

Returns a new RenderState object that represents the composition of this state's inverse with the other state.

This is similar to compose(), but is particularly useful for computing the relative state of a node as viewed from some other node.

Definition at line 487 of file renderState.cxx.

References _attributes.

bool RenderState::is_destructing  )  const [inline, private]
 

Returns true if the RenderState object is currently within its destructor (i.e.

set_destructing() has been called). This is only used as a sanity check, and is only meaningful when NDEBUG is not defined.

Definition at line 405 of file renderState.I.

bool RenderState::is_empty  )  const [inline]
 

Returns true if the state is empty, false otherwise.

Definition at line 190 of file renderState.I.

References _bin_index, _flags, F_checked_bin_index, and INLINE.

bool TypedObject::is_exact_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is the indicated type exactly.

Definition at line 101 of file typedObject.I.

Referenced by PT(), and CollisionNode::xform().

bool TypedObject::is_of_type TypeHandle  handle  )  const [inline, inherited]
 

Returns true if the current object is or derives from the indicated type.

Definition at line 86 of file typedObject.I.

Referenced by EggMaterialCollection::collapse_equivalent_materials(), EggTextureCollection::collapse_equivalent_textures(), DeferredNodeProperty::compose(), AnimBundleMaker::create_s_channel(), CharacterMaker::create_slider(), ProjectionScreen::cull_callback(), DataNode::define_output(), EggNode::determine_draw_order(), CharacterMaker::egg_to_index(), EggGroupUniquifier::EggGroupUniquifier(), EggPoolUniquifier::EggPoolUniquifier(), EggGroupNode::find_textures(), StaticTextFont::get_glyph(), EggMaterialCollection::insert_materials(), EggTextureCollection::insert_textures(), CharacterJoint::make_copy(), PT(), EggGroupNode::r_flatten_transforms(), EggGroupNode::r_transform_vertices(), EggGroupNode::recompute_polygon_normals(), CollisionLevelState::reserve(), PandaFramework::reset_frame_rate(), PandaFramework::set_texture(), EggGroupNode::steal_children(), and DataGraphTraverser::traverse().

ConstPointerTo< RenderState > RenderState::issue_delta_modify const RenderState *  other,
GraphicsStateGuardianBase gsg
const
 

This is intended to be called only from GraphicsStateGuardian::modify_state().

It calls issue() for each attribute given in the other state that differs from the current state (which is assumed to represent the GSG's current state). Returns the RenderState representing the newly composed result.

Definition at line 954 of file renderState.cxx.

References _saved_entry, _states, CPT, nassertr, and NULL.

ConstPointerTo< RenderState > RenderState::issue_delta_set const RenderState *  other,
GraphicsStateGuardianBase gsg
const
 

This is intended to be called only from GraphicsStateGuardian::set_state().

It calls issue() for each attribute given in the other state that differs from the current state (which is assumed to represent the GSG's current state). Returns the RenderState representing the newly composed result (which will be the same as other).

Definition at line 1045 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::make const RenderAttrib *const *  attrib,
int  num_attribs,
int  override = 0
[static]
 

Returns a RenderState with n attributes set.

Definition at line 368 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::make const RenderAttrib attrib1,
const RenderAttrib attrib2,
const RenderAttrib attrib3,
const RenderAttrib attrib4,
int  override = 0
[static]
 

Returns a RenderState with four attributes set.

Definition at line 345 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::make const RenderAttrib attrib1,
const RenderAttrib attrib2,
const RenderAttrib attrib3,
int  override = 0
[static]
 

Returns a RenderState with three attributes set.

Definition at line 324 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::make const RenderAttrib attrib1,
const RenderAttrib attrib2,
int  override = 0
[static]
 

Returns a RenderState with two attributes set.

Definition at line 305 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::make const RenderAttrib attrib,
int  override = 0
[static]
 

Returns a RenderState with one attribute set.

Definition at line 289 of file renderState.cxx.

Referenced by GraphicsStateGuardian::begin_bind_clip_planes(), GraphicsStateGuardian::begin_scene(), CullResult::bin_removed(), CollisionSolid::fillin(), CullTraverser::get_bounds_outer_viz_state(), CollisionSolid::get_solid_viz_state(), CullTraverser::make_bounds_viz(), and CullResult::make_new_bin().

ConstPointerTo< RenderState > RenderState::make_empty  )  [static]
 

Returns a RenderState with no attributes set.

Definition at line 269 of file renderState.cxx.

Referenced by CollisionNode::combine_with(), NodePath::do_billboard_point_eye(), PandaNode::set_attrib(), TextGlyph::TextGlyph(), and GraphicsStateGuardian::~GraphicsStateGuardian().

TypedWritable * RenderState::make_from_bam const FactoryParams params  )  [static, protected]
 

This function is called by the BamReader's factory when a new object of type RenderState is encountered in the Bam file.

It should create the RenderState and extract its information from the file.

Definition at line 1558 of file renderState.cxx.

bool RenderState::operator< const RenderState &  other  )  const
 

Provides an arbitrary ordering among all unique RenderStates, so we can store the essentially different ones in a big set and throw away the rest.

This method is not needed outside of the RenderState class because all equivalent RenderState objects are guaranteed to share the same pointer; thus, a pointer comparison is always sufficient.

Definition at line 230 of file renderState.cxx.

References _empty_state, NULL, and return_new().

void RenderState::operator= const RenderState &  copy  )  [private]
 

RenderStates are not meant to be copied.

Definition at line 89 of file renderState.cxx.

References _saved_entry, and _states.

void RenderState::output ostream &  out  )  const
 

Definition at line 674 of file renderState.cxx.

Referenced by init_type().

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 RenderState::register_with_read_factory void   )  [static]
 

Tells the BamReader how to create objects of type RenderState.

Definition at line 1409 of file renderState.cxx.

ConstPointerTo< RenderState > RenderState::remove_attrib TypeHandle  type  )  const
 

Returns a new RenderState object that represents the same as the source state, with the indicated RenderAttrib removed.

Definition at line 594 of file renderState.cxx.

References RenderState::Attribute::_attrib, _attributes, and indent().

ConstPointerTo< RenderState > RenderState::return_new RenderState *  state  )  [static, private]
 

This function is used to share a common RenderState pointer for all equivalent RenderState objects.

See the similar logic in RenderAttrib. The idea is to create a new RenderState object and pass it through this function, which will share the pointer with a previously-created RenderState object if it is equivalent.

Definition at line 1135 of file renderState.cxx.

References TransparencyAttrib::M_alpha_sorted, and TransparencyAttrib::M_dual.

Referenced by operator<().

void RenderState::set_destructing  )  [inline, private]
 

This function should only be called from the destructor; it indicates that this RenderState object is beginning destruction.

It is only used as a sanity check, and is only meaningful when NDEBUG is not defined.

Definition at line 382 of file renderState.I.

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 determine_bin_index(), and RenderEffects::determine_show_bounds().

void RenderState::write ostream &  out,
int  indent_level
const
 

Definition at line 700 of file renderState.cxx.

Referenced by GraphicsStateGuardian::reset_if_new().

void RenderState::write_datagram BamWriter manager,
Datagram dg
[virtual]
 

Writes the contents of this object to the datagram for shipping out to a Bam file.

Implements TypedWritableReferenceCount.

Definition at line 1424 of file renderState.cxx.


Member Data Documentation

Attributes RenderState::_attributes [private]
 

Definition at line 195 of file renderState.h.

Referenced by determine_fog(), do_invert_compose(), invert_compose(), and remove_attrib().

const CullBinAttrib* RenderState::_bin [private]
 

Definition at line 205 of file renderState.h.

Referenced by do_compose(), and get_bin_index().

int RenderState::_bin_index [private]
 

Definition at line 199 of file renderState.h.

Referenced by is_empty().

CompositionCache RenderState::_composition_cache [private]
 

Definition at line 166 of file renderState.h.

Referenced by ~RenderState().

int RenderState::_draw_order [private]
 

Definition at line 200 of file renderState.h.

Referenced by get_attrib().

ConstPointerTo< RenderState > RenderState::_empty_state [static, private]
 

Definition at line 36 of file renderState.cxx.

Referenced by operator<().

unsigned short RenderState::_flags [private]
 

Definition at line 215 of file renderState.h.

Referenced by do_compose(), get_draw_order(), get_fog(), get_num_attribs(), and is_empty().

const FogAttrib* RenderState::_fog [private]
 

Definition at line 204 of file renderState.h.

CompositionCache RenderState::_invert_composition_cache [private]
 

Definition at line 167 of file renderState.h.

States::iterator RenderState::_saved_entry [private]
 

Definition at line 150 of file renderState.h.

Referenced by issue_delta_modify(), and operator=().

const RenderState* RenderState::_self_compose [private]
 

Definition at line 175 of file renderState.h.

RenderState::States * RenderState::_states = NULL [static, private]
 

Definition at line 35 of file renderState.cxx.

Referenced by adjust_all_priorities(), get_attrib(), get_num_states(), get_num_unused_states(), issue_delta_modify(), and operator=().

const TransparencyAttrib* RenderState::_transparency [private]
 

Definition at line 206 of file renderState.h.

TypeHandle RenderState::_type_handle [static, private]
 

Reimplemented from TypedWritableReferenceCount.

Definition at line 37 of file renderState.cxx.

TypedWritable *const TypedWritable::Null = (TypedWritable*)0L [static, inherited]
 

Definition at line 25 of file typedWritable.cxx.

Referenced by Child::complete_pointers(), Parent::complete_pointers(), Person::complete_pointers(), LoaderFileTypeBam::get_extension(), PartGroup::pick_channel_index(), BamReader::read_pointer(), and AnimGroup::write_datagram().


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