This is a global object that maintains the collection of named CullBins in the world. More...
#include "cullBinManager.h"
Public Types | |
typedef CullBin * | BinConstructor (const string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector) |
typedef CullBin::BinType | BinType |
![]() | |
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. More... | |
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. More... | |
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(). More... | |
bool | get_bin_active (int bin_index) const |
Returns the active flag of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()). More... | |
bool | get_bin_active (const string &name) const |
Returns the active flag of the bin with the indicated name. More... | |
bool | get_bin_flash_active (int bin_index) const |
Returns true if the bin with the given bin_index is configured to flash at a predetermined color (where bin_index was retrieved by get_bin() or find_bin()). More... | |
const LColor & | get_bin_flash_color (int bin_index) const |
Returns the color that this bin has been configured to flash to, if configured. More... | |
string | get_bin_name (int bin_index) const |
Returns the name of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()). More... | |
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()). More... | |
int | get_bin_sort (const string &name) const |
Returns the sort order of the bin with the indicated name. More... | |
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()). More... | |
BinType | get_bin_type (const string &name) const |
Returns the type of the bin with the indicated name. More... | |
int | get_num_bins () const |
Returns the number of bins in the world. More... | |
MAKE_SEQ (get_bins, get_num_bins, get_bin) | |
PT (CullBin) make_new_bin(int bin_index | |
void | register_bin_type (BinType type, BinConstructor *constructor) |
Intended to be called at startup type by each CullBin type, to register the constructor for each type. More... | |
void | remove_bin (int bin_index) |
Permanently removes the indicated bin. More... | |
void | set_bin_active (int bin_index, bool active) |
Changes the active flag of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()). More... | |
void | set_bin_active (const string &name, bool active) |
Changes the active flag of the bin with the indicated name. More... | |
void | set_bin_flash_active (int bin_index, bool active) |
When set to true, the given bin_index is configured to flash at a predetermined color (where bin_index was retrieved by get_bin() or find_bin()). More... | |
void | set_bin_flash_color (int bin_index, const LColor &color) |
Changes the flash color for the given bin index. More... | |
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()). More... | |
void | set_bin_sort (const string &name, int sort) |
Changes the sort order of the bin with the indicated name. More... | |
void | set_bin_type (int bin_index, BinType type) |
Changes the type of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()). More... | |
void | set_bin_type (const string &name, BinType type) |
Changes the type of the bin with the indicated name. More... | |
void | write (ostream &out) const |
Static Public Member Functions | |
static CullBinManager * | get_global_ptr () |
Returns the pointer to the global CullBinManager object. More... | |
Public Attributes | |
GraphicsStateGuardianBase const PStatCollector & | draw_region_pcollector |
GraphicsStateGuardianBase * | gsg |
Friends | |
class | SortBins |
This is a global object that maintains the collection of named CullBins in the world.
Definition at line 36 of file cullBinManager.h.
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 60 of file cullBinManager.cxx.
References ConfigVariable::get_num_words(), and ConfigVariableColor::get_value().
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 173 of file cullBinManager.cxx.
Referenced by CullResult::add_object(), get_bin_active(), get_bin_sort(), get_bin_type(), set_bin_active(), set_bin_sort(), and set_bin_type().
|
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 69 of file cullBinManager.I.
Referenced by CullResult::draw().
|
inline |
Returns the active flag of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).
When a bin is marked inactive, all geometry assigned to it is not rendered.
Definition at line 233 of file cullBinManager.I.
Referenced by CullResult::finish_cull(), and get_bin_active().
|
inline |
Returns the active flag of the bin with the indicated name.
When a bin is marked inactive, all geometry assigned to it is not rendered.
Definition at line 249 of file cullBinManager.I.
References find_bin(), and get_bin_active().
|
inline |
Returns true if the bin with the given bin_index is configured to flash at a predetermined color (where bin_index was retrieved by get_bin() or find_bin()).
This method is not available in release builds.
Definition at line 299 of file cullBinManager.I.
|
inline |
Returns the color that this bin has been configured to flash to, if configured.
This method is not available in release builds.
Definition at line 313 of file cullBinManager.I.
References LVecBase4f::zero().
|
inline |
Returns the name of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).
The bin's name may not be changed during the life of the bin.
Definition at line 83 of file cullBinManager.I.
|
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 163 of file cullBinManager.I.
Referenced by get_bin_sort().
|
inline |
Returns the sort order of the bin with the indicated name.
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 180 of file cullBinManager.I.
References find_bin(), and get_bin_sort().
|
inline |
Returns the type of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).
Definition at line 97 of file cullBinManager.I.
Referenced by get_bin_type().
|
inline |
Returns the type of the bin with the indicated name.
Definition at line 110 of file cullBinManager.I.
References find_bin(), and get_bin_type().
|
inlinestatic |
Returns the pointer to the global CullBinManager object.
Definition at line 354 of file cullBinManager.I.
Referenced by CullResult::add_object(), CullResult::draw(), and CullResult::finish_cull().
|
inline |
Returns the number of bins in the world.
Definition at line 49 of file cullBinManager.I.
Referenced by CullResult::draw().
void CullBinManager::register_bin_type | ( | BinType | type, |
CullBinManager::BinConstructor * | constructor | ||
) |
Intended to be called at startup type by each CullBin type, to register the constructor for each type.
Definition at line 234 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 143 of file cullBinManager.cxx.
References CullResult::bin_removed(), and RenderState::bin_removed().
|
inline |
Changes the active flag of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).
When a bin is marked inactive, all geometry assigned to it is not rendered.
Definition at line 266 of file cullBinManager.I.
Referenced by set_bin_active().
|
inline |
Changes the active flag of the bin with the indicated name.
When a bin is marked inactive, all geometry assigned to it is not rendered.
Definition at line 282 of file cullBinManager.I.
References find_bin(), and set_bin_active().
|
inline |
When set to true, the given bin_index is configured to flash at a predetermined color (where bin_index was retrieved by get_bin() or find_bin()).
This method is not available in release builds.
Definition at line 328 of file cullBinManager.I.
|
inline |
Changes the flash color for the given bin index.
Definition at line 341 of file cullBinManager.I.
|
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 198 of file cullBinManager.I.
Referenced by set_bin_sort().
|
inline |
Changes the sort order of the bin with the indicated name.
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 216 of file cullBinManager.I.
References find_bin(), and set_bin_sort().
|
inline |
Changes the type of the bin with the indicated bin_index (where bin_index was retrieved by get_bin() or find_bin()).
The change might be effective immediately, or it might take place next frame, depending on the bin type.
Definition at line 128 of file cullBinManager.I.
Referenced by set_bin_type().
|
inline |
Changes the type of the bin with the indicated name.
The change might be effective immediately, or it might take place next frame, depending on the bin type.
Definition at line 145 of file cullBinManager.I.
References find_bin(), and set_bin_type().