Panda3D
|
This functions similarly to a LightAttrib or ClipPlaneAttrib. More...
#include "occluderEffect.h"
Public Member Functions | |
virtual int | complete_pointers (TypedWritable **plist, BamReader *manager) |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin(). | |
CPT (RenderEffect) add_on_occluder(const NodePath &occluder) const | |
CPT (RenderEffect) remove_on_occluder(const NodePath &occluder) const | |
virtual TypeHandle | force_init_type () |
int | get_num_on_occluders () const |
Returns the number of occluders that are enabled by the effectute. | |
NodePath | get_on_occluder (int n) const |
Returns the nth occluder enabled by the effectute, sorted in render order. | |
virtual TypeHandle | get_type () const |
bool | has_on_occluder (const NodePath &occluder) const |
Returns true if the indicated occluder is enabled by the effect, false otherwise. | |
bool | is_identity () const |
Returns true if this is an identity effect: it does not change the set of occluders in use. | |
MAKE_SEQ (get_on_occluders, get_num_on_occluders, get_on_occluder) | |
virtual void | output (ostream &out) const |
virtual bool | require_fully_complete () const |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed. | |
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 Public Member Functions | |
static | CPT (RenderEffect) make() |
static TypeHandle | get_class_type () |
static void | init_type () |
static void | register_with_read_factory () |
Tells the BamReader how to create objects of type OccluderEffect. | |
Protected Member Functions | |
virtual int | compare_to_impl (const RenderEffect *other) const |
Intended to be overridden by derived OccluderEffect types to return a unique number indicating whether this OccluderEffect is equivalent to the other one. | |
void | fillin (DatagramIterator &scan, BamReader *manager) |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new OccluderEffect. | |
Static Protected Member Functions | |
static TypedWritable * | make_from_bam (const FactoryParams ¶ms) |
This function is called by the BamReader's factory when a new object of type OccluderEffect is encountered in the Bam file. |
This functions similarly to a LightAttrib or ClipPlaneAttrib.
It indicates the set of occluders that modify the geometry at this level and below. Unlike a ClipPlaneAttrib, an OccluderEffect takes effect immediately when it is encountered during traversal, and thus can only add occluders; it may not remove them.
Definition at line 36 of file occluderEffect.h.
int OccluderEffect::compare_to_impl | ( | const RenderEffect * | other | ) | const [protected, virtual] |
Intended to be overridden by derived OccluderEffect types to return a unique number indicating whether this OccluderEffect is equivalent to the other one.
This should return 0 if the two OccluderEffect objects are equivalent, a number less than zero if this one should be sorted before the other one, and a number greater than zero otherwise.
This will only be called with two OccluderEffect objects whose get_type() functions return the same.
Reimplemented from RenderEffect.
Definition at line 116 of file occluderEffect.cxx.
References ordered_vector< Key, Compare >::begin(), NodePath::compare_to(), and ordered_vector< Key, Compare >::end().
int OccluderEffect::complete_pointers | ( | TypedWritable ** | p_list, |
BamReader * | manager | ||
) | [virtual] |
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
Returns the number of pointers processed.
Reimplemented from TypedWritable.
Definition at line 185 of file occluderEffect.cxx.
References ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::end(), AttribNodeRegistry::find_node(), AttribNodeRegistry::get_node(), and ov_set< Key, Compare >::sort().
void OccluderEffect::fillin | ( | DatagramIterator & | scan, |
BamReader * | manager | ||
) | [protected, virtual] |
This internal function is called by make_from_bam to read in all of the relevant data from the BamFile for the new OccluderEffect.
Reimplemented from RenderEffect.
Definition at line 251 of file occluderEffect.cxx.
References DatagramIterator::get_uint16(), ordered_vector< Key, Compare >::push_back(), BamReader::read_pointer(), and ordered_vector< Key, Compare >::reserve().
Referenced by make_from_bam().
int OccluderEffect::get_num_on_occluders | ( | ) | const [inline] |
Returns the number of occluders that are enabled by the effectute.
Definition at line 46 of file occluderEffect.I.
References ordered_vector< Key, Compare >::size().
Referenced by write_datagram().
NodePath OccluderEffect::get_on_occluder | ( | int | n | ) | const [inline] |
Returns the nth occluder enabled by the effectute, sorted in render order.
Definition at line 57 of file occluderEffect.I.
References NodePath::fail(), and ordered_vector< Key, Compare >::size().
bool OccluderEffect::has_on_occluder | ( | const NodePath & | occluder | ) | const [inline] |
Returns true if the indicated occluder is enabled by the effect, false otherwise.
Definition at line 69 of file occluderEffect.I.
References ordered_vector< Key, Compare >::end().
Referenced by NodePath::has_occluder().
bool OccluderEffect::is_identity | ( | ) | const [inline] |
Returns true if this is an identity effect: it does not change the set of occluders in use.
Definition at line 80 of file occluderEffect.I.
References ordered_vector< Key, Compare >::empty().
TypedWritable * OccluderEffect::make_from_bam | ( | const FactoryParams & | params | ) | [static, protected] |
This function is called by the BamReader's factory when a new object of type OccluderEffect is encountered in the Bam file.
It should create the OccluderEffect and extract its information from the file.
Definition at line 232 of file occluderEffect.cxx.
References fillin().
Referenced by register_with_read_factory().
void OccluderEffect::register_with_read_factory | ( | ) | [static] |
Tells the BamReader how to create objects of type OccluderEffect.
Definition at line 153 of file occluderEffect.cxx.
References BamReader::get_factory(), make_from_bam(), and Factory< Type >::register_factory().
bool OccluderEffect::require_fully_complete | ( | ) | const [virtual] |
Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
If this is the case, override this method to return true, and be careful with circular references (which would make the object unreadable from a bam file).
Reimplemented from TypedWritable.
Definition at line 219 of file occluderEffect.cxx.
void OccluderEffect::write_datagram | ( | BamWriter * | manager, |
Datagram & | dg | ||
) | [virtual] |
Writes the contents of this object to the datagram for shipping out to a Bam file.
Reimplemented from RenderEffect.
Definition at line 164 of file occluderEffect.cxx.
References Datagram::add_uint16(), ordered_vector< Key, Compare >::begin(), ordered_vector< Key, Compare >::end(), get_num_on_occluders(), NodePath::node(), and BamWriter::write_pointer().