15 #include "pointerTo.h"
18 #include "physicsManager.h"
46 if (total_objects == 1) {
52 if (pre_alloc ==
true) {
53 for (
int i = 0; i < total_objects; ++i) {
73 LinearForceVector::const_iterator lf_cur;
74 LinearForceVector::const_iterator lf_end = copy._linear_forces.end();
76 for (lf_cur = copy._linear_forces.begin(); lf_cur != lf_end; lf_cur++) {
77 _linear_forces.push_back((*lf_cur)->make_copy());
80 AngularForceVector::const_iterator af_cur;
81 AngularForceVector::const_iterator af_end = copy._angular_forces.end();
83 for (af_cur = copy._angular_forces.begin(); af_cur != af_end; af_cur++) {
84 _angular_forces.push_back((*af_cur)->make_copy());
88 PhysicsObject::Vector::const_iterator p_cur;
89 PhysicsObject::Vector::const_iterator p_end = copy._physics_objects.end();
91 for (p_cur = copy._physics_objects.begin(); p_cur != p_end; p_cur++) {
93 _physics_objects.push_back((*p_cur)->make_copy());
97 if (_physics_objects.size() == 1)
98 _phys_body = _physics_objects[0];
127 for (PhysicsObject::Vector::const_iterator i=_physics_objects.begin();
128 i != _physics_objects.end();
159 out<<
""<<
"_physics_objects ("<<_physics_objects.size()<<
" objects)\n";
160 for (PhysicsObject::Vector::const_iterator i=_physics_objects.begin();
161 i != _physics_objects.end();
163 (*i)->write(out, indent+2);
178 out<<
""<<
"_linear_forces ("<<_linear_forces.size()<<
" forces)\n";
179 for (LinearForceVector::const_iterator i=_linear_forces.begin();
180 i != _linear_forces.end();
182 (*i)->write(out, indent+2);
197 out<<
""<<
"_angular_forces ("<<_angular_forces.size()<<
" forces)\n";
198 for (AngularForceVector::const_iterator i=_angular_forces.begin();
199 i != _angular_forces.end();
201 (*i)->write(out, indent+2);
213 write(ostream &out,
unsigned int indent)
const {
215 out.width(indent); out<<
""<<
"Physical\n";
220 out.width(indent+2); out<<
""<<
"_phys_body\n";
221 _phys_body->
write(out, indent+4);
223 out.width(indent+2); out<<
""<<
"_phys_body is null\n";
void remove_physical(Physical *p)
takes a physical out of the object list
virtual void write_linear_forces(ostream &out=cout, unsigned int indent=0) const
Write a string representation of this instance to <out>.
A body on which physics will be applied.
This is a set of zero or more PhysicsObjects.
virtual void write_physics_objects(ostream &out=cout, unsigned int indent=0) const
Write a string representation of this instance to <out>.
Graph node that encapsulated a series of physical objects.
virtual void write_angular_forces(ostream &out=cout, unsigned int indent=0) const
Write a string representation of this instance to <out>.
virtual void output(ostream &out=cout) const
Write a string representation of this instance to <out>.
Physics don't get much higher-level than this.
virtual ~Physical()
destructor
Defines a set of physically modeled attributes.
Physical(int total_objects=1, bool pre_alloc=false)
Default Constructor.
void add_physics_object(PT(PhysicsObject) physics_object)
Adds a new PhysicsObject to the collection.
void add_physics_object(PhysicsObject *po)
Adds an object to the physics object vector.
TypeHandle is the identifier used to differentiate C++ class types.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
virtual void write(ostream &out=cout, unsigned int indent=0) const
Write a string representation of this instance to <out>.