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