Panda3D
 All Classes Functions Variables Enumerations
partBundleNode.h
1 // Filename: partBundleNode.h
2 // Created by: drose (06Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PARTBUNDLENODE_H
16 #define PARTBUNDLENODE_H
17 
18 #include "pandabase.h"
19 
20 #include "partBundle.h"
21 #include "partBundleHandle.h"
22 
23 #include "pandaNode.h"
24 #include "dcast.h"
25 #include "pvector.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : PartBundleNode
29 // Description : This is a node that contains a pointer to an
30 // PartBundle. Like AnimBundleNode, it exists to make
31 // it easy to store PartBundles in the scene graph.
32 //
33 // (Unlike AnimBundleNode, however, PartBundleNode has
34 // an additional function: it is also the base class of
35 // the Character node type, which adds additional
36 // functionality.)
37 ////////////////////////////////////////////////////////////////////
38 class EXPCL_PANDA_CHAN PartBundleNode : public PandaNode {
39 PUBLISHED:
40  INLINE PartBundleNode(const string &name, PartBundle *bundle);
41 
42 protected:
43  INLINE PartBundleNode();
44  INLINE PartBundleNode(const PartBundleNode &copy);
45 
46 public:
47  virtual ~PartBundleNode();
48  virtual void apply_attribs_to_vertices(const AccumulatedAttribs &attribs,
49  int attrib_types,
50  GeomTransformer &transformer);
51  virtual void xform(const LMatrix4 &mat);
52 
53 PUBLISHED:
54  INLINE int get_num_bundles() const;
55  INLINE PartBundle *get_bundle(int n) const;
56  MAKE_SEQ(get_bundles, get_num_bundles, get_bundle);
57  INLINE PartBundleHandle *get_bundle_handle(int n) const;
58  MAKE_SEQ(get_bundle_handles, get_num_bundles, get_bundle_handle);
59 
60 protected:
61  void add_bundle(PartBundle *bundle);
62  void add_bundle_handle(PartBundleHandle *handle);
63  void steal_bundles(PartBundleNode *other);
64  virtual void update_bundle(PartBundleHandle *old_bundle_handle,
65  PartBundle *new_bundle);
66 
67 protected:
69  Bundles _bundles;
70 
71 public:
72  virtual void write_datagram(BamWriter* manager, Datagram &me);
73  virtual int complete_pointers(TypedWritable **p_list,
74  BamReader *manager);
75 
76 protected:
77  void fillin(DatagramIterator& scan, BamReader* manager);
78 
79 public:
80  virtual TypeHandle get_type() const {
81  return get_class_type();
82  }
83  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
84  static TypeHandle get_class_type() {
85  return _type_handle;
86  }
87  static void init_type() {
88  PandaNode::init_type();
89  register_type(_type_handle, "PartBundleNode",
90  PandaNode::get_class_type());
91  }
92 
93 private:
94  static TypeHandle _type_handle;
95 };
96 
97 #include "partBundleNode.I"
98 
99 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
Definition: pandaNode.cxx:4164
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...
Definition: pandaNode.cxx:352
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:122
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:37
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:73
This is a trivial class returned by PartBundleNode::get_bundle().
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this PandaNode by the indicated matrix, if it means anything to do so...
Definition: pandaNode.cxx:377
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.
Definition: lmatrix.h:451
This is a node that contains a pointer to an PartBundle.
This is the root of a MovingPart hierarchy.
Definition: partBundle.h:49
A class to retrieve the individual data elements previously stored in a Datagram. ...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:43
An object specifically designed to transform the vertices of a Geom without disturbing indexing or af...