namechange _frame --> _frameCount

This commit is contained in:
Andrew Meadows 2014-08-07 09:02:31 -07:00
parent cb8c0792b2
commit 27b876e84c
2 changed files with 6 additions and 6 deletions

View file

@ -24,7 +24,7 @@ int MAX_ENTITIES_PER_SIMULATION = 64;
int MAX_COLLISIONS_PER_SIMULATION = 256; int MAX_COLLISIONS_PER_SIMULATION = 256;
PhysicsSimulation::PhysicsSimulation() : _frame(0), _entity(NULL), _ragdoll(NULL), _collisions(MAX_COLLISIONS_PER_SIMULATION) { PhysicsSimulation::PhysicsSimulation() : _frameCount(0), _entity(NULL), _ragdoll(NULL), _collisions(MAX_COLLISIONS_PER_SIMULATION) {
} }
PhysicsSimulation::~PhysicsSimulation() { PhysicsSimulation::~PhysicsSimulation() {
@ -157,7 +157,7 @@ void PhysicsSimulation::removeRagdoll(Ragdoll* doll) {
} }
void PhysicsSimulation::stepForward(float deltaTime, float minError, int maxIterations, quint64 maxUsec) { void PhysicsSimulation::stepForward(float deltaTime, float minError, int maxIterations, quint64 maxUsec) {
++_frame; ++_frameCount;
if (!_ragdoll) { if (!_ragdoll) {
return; return;
} }
@ -288,9 +288,9 @@ void PhysicsSimulation::updateContacts() {
} }
QMap<quint64, ContactPoint>::iterator itr = _contacts.find(key); QMap<quint64, ContactPoint>::iterator itr = _contacts.find(key);
if (itr == _contacts.end()) { if (itr == _contacts.end()) {
_contacts.insert(key, ContactPoint(*collision, _frame)); _contacts.insert(key, ContactPoint(*collision, _frameCount));
} else { } else {
itr.value().updateContact(*collision, _frame); itr.value().updateContact(*collision, _frameCount);
} }
} }
} }
@ -300,7 +300,7 @@ const quint32 MAX_CONTACT_FRAME_LIFETIME = 2;
void PhysicsSimulation::pruneContacts() { void PhysicsSimulation::pruneContacts() {
QMap<quint64, ContactPoint>::iterator itr = _contacts.begin(); QMap<quint64, ContactPoint>::iterator itr = _contacts.begin();
while (itr != _contacts.end()) { while (itr != _contacts.end()) {
if (_frame - itr.value().getLastFrame() > MAX_CONTACT_FRAME_LIFETIME) { if (_frameCount - itr.value().getLastFrame() > MAX_CONTACT_FRAME_LIFETIME) {
itr = _contacts.erase(itr); itr = _contacts.erase(itr);
} else { } else {
++itr; ++itr;

View file

@ -59,7 +59,7 @@ protected:
void pruneContacts(); void pruneContacts();
private: private:
quint32 _frame; quint32 _frameCount;
PhysicsEntity* _entity; PhysicsEntity* _entity;
Ragdoll* _ragdoll; Ragdoll* _ragdoll;