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

panda/src/physics/linearIntegrator.cxx

Go to the documentation of this file.
00001 // Filename: linearIntegrator.cxx
00002 // Created by:  charles (02Aug00)
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 #include "linearIntegrator.h"
00020 #include "config_physics.h"
00021 #include "physicalNode.h"
00022 #include "forceNode.h"
00023 
00024 ////////////////////////////////////////////////////////////////////
00025 //    Function : BaseLinearIntegrator
00026 //      Access : Protected
00027 // Description : constructor
00028 ////////////////////////////////////////////////////////////////////
00029 LinearIntegrator::
00030 LinearIntegrator(void) {
00031 }
00032 
00033 ////////////////////////////////////////////////////////////////////
00034 //    Function : ~LinearIntegrator
00035 //      Access : public, virtual
00036 // Description : destructor
00037 ////////////////////////////////////////////////////////////////////
00038 LinearIntegrator::
00039 ~LinearIntegrator(void) {
00040 }
00041 
00042 ////////////////////////////////////////////////////////////////////
00043 //    Function : integrate
00044 //      Access : public
00045 // Description : parent integration routine, hands off to child
00046 //               virtual.
00047 ////////////////////////////////////////////////////////////////////
00048 void LinearIntegrator::
00049 integrate(Physical *physical, pvector< PT(LinearForce) > &forces,
00050           float dt) {
00051 /* <-- darren, 2000.10.06
00052   // cap dt so physics don't go flying off on lags
00053   if (dt > _max_linear_dt)
00054     dt = _max_linear_dt;
00055 */
00056 
00057   pvector< PT(PhysicsObject) >::const_iterator current_object_iter;
00058   current_object_iter = physical->get_object_vector().begin();
00059   for (; current_object_iter != physical->get_object_vector().end();
00060        current_object_iter++) {
00061     PhysicsObject *current_object = *current_object_iter;
00062 
00063     // bail out if this object doesn't exist or doesn't want to be
00064     // processed.
00065     if (current_object == (PhysicsObject *) NULL)
00066       continue;
00067 
00068     // set the object's last position to its current position before we move it
00069     current_object->set_last_position(current_object->get_position());
00070 
00071   }
00072 
00073   child_integrate(physical, forces, dt);
00074 }

Generated on Fri May 2 00:42:56 2003 for Panda by doxygen1.3