Panda3D
physicalNode.h
1 // Filename: physicalNode.h
2 // Created by: charles (01Aug00)
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 PHYSICALNODE_H
16 #define PHYSICALNODE_H
17 
18 #include "pandabase.h"
19 #include "pandaNode.h"
20 
21 #include "pvector.h"
22 
23 #include "physical.h"
24 #include "config_physics.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : PhysicalNode
28 // Description : Graph node that encapsulated a series of physical
29 // objects
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDAPHYSICS PhysicalNode : public PandaNode {
32 PUBLISHED:
33  PhysicalNode(const string &name);
34  INLINE void clear();
35  INLINE Physical *get_physical(int index) const;
36  INLINE int get_num_physicals() const;
37  MAKE_SEQ(get_physicals, get_num_physicals, get_physical);
38  INLINE void add_physical(Physical *physical);
39 
40  void add_physicals_from(const PhysicalNode &other);
41  void remove_physical(Physical *physical);
42  void remove_physical(int index);
43 
44  virtual void write(ostream &out, unsigned int indent=0) const;
45 
46 public:
47  virtual ~PhysicalNode();
48  virtual bool safe_to_flatten() const { return false; }
49  virtual PandaNode *make_copy() const;
50 
51 protected:
52  PhysicalNode(const PhysicalNode &copy);
53 
54 private:
56  PhysicalsVector _physicals;
57 
58 public:
59  static TypeHandle get_class_type() {
60  return _type_handle;
61  }
62  static void init_type() {
63  PandaNode::init_type();
64  register_type(_type_handle, "PhysicalNode",
65  PandaNode::get_class_type());
66  }
67  virtual TypeHandle get_type() const {
68  return get_class_type();
69  }
70  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
71 
72 private:
73  static TypeHandle _type_handle;
74 };
75 
76 #include "physicalNode.I"
77 
78 #endif // PHYSICALNODE_H
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...
Definition: physicalNode.h:48
Graph node that encapsulated a series of physical objects.
Definition: physicalNode.h:31
Defines a set of physically modeled attributes.
Definition: physical.h:40
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
Definition: pandaNode.cxx:604
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85