Panda3D
Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

PartBundleNode Class Reference

This is a node that contains a pointer to an PartBundle. More...

#include "partBundleNode.h"

Inheritance diagram for PartBundleNode:
PandaNode TypedWritable Namable LinkedListNode ReferenceCount TypedObject MemoryBase MemoryBase MemoryBase Character

List of all members.

Public Member Functions

 PartBundleNode (const string &name, PartBundle *bundle)
 The PartBundle and its node should be constructed together.
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 bitmask) to the vertices on this node, if appropriate.
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().
virtual TypeHandle force_init_type ()
PartBundleget_bundle (int n) const
PartBundleHandleget_bundle_handle (int n) const
 Returns the PartBundleHandle that wraps around the actual nth PartBundle.
int get_num_bundles () const
virtual TypeHandle get_type () const
 MAKE_SEQ (get_bundles, get_num_bundles, get_bundle)
 MAKE_SEQ (get_bundle_handles, get_num_bundles, get_bundle_handle)
virtual void write_datagram (BamWriter *manager, Datagram &me)
 Writes the contents of this object to the datagram for shipping out to a Bam file.
virtual void xform (const LMatrix4 &mat)
 Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.

Static Public Member Functions

static TypeHandle get_class_type ()
static void init_type ()

Protected Types

typedef pvector< PT(PartBundleHandle) > Bundles

Protected Member Functions

 PartBundleNode ()
 For internal use only.
 PartBundleNode (const PartBundleNode &copy)
 Use make_copy() or copy_subgraph() to copy one of these.
void add_bundle (PartBundle *bundle)
void add_bundle_handle (PartBundleHandle *handle)
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 PandaNode.
void steal_bundles (PartBundleNode *other)
 Moves the PartBundles from the other node onto this one.
virtual void update_bundle (PartBundleHandle *old_bundle_handle, PartBundle *new_bundle)
 Replaces the contents of the indicated PartBundleHandle (presumably stored within this node) with new_bundle.

Protected Attributes

Bundles _bundles

Detailed Description

This is a node that contains a pointer to an PartBundle.

Like AnimBundleNode, it exists to make it easy to store PartBundles in the scene graph.

(Unlike AnimBundleNode, however, PartBundleNode has an additional function: it is also the base class of the Character node type, which adds additional functionality.)

Definition at line 38 of file partBundleNode.h.


Constructor & Destructor Documentation

PartBundleNode::PartBundleNode ( const string &  name,
PartBundle bundle 
) [inline]

The PartBundle and its node should be constructed together.

Generally, the derived classes of PartBundleNode will automatically create a PartBundle of the appropriate type, and pass it up to this constructor.

Definition at line 26 of file partBundleNode.I.

PartBundleNode::PartBundleNode ( ) [inline, protected]

For internal use only.

Definition at line 38 of file partBundleNode.I.

PartBundleNode::PartBundleNode ( const PartBundleNode copy) [inline, protected]

Use make_copy() or copy_subgraph() to copy one of these.

This constructor does not copy the bundle pointers.

Definition at line 50 of file partBundleNode.I.


Member Function Documentation

void PartBundleNode::apply_attribs_to_vertices ( const AccumulatedAttribs attribs,
int  attrib_types,
GeomTransformer transformer 
) [virtual]

Applies whatever attributes are specified in the AccumulatedAttribs object (and by the attrib_types bitmask) to the vertices on this node, if appropriate.

If this node uses geom arrays like a GeomNode, the supplied GeomTransformer may be used to unify shared arrays across multiple different nodes.

This is a generalization of xform().

Reimplemented from PandaNode.

Definition at line 50 of file partBundleNode.cxx.

References Thread::get_current_thread(), PandaNode::r_mark_geom_bounds_stale(), and update_bundle().

int PartBundleNode::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.

Reimplemented in Character.

Definition at line 187 of file partBundleNode.cxx.

void PartBundleNode::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 PandaNode.

Reimplemented from PandaNode.

Reimplemented in Character.

Definition at line 208 of file partBundleNode.cxx.

References BamReader::get_file_minor_ver(), DatagramIterator::get_uint16(), and BamReader::read_pointer().

PartBundleHandle * PartBundleNode::get_bundle_handle ( int  n) const [inline]

Returns the PartBundleHandle that wraps around the actual nth PartBundle.

While the PartBundle pointer might later change due to a future flatten operation, the PartBundleHandle will not.

Definition at line 85 of file partBundleNode.I.

void PartBundleNode::steal_bundles ( PartBundleNode other) [protected]

Moves the PartBundles from the other node onto this one.

Definition at line 133 of file partBundleNode.cxx.

References PartBundleHandle::get_bundle(), and PartBundle::remove_node().

Referenced by Character::combine_with().

void PartBundleNode::update_bundle ( PartBundleHandle old_bundle_handle,
PartBundle new_bundle 
) [protected, virtual]

Replaces the contents of the indicated PartBundleHandle (presumably stored within this node) with new_bundle.

Reimplemented in Character.

Definition at line 155 of file partBundleNode.cxx.

References PartBundle::add_node(), PartBundleHandle::get_bundle(), PartBundle::remove_node(), and PartBundleHandle::set_bundle().

Referenced by apply_attribs_to_vertices(), and xform().

void PartBundleNode::write_datagram ( BamWriter manager,
Datagram me 
) [virtual]

Writes the contents of this object to the datagram for shipping out to a Bam file.

Reimplemented from PandaNode.

Reimplemented in Character.

Definition at line 169 of file partBundleNode.cxx.

References Datagram::add_uint16(), and BamWriter::write_pointer().

void PartBundleNode::xform ( const LMatrix4 mat) [virtual]

Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so.

For most kinds of PandaNodes, this does nothing.

Reimplemented from PandaNode.

Definition at line 75 of file partBundleNode.cxx.

References LMatrix4f::almost_equal(), PartGroup::copy_subgraph(), PartBundle::get_num_nodes(), LMatrix4f::ident_mat(), update_bundle(), and PartBundle::xform().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations