15 #include "renderEffect.h" 16 #include "bamReader.h" 18 #include "config_pgraph.h" 30 if (_effects == (Effects *)NULL) {
36 _effects =
new Effects;
38 _saved_entry = _effects->end();
69 if (_saved_entry != _effects->end()) {
84 _effects->erase(_saved_entry);
85 _saved_entry = _effects->end();
109 CPT(TransformState) RenderEffect::
110 prepare_flatten_transform(
const TransformState *net_transform)
const {
111 return net_transform;
122 safe_to_combine()
const {
147 has_cull_callback()
const {
182 has_adjust_transform()
const {
198 adjust_transform(CPT(TransformState) &, CPT(TransformState) &,
208 output(ostream &out)
const {
218 write(ostream &out,
int indent_level)
const {
219 indent(out, indent_level) << *
this <<
"\n";
231 if (_effects == (
Effects *)NULL) {
234 return _effects->size();
246 out << _effects->size() <<
" effects:\n";
247 Effects::const_iterator si;
248 for (si = _effects->begin(); si != _effects->end(); ++si) {
250 effect->write(out, 2);
264 if (_effects->empty()) {
268 Effects::const_iterator si = _effects->begin();
269 Effects::const_iterator snext = si;
271 while (snext != _effects->end()) {
272 if ((*si)->compare_to(*(*snext)) >= 0) {
274 <<
"RenderEffects out of order!\n";
275 (*si)->write(pgraph_cat.error(
false), 2);
276 (*snext)->write(pgraph_cat.error(
false), 2);
306 nassertr(effect->_saved_entry == _effects->end(), effect);
309 if (paranoid_const) {
318 pair<Effects::iterator, bool> result = _effects->insert(effect);
322 effect->_saved_entry = result.first;
328 return *(result.first);
384 if (pointer == effect) {
A basic node of the scene graph or data graph.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static bool validate_effects()
Ensures that the cache is still stored in sorted order.
Base class for objects that can be written to and read from Bam files.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is the base class for a number of special render effects that may be set on scene graph nodes to...
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.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
This is a 4-by-4 transform matrix.
static TypedWritable * change_this(TypedWritable *old_ptr, BamReader *manager)
Called immediately after complete_pointers(), this gives the object a chance to adjust its own pointe...
void register_finalize(TypedWritable *whom)
Should be called by an object reading itself from the Bam file to indicate that this particular objec...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
int get_ref_count() const
Returns the current reference count.
virtual bool safe_to_transform() const
Returns true if it is generally safe to transform this particular kind of RenderEffect by calling the...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
static void list_effects(ostream &out)
Lists all of the RenderEffects in the cache to the output stream, one per line.
This is our own Panda specialization on the default STL set.
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
virtual ~RenderEffect()
The destructor is responsible for removing the RenderEffect from the global set if it is there...
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...
virtual bool unref() const
Explicitly decrements the reference count.