Panda3D
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
CullBinManager Class Reference

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

#include "cullBinManager.h"

Inheritance diagram for CullBinManager:
CullBinEnums

Public Types

typedef CullBinBinConstructor(const std::string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector)
 
typedef CullBin::BinType BinType
 
- Public Types inherited from CullBinEnums
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 std::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 std::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
 
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 std::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...
 
std::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 std::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 std::string &name) const
 Returns the type of the bin with the indicated name. More...
 
int get_num_bins () const
 
 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 std::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 std::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 std::string &name, BinType type)
 Changes the type of the bin with the indicated name. More...
 
void write (std::ostream &out) const
 

Static Public Member Functions

static CullBinManagerget_global_ptr ()
 Returns the pointer to the global CullBinManager object. More...
 

Public Attributes

GraphicsStateGuardianBase const PStatCollectordraw_region_pcollector
 
 get_bin
 Returns the bin_index of the nth bin in the set, where n is a number between 0 and get_num_bins(). More...
 
 get_num_bins
 Returns the number of bins in the world. More...
 
GraphicsStateGuardianBasegsg
 

Friends

class SortBins
 

Detailed Description

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

Definition at line 34 of file cullBinManager.h.

Member Function Documentation

◆ add_bin()

int CullBinManager::add_bin ( const std::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 52 of file cullBinManager.cxx.

◆ find_bin()

int CullBinManager::find_bin ( const std::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 157 of file cullBinManager.cxx.

Referenced by get_bin_active(), get_bin_sort(), get_bin_type(), set_bin_active(), set_bin_sort(), and set_bin_type().

◆ get_bin_active() [1/2]

bool CullBinManager::get_bin_active ( int  bin_index) const
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 183 of file cullBinManager.I.

◆ get_bin_active() [2/2]

bool CullBinManager::get_bin_active ( const std::string &  name) const
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 195 of file cullBinManager.I.

References find_bin().

◆ get_bin_flash_active()

bool CullBinManager::get_bin_flash_active ( int  bin_index) const
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 235 of file cullBinManager.I.

◆ get_bin_flash_color()

const LColor & CullBinManager::get_bin_flash_color ( int  bin_index) const
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 247 of file cullBinManager.I.

◆ get_bin_name()

std::string CullBinManager::get_bin_name ( int  bin_index) const
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 67 of file cullBinManager.I.

◆ get_bin_sort() [1/2]

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 129 of file cullBinManager.I.

◆ get_bin_sort() [2/2]

int CullBinManager::get_bin_sort ( const std::string &  name) const
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 142 of file cullBinManager.I.

References find_bin().

◆ get_bin_type() [1/2]

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()).

Definition at line 78 of file cullBinManager.I.

◆ get_bin_type() [2/2]

CullBinManager::BinType CullBinManager::get_bin_type ( const std::string &  name) const
inline

Returns the type of the bin with the indicated name.

Definition at line 88 of file cullBinManager.I.

References find_bin().

◆ get_global_ptr()

CullBinManager * CullBinManager::get_global_ptr ( )
inlinestatic

Returns the pointer to the global CullBinManager object.

Definition at line 281 of file cullBinManager.I.

Referenced by CullResult::draw(), CullResult::finish_cull(), init_libcull(), and PT().

◆ register_bin_type()

void CullBinManager::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.

Definition at line 211 of file cullBinManager.cxx.

Referenced by init_libcull().

◆ remove_bin()

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 130 of file cullBinManager.cxx.

◆ set_bin_active() [1/2]

void CullBinManager::set_bin_active ( int  bin_index,
bool  active 
)
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 208 of file cullBinManager.I.

◆ set_bin_active() [2/2]

void CullBinManager::set_bin_active ( const std::string &  name,
bool  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 220 of file cullBinManager.I.

References find_bin().

◆ set_bin_flash_active()

void CullBinManager::set_bin_flash_active ( int  bin_index,
bool  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 260 of file cullBinManager.I.

◆ set_bin_flash_color()

void CullBinManager::set_bin_flash_color ( int  bin_index,
const LColor &  color 
)
inline

Changes the flash color for the given bin index.

This method is not available in release builds.

Definition at line 271 of file cullBinManager.I.

◆ set_bin_sort() [1/2]

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 156 of file cullBinManager.I.

◆ set_bin_sort() [2/2]

void CullBinManager::set_bin_sort ( const std::string &  name,
int  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 170 of file cullBinManager.I.

References find_bin().

◆ set_bin_type() [1/2]

void CullBinManager::set_bin_type ( int  bin_index,
CullBinManager::BinType  type 
)
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 102 of file cullBinManager.I.

◆ set_bin_type() [2/2]

void CullBinManager::set_bin_type ( const std::string &  name,
CullBinManager::BinType  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 115 of file cullBinManager.I.

References find_bin().

Member Data Documentation

◆ get_bin

int CullBinManager::get_bin
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 47 of file cullBinManager.h.

◆ get_num_bins

int CullBinManager::get_num_bins
inline

Returns the number of bins in the world.

Definition at line 47 of file cullBinManager.h.

Referenced by CullResult::draw(), and PT().


The documentation for this class was generated from the following files: