This class is used to associate each RenderAttrib with a different slot index at runtime, so we can store a list of RenderAttribs in the RenderState object, and very quickly look them up by type.
More...
#include "renderAttribRegistry.h"
List of all members.
Detailed Description
This class is used to associate each RenderAttrib with a different slot index at runtime, so we can store a list of RenderAttribs in the RenderState object, and very quickly look them up by type.
Definition at line 34 of file renderAttribRegistry.h.
Member Function Documentation
| int RenderAttribRegistry::get_max_slots |
( |
| ) |
const [inline] |
Returns the maximum number that any slot number is allowed to grow.
Actually, this number will be one higher than the highest possible slot number. This puts an upper bound on the number of RenderAttrib slots that may be allocated, and allows other code to define an array of slots.
This number will not change during the lifetime of the application.
Definition at line 45 of file renderAttribRegistry.I.
Referenced by RenderState::RenderState(), and RenderState::~RenderState().
| int RenderAttribRegistry::get_num_slots |
( |
| ) |
const [inline] |
| int RenderAttribRegistry::get_num_sorted_slots |
( |
| ) |
const [inline] |
| int RenderAttribRegistry::get_slot |
( |
TypeHandle |
type_handle | ) |
const [inline] |
| int RenderAttribRegistry::get_slot_sort |
( |
int |
slot | ) |
const [inline] |
| TypeHandle RenderAttribRegistry::get_slot_type |
( |
int |
slot | ) |
const [inline] |
| int RenderAttribRegistry::get_sorted_slot |
( |
int |
n | ) |
const [inline] |
| int RenderAttribRegistry::register_slot |
( |
TypeHandle |
type_handle, |
|
|
int |
sort, |
|
|
MakeDefaultFunc * |
make_default_func |
|
) |
| |
Adds the indicated TypeHandle to the registry, if it is not there already, and returns a unique slot number in the range 0 < slot < get_max_slots().
The sort value is an arbitrary integer. In general, the RenderAttribs will be sorted in order from lowest sort value to highest sort value, when they are traversed via the get_num_sorted_slots() / get_sorted_slot() methods. This will be used to sort render states, so that heavier RenderAttribs are changed less frequently. In general, you should choose sort values such that the heavier RenderAttribs (that is, those which are more expensive to change) have lower sort values.
The make_default_func pointer is a function that may be called to generate a default RenderAttrib to apply in the absence of any other attrib of this type.
register_slot() is intended to be called at application start for each different RenderAttrib type in the system, to assign a different integer slot number to each one.
Definition at line 99 of file renderAttribRegistry.cxx.
References TypeHandle::get_index().
Referenced by RenderAttrib::register_slot().
| void RenderAttribRegistry::set_slot_sort |
( |
int |
slot, |
|
|
int |
sort |
|
) |
| |
The documentation for this class was generated from the following files: