Panda3D
 All Classes Functions Variables Enumerations
linearUserDefinedForce.h
1 // Filename: linearUserDefinedForce.h
2 // Created by: charles (31Jul00)
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 LINEARUSERDEFINEDFORCE_H
16 #define LINEARUSERDEFINEDFORCE_H
17 
18 #include "linearForce.h"
19 
20 ////////////////////////////////////////////////////////////////////
21 // Class : LinearUserDefinedForce
22 // Description : a programmable force that takes an evaluator fn.
23 //
24 // NOTE : AS OF Interrogate => Squeak, this class does NOT
25 // get FFI'd due to the function pointer bug, and is
26 // currently NOT getting interrogated. Change this
27 // in the makefile when the time is right or this class
28 // becomes needed...
29 ////////////////////////////////////////////////////////////////////
30 class EXPCL_PANDAPHYSICS LinearUserDefinedForce : public LinearForce {
31 PUBLISHED:
32  LinearUserDefinedForce(LVector3 (*proc)(const PhysicsObject *) = NULL,
33  PN_stdfloat a = 1.0f,
34  bool md = false);
36  virtual ~LinearUserDefinedForce();
37 
38  INLINE void set_proc(LVector3 (*proc)(const PhysicsObject *));
39 
40  virtual void output(ostream &out) const;
41  virtual void write(ostream &out, unsigned int indent=0) const;
42 
43 private:
44  LVector3 (*_proc)(const PhysicsObject *po);
45 
46  virtual LVector3 get_child_vector(const PhysicsObject *po);
47  virtual LinearForce *make_copy();
48 
49 public:
50  static TypeHandle get_class_type() {
51  return _type_handle;
52  }
53  static void init_type() {
54  LinearForce::init_type();
55  register_type(_type_handle, "LinearUserDefinedForce",
56  LinearForce::get_class_type());
57  }
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62 
63 private:
64  static TypeHandle _type_handle;
65 };
66 
67 #include "linearUserDefinedForce.I"
68 
69 #endif // LINEARUSERDEFINEDFORCE_H
a programmable force that takes an evaluator fn.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
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
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:97
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85