15 #include "partBundleNode.h"
17 #include "datagramIterator.h"
18 #include "bamReader.h"
19 #include "bamWriter.h"
20 #include "sceneGraphReducer.h"
32 for (bi = _bundles.begin(); bi != _bundles.end(); ++bi) {
33 (*bi)->get_bundle()->remove_node(
this);
52 if ((attrib_types & SceneGraphReducer::TT_transform) != 0) {
54 for (bi = _bundles.begin(); bi != _bundles.end(); ++bi) {
57 PT(
PartBundle) new_bundle = bundle->apply_transform(attribs._transform);
58 update_bundle(handle, new_bundle);
86 for (bi = _bundles.begin(); bi != _bundles.end(); ++bi) {
91 update_bundle(handle, new_bundle);
103 void PartBundleNode::
106 add_bundle_handle(handle);
116 Bundles::iterator bi = find(_bundles.begin(), _bundles.end(), handle);
117 if (bi != _bundles.end()) {
122 _bundles.push_back(handle);
123 handle->get_bundle()->add_node(
this);
132 void PartBundleNode::
138 Bundles::iterator bi;
139 for (bi = other->_bundles.begin(); bi != other->_bundles.end(); ++bi) {
142 add_bundle_handle(handle);
144 other->_bundles.clear();
154 void PartBundleNode::
157 old_bundle->remove_node(
this);
159 new_bundle->add_node(
this);
173 Bundles::iterator bi;
174 for (bi = _bundles.begin(); bi != _bundles.end(); ++bi) {
190 Bundles::iterator bi;
191 for (bi = _bundles.begin(); bi != _bundles.end(); ++bi) {
193 bundle->add_node(
this);
207 void PartBundleNode::
209 PandaNode::fillin(scan, manager);
216 nassertv(num_bundles >= 1);
222 for (
int i = 1; i < num_bundles; ++i) {
224 _bundles.push_back(NULL);
static const LMatrix4f & ident_mat()
Returns an identity matrix.
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 the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Base class for objects that can be written to and read from Bam files.
void xform(const LMatrix4 &mat)
Applies the indicated transform to the root of the animated hierarchy.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is a trivial class returned by PartBundleNode::get_bundle().
PN_uint16 get_uint16()
Extracts an unsigned 16-bit integer.
static Thread * get_current_thread()
Returns a pointer to the currently-executing Thread object.
PartGroup * copy_subgraph() const
Allocates and returns a new copy of this node and of all of its children.
This class is used by the SceneGraphReducer to maintain and accumulate the set of attributes we have ...
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 is a 4-by-4 transform matrix.
This is a node that contains a pointer to an PartBundle.
virtual void apply_attribs_to_vertices(const AccumulatedAttribs &attribs, int attrib_types, GeomTransformer &transformer)
Applies whatever attributes are specified in the AccumulatedAttribs object (and by the attrib_types b...
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
virtual void write_datagram(BamWriter *manager, Datagram &me)
Writes the contents of this object to the datagram for shipping out to a Bam file.
void add_uint16(PN_uint16 value)
Adds an unsigned 16-bit integer to the datagram.
This is the root of a MovingPart hierarchy.
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()...
bool almost_equal(const LMatrix4f &other, float threshold) const
Returns true if two matrices are memberwise equal within a specified tolerance.
int get_num_nodes() const
Returns the number of PartBundleNodes that contain a pointer to this PartBundle.
A class to retrieve the individual data elements previously stored in a Datagram. ...
int get_file_minor_ver() const
Returns the minor version number of the Bam file currently being read.
TypeHandle is the identifier used to differentiate C++ class types.
void set_bundle(PartBundle *bundle)
Changes the actual PartBundle embedded within the handle.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
PartBundle * get_bundle()
Returns the actual PartBundle embedded within the handle.
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.