Panda3D
linearUserDefinedForce.cxx
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 linearUserDefinedForce.cxx
10  * @author charles
11  * @date 2000-07-31
12  */
13 
14 #include "linearUserDefinedForce.h"
15 
16 TypeHandle LinearUserDefinedForce::_type_handle;
17 
18 /**
19  * constructor
20  */
22 LinearUserDefinedForce(LVector3 (*proc)(const PhysicsObject *),
23  PN_stdfloat a, bool md) :
24  LinearForce(a, md),
25  _proc(proc)
26 {
27 }
28 
29 /**
30  * copy constructor
31  */
34  LinearForce(copy) {
35  _proc = copy._proc;
36 }
37 
38 /**
39  * destructor
40  */
43 }
44 
45 /**
46  * child copier
47  */
48 LinearForce *LinearUserDefinedForce::
49 make_copy() {
50  return new LinearUserDefinedForce(*this);
51 }
52 
53 /**
54  * force builder
55  */
56 LVector3 LinearUserDefinedForce::
57 get_child_vector(const PhysicsObject *po) {
58  return _proc(po);
59 }
60 
61 /**
62  * Write a string representation of this instance to <out>.
63  */
65 output(std::ostream &out) const {
66  #ifndef NDEBUG //[
67  out<<"LinearUserDefinedForce";
68  #endif //] NDEBUG
69 }
70 
71 /**
72  * Write a string representation of this instance to <out>.
73  */
75 write(std::ostream &out, int indent) const {
76  #ifndef NDEBUG //[
77  out.width(indent); out<<""; out<<"LinearUserDefinedForce:\n";
78  LinearForce::write(out, indent+2);
79  #endif //] NDEBUG
80 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A programmable force that takes an evaluator function.
A body on which physics will be applied.
Definition: physicsObject.h:27
virtual ~LinearUserDefinedForce()
destructor
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:23
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
LinearUserDefinedForce(LVector3(*proc)(const PhysicsObject *)=nullptr, PN_stdfloat a=1.0f, bool md=false)
constructor
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:95
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81