18 #include "pandabase.h"
20 #include "renderAttrib.h"
21 #include "nodeCachedReferenceCount.h"
22 #include "pointerTo.h"
24 #include "updateSeq.h"
25 #include "pStatCollector.h"
26 #include "renderModeAttrib.h"
27 #include "texMatrixAttrib.h"
28 #include "geomMunger.h"
29 #include "weakPointerTo.h"
30 #include "lightReMutex.h"
31 #include "lightMutex.h"
32 #include "deletedChain.h"
33 #include "simpleHashMap.h"
34 #include "cacheStats.h"
35 #include "renderAttribRegistry.h"
71 INLINE
size_t get_hash()
const;
73 INLINE
bool is_empty()
const;
75 INLINE
bool has_cull_callback()
const;
96 int num_attribs,
int override = 0);
107 CPT(
RenderState) adjust_all_priorities(
int adjustment)
const;
109 INLINE
bool has_attrib(
TypeHandle type)
const;
110 INLINE
bool has_attrib(
int slot)
const;
113 INLINE
const RenderAttrib *get_attrib_def(
int slot)
const;
114 INLINE
int get_override(
TypeHandle type)
const;
115 INLINE
int get_override(
int slot)
const;
119 virtual bool unref()
const;
126 INLINE
int get_composition_cache_num_entries()
const;
127 INLINE
int get_invert_composition_cache_num_entries()
const;
129 INLINE
int get_composition_cache_size()
const;
130 INLINE
const RenderState *get_composition_cache_source(
int n)
const;
131 INLINE
const RenderState *get_composition_cache_result(
int n)
const;
132 INLINE
int get_invert_composition_cache_size()
const;
133 INLINE
const RenderState *get_invert_composition_cache_source(
int n)
const;
134 INLINE
const RenderState *get_invert_composition_cache_result(
int n)
const;
135 EXTENSION(PyObject *get_composition_cache()
const);
136 EXTENSION(PyObject *get_invert_composition_cache()
const);
140 void output(ostream &out)
const;
141 void write(ostream &out,
int indent_level)
const;
143 static int get_max_priority();
145 static int get_num_states();
146 static int get_num_unused_states();
147 static int clear_cache();
148 static void clear_munger_cache();
149 static int garbage_collect();
150 static void list_cycles(ostream &out);
151 static void list_states(ostream &out);
152 static bool validate_states();
153 EXTENSION(
static PyObject *get_states());
158 INLINE
int get_draw_order()
const;
159 INLINE
int get_bin_index()
const;
160 int get_geom_rendering(
int geom_rendering)
const;
163 static void bin_removed(
int bin_index);
165 INLINE
static void flush_level();
168 template<
class AttribType>
169 INLINE
bool get_attrib(
const AttribType *&attrib)
const;
170 template<
class AttribType>
171 INLINE
void get_attrib_def(
const AttribType *&attrib)
const;
175 INLINE
void check_hash()
const;
176 bool validate_filled_slots()
const;
177 INLINE
bool do_cache_unref()
const;
178 INLINE
bool do_node_unref()
const;
179 INLINE
void calc_hash();
181 void assign_auto_shader_state();
184 class CompositionCycleDescEntry {
186 INLINE CompositionCycleDescEntry(
const RenderState *obj,
200 void detect_and_break_cycles();
201 static bool r_detect_cycles(
const RenderState *start_state,
205 static bool r_detect_reverse_cycles(
const RenderState *start_state,
211 void remove_cache_pointers();
213 void determine_bin_index();
214 void determine_cull_callback();
217 INLINE
void set_destructing();
218 INLINE
bool is_destructing()
const;
220 INLINE
void consider_update_pstats(
int old_referenced_bits)
const;
221 static void update_pstats(
int old_referenced_bits,
int new_referenced_bits);
224 static void init_states();
256 INLINE Composition();
257 INLINE Composition(
const Composition ©);
280 Mungers::const_iterator _last_mi;
288 static int _garbage_index;
305 INLINE Attribute(
const RenderAttrib *attrib,
int override);
306 INLINE Attribute(
int override = 0);
307 INLINE Attribute(
const Attribute ©);
308 INLINE
void operator = (
const Attribute ©);
309 INLINE
void set(
const RenderAttrib *attrib,
int override);
310 INLINE
int compare_to(
const Attribute &other)
const;
315 Attribute *_attributes;
330 F_checked_bin_index = 0x000001,
331 F_checked_cull_callback = 0x000002,
332 F_has_cull_callback = 0x000004,
333 F_is_destructing = 0x000008,
334 F_hash_known = 0x000010,
338 vector_int *_read_overrides;
346 static void register_with_read_factory();
360 static void init_type() {
361 NodeCachedReferenceCount::init_type();
362 register_type(_type_handle,
"RenderState",
363 NodeCachedReferenceCount::get_class_type());
366 return get_class_type();
368 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
378 INLINE ostream &operator << (ostream &out,
const RenderState &state) {
383 #include "renderState.I"
This is the base class for a number of render attributes (other than transform) that may be set on sc...
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
This class further specializes CachedTypedWritableReferenceCount to also add a node_ref_count, for the purposes of counting the number of times the object is referenced by a "node", presumably a PandaNode.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
bool node_unref() const
Explicitly decrements the node reference count and the normal reference count simultaneously.
Base class for objects that can be written to and read from Bam files.
A lightweight reentrant mutex.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This template class implements an unordered map of keys to data, implemented as a hashtable...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is our own Panda specialization on the default STL list.
virtual void fillin(DatagramIterator &scan, BamReader *manager)
This internal function is intended to be called by each class's make_from_bam() method to read in all...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
This is our own Panda specialization on the default STL vector.
A lightweight class that represents a single element that may be timed and/or counted via stats...
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
virtual bool unref() const
Explicitly decrements the reference count.
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.
void cache_ref() const
Explicitly increments the cache reference count and the normal reference count simultaneously.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void node_ref() const
Explicitly increments the reference count.
The default class template does not define any methods.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
An STL function object class, this is intended to be used on any ordered collection of class objects ...
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
This is used to track the utilization of the TransformState and RenderState caches, for low-level performance tuning information.
Encapsulates all the communication with a particular instance of a given rendering backend...
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
This is a sequence number that increments monotonically.
This is a standard, non-reentrant mutex, similar to the Mutex class.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling...
bool cache_unref() const
Explicitly decrements the cache reference count and the normal reference count simultaneously.