Panda3D
baseIntegrator.h
1 // Filename: baseIntegrator.h
2 // Created by: charles (11Aug00)
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 BASEINTEGRATOR_H
16 #define BASEINTEGRATOR_H
17 
18 #include "pandabase.h"
19 #include "pointerTo.h"
20 #include "referenceCount.h"
21 #include "luse.h"
22 
23 #include "linearForce.h"
24 #include "angularForce.h"
25 
26 #include "pvector.h"
27 #include "epvector.h"
28 
29 class Physical;
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : BaseIntegrator
33 // Description : pure virtual integrator class that holds cached
34 // matrix information that really should be common to
35 // any possible child implementation.
36 ////////////////////////////////////////////////////////////////////
37 class EXPCL_PANDAPHYSICS BaseIntegrator : public ReferenceCount {
38 public:
39  typedef epvector<LMatrix4> MatrixVector;
42 
43  virtual ~BaseIntegrator();
44 
45 PUBLISHED:
46  virtual void output(ostream &out) const;
47  virtual void write_precomputed_linear_matrices(ostream &out,
48  unsigned int indent=0) const;
49  virtual void write_precomputed_angular_matrices(ostream &out,
50  unsigned int indent=0) const;
51  virtual void write(ostream &out, unsigned int indent=0) const;
52 
53 protected:
55 
56  INLINE const MatrixVector &get_precomputed_linear_matrices() const;
57  INLINE const MatrixVector &get_precomputed_angular_matrices() const;
58 
59  void precompute_linear_matrices(Physical *physical,
60  const LinearForceVector &forces);
61  void precompute_angular_matrices(Physical *physical,
62  const AngularForceVector &forces);
63 
64 private:
65  // since the wrt for each physicsobject between its physicalnode
66  // and however many forces will be the same among one physical,
67  // the transformation matrices can be pulled out of the inner loop
68  // and precomputed.
69  MatrixVector _precomputed_linear_matrices;
70  MatrixVector _precomputed_angular_matrices;
71 };
72 
73 #include "baseIntegrator.I"
74 
75 #endif // BASEINTEGRATOR_H
pure virtual integrator class that holds cached matrix information that really should be common to an...
Defines a set of physically modeled attributes.
Definition: physical.h:40
A base class for all things that want to be reference-counted.