00001 // Filename: baseIntegrator.h 00002 // Created by: charles (11Aug00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef BASEINTEGRATOR_H 00020 #define BASEINTEGRATOR_H 00021 00022 #include <pandabase.h> 00023 #include <pointerTo.h> 00024 #include <referenceCount.h> 00025 #include <luse.h> 00026 00027 #include "linearForce.h" 00028 #include "angularForce.h" 00029 00030 #include "pvector.h" 00031 00032 class Physical; 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : BaseIntegrator 00036 // Description : pure virtual integrator class that holds cached 00037 // matrix information that really should be common to 00038 // any possible child implementation. 00039 //////////////////////////////////////////////////////////////////// 00040 class EXPCL_PANDAPHYSICS BaseIntegrator : public ReferenceCount { 00041 private: 00042 // since the wrt for each physicsobject between its physicalnode 00043 // and however many forces will be the same among one physical, 00044 // the transformation matrices can be pulled out of the inner loop 00045 // and precomputed. 00046 pvector< LMatrix4f > _precomputed_linear_matrices; 00047 pvector< LMatrix4f > _precomputed_angular_matrices; 00048 00049 protected: 00050 BaseIntegrator(void); 00051 00052 INLINE const pvector< LMatrix4f > &get_precomputed_linear_matrices(void) const; 00053 INLINE const pvector< LMatrix4f > &get_precomputed_angular_matrices(void) const; 00054 00055 void precompute_linear_matrices(Physical *physical, 00056 const pvector< PT(LinearForce) > &forces); 00057 void precompute_angular_matrices(Physical *physical, 00058 const pvector< PT(AngularForce) > &forces); 00059 00060 public: 00061 virtual ~BaseIntegrator(void); 00062 }; 00063 00064 #include "baseIntegrator.I" 00065 00066 #endif // BASEINTEGRATOR_H