Panda3D
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends
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

List of all members.

Classes

class  BinDefinition
class  SortBins

Public Types

typedef CullBinBinConstructor (const string &name, GraphicsStateGuardianBase *gsg, const PStatCollector &draw_region_pcollector)
typedef CullBin::BinType BinType

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.
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.
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().
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()).
bool get_bin_active (const string &name) const
 Returns the active flag of the bin with the indicated name.
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()).
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()).
int get_bin_sort (const string &name) const
 Returns the sort order of the bin with the indicated name.
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()).
BinType get_bin_type (const string &name) const
 Returns the type of the bin with the indicated name.
int get_num_bins () const
 Returns the number of bins in the world.
 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.
void remove_bin (int bin_index)
 Permanently removes the indicated bin.
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()).
void set_bin_active (const string &name, bool active)
 Changes the active flag of the bin with the indicated name.
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()).
void set_bin_sort (const string &name, int sort)
 Changes the sort order of the bin with the indicated name.
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()).
void set_bin_type (const string &name, BinType type)
 Changes the type of the bin with the indicated name.
void write (ostream &out) const

Static Public Member Functions

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

Public Attributes

GraphicsStateGuardianBase
const PStatCollector
draw_region_pcollector
GraphicsStateGuardianBasegsg

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.

Friends

class SortBins

Detailed Description

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

Definition at line 35 of file cullBinManager.h.


Constructor & Destructor Documentation

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

Referenced by get_global_ptr().

Don't call the destructor.

Definition at line 47 of file cullBinManager.cxx.


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

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

Referenced by CullResult::draw().

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

Referenced by CullResult::finish_cull(), and get_bin_active().

bool CullBinManager::get_bin_active ( const 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 249 of file cullBinManager.I.

References find_bin(), and get_bin_active().

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

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

Referenced by PGItem::cull_callback(), and get_bin_sort().

int CullBinManager::get_bin_sort ( const 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 180 of file cullBinManager.I.

References find_bin(), and get_bin_sort().

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

Referenced by PGItem::cull_callback(), and get_bin_type().

CullBinManager::BinType CullBinManager::get_bin_type ( const string &  name) const [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().

Returns the pointer to the global CullBinManager object.

Definition at line 195 of file cullBinManager.cxx.

References CullBinManager().

Referenced by PGItem::cull_callback(), CullResult::draw(), and CullResult::finish_cull().

int CullBinManager::get_num_bins ( ) const [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 236 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 131 of file cullBinManager.cxx.

References CullResult::bin_removed(), and RenderState::bin_removed().

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

Referenced by set_bin_active().

void CullBinManager::set_bin_active ( const 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 282 of file cullBinManager.I.

References find_bin(), and set_bin_active().

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

Referenced by set_bin_sort().

void CullBinManager::set_bin_sort ( const 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 216 of file cullBinManager.I.

References find_bin(), and set_bin_sort().

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

Referenced by set_bin_type().

void CullBinManager::set_bin_type ( const 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 145 of file cullBinManager.I.

References find_bin(), and set_bin_type().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations