Panda3D
 All Classes Functions Variables Enumerations
linearForce.h
1 // Filename: linearForce.h
2 // Created by: charles (13Jun00)
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 LINEARFORCE_H
16 #define LINEARFORCE_H
17 
18 #include "baseForce.h"
19 
20 ////////////////////////////////////////////////////////////////////
21 // Class : LinearForce
22 // Description : A force that acts on a PhysicsObject by way of an
23 // Integrator. This is a pure virtual base class.
24 ////////////////////////////////////////////////////////////////////
25 class EXPCL_PANDAPHYSICS LinearForce : public BaseForce {
26 PUBLISHED:
27  ~LinearForce();
28 
29  INLINE void set_amplitude(const PN_stdfloat a);
30  INLINE void set_mass_dependent(bool m);
31 
32  INLINE PN_stdfloat get_amplitude() const;
33  INLINE bool get_mass_dependent() const;
34 
35  INLINE void set_vector_masks(bool x, bool y, bool z);
36  INLINE LVector3 get_vector_masks();
37 
38  LVector3 get_vector(const PhysicsObject *po);
39 
40  virtual LinearForce *make_copy() = 0;
41 
42  virtual bool is_linear() const;
43 
44  virtual void output(ostream &out) const;
45  virtual void write(ostream &out, unsigned int indent=0) const;
46 
47 protected:
48  LinearForce(PN_stdfloat a, bool mass);
49  LinearForce(const LinearForce& copy);
50 
51 private:
52  PN_stdfloat _amplitude;
53  bool _mass_dependent;
54 
55  bool _x_mask;
56  bool _y_mask;
57  bool _z_mask;
58 
59  virtual LVector3 get_child_vector(const PhysicsObject *po) = 0;
60 
61 public:
62  static TypeHandle get_class_type() {
63  return _type_handle;
64  }
65  static void init_type() {
66  BaseForce::init_type();
67  register_type(_type_handle, "LinearForce",
68  BaseForce::get_class_type());
69  }
70  virtual TypeHandle get_type() const {
71  return get_class_type();
72  }
73  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
74 
75 private:
76  static TypeHandle _type_handle;
77 };
78 
79 #include "linearForce.I"
80 
81 #endif // BASELINEARFORCE_H
A body on which physics will be applied.
Definition: physicsObject.h:29
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:25
pure virtual base class for all forces that could POSSIBLY exist.
Definition: baseForce.h:32
virtual void write(ostream &out, int indent_level=0) const
Write a string representation of this instance to <out>.
Definition: baseForce.cxx:72
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
Definition: baseForce.cxx:61
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85