mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
more perfstats for ragdoll simulation
This commit is contained in:
parent
67b9c185eb
commit
81ba686fdf
1 changed files with 10 additions and 4 deletions
|
@ -14,6 +14,7 @@
|
||||||
|
|
||||||
#include "PhysicsSimulation.h"
|
#include "PhysicsSimulation.h"
|
||||||
|
|
||||||
|
#include "PerfStat.h"
|
||||||
#include "PhysicsEntity.h"
|
#include "PhysicsEntity.h"
|
||||||
#include "Ragdoll.h"
|
#include "Ragdoll.h"
|
||||||
#include "SharedUtil.h"
|
#include "SharedUtil.h"
|
||||||
|
@ -142,10 +143,12 @@ void PhysicsSimulation::stepForward(float deltaTime, float minError, int maxIter
|
||||||
computeCollisions();
|
computeCollisions();
|
||||||
processCollisions();
|
processCollisions();
|
||||||
|
|
||||||
// enforce constraints
|
{ // enforce constraints
|
||||||
error = 0.0f;
|
PerformanceTimer perfTimer("4-enforce");
|
||||||
for (int i = 0; i < numDolls; ++i) {
|
error = 0.0f;
|
||||||
error = glm::max(error, _dolls[i]->enforceRagdollConstraints());
|
for (int i = 0; i < numDolls; ++i) {
|
||||||
|
error = glm::max(error, _dolls[i]->enforceRagdollConstraints());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
++iterations;
|
++iterations;
|
||||||
|
|
||||||
|
@ -166,6 +169,7 @@ void PhysicsSimulation::stepForward(float deltaTime, float minError, int maxIter
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSimulation::moveRagdolls(float deltaTime) {
|
void PhysicsSimulation::moveRagdolls(float deltaTime) {
|
||||||
|
PerformanceTimer perfTimer("1-integrate");
|
||||||
int numDolls = _dolls.size();
|
int numDolls = _dolls.size();
|
||||||
for (int i = 0; i < numDolls; ++i) {
|
for (int i = 0; i < numDolls; ++i) {
|
||||||
_dolls.at(i)->stepRagdollForward(deltaTime);
|
_dolls.at(i)->stepRagdollForward(deltaTime);
|
||||||
|
@ -173,6 +177,7 @@ void PhysicsSimulation::moveRagdolls(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSimulation::computeCollisions() {
|
void PhysicsSimulation::computeCollisions() {
|
||||||
|
PerformanceTimer perfTimer("2-collide");
|
||||||
_collisionList.clear();
|
_collisionList.clear();
|
||||||
// TODO: keep track of QSet<PhysicsEntity*> collidedEntities;
|
// TODO: keep track of QSet<PhysicsEntity*> collidedEntities;
|
||||||
int numEntities = _entities.size();
|
int numEntities = _entities.size();
|
||||||
|
@ -204,6 +209,7 @@ void PhysicsSimulation::computeCollisions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicsSimulation::processCollisions() {
|
void PhysicsSimulation::processCollisions() {
|
||||||
|
PerformanceTimer perfTimer("3-resolve");
|
||||||
// walk all collisions, accumulate movement on shapes, and build a list of affected shapes
|
// walk all collisions, accumulate movement on shapes, and build a list of affected shapes
|
||||||
QSet<Shape*> shapes;
|
QSet<Shape*> shapes;
|
||||||
int numCollisions = _collisionList.size();
|
int numCollisions = _collisionList.size();
|
||||||
|
|
Loading…
Reference in a new issue