From 184ed3e96fd8473fab9c2c3785996e91f66d3045 Mon Sep 17 00:00:00 2001 From: Dave Schuyler Date: Wed, 1 Sep 2004 03:57:57 +0000 Subject: [PATCH] added deubg_output --- panda/src/physics/physicsManager.cxx | 42 +++++++++++++++++++++++++--- panda/src/physics/physicsManager.h | 2 ++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/panda/src/physics/physicsManager.cxx b/panda/src/physics/physicsManager.cxx index 06c18e2ab3..f0255300b1 100644 --- a/panda/src/physics/physicsManager.cxx +++ b/panda/src/physics/physicsManager.cxx @@ -76,9 +76,9 @@ remove_angular_force(AngularForce *f) { PT(BaseForce) ptbf = f; found = find(_angular_forces.begin(), _angular_forces.end(), ptbf); - if (found == _angular_forces.end()) + if (found == _angular_forces.end()) { return; - + } _angular_forces.erase(found); } @@ -115,12 +115,14 @@ do_physics(float dt) { nassertv(physical); // do linear - if (_linear_integrator.is_null() == false) { + //if (_linear_integrator.is_null() == false) { + if (_linear_integrator) { _linear_integrator->integrate(physical, _linear_forces, dt); } // do angular - if (_angular_integrator.is_null() == false) { + //if (_angular_integrator.is_null() == false) { + if (_angular_integrator) { _angular_integrator->integrate(physical, _angular_forces, dt); } @@ -239,3 +241,35 @@ write(ostream &out, unsigned int indent) const { } #endif //] NDEBUG } + +//////////////////////////////////////////////////////////////////// +// Function : write +// Access : Public +// Description : Write a string representation of this instance to +// . +//////////////////////////////////////////////////////////////////// +void PhysicsManager:: +debug_output(ostream &out, unsigned int indent) const { + #ifndef NDEBUG //[ + out.width(indent); out<<""<<"PhysicsManager li"<<(_linear_integrator?1:0)<<" ai"<<(_angular_integrator?1:0)<<"\n"; + out<<" _physicals "<<_physicals.size()<<"\n"; + //_physicals._phys_body.write(out, indent+2); + + + out.width(indent+2); + out<<""<<"_linear_forces ("<<_linear_forces.size()<<" forces)\n"; + for (LinearForceVector::const_iterator i=_linear_forces.begin(); + i != _linear_forces.end(); + ++i) { + (*i)->write(out, indent+2); + } + + out.width(indent+2); + out<<""<<" _angular_forces "<<_angular_forces.size()<<"\n"; + for (AngularForceVector::const_iterator i=_angular_forces.begin(); + i != _angular_forces.end(); + ++i) { + (*i)->write(out, indent+2); + } + #endif //] NDEBUG +} diff --git a/panda/src/physics/physicsManager.h b/panda/src/physics/physicsManager.h index b8920ea8bf..51f9c0cee7 100644 --- a/panda/src/physics/physicsManager.h +++ b/panda/src/physics/physicsManager.h @@ -79,6 +79,8 @@ PUBLISHED: virtual void write_angular_forces(ostream &out, unsigned int indent=0) const; virtual void write(ostream &out, unsigned int indent=0) const; + virtual void debug_output(ostream &out, unsigned int indent=0) const; + public: friend class Physical;