Panda3D
partBundleNode.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file partBundleNode.h
10  * @author drose
11  * @date 2002-03-06
12  */
13 
14 #ifndef PARTBUNDLENODE_H
15 #define PARTBUNDLENODE_H
16 
17 #include "pandabase.h"
18 
19 #include "partBundle.h"
20 #include "partBundleHandle.h"
21 
22 #include "pandaNode.h"
23 #include "dcast.h"
24 #include "pvector.h"
25 
26 /**
27  * This is a node that contains a pointer to an PartBundle. Like
28  * AnimBundleNode, it exists to make it easy to store PartBundles in the scene
29  * graph.
30  *
31  * (Unlike AnimBundleNode, however, PartBundleNode has an additional function:
32  * it is also the base class of the Character node type, which adds additional
33  * functionality.)
34  */
35 class EXPCL_PANDA_CHAN PartBundleNode : public PandaNode {
36 PUBLISHED:
37  INLINE explicit PartBundleNode(const std::string &name, PartBundle *bundle);
38 
39 protected:
40  INLINE PartBundleNode();
41  INLINE PartBundleNode(const PartBundleNode &copy);
42 
43 public:
44  virtual ~PartBundleNode();
45  virtual void apply_attribs_to_vertices(const AccumulatedAttribs &attribs,
46  int attrib_types,
47  GeomTransformer &transformer);
48  virtual void xform(const LMatrix4 &mat);
49 
50 PUBLISHED:
51  INLINE int get_num_bundles() const;
52  INLINE PartBundle *get_bundle(int n) const;
53  MAKE_SEQ(get_bundles, get_num_bundles, get_bundle);
54  INLINE PartBundleHandle *get_bundle_handle(int n) const;
55  MAKE_SEQ(get_bundle_handles, get_num_bundles, get_bundle_handle);
56 
57  MAKE_SEQ_PROPERTY(bundles, get_num_bundles, get_bundle);
58  MAKE_SEQ_PROPERTY(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:
68  typedef pvector< PT(PartBundleHandle) > Bundles;
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
This class is used by the SceneGraphReducer to maintain and accumulate the set of attributes we have ...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
Definition: bamReader.h:110
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
Definition: bamWriter.h:63
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
An object specifically designed to transform the vertices of a Geom without disturbing indexing or af...
A basic node of the scene graph or data graph.
Definition: pandaNode.h:65
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:304
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:282
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:3583
This is a trivial class returned by PartBundleNode::get_bundle().
This is a node that contains a pointer to an PartBundle.
This is the root of a MovingPart hierarchy.
Definition: partBundle.h:46
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Base class for objects that can be written to and read from Bam files.
Definition: typedWritable.h:35
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 our own Panda specialization on the default STL vector.
Definition: pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22