Panda3D
 All Classes Functions Variables Enumerations
baseForce.h
1 // Filename: baseForce.h
2 // Created by: charles (08Aug00)
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 BASEFORCE_H
16 #define BASEFORCE_H
17 
18 #include "pandabase.h"
19 #include "typedReferenceCount.h"
20 #include "luse.h"
21 #include "nodePath.h"
22 
23 #include "physicsObject.h"
24 
25 class ForceNode;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : BaseForce
29 // Description : pure virtual base class for all forces that could
30 // POSSIBLY exist.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDAPHYSICS BaseForce : public TypedReferenceCount {
33 PUBLISHED:
34  virtual ~BaseForce();
35 
36  INLINE bool get_active() const;
37  INLINE void set_active(bool active);
38  virtual bool is_linear() const = 0;
39 
40  INLINE ForceNode *get_force_node() const;
41  INLINE NodePath get_force_node_path() const;
42 
43  virtual void output(ostream &out) const;
44  virtual void write(ostream &out, int indent_level=0) const;
45 
46 protected:
47  BaseForce(bool active = true);
48  BaseForce(const BaseForce &copy);
49 
50 private:
51  ForceNode *_force_node;
52  NodePath _force_node_path;
53  bool _active;
54 
55 public:
56  static TypeHandle get_class_type() {
57  return _type_handle;
58  }
59  static void init_type() {
60  TypedReferenceCount::init_type();
61  register_type(_type_handle, "BaseForce",
62  TypedReferenceCount::get_class_type());
63  }
64  virtual TypeHandle get_type() const {
65  return get_class_type();
66  }
67  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
68 
69 private:
70  static TypeHandle _type_handle;
71 
72  friend class ForceNode;
73 };
74 
75 #include "baseForce.I"
76 
77 #endif // BASEFORCE_H
A force that lives in the scene graph and is therefore subject to local coordinate systems...
Definition: forceNode.h:30
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
pure virtual base class for all forces that could POSSIBLY exist.
Definition: baseForce.h:32
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165