15 #include "occluderEffect.h"
16 #include "pandaNode.h"
17 #include "graphicsStateGuardianBase.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
21 #include "datagramIterator.h"
22 #include "config_pgraph.h"
23 #include "attribNodeRegistry.h"
53 add_on_occluder(const
NodePath &occluder)
const {
54 nassertr(!occluder.is_empty() && occluder.node()->is_of_type(OccluderNode::get_class_type()),
this);
56 effect->_on_occluders.insert(occluder);
58 pair<Occluders::iterator, bool> insert_result =
59 effect->_on_occluders.insert(Occluders::value_type(occluder));
61 return return_new(effect);
72 remove_on_occluder(const
NodePath &occluder)
const {
73 nassertr(!occluder.is_empty() && occluder.node()->is_of_type(OccluderNode::get_class_type()),
this);
75 effect->_on_occluders.erase(occluder);
76 return return_new(effect);
85 output(ostream &out)
const {
86 out << get_type() <<
":";
87 if (_on_occluders.
empty()) {
92 Occluders::const_iterator li;
93 for (li = _on_occluders.
begin(); li != _on_occluders.
end(); ++li) {
95 out <<
" " << occluder;
118 DCAST_INTO_R(ta, other, 0);
120 Occluders::const_iterator li = _on_occluders.
begin();
121 Occluders::const_iterator oli = ta->_on_occluders.
begin();
123 while (li != _on_occluders.
end() && oli != ta->_on_occluders.
end()) {
127 int compare = occluder.
compare_to(other_occluder);
136 if (li != _on_occluders.
end()) {
139 if (oli != ta->_on_occluders.
end()) {
170 Occluders::const_iterator nti;
171 for (nti = _on_occluders.
begin(); nti != _on_occluders.
end(); ++nti) {
189 Occluders::iterator ci;
190 ci = _on_occluders.
begin();
191 while (ci != _on_occluders.
end()) {
193 DCAST_INTO_R(node, p_list[pi++], pi);
195 int ni = areg->
find_node(node->get_type(), node->get_name());
203 _on_occluders.
sort();
237 parse_params(params, scan, manager);
238 effect->fillin(scan, manager);
250 void OccluderEffect::
252 RenderEffect::fillin(scan, manager);
257 _on_occluders.
reserve(num_on_occluders);
258 for (
int i = 0; i < num_on_occluders; i++) {
static void register_with_read_factory()
Tells the BamReader how to create objects of type OccluderEffect.
NodePath get_node(int n) const
Returns the nth NodePath recorded in the registry.
A basic node of the scene graph or data graph.
int compare_to(const NodePath &other) const
Returns a number less than zero if this NodePath sorts before the other one, greater than zero if it ...
bool empty() const
Returns true if the ordered vector is empty, false otherwise.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This global object records NodePaths that are referenced by scene graph attribs, such as ClipPlaneAtt...
Base class for objects that can be written to and read from Bam files.
iterator_0 begin()
Returns the iterator that marks the first element in the ordered vector.
PandaNode * node() const
Returns the referenced node of the path.
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...
iterator_0 end()
Returns the iterator that marks the end of the ordered vector.
void reserve(size_type_0 n)
Informs the vector of a planned change in size; ensures that the capacity of the vector is greater th...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
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()...
This functions similarly to a LightAttrib or ClipPlaneAttrib.
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin()...
void sort()
Maps to sort_unique().
An instance of this class is passed to the Factory when requesting it to do its business and construc...
void push_back(const value_type_0 &key)
Adds the new element to the end of the vector without regard for proper sorting.
void register_factory(TypeHandle handle, CreateFunc *func)
Registers a new kind of thing the Factory will be able to create.
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the datagram.
int find_node(const NodePath &attrib_node) const
Returns the index number of the indicated NodePath in the registry (assuming its name hasn't changed ...
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 WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
virtual bool require_fully_complete() const
Some objects require all of their nested pointers to have been completed before the objects themselve...
int get_num_on_occluders() const
Returns the number of occluders that are enabled by the effectute.
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
void read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.