Panda3D
baseForce.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 baseForce.h
10  * @author charles
11  * @date 2000-08-08
12  */
13 
14 #ifndef BASEFORCE_H
15 #define BASEFORCE_H
16 
17 #include "pandabase.h"
18 #include "typedReferenceCount.h"
19 #include "luse.h"
20 #include "nodePath.h"
21 
22 #include "physicsObject.h"
23 
24 class ForceNode;
25 
26 /**
27  * pure virtual base class for all forces that could POSSIBLY exist.
28  */
29 class EXPCL_PANDA_PHYSICS BaseForce : public TypedReferenceCount {
30 PUBLISHED:
31  virtual ~BaseForce();
32 
33  INLINE bool get_active() const;
34  INLINE void set_active(bool active);
35  virtual bool is_linear() const = 0;
36 
37  INLINE ForceNode *get_force_node() const;
38  INLINE NodePath get_force_node_path() const;
39 
40  virtual void output(std::ostream &out) const;
41  virtual void write(std::ostream &out, int indent_level=0) const;
42 
43 protected:
44  BaseForce(bool active = true);
45  BaseForce(const BaseForce &copy);
46 
47 private:
48  ForceNode *_force_node;
49  NodePath _force_node_path;
50  bool _active;
51 
52 public:
53  static TypeHandle get_class_type() {
54  return _type_handle;
55  }
56  static void init_type() {
57  TypedReferenceCount::init_type();
58  register_type(_type_handle, "BaseForce",
59  TypedReferenceCount::get_class_type());
60  }
61  virtual TypeHandle get_type() const {
62  return get_class_type();
63  }
64  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
65 
66 private:
67  static TypeHandle _type_handle;
68 
69  friend class ForceNode;
70 };
71 
72 #include "baseForce.I"
73 
74 #endif // BASEFORCE_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A force that lives in the scene graph and is therefore subject to local coordinate systems.
Definition: forceNode.h:27
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:29
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161