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

panda/src/physics/physicsManager.I

Go to the documentation of this file.
00001 // Filename: physicsManager.I
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 ////////////////////////////////////////////////////////////////////
00020 //    Function : attach_physical
00021 //      Access : Public
00022 // Description : Registers a Physical class with the manager
00023 ////////////////////////////////////////////////////////////////////
00024 INLINE void PhysicsManager::
00025 attach_physical(Physical *p) {
00026   p->_physics_manager = this;
00027   pvector< Physical * >::iterator found;
00028   found = find(_physicals.begin(), _physicals.end(), p);
00029   if (found == _physicals.end())
00030     _physicals.push_back(p);
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //    Function : attach_linear_force
00035 //      Access : Public
00036 // Description : Adds a global linear force to the physics manager
00037 ////////////////////////////////////////////////////////////////////
00038 INLINE void PhysicsManager::
00039 add_linear_force(LinearForce *f) {
00040   pvector< PT(LinearForce) >::iterator found;
00041   PT(LinearForce) ptlf = f;
00042   found = find(_linear_forces.begin(), _linear_forces.end(), ptlf);
00043   if (found == _linear_forces.end())
00044     _linear_forces.push_back(f);
00045 }
00046 
00047 ////////////////////////////////////////////////////////////////////
00048 //    Function : attach_physicalnode
00049 //      Access : Public
00050 // Description : Registers an physicalnode with the manager
00051 ////////////////////////////////////////////////////////////////////
00052 INLINE void PhysicsManager::
00053 attach_physicalnode(PhysicalNode *p) {
00054   for (int i = 0; i < p->get_num_physicals(); i++)
00055     attach_physical(p->get_physical(i));
00056 }
00057 
00058 ////////////////////////////////////////////////////////////////////
00059 //    Function : clear_linear_forces
00060 //      Access : Public
00061 // Description : Resets the physics manager force vector
00062 ////////////////////////////////////////////////////////////////////
00063 INLINE void PhysicsManager::
00064 clear_linear_forces(void) {
00065   _linear_forces.erase(_linear_forces.begin(), _linear_forces.end());
00066 }
00067 
00068 ////////////////////////////////////////////////////////////////////
00069 //    Function : attach_angular_force
00070 //      Access : Public
00071 // Description : Adds a global angular force to the physics manager
00072 ////////////////////////////////////////////////////////////////////
00073 INLINE void PhysicsManager::
00074 add_angular_force(AngularForce *f) {
00075   pvector< PT(AngularForce) >::iterator found;
00076   PT(AngularForce) ptaf = f;
00077   found = find(_angular_forces.begin(), _angular_forces.end(), ptaf);
00078   if (found == _angular_forces.end())
00079     _angular_forces.push_back(f);
00080 }
00081 
00082 ////////////////////////////////////////////////////////////////////
00083 //    Function : clear_angular_forces
00084 //      Access : Public
00085 // Description : Resets the physics manager force vector
00086 ////////////////////////////////////////////////////////////////////
00087 INLINE void PhysicsManager::
00088 clear_angular_forces(void) {
00089   _angular_forces.erase(_angular_forces.begin(), _angular_forces.end());
00090 }
00091 
00092 ////////////////////////////////////////////////////////////////////
00093 //    Function : clear_physicals
00094 //      Access : Public
00095 // Description : Resets the physics manager objects vector
00096 ////////////////////////////////////////////////////////////////////
00097 INLINE void PhysicsManager::
00098 clear_physicals(void) {
00099   _physicals.erase(_physicals.begin(), _physicals.end());
00100 }
00101 
00102 ////////////////////////////////////////////////////////////////////
00103 //    Function : attach_linear_integrator
00104 //      Access : Public
00105 // Description : Hooks a linear integrator into the manager
00106 ////////////////////////////////////////////////////////////////////
00107 INLINE void PhysicsManager::
00108 attach_linear_integrator(LinearIntegrator *i) {
00109   _linear_integrator = i;
00110 }
00111 
00112 ////////////////////////////////////////////////////////////////////
00113 //    Function : attach_angular_integrator
00114 //      Access : Public
00115 // Description : Hooks an angular integrator into the manager
00116 ////////////////////////////////////////////////////////////////////
00117 INLINE void PhysicsManager::
00118 attach_angular_integrator(AngularIntegrator *i) {
00119   _angular_integrator = i;
00120 }

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