Panda3D
baseIntegrator.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 baseIntegrator.h
10  * @author charles
11  * @date 2000-08-11
12  */
13 
14 #ifndef BASEINTEGRATOR_H
15 #define BASEINTEGRATOR_H
16 
17 #include "pandabase.h"
18 #include "pointerTo.h"
19 #include "referenceCount.h"
20 #include "luse.h"
21 
22 #include "linearForce.h"
23 #include "angularForce.h"
24 
25 #include "pvector.h"
26 #include "epvector.h"
27 
28 class Physical;
29 
30 /**
31  * pure virtual integrator class that holds cached matrix information that
32  * really should be common to any possible child implementation.
33  */
34 class EXPCL_PANDA_PHYSICS BaseIntegrator : public ReferenceCount {
35 public:
36  typedef epvector<LMatrix4> MatrixVector;
39 
40  virtual ~BaseIntegrator();
41 
42 PUBLISHED:
43  virtual void output(std::ostream &out) const;
44  virtual void write_precomputed_linear_matrices(std::ostream &out,
45  int indent=0) const;
46  virtual void write_precomputed_angular_matrices(std::ostream &out,
47  int indent=0) const;
48  virtual void write(std::ostream &out, int indent=0) const;
49 
50 protected:
52 
53  INLINE const MatrixVector &get_precomputed_linear_matrices() const;
54  INLINE const MatrixVector &get_precomputed_angular_matrices() const;
55 
56  void precompute_linear_matrices(Physical *physical,
57  const LinearForceVector &forces);
58  void precompute_angular_matrices(Physical *physical,
59  const AngularForceVector &forces);
60 
61 private:
62  // since the wrt for each physicsobject between its physicalnode and however
63  // many forces will be the same among one physical, the transformation
64  // matrices can be pulled out of the inner loop and precomputed.
65  MatrixVector _precomputed_linear_matrices;
66  MatrixVector _precomputed_angular_matrices;
67 };
68 
69 #include "baseIntegrator.I"
70 
71 #endif // BASEINTEGRATOR_H
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:23
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:42
pure virtual integrator class that holds cached matrix information that really should be common to an...
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a set of physically modeled attributes.
Definition: physical.h:37
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things that want to be reference-counted.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pure virtual parent of all quat-based forces.
Definition: angularForce.h:22
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.