Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/physics/physicsManager.h

Go to the documentation of this file.
00001 // Filename: physicsManager.h
00002 // Created by:  charles (14Jun00)
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 PHYSICSMANAGER_H
00020 #define PHYSICSMANAGER_H
00021 
00022 #include <pandabase.h>
00023 #include <pointerTo.h>
00024 
00025 #include "physical.h"
00026 #include "linearForce.h"
00027 #include "angularForce.h"
00028 #include "linearIntegrator.h"
00029 #include "angularIntegrator.h"
00030 #include "physicalNode.h"
00031 
00032 #include "plist.h"
00033 #include "pvector.h"
00034 
00035 ////////////////////////////////////////////////////////////////////
00036 //       Class : PhysicsManager
00037 // Description : Physics don't get much higher-level than this.
00038 //               Attach as many Physicals (particle systems, etc..)
00039 //               as you want, pick an integrator and go.
00040 ////////////////////////////////////////////////////////////////////
00041 class EXPCL_PANDAPHYSICS PhysicsManager {
00042 private:
00043   // NOTE that the physicals container is NOT reference counted.
00044   // this does indeed mean that you are NOT supposed to use this
00045   // as a primary storage container for the physicals.  This is so
00046   // because physicals, on their death, ask to be removed from their
00047   // current physicsmanager, if one exists, relieving the client from
00048   // the task and also allowing for dynamically created and destroyed
00049   // physicals.
00050   pvector< Physical * > _physicals;
00051   pvector< PT(LinearForce) > _linear_forces;
00052   pvector< PT(AngularForce) > _angular_forces;
00053 
00054   PT(LinearIntegrator) _linear_integrator;
00055   PT(AngularIntegrator) _angular_integrator;
00056 
00057 PUBLISHED:
00058   PhysicsManager(void);
00059   virtual ~PhysicsManager(void);
00060 
00061   INLINE void attach_linear_integrator(LinearIntegrator *i);
00062   INLINE void attach_angular_integrator(AngularIntegrator *i);
00063   INLINE void attach_physical(Physical *p);
00064   INLINE void attach_physicalnode(PhysicalNode *p);
00065   INLINE void add_linear_force(LinearForce *f);
00066   INLINE void add_angular_force(AngularForce *f);
00067   INLINE void clear_linear_forces(void);
00068   INLINE void clear_angular_forces(void);
00069   INLINE void clear_physicals(void);
00070 
00071   void remove_physical(Physical *p);
00072   void remove_linear_force(LinearForce *f);
00073   void remove_angular_force(AngularForce *f);
00074   void do_physics(float dt);
00075 
00076 public:
00077   friend class Physical;
00078 };
00079 
00080 #include "physicsManager.I"
00081 
00082 #endif // PHYSICSMANAGER_H

Generated on Fri May 2 00:43:04 2003 for Panda by doxygen1.3