37 if ((_flags & F_checked_cull_callback) == 0) {
42 return (_flags & F_has_cull_callback) != 0;
61 return remove_attrib(slot);
68 INLINE
bool RenderState::
70 return get_attrib(type) !=
nullptr;
77 INLINE
bool RenderState::
78 has_attrib(
int slot)
const {
79 return get_attrib(slot) !=
nullptr;
90 return _attributes[slot]._attrib;
98 get_attrib(
int slot)
const {
99 return _attributes[slot]._attrib;
107 get_attrib_def(
int slot)
const {
108 if (_attributes[slot]._attrib !=
nullptr) {
109 return _attributes[slot]._attrib;
119 INLINE
int RenderState::
123 return _attributes[slot]._override;
130 INLINE
int RenderState::
131 get_override(
int slot)
const {
132 return _attributes[slot]._override;
150 INLINE
void RenderState::
155 consider_update_pstats(old_referenced_bits);
164 INLINE
bool RenderState::
165 cache_unref()
const {
168 bool result = do_cache_unref();
169 consider_update_pstats(old_referenced_bits);
172 return do_cache_unref();
179 INLINE
void RenderState::
184 consider_update_pstats(old_referenced_bits);
193 INLINE
bool RenderState::
197 bool result = do_node_unref();
198 consider_update_pstats(old_referenced_bits);
201 return do_node_unref();
211 INLINE
size_t RenderState::
212 get_composition_cache_num_entries()
const {
223 INLINE
size_t RenderState::
224 get_invert_composition_cache_num_entries()
const {
237 INLINE
size_t RenderState::
238 get_composition_cache_size()
const {
252 get_composition_cache_source(
size_t n)
const {
254 return _composition_cache.
get_key(n);
268 get_composition_cache_result(
size_t n)
const {
270 return _composition_cache.
get_data(n)._result;
282 INLINE
size_t RenderState::
283 get_invert_composition_cache_size()
const {
297 get_invert_composition_cache_source(
size_t n)
const {
299 return _invert_composition_cache.
get_key(n);
314 get_invert_composition_cache_result(
size_t n)
const {
316 return _invert_composition_cache.
get_data(n)._result;
323 INLINE
int RenderState::
324 get_draw_order()
const {
325 if ((_flags & F_checked_bin_index) == 0) {
339 INLINE
int RenderState::
340 get_bin_index()
const {
341 if ((_flags & F_checked_bin_index) == 0) {
354 INLINE
void RenderState::
357 _flags |= F_is_destructing;
366 INLINE
bool RenderState::
367 is_destructing()
const {
369 return (_flags & F_is_destructing) != 0;
379 INLINE
void RenderState::
380 consider_update_pstats(
int old_referenced_bits)
const {
383 if (old_referenced_bits != new_referenced_bits) {
384 update_pstats(old_referenced_bits, new_referenced_bits);
392 INLINE RenderState::Composition::
399 INLINE RenderState::Composition::
400 Composition(
const RenderState::Composition ©) :
401 _result(copy._result)
408 INLINE RenderState::Attribute::
418 INLINE RenderState::Attribute::
419 Attribute(
int override) :
427 INLINE RenderState::Attribute::
428 Attribute(
const Attribute ©) :
429 _attrib(copy._attrib),
430 _override(copy._override)
437 INLINE
void RenderState::Attribute::
438 operator = (
const Attribute ©) {
439 _attrib = copy._attrib;
440 _override = copy._override;
448 INLINE
int RenderState::Attribute::
449 compare_to(
const Attribute &other)
const {
450 if (_attrib != other._attrib) {
451 if (_attrib ==
nullptr) {
453 }
else if (other._attrib ==
nullptr) {
457 int c = _attrib->compare_to(*other._attrib);
463 return _override - other._override;
469 INLINE
void RenderState::Attribute::
472 _override =
override;
480 _node_counter.flush_level();
481 _cache_counter.flush_level();
489 template<
class AttribType>
490 INLINE
bool RenderState::
491 get_attrib(
const AttribType *&attrib)
const {
492 attrib = (
const AttribType *)get_attrib((
int)AttribType::get_class_slot());
493 return (attrib !=
nullptr);
495 template<
class AttribType>
496 INLINE
bool RenderState::
497 get_attrib(
CPT(AttribType) &attrib)
const {
498 attrib = (
const AttribType *)get_attrib((
int)AttribType::get_class_slot());
499 return (attrib !=
nullptr);
505 template<
class AttribType>
506 INLINE
void RenderState::
507 get_attrib_def(
const AttribType *&attrib)
const {
508 attrib = (
const AttribType *)get_attrib_def((
int)AttribType::get_class_slot());
510 template<
class AttribType>
511 INLINE
void RenderState::
512 get_attrib_def(
CPT(AttribType) &attrib)
const {
513 attrib = (
const AttribType *)get_attrib_def((
int)AttribType::get_class_slot());
520 INLINE
void RenderState::
524 if ((_flags & F_hash_known) != 0) {
534 INLINE
bool RenderState::
535 do_cache_unref()
const {
544 INLINE
bool RenderState::
545 do_node_unref()
const {
553 INLINE
void RenderState::
562 INLINE RenderState::CompositionCycleDescEntry::
bool is_empty() const
Returns true if the state is empty, false otherwise.
This is the base class for a number of render attributes (other than transform) that may be set on sc...
size_t get_hash() const
Returns a suitable hash value for phash_map.
CPT(RenderState) RenderState
Returns a RenderState with no attributes set.
const Value & get_data(size_t n) const
Returns the data in the nth entry of the table.
void node_ref() const
Explicitly increments the reference count.
virtual bool unref() const
Explicitly decrements the reference count.
size_t get_num_entries() const
Returns the number of active entries in the table.
int get_slot(TypeHandle type_handle) const
Returns the slot number assigned to the indicated TypeHandle, or 0 if no slot number has been assigne...
This class is used to associate each RenderAttrib with a different slot index at runtime,...
Similar to MutexHolder, but for a light mutex.
const Key & get_key(size_t n) const
Returns the key in the nth entry of the table.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
Similar to MutexHolder, but for a light reentrant mutex.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
bool has_cull_callback() const
Returns true if any of the RenderAttribs in this state request a cull_callback(), false if none of th...
static void flush_level()
Flushes the PStatCollectors used during traversal.
const RenderAttrib * get_slot_default(int slot) const
Returns the default RenderAttrib object associated with slot n.
TypeHandle is the identifier used to differentiate C++ class types.
int get_referenced_bits() const
Returns the union of the values defined in the Referenced enum that represents the various things tha...
static RenderAttribRegistry * quick_get_global_ptr()
Returns the global_ptr without first ensuring it has been initialized.
bool is_zero() const
Returns true if the entire bitmask is zero, false otherwise.