14#ifndef RENDEREFFECTS_H
15#define RENDEREFFECTS_H
41class EXPCL_PANDA_PGRAPH RenderEffects :
public TypedWritableReferenceCount {
46 RenderEffects(
const RenderEffects ©) =
delete;
47 virtual ~RenderEffects();
49 RenderEffects &operator = (
const RenderEffects ©) =
delete;
54 CPT(RenderEffects)
xform(
const LMatrix4 &mat)
const;
57 bool operator < (
const RenderEffects &other)
const;
63 INLINE
size_t size()
const;
86 virtual bool unref()
const;
88 void output(std::ostream &out)
const;
89 void write(std::ostream &out,
int indent_level)
const;
113 static CPT(RenderEffects) return_new(RenderEffects *state);
116 void determine_decal();
117 void determine_show_bounds();
118 void determine_cull_callback();
119 void determine_adjust_transform();
126 typedef pset<const RenderEffects *, indirect_less<const RenderEffects *> > States;
127 static States *_states;
128 static CPT(RenderEffects) _empty_state;
133 States::iterator _saved_entry;
142 INLINE Effect(
const Effect ©);
143 INLINE
void operator = (
const Effect ©);
144 INLINE
bool operator < (
const Effect &other)
const;
145 INLINE
int compare_to(
const Effect &other)
const;
154 F_checked_decal = 0x0001,
155 F_has_decal = 0x0002,
156 F_checked_show_bounds = 0x0004,
157 F_has_show_bounds = 0x0008,
158 F_has_show_tight_bounds = 0x0010,
159 F_checked_cull_callback = 0x0020,
160 F_has_cull_callback = 0x0040,
161 F_checked_adjust_transform = 0x0080,
162 F_has_adjust_transform = 0x0100,
179 static TypedWritable *make_from_bam(
const FactoryParams ¶ms);
186 static void init_type() {
187 TypedWritableReferenceCount::init_type();
189 TypedWritableReferenceCount::get_class_type());
192 return get_class_type();
194 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
200INLINE std::ostream &operator << (std::ostream &out,
const RenderEffects &state) {
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is a standard, non-reentrant mutex, similar to the Mutex class.
A lightweight reentrant mutex.
A basic node of the scene graph or data graph.
virtual bool unref() const
Explicitly decrements the reference count.
This is the base class for a number of special render effects that may be set on scene graph nodes to...
This represents a unique collection of RenderEffect objects that correspond to a particular renderabl...
static void list_states(std::ostream &out)
Lists all of the RenderEffects in the cache to the output stream, one per line.
bool safe_to_combine() const
Returns true if all of the effects in this set can safely be shared with a sibling node that has the ...
ConstPointerTo< RenderEffects > add_effect(const RenderEffect *effect) const
Returns a new RenderEffects object that represents the same as the source state, with the new RenderE...
bool has_cull_callback() const
This function is provided as an optimization, to speed up the render-time checking for the existance ...
static int get_num_states()
Returns the total number of unique RenderEffects objects allocated in the world.
bool has_decal() const
This function is provided as an optimization, to speed up the render-time checking for the existance ...
ConstPointerTo< RenderEffects > remove_effect(TypeHandle type) const
Returns a new RenderEffects object that represents the same as the source state, with the indicated R...
static ConstPointerTo< RenderEffects > make(const RenderEffect *effect)
Returns a RenderEffects with one effect set.
int find_effect(TypeHandle type) const
Searches for an effect with the indicated type in the state, and returns its index if it is found,...
void adjust_transform(ConstPointerTo< TransformState > &net_transform, ConstPointerTo< TransformState > &node_transform, const PandaNode *node) const
Calls adjust_transform() on all effects.
bool has_adjust_transform() const
This function is provided as an optimization, to speed up the render-time checking for the existance ...
bool is_empty() const
Returns true if the state is empty, false otherwise.
static bool validate_states()
Ensures that the cache is still stored in sorted order.
bool has_show_tight_bounds() const
If has_show_bounds() returns true, this will return true if the ShowBoundsEffect in question requests...
const RenderEffect * get_effect(size_t n) const
Returns the nth effect in the state.
bool safe_to_transform() const
Returns true if all of the effects in this set can safely be transformed, and therefore the complete ...
size_t get_num_effects() const
Returns the number of separate effects indicated in the state.
static ConstPointerTo< RenderEffects > make_empty()
Returns a RenderEffects with no effects set.
void cull_callback(CullTraverser *trav, CullTraverserData &data, ConstPointerTo< TransformState > &node_transform, ConstPointerTo< RenderState > &node_state) const
Calls cull_callback() on all effects.
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...
bool has_show_bounds() const
This function is provided as an optimization, to speed up the render-time checking for the existance ...
virtual ConstPointerTo< TransformState > prepare_flatten_transform(const TransformState *net_transform) const
Preprocesses the accumulated transform that is about to be applied to (or through) this node due to a...
ConstPointerTo< RenderEffects > xform(const LMatrix4 &mat) const
Returns a new RenderEffects transformed by the indicated matrix.
size_t size() const
Returns the number of separate effects indicated in the state.
static void init_states()
Make sure the global _states map is allocated.
static void register_with_read_factory()
Tells the BamReader how to create objects of type RenderEffects.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
TypeHandle is the identifier used to differentiate C++ class types.
virtual void finalize(BamReader *manager)
Called by the BamReader to perform any final actions needed for setting up the object after all objec...
virtual bool require_fully_complete() const
Some objects require all of their nested pointers to have been completed before the objects themselve...
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 int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
An STL function object class, this is intended to be used on any ordered collection of class objects ...
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
This is our own Panda specialization on the default STL list.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.