mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
added Vector
This commit is contained in:
parent
a9439db14d
commit
bf7c3c3508
@ -36,7 +36,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void child_integrate(Physical *physical,
|
virtual void child_integrate(Physical *physical,
|
||||||
pvector< PT(AngularForce) >& forces,
|
AngularForceVector& forces,
|
||||||
float dt);
|
float dt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ AngularIntegrator::
|
|||||||
// Description : high-level integration. API.
|
// Description : high-level integration. API.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void AngularIntegrator::
|
void AngularIntegrator::
|
||||||
integrate(Physical *physical, pvector< PT(AngularForce) >& forces,
|
integrate(Physical *physical, AngularForceVector& forces,
|
||||||
float dt) {
|
float dt) {
|
||||||
// intercept in case we want to censor/adjust values
|
// intercept in case we want to censor/adjust values
|
||||||
if (dt > _max_angular_dt)
|
if (dt > _max_angular_dt)
|
||||||
|
@ -32,7 +32,7 @@ class EXPCL_PANDAPHYSICS AngularIntegrator : public BaseIntegrator {
|
|||||||
public:
|
public:
|
||||||
virtual ~AngularIntegrator();
|
virtual ~AngularIntegrator();
|
||||||
|
|
||||||
void integrate(Physical *physical, pvector< PT(AngularForce) > &forces,
|
void integrate(Physical *physical, AngularForceVector &forces,
|
||||||
float dt);
|
float dt);
|
||||||
|
|
||||||
virtual void output(ostream &out) const;
|
virtual void output(ostream &out) const;
|
||||||
@ -46,7 +46,7 @@ private:
|
|||||||
|
|
||||||
// this allows baseAngularIntegrator to censor/modify data that the
|
// this allows baseAngularIntegrator to censor/modify data that the
|
||||||
// actual integration function receives.
|
// actual integration function receives.
|
||||||
virtual void child_integrate(Physical *physical, pvector< PT(AngularForce) > &forces,
|
virtual void child_integrate(Physical *physical, AngularForceVector &forces,
|
||||||
float dt) = 0;
|
float dt) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ BaseIntegrator::
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void BaseIntegrator::
|
void BaseIntegrator::
|
||||||
precompute_linear_matrices(Physical *physical,
|
precompute_linear_matrices(Physical *physical,
|
||||||
const pvector< PT(LinearForce) > &forces) {
|
const LinearForceVector &forces) {
|
||||||
nassertv(physical);
|
nassertv(physical);
|
||||||
// make sure the physical's in the scene graph, somewhere.
|
// make sure the physical's in the scene graph, somewhere.
|
||||||
PhysicalNode *physical_node = physical->get_physical_node();
|
PhysicalNode *physical_node = physical->get_physical_node();
|
||||||
@ -79,8 +79,7 @@ precompute_linear_matrices(Physical *physical,
|
|||||||
_precomputed_linear_matrices.push_back(physical_np.get_mat(force_node));
|
_precomputed_linear_matrices.push_back(physical_np.get_mat(force_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
const pvector< PT(LinearForce) > &force_vector =
|
const LinearForceVector &force_vector = physical->get_linear_forces();
|
||||||
physical->get_linear_forces();
|
|
||||||
|
|
||||||
// tally the local xforms
|
// tally the local xforms
|
||||||
for (i = 0; i < local_force_vec_size; ++i) {
|
for (i = 0; i < local_force_vec_size; ++i) {
|
||||||
@ -102,7 +101,7 @@ precompute_linear_matrices(Physical *physical,
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void BaseIntegrator::
|
void BaseIntegrator::
|
||||||
precompute_angular_matrices(Physical *physical,
|
precompute_angular_matrices(Physical *physical,
|
||||||
const pvector< PT(AngularForce) > &forces) {
|
const AngularForceVector &forces) {
|
||||||
nassertv(physical);
|
nassertv(physical);
|
||||||
// make sure the physical's in the scene graph, somewhere.
|
// make sure the physical's in the scene graph, somewhere.
|
||||||
PhysicalNode *physical_node = physical->get_physical_node();
|
PhysicalNode *physical_node = physical->get_physical_node();
|
||||||
@ -124,7 +123,7 @@ precompute_angular_matrices(Physical *physical,
|
|||||||
NodePath physical_np(physical_node);
|
NodePath physical_np(physical_node);
|
||||||
|
|
||||||
// tally the global xforms
|
// tally the global xforms
|
||||||
for (i = 0; i < global_force_vec_size; i++) {
|
for (i = 0; i < global_force_vec_size; ++i) {
|
||||||
force_node = forces[i]->get_force_node();
|
force_node = forces[i]->get_force_node();
|
||||||
nassertv(force_node != (ForceNode *) NULL);
|
nassertv(force_node != (ForceNode *) NULL);
|
||||||
|
|
||||||
@ -132,11 +131,11 @@ precompute_angular_matrices(Physical *physical,
|
|||||||
_precomputed_angular_matrices.push_back(physical_np.get_mat(force_node));
|
_precomputed_angular_matrices.push_back(physical_np.get_mat(force_node));
|
||||||
}
|
}
|
||||||
|
|
||||||
const pvector< PT(AngularForce) > &force_vector =
|
const AngularForceVector &force_vector =
|
||||||
physical->get_angular_forces();
|
physical->get_angular_forces();
|
||||||
|
|
||||||
// tally the local xforms
|
// tally the local xforms
|
||||||
for (i = 0; i < local_force_vec_size; i++) {
|
for (i = 0; i < local_force_vec_size; ++i) {
|
||||||
force_node = force_vector[i]->get_force_node();
|
force_node = force_vector[i]->get_force_node();
|
||||||
nassertv(force_node != (ForceNode *) NULL);
|
nassertv(force_node != (ForceNode *) NULL);
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ class Physical;
|
|||||||
class EXPCL_PANDAPHYSICS BaseIntegrator : public ReferenceCount {
|
class EXPCL_PANDAPHYSICS BaseIntegrator : public ReferenceCount {
|
||||||
public:
|
public:
|
||||||
typedef pvector<LMatrix4f> MatrixVector;
|
typedef pvector<LMatrix4f> MatrixVector;
|
||||||
|
typedef pvector<PT(LinearForce)> LinearForceVector;
|
||||||
|
typedef pvector<PT(AngularForce)> AngularForceVector;
|
||||||
|
|
||||||
virtual ~BaseIntegrator();
|
virtual ~BaseIntegrator();
|
||||||
|
|
||||||
@ -57,9 +59,9 @@ protected:
|
|||||||
INLINE const MatrixVector &get_precomputed_angular_matrices() const;
|
INLINE const MatrixVector &get_precomputed_angular_matrices() const;
|
||||||
|
|
||||||
void precompute_linear_matrices(Physical *physical,
|
void precompute_linear_matrices(Physical *physical,
|
||||||
const pvector< PT(LinearForce) > &forces);
|
const LinearForceVector &forces);
|
||||||
void precompute_angular_matrices(Physical *physical,
|
void precompute_angular_matrices(Physical *physical,
|
||||||
const pvector< PT(AngularForce) > &forces);
|
const AngularForceVector &forces);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// since the wrt for each physicsobject between its physicalnode
|
// since the wrt for each physicsobject between its physicalnode
|
||||||
|
@ -57,7 +57,7 @@ LinearEulerIntegrator::
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void LinearEulerIntegrator::
|
void LinearEulerIntegrator::
|
||||||
child_integrate(Physical *physical,
|
child_integrate(Physical *physical,
|
||||||
pvector< PT(LinearForce) >& forces,
|
LinearForceVector& forces,
|
||||||
float dt) {
|
float dt) {
|
||||||
// perform the precomputation. Note that the vector returned by
|
// perform the precomputation. Note that the vector returned by
|
||||||
// get_precomputed_matrices() has the matrices loaded in order of force
|
// get_precomputed_matrices() has the matrices loaded in order of force
|
||||||
@ -77,10 +77,10 @@ child_integrate(Physical *physical,
|
|||||||
// velocity of each physicsobject in the set. Accordingly, we have
|
// velocity of each physicsobject in the set. Accordingly, we have
|
||||||
// to grunt our way through each one. wrt caching of the xform matrix
|
// to grunt our way through each one. wrt caching of the xform matrix
|
||||||
// should help.
|
// should help.
|
||||||
pvector< PT(PhysicsObject) >::const_iterator current_object_iter;
|
PhysicsObject::Vector::const_iterator current_object_iter;
|
||||||
current_object_iter = physical->get_object_vector().begin();
|
current_object_iter = physical->get_object_vector().begin();
|
||||||
for (; current_object_iter != physical->get_object_vector().end();
|
for (; current_object_iter != physical->get_object_vector().end();
|
||||||
current_object_iter++) {
|
++current_object_iter) {
|
||||||
PhysicsObject *current_object = *current_object_iter;
|
PhysicsObject *current_object = *current_object_iter;
|
||||||
|
|
||||||
// bail out if this object doesn't exist or doesn't want to be
|
// bail out if this object doesn't exist or doesn't want to be
|
||||||
@ -93,7 +93,7 @@ child_integrate(Physical *physical,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LVector3f md_accum_vec;
|
LVector3f md_accum_vec; // mass dependent accumulation vector.
|
||||||
LVector3f non_md_accum_vec;
|
LVector3f non_md_accum_vec;
|
||||||
LVector3f accel_vec;
|
LVector3f accel_vec;
|
||||||
LVector3f vel_vec;
|
LVector3f vel_vec;
|
||||||
@ -107,7 +107,7 @@ child_integrate(Physical *physical,
|
|||||||
// LMatrix4f force_to_object_xform;
|
// LMatrix4f force_to_object_xform;
|
||||||
|
|
||||||
ForceNode *force_node;
|
ForceNode *force_node;
|
||||||
pvector< PT(LinearForce) >::const_iterator f_cur;
|
LinearForceVector::const_iterator f_cur;
|
||||||
|
|
||||||
// global forces
|
// global forces
|
||||||
f_cur = forces.begin();
|
f_cur = forces.begin();
|
||||||
|
@ -36,7 +36,7 @@ PUBLISHED:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
virtual void child_integrate(Physical *physical,
|
virtual void child_integrate(Physical *physical,
|
||||||
pvector< PT(LinearForce) >& forces,
|
LinearForceVector& forces,
|
||||||
float dt);
|
float dt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ LinearIntegrator::
|
|||||||
// virtual.
|
// virtual.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
void LinearIntegrator::
|
void LinearIntegrator::
|
||||||
integrate(Physical *physical, pvector< PT(LinearForce) > &forces,
|
integrate(Physical *physical, LinearForceVector &forces,
|
||||||
float dt) {
|
float dt) {
|
||||||
/* <-- darren, 2000.10.06
|
/* <-- darren, 2000.10.06
|
||||||
// cap dt so physics don't go flying off on lags
|
// cap dt so physics don't go flying off on lags
|
||||||
@ -54,7 +54,7 @@ integrate(Physical *physical, pvector< PT(LinearForce) > &forces,
|
|||||||
dt = _max_linear_dt;
|
dt = _max_linear_dt;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pvector< PT(PhysicsObject) >::const_iterator current_object_iter;
|
PhysicsObject::Vector::const_iterator current_object_iter;
|
||||||
current_object_iter = physical->get_object_vector().begin();
|
current_object_iter = physical->get_object_vector().begin();
|
||||||
for (; current_object_iter != physical->get_object_vector().end();
|
for (; current_object_iter != physical->get_object_vector().end();
|
||||||
current_object_iter++) {
|
current_object_iter++) {
|
||||||
|
@ -33,7 +33,7 @@ class EXPCL_PANDAPHYSICS LinearIntegrator : public BaseIntegrator {
|
|||||||
public:
|
public:
|
||||||
virtual ~LinearIntegrator();
|
virtual ~LinearIntegrator();
|
||||||
|
|
||||||
void integrate(Physical *physical, pvector< PT(LinearForce) > &forces,
|
void integrate(Physical *physical, LinearForceVector &forces,
|
||||||
float dt);
|
float dt);
|
||||||
|
|
||||||
virtual void output(ostream &out) const;
|
virtual void output(ostream &out) const;
|
||||||
@ -48,7 +48,7 @@ private:
|
|||||||
// this allows baseLinearIntegrator to censor/modify data that the
|
// this allows baseLinearIntegrator to censor/modify data that the
|
||||||
// actual integration function receives.
|
// actual integration function receives.
|
||||||
virtual void child_integrate(Physical *physical,
|
virtual void child_integrate(Physical *physical,
|
||||||
pvector< PT(LinearForce) > &forces,
|
LinearForceVector &forces,
|
||||||
float dt) = 0;
|
float dt) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ add_angular_force(AngularForce *f) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void Physical::
|
INLINE void Physical::
|
||||||
remove_linear_force(LinearForce *f) {
|
remove_linear_force(LinearForce *f) {
|
||||||
pvector< PT(LinearForce) >::iterator found;
|
LinearForceVector::iterator found;
|
||||||
|
|
||||||
// this is a PT because the templates don't like what should be
|
// this is a PT because the templates don't like what should be
|
||||||
// perfectly allowable, which is to search for bf directly.
|
// perfectly allowable, which is to search for bf directly.
|
||||||
@ -98,7 +98,7 @@ remove_linear_force(LinearForce *f) {
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE void Physical::
|
INLINE void Physical::
|
||||||
remove_angular_force(AngularForce *f) {
|
remove_angular_force(AngularForce *f) {
|
||||||
pvector< PT(AngularForce) >::iterator found;
|
AngularForceVector::iterator found;
|
||||||
|
|
||||||
PT(AngularForce) pt_af = f;
|
PT(AngularForce) pt_af = f;
|
||||||
found = find(_angular_forces.begin(), _angular_forces.end(), pt_af);
|
found = find(_angular_forces.begin(), _angular_forces.end(), pt_af);
|
||||||
@ -150,7 +150,7 @@ get_physical_node() const {
|
|||||||
// Function : get_object_vector
|
// Function : get_object_vector
|
||||||
// Access : Public
|
// Access : Public
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE const pvector< PT(PhysicsObject) > &Physical::
|
INLINE const PhysicsObject::Vector &Physical::
|
||||||
get_object_vector() const {
|
get_object_vector() const {
|
||||||
return _physics_objects;
|
return _physics_objects;
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ get_object_vector() const {
|
|||||||
// Function : get_linear_forces
|
// Function : get_linear_forces
|
||||||
// Access : Public
|
// Access : Public
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE const pvector< PT(LinearForce) > &Physical::
|
INLINE const Physical::LinearForceVector &Physical::
|
||||||
get_linear_forces() const {
|
get_linear_forces() const {
|
||||||
return _linear_forces;
|
return _linear_forces;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ get_linear_forces() const {
|
|||||||
// Function : get_angular_forces
|
// Function : get_angular_forces
|
||||||
// Access : Public
|
// Access : Public
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE const pvector< PT(AngularForce) > &Physical::
|
INLINE const Physical::AngularForceVector &Physical::
|
||||||
get_angular_forces() const {
|
get_angular_forces() const {
|
||||||
return _angular_forces;
|
return _angular_forces;
|
||||||
}
|
}
|
||||||
|
@ -74,23 +74,23 @@ Physical(const Physical& copy) {
|
|||||||
_physics_manager = (PhysicsManager *) NULL;
|
_physics_manager = (PhysicsManager *) NULL;
|
||||||
|
|
||||||
// copy the forces.
|
// copy the forces.
|
||||||
pvector< PT(LinearForce) >::const_iterator lf_cur;
|
LinearForceVector::const_iterator lf_cur;
|
||||||
pvector< PT(LinearForce) >::const_iterator lf_end = copy._linear_forces.end();
|
LinearForceVector::const_iterator lf_end = copy._linear_forces.end();
|
||||||
|
|
||||||
for (lf_cur = copy._linear_forces.begin(); lf_cur != lf_end; lf_cur++) {
|
for (lf_cur = copy._linear_forces.begin(); lf_cur != lf_end; lf_cur++) {
|
||||||
_linear_forces.push_back((*lf_cur)->make_copy());
|
_linear_forces.push_back((*lf_cur)->make_copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
pvector< PT(AngularForce) >::const_iterator af_cur;
|
AngularForceVector::const_iterator af_cur;
|
||||||
pvector< PT(AngularForce) >::const_iterator af_end = copy._angular_forces.end();
|
AngularForceVector::const_iterator af_end = copy._angular_forces.end();
|
||||||
|
|
||||||
for (af_cur = copy._angular_forces.begin(); af_cur != af_end; af_cur++) {
|
for (af_cur = copy._angular_forces.begin(); af_cur != af_end; af_cur++) {
|
||||||
_angular_forces.push_back((*af_cur)->make_copy());
|
_angular_forces.push_back((*af_cur)->make_copy());
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the physics objects
|
// copy the physics objects
|
||||||
pvector< PT(PhysicsObject) >::const_iterator p_cur;
|
PhysicsObject::Vector::const_iterator p_cur;
|
||||||
pvector< PT(PhysicsObject) >::const_iterator p_end = copy._physics_objects.end();
|
PhysicsObject::Vector::const_iterator p_end = copy._physics_objects.end();
|
||||||
|
|
||||||
for (p_cur = copy._physics_objects.begin(); p_cur != p_end; p_cur++) {
|
for (p_cur = copy._physics_objects.begin(); p_cur != p_end; p_cur++) {
|
||||||
// oooh so polymorphic.
|
// oooh so polymorphic.
|
||||||
@ -144,7 +144,7 @@ write_physics_objects(ostream &out, unsigned int indent) const {
|
|||||||
#ifndef NDEBUG //[
|
#ifndef NDEBUG //[
|
||||||
out.width(indent);
|
out.width(indent);
|
||||||
out<<""<<"_physics_objects ("<<_physics_objects.size()<<" objects)\n";
|
out<<""<<"_physics_objects ("<<_physics_objects.size()<<" objects)\n";
|
||||||
for (PhysicsObjectVector::const_iterator i=_physics_objects.begin();
|
for (PhysicsObject::Vector::const_iterator i=_physics_objects.begin();
|
||||||
i != _physics_objects.end();
|
i != _physics_objects.end();
|
||||||
++i) {
|
++i) {
|
||||||
(*i)->write(out, indent+2);
|
(*i)->write(out, indent+2);
|
||||||
|
@ -40,6 +40,11 @@ class PhysicsManager;
|
|||||||
// it from this.
|
// it from this.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_PANDAPHYSICS Physical : public TypedReferenceCount {
|
class EXPCL_PANDAPHYSICS Physical : public TypedReferenceCount {
|
||||||
|
public:
|
||||||
|
//typedef pvector<PT(PhysicsObject)> PhysicsObjectVector;
|
||||||
|
typedef pvector<PT(LinearForce)> LinearForceVector;
|
||||||
|
typedef pvector<PT(AngularForce)> AngularForceVector;
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
Physical(int total_objects = 1, bool pre_alloc = false);
|
Physical(int total_objects = 1, bool pre_alloc = false);
|
||||||
Physical(const Physical& copy);
|
Physical(const Physical& copy);
|
||||||
@ -75,11 +80,7 @@ PUBLISHED:
|
|||||||
virtual void write(ostream &out, unsigned int indent=0) const;
|
virtual void write(ostream &out, unsigned int indent=0) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef pvector< PT(PhysicsObject) > PhysicsObjectVector;
|
INLINE const PhysicsObject::Vector &get_object_vector() const;
|
||||||
typedef pvector< PT(LinearForce) > LinearForceVector;
|
|
||||||
typedef pvector< PT(AngularForce) > AngularForceVector;
|
|
||||||
|
|
||||||
INLINE const PhysicsObjectVector &get_object_vector() const;
|
|
||||||
INLINE const LinearForceVector &get_linear_forces() const;
|
INLINE const LinearForceVector &get_linear_forces() const;
|
||||||
INLINE const AngularForceVector &get_angular_forces() const;
|
INLINE const AngularForceVector &get_angular_forces() const;
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
float _viscosity;
|
float _viscosity;
|
||||||
// containers
|
// containers
|
||||||
PhysicsObjectVector _physics_objects;
|
PhysicsObject::Vector _physics_objects;
|
||||||
LinearForceVector _linear_forces;
|
LinearForceVector _linear_forces;
|
||||||
AngularForceVector _angular_forces;
|
AngularForceVector _angular_forces;
|
||||||
|
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
// NOT derive from this. Derive from Physical instead.
|
// NOT derive from this. Derive from Physical instead.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
class EXPCL_PANDAPHYSICS PhysicsObject : public TypedReferenceCount {
|
class EXPCL_PANDAPHYSICS PhysicsObject : public TypedReferenceCount {
|
||||||
|
public:
|
||||||
|
typedef pvector<PT(PhysicsObject)> Vector;
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
PhysicsObject();
|
PhysicsObject();
|
||||||
PhysicsObject(const PhysicsObject ©);
|
PhysicsObject(const PhysicsObject ©);
|
||||||
|
@ -58,7 +58,7 @@ int main(int, char **) {
|
|||||||
b.add_linear_force(new LinearJitterForce(0.1f));
|
b.add_linear_force(new LinearJitterForce(0.1f));
|
||||||
|
|
||||||
int i=0;
|
int i=0;
|
||||||
for (Physical::PhysicsObjectVector::const_iterator co=b.get_object_vector().begin();
|
for (PhysicsObject::Vector::const_iterator co=b.get_object_vector().begin();
|
||||||
co != b.get_object_vector().end();
|
co != b.get_object_vector().end();
|
||||||
++i, ++co) {
|
++i, ++co) {
|
||||||
(*co)->set_position(i * 2.0f, float(i), 0.0f);
|
(*co)->set_position(i * 2.0f, float(i), 0.0f);
|
||||||
@ -71,7 +71,7 @@ int main(int, char **) {
|
|||||||
physics_manager.add_linear_force(new LinearVectorForce(0.0f, 0.0f, -9.8f, 1.0f, false));
|
physics_manager.add_linear_force(new LinearVectorForce(0.0f, 0.0f, -9.8f, 1.0f, false));
|
||||||
|
|
||||||
cout << "Object vector:" << endl;
|
cout << "Object vector:" << endl;
|
||||||
for (Physical::PhysicsObjectVector::const_iterator co=b.get_object_vector().begin();
|
for (PhysicsObject::Vector::const_iterator co=b.get_object_vector().begin();
|
||||||
co != b.get_object_vector().end();
|
co != b.get_object_vector().end();
|
||||||
++co) {
|
++co) {
|
||||||
cout << "vel: " << (*co)->get_velocity() << " ";
|
cout << "vel: " << (*co)->get_velocity() << " ";
|
||||||
@ -81,7 +81,7 @@ int main(int, char **) {
|
|||||||
physics_manager.do_physics(1.0f);
|
physics_manager.do_physics(1.0f);
|
||||||
cout << "Physics have been applied." << endl;
|
cout << "Physics have been applied." << endl;
|
||||||
|
|
||||||
for (Physical::PhysicsObjectVector::const_iterator co=b.get_object_vector().begin();
|
for (PhysicsObject::Vector::const_iterator co=b.get_object_vector().begin();
|
||||||
co != b.get_object_vector().end();
|
co != b.get_object_vector().end();
|
||||||
++co) {
|
++co) {
|
||||||
cout << "vel: " << (*co)->get_velocity() << " ";
|
cout << "vel: " << (*co)->get_velocity() << " ";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user