mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
Optimize WMO rendering and collision performance
- Add texture-sorted batch merging with glMultiDrawElements to reduce draw calls - Pre-compute merged batches at load time instead of per-frame - Add persistent floor height cache with disk save/load (cache/wmo_floor_cache.bin) - Reduce collision focus radius and sweep steps for faster collision checks - Add floor cache size to performance HUD - Reduce WMO group distance culling to 80 units
This commit is contained in:
parent
44b03a06a0
commit
a96ea0758c
7 changed files with 229 additions and 40 deletions
|
|
@ -291,7 +291,7 @@ void CameraController::update(float deltaTime) {
|
|||
glm::vec3 swimFrom = *followTarget;
|
||||
glm::vec3 swimTo = targetPos;
|
||||
float swimMoveDist = glm::length(swimTo - swimFrom);
|
||||
int swimSteps = std::max(1, std::min(12, static_cast<int>(std::ceil(swimMoveDist / 0.22f))));
|
||||
int swimSteps = std::max(1, std::min(4, static_cast<int>(std::ceil(swimMoveDist / 0.5f))));
|
||||
glm::vec3 stepPos = swimFrom;
|
||||
glm::vec3 stepDelta = (swimTo - swimFrom) / static_cast<float>(swimSteps);
|
||||
|
||||
|
|
@ -357,9 +357,9 @@ void CameraController::update(float deltaTime) {
|
|||
glm::vec3 desiredPos = targetPos;
|
||||
float moveDist = glm::length(desiredPos - startPos);
|
||||
// Adaptive CCD: keep per-step movement short, especially on low FPS spikes.
|
||||
int sweepSteps = std::max(1, std::min(14, static_cast<int>(std::ceil(moveDist / 0.24f))));
|
||||
int sweepSteps = std::max(1, std::min(4, static_cast<int>(std::ceil(moveDist / 0.5f))));
|
||||
if (deltaTime > 0.04f) {
|
||||
sweepSteps = std::min(16, std::max(sweepSteps, static_cast<int>(std::ceil(deltaTime / 0.016f)) * 2));
|
||||
sweepSteps = std::min(6, std::max(sweepSteps, static_cast<int>(std::ceil(deltaTime / 0.016f))));
|
||||
}
|
||||
glm::vec3 stepPos = startPos;
|
||||
glm::vec3 stepDelta = (desiredPos - startPos) / static_cast<float>(sweepSteps);
|
||||
|
|
@ -779,9 +779,9 @@ void CameraController::update(float deltaTime) {
|
|||
glm::vec3 startFeet = camera->getPosition() - glm::vec3(0, 0, eyeHeight);
|
||||
glm::vec3 desiredFeet = newPos - glm::vec3(0, 0, eyeHeight);
|
||||
float moveDist = glm::length(desiredFeet - startFeet);
|
||||
int sweepSteps = std::max(1, std::min(14, static_cast<int>(std::ceil(moveDist / 0.24f))));
|
||||
int sweepSteps = std::max(1, std::min(4, static_cast<int>(std::ceil(moveDist / 0.5f))));
|
||||
if (deltaTime > 0.04f) {
|
||||
sweepSteps = std::min(16, std::max(sweepSteps, static_cast<int>(std::ceil(deltaTime / 0.016f)) * 2));
|
||||
sweepSteps = std::min(6, std::max(sweepSteps, static_cast<int>(std::ceil(deltaTime / 0.016f))));
|
||||
}
|
||||
glm::vec3 stepPos = startFeet;
|
||||
glm::vec3 stepDelta = (desiredFeet - startFeet) / static_cast<float>(sweepSteps);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue