mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
added ls()
This commit is contained in:
parent
bf7c3c3508
commit
fe3b009d2b
@ -27,8 +27,9 @@ attach_physical(Physical *p) {
|
||||
p->_physics_manager = this;
|
||||
pvector< Physical * >::iterator found;
|
||||
found = find(_physicals.begin(), _physicals.end(), p);
|
||||
if (found == _physicals.end())
|
||||
if (found == _physicals.end()) {
|
||||
_physicals.push_back(p);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -39,11 +40,12 @@ attach_physical(Physical *p) {
|
||||
INLINE void PhysicsManager::
|
||||
add_linear_force(LinearForce *f) {
|
||||
nassertv(f);
|
||||
pvector< PT(LinearForce) >::iterator found;
|
||||
LinearForceVector::iterator found;
|
||||
PT(LinearForce) ptlf = f;
|
||||
found = find(_linear_forces.begin(), _linear_forces.end(), ptlf);
|
||||
if (found == _linear_forces.end())
|
||||
if (found == _linear_forces.end()) {
|
||||
_linear_forces.push_back(f);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -54,8 +56,9 @@ add_linear_force(LinearForce *f) {
|
||||
INLINE void PhysicsManager::
|
||||
attach_physicalnode(PhysicalNode *p) {
|
||||
nassertv(p);
|
||||
for (int i = 0; i < p->get_num_physicals(); i++)
|
||||
for (int i = 0; i < p->get_num_physicals(); i++) {
|
||||
attach_physical(p->get_physical(i));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
@ -76,7 +79,7 @@ clear_linear_forces() {
|
||||
INLINE void PhysicsManager::
|
||||
add_angular_force(AngularForce *f) {
|
||||
nassertv(f);
|
||||
pvector< PT(AngularForce) >::iterator found;
|
||||
AngularForceVector::iterator found;
|
||||
PT(AngularForce) ptaf = f;
|
||||
found = find(_angular_forces.begin(), _angular_forces.end(), ptaf);
|
||||
if (found == _angular_forces.end())
|
||||
@ -144,3 +147,14 @@ attach_angular_integrator(AngularIntegrator *i) {
|
||||
nassertv(i);
|
||||
_angular_integrator = i;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PhysicsManager::ls
|
||||
// Access: Published
|
||||
// Description: Shortcut for write(). This is handy for interactive
|
||||
// debugging.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void PhysicsManager::
|
||||
ls() const {
|
||||
write(nout, 0);
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ PhysicsManager::
|
||||
void PhysicsManager::
|
||||
remove_linear_force(LinearForce *f) {
|
||||
nassertv(f);
|
||||
pvector< PT(LinearForce) >::iterator found;
|
||||
LinearForceVector::iterator found;
|
||||
|
||||
PT(LinearForce) ptbf = f;
|
||||
found = find(_linear_forces.begin(), _linear_forces.end(), ptbf);
|
||||
@ -71,7 +71,7 @@ remove_linear_force(LinearForce *f) {
|
||||
void PhysicsManager::
|
||||
remove_angular_force(AngularForce *f) {
|
||||
nassertv(f);
|
||||
pvector< PT(AngularForce) >::iterator found;
|
||||
AngularForceVector::iterator found;
|
||||
|
||||
PT(BaseForce) ptbf = f;
|
||||
found = find(_angular_forces.begin(), _angular_forces.end(), ptbf);
|
||||
@ -180,7 +180,7 @@ write_linear_forces(ostream &out, unsigned int indent) const {
|
||||
#ifndef NDEBUG //[
|
||||
out.width(indent);
|
||||
out<<""<<"_linear_forces ("<<_linear_forces.size()<<" forces)\n";
|
||||
for (pvector< PT(LinearForce) >::const_iterator i=_linear_forces.begin();
|
||||
for (LinearForceVector::const_iterator i=_linear_forces.begin();
|
||||
i != _linear_forces.end();
|
||||
++i) {
|
||||
(*i)->write(out, indent+2);
|
||||
@ -199,7 +199,7 @@ write_angular_forces(ostream &out, unsigned int indent) const {
|
||||
#ifndef NDEBUG //[
|
||||
out.width(indent);
|
||||
out<<""<<"_angular_forces ("<<_angular_forces.size()<<" forces)\n";
|
||||
for (pvector< PT(AngularForce) >::const_iterator i=_angular_forces.begin();
|
||||
for (AngularForceVector::const_iterator i=_angular_forces.begin();
|
||||
i != _angular_forces.end();
|
||||
++i) {
|
||||
(*i)->write(out, indent+2);
|
||||
|
@ -48,8 +48,8 @@ public:
|
||||
// the task and also allowing for dynamically created and destroyed
|
||||
// physicals.
|
||||
typedef pvector<Physical *> PhysicalsVector;
|
||||
typedef pvector<PT(LinearForce)> LinearForcesVector;
|
||||
typedef pvector<PT(AngularForce)> AngularForcesVector;
|
||||
typedef pvector<PT(LinearForce)> LinearForceVector;
|
||||
typedef pvector<PT(AngularForce)> AngularForceVector;
|
||||
|
||||
PUBLISHED:
|
||||
PhysicsManager();
|
||||
@ -74,6 +74,7 @@ PUBLISHED:
|
||||
void do_physics(float dt);
|
||||
|
||||
virtual void output(ostream &out) const;
|
||||
INLINE void ls() const;
|
||||
virtual void write_physicals(ostream &out, unsigned int indent=0) const;
|
||||
virtual void write_linear_forces(ostream &out, unsigned int indent=0) const;
|
||||
virtual void write_angular_forces(ostream &out, unsigned int indent=0) const;
|
||||
@ -85,8 +86,8 @@ public:
|
||||
private:
|
||||
float _viscosity;
|
||||
PhysicalsVector _physicals;
|
||||
LinearForcesVector _linear_forces;
|
||||
AngularForcesVector _angular_forces;
|
||||
LinearForceVector _linear_forces;
|
||||
AngularForceVector _angular_forces;
|
||||
|
||||
PT(LinearIntegrator) _linear_integrator;
|
||||
PT(AngularIntegrator) _angular_integrator;
|
||||
|
Loading…
x
Reference in New Issue
Block a user