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

CullBinManager Class Reference

This is a global object that maintains the collection of named CullBins in the world. More...

#include <cullBinManager.h>

List of all members.

Public Types

enum  BinType {
  BT_invalid, BT_unsorted, BT_state_sorted, BT_back_to_front,
  BT_front_to_back, BT_fixed
}

Public Member Functions

int add_bin (const string &name, BinType type, int sort)
 Defines a new bin with the indicated name, and returns the new bin_index.

void remove_bin (int bin_index)
 Permanently removes the indicated bin.

int get_num_bins () const
 Returns the number of bins in the world.

int get_bin (int n) const
 Returns the bin_index of the nth bin in the set, where n is a number between 0 and get_num_bins().

int find_bin (const string &name) const
 Returns the bin_index associated with the bin of the given name, or -1 if no bin has that name.

string get_bin_name (int bin_index) const
BinType get_bin_type (int bin_index) const
 Returns the type of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).

int get_bin_sort (int bin_index) const
 Returns the sort order of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).

void set_bin_sort (int bin_index, int sort)
 Changes the sort order of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).

PointerTo< CullBinmake_new_bin (int bin_index, GraphicsStateGuardianBase *gsg)
 Intended to be called by CullResult when a new CullBin pointer corresponding to the indicated bin_index is required.


Static Public Member Functions

CullBinManager * get_global_ptr ()
 Returns the pointer to the global CullBinManager object.


Protected Member Functions

 CullBinManager ()
 The constructor is not intended to be called directly; there is only one CullBinManager and it constructs itself.

 ~CullBinManager ()
 Don't call the destructor.


Private Types

typedef pvector< BinDefinitionBinDefinitions
typedef pmap< string, int > BinsByName
typedef vector_int SortedBins

Private Member Functions

void do_sort_bins ()
 Puts the _sorted_bins vector in proper rendering order.

void setup_initial_bins ()
 Called only at construction time to create the default bins and the bins specified in the Configrc file.


Static Private Member Functions

BinType parse_bin_type (const string &bin_type)
 Given the name of a bin type, returns the corresponding BinType value, or BT_invalid if it is an unknown type.


Private Attributes

BinDefinitions _bin_definitions
BinsByName _bins_by_name
SortedBins _sorted_bins
bool _bins_are_sorted
bool _unused_bin_index

Static Private Attributes

CullBinManager * _global_ptr = (CullBinManager *)NULL

Friends

class SortBins


Detailed Description

This is a global object that maintains the collection of named CullBins in the world.

Definition at line 44 of file cullBinManager.h.


Member Typedef Documentation

typedef pvector<BinDefinition> CullBinManager::BinDefinitions [private]
 

Definition at line 90 of file cullBinManager.h.

typedef pmap<string, int> CullBinManager::BinsByName [private]
 

Definition at line 100 of file cullBinManager.h.

typedef vector_int CullBinManager::SortedBins [private]
 

Definition at line 103 of file cullBinManager.h.


Member Enumeration Documentation

enum CullBinManager::BinType
 

Enumeration values:
BT_invalid 
BT_unsorted 
BT_state_sorted 
BT_back_to_front 
BT_front_to_back 
BT_fixed 

Definition at line 50 of file cullBinManager.h.

Referenced by get_bin(), and PGItem::has_cull_callback().


Constructor & Destructor Documentation

CullBinManager::CullBinManager  )  [protected]
 

The constructor is not intended to be called directly; there is only one CullBinManager and it constructs itself.

This could have been a private constructor, but gcc issues a spurious warning if the constructor is private and the class has no friends.

Definition at line 52 of file cullBinManager.cxx.

CullBinManager::~CullBinManager  )  [protected]
 

Don't call the destructor.

Definition at line 68 of file cullBinManager.cxx.

References _bin_definitions, _bins_by_name, CullBinManager::BinDefinition::_in_use, CullBinManager::BinDefinition::_sort, CullBinManager::BinDefinition::_type, and nassertr.


Member Function Documentation

int CullBinManager::add_bin const string &  name,
BinType  type,
int  sort
 

Defines a new bin with the indicated name, and returns the new bin_index.

If there is already a bin with the same name returns its bin_index if it had the same properties; otherwise, reports an error and returns -1.

Definition at line 88 of file cullBinManager.cxx.

References _bin_definitions, and _unused_bin_index.

void CullBinManager::do_sort_bins  )  [private]
 

Puts the _sorted_bins vector in proper rendering order.

Definition at line 273 of file cullBinManager.cxx.

int CullBinManager::find_bin const string &  name  )  const
 

Returns the bin_index associated with the bin of the given name, or -1 if no bin has that name.

Definition at line 201 of file cullBinManager.cxx.

References BT_back_to_front, BT_fixed, BT_front_to_back, and NULL.

int CullBinManager::get_bin int  n  )  const [inline]
 

Returns the bin_index of the nth bin in the set, where n is a number between 0 and get_num_bins().

This returns the list of bin_index numbers, in sorted order (that is, in the order in which the bins should be rendered).

Definition at line 96 of file cullBinManager.I.

References _bin_definitions, BinType, BT_invalid, INLINE, and nassertr.

string CullBinManager::get_bin_name int  bin_index  )  const [inline]
 

int CullBinManager::get_bin_sort int  bin_index  )  const [inline]
 

Returns the sort order of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).

The bins are rendered in increasing order by their sort order; this number may be changed from time to time to reorder the bins.

Definition at line 165 of file cullBinManager.I.

Referenced by PGItem::has_cull_callback().

CullBinManager::BinType CullBinManager::get_bin_type int  bin_index  )  const [inline]
 

Returns the type of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).

The bin's type may not be changed during the life of the bin.

Definition at line 138 of file cullBinManager.I.

References _bin_definitions, _bins_are_sorted, INLINE, and nassertv.

Referenced by PGItem::has_cull_callback().

CullBinManager * CullBinManager::get_global_ptr  )  [static]
 

Returns the pointer to the global CullBinManager object.

Definition at line 221 of file cullBinManager.cxx.

References _bins_are_sorted, _sorted_bins, and SortBins.

Referenced by PGItem::has_cull_callback().

int CullBinManager::get_num_bins  )  const [inline]
 

Returns the number of bins in the world.

Definition at line 69 of file cullBinManager.I.

References _sorted_bins, INLINE, and nassertr.

PointerTo< CullBin > CullBinManager::make_new_bin int  bin_index,
GraphicsStateGuardianBase gsg
 

Intended to be called by CullResult when a new CullBin pointer corresponding to the indicated bin_index is required.

It allocates and returns a brand new CullBin object of the appropriate type.

Definition at line 243 of file cullBinManager.cxx.

References ConfigString.

CullBinManager::BinType CullBinManager::parse_bin_type const string &  bin_type  )  [static, private]
 

Given the name of a bin type, returns the corresponding BinType value, or BT_invalid if it is an unknown type.

Definition at line 362 of file cullBinManager.cxx.

void CullBinManager::remove_bin int  bin_index  ) 
 

Permanently removes the indicated bin.

This operation is not protected from the pipeline and will disturb whatever is currently rendering in draw. You should not call this during the normal course of rendering a frame; it is intended only as an aid to development, to allow the developer to interactively fiddle with the set of bins.

Definition at line 167 of file cullBinManager.cxx.

References _bins_by_name.

void CullBinManager::set_bin_sort int  bin_index,
int  sort
[inline]
 

Changes the sort order of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).

The bins are rendered in increasing order by their sort order; this number may be changed from time to time to reorder the bins.

Definition at line 192 of file cullBinManager.I.

void CullBinManager::setup_initial_bins  )  [private]
 

Called only at construction time to create the default bins and the bins specified in the Configrc file.

Definition at line 291 of file cullBinManager.cxx.


Friends And Related Function Documentation

friend class SortBins [friend]
 

Definition at line 109 of file cullBinManager.h.

Referenced by get_global_ptr().


Member Data Documentation

BinDefinitions CullBinManager::_bin_definitions [private]
 

Definition at line 91 of file cullBinManager.h.

Referenced by add_bin(), get_bin(), get_bin_type(), CullBinManager::SortBins::SortBins(), and ~CullBinManager().

bool CullBinManager::_bins_are_sorted [private]
 

Definition at line 105 of file cullBinManager.h.

Referenced by get_bin_type(), and get_global_ptr().

BinsByName CullBinManager::_bins_by_name [private]
 

Definition at line 101 of file cullBinManager.h.

Referenced by remove_bin(), and ~CullBinManager().

CullBinManager * CullBinManager::_global_ptr = (CullBinManager *)NULL [static, private]
 

Definition at line 33 of file cullBinManager.cxx.

SortedBins CullBinManager::_sorted_bins [private]
 

Definition at line 104 of file cullBinManager.h.

Referenced by get_global_ptr(), and get_num_bins().

bool CullBinManager::_unused_bin_index [private]
 

Definition at line 106 of file cullBinManager.h.

Referenced by add_bin().


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