mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
Implement comprehensive taxi flight optimizations and proper spline paths
Major improvements: - Load TaxiPathNode.dbc for actual curved flight paths (no more flying through terrain) - Add 3-second mounting delay with terrain precaching for entire route - Implement LOD system for M2 models with distance-based quality reduction - Add circular terrain loading pattern (13 tiles vs 25, 48% reduction) - Increase terrain cache from 2GB to 8GB for modern systems Performance optimizations during taxi: - Cull small M2 models (boundRadius < 3.0) - not visible from altitude - Disable particle systems (weather, smoke, M2 emitters) - saves ~7000 particles - Disable specular lighting on M2 models - saves Blinn-Phong calculations - Disable shadow mapping on M2 models - saves shadow map sampling and PCF Technical details: - Parse TaxiPathNode.dbc spline waypoints for curved paths around terrain - Build full path from node pairs using TaxiPathEdge lookup - Precache callback triggers during mounting delay for smooth takeoff - Circular tile loading uses Euclidean distance check (dx²+dy² <= r²) - LOD fallback to base mesh when higher LODs unavailable Result: Buttery smooth taxi flights with no terrain clipping or performance hitches
This commit is contained in:
parent
941dac446d
commit
536b3cea48
9 changed files with 249 additions and 32 deletions
|
|
@ -420,11 +420,11 @@ void Application::update(float deltaTime) {
|
|||
}
|
||||
if (renderer && renderer->getTerrainManager()) {
|
||||
renderer->getTerrainManager()->setStreamingEnabled(true);
|
||||
// With 2GB tile cache, keep streaming active during taxi at moderate rate.
|
||||
// With 8GB tile cache, keep streaming active during taxi at moderate rate.
|
||||
// Increase load radius to pre-cache tiles ahead of flight path.
|
||||
if (onTaxi) {
|
||||
renderer->getTerrainManager()->setUpdateInterval(0.3f);
|
||||
renderer->getTerrainManager()->setLoadRadius(4); // 9x9 grid for taxi
|
||||
renderer->getTerrainManager()->setLoadRadius(2); // 5x5 grid for taxi (each tile ~533 yards)
|
||||
} else {
|
||||
// Ramp streaming back in after taxi to avoid end-of-flight hitches.
|
||||
if (lastTaxiFlight_) {
|
||||
|
|
@ -689,6 +689,35 @@ void Application::setupUICallbacks() {
|
|||
pendingMountDisplayId_ = mountDisplayId;
|
||||
});
|
||||
|
||||
// Taxi precache callback - preload terrain tiles along flight path
|
||||
gameHandler->setTaxiPrecacheCallback([this](const std::vector<glm::vec3>& path) {
|
||||
if (!renderer || !renderer->getTerrainManager()) return;
|
||||
|
||||
std::set<std::pair<int, int>> uniqueTiles;
|
||||
|
||||
// Sample waypoints along path and gather tiles
|
||||
for (const auto& waypoint : path) {
|
||||
glm::vec3 renderPos = core::coords::canonicalToRender(waypoint);
|
||||
int tileX = static_cast<int>(32 - (renderPos.x / 533.33333f));
|
||||
int tileY = static_cast<int>(32 - (renderPos.y / 533.33333f));
|
||||
|
||||
// Load tile at waypoint + 1 radius around it (3x3 per waypoint)
|
||||
for (int dy = -1; dy <= 1; dy++) {
|
||||
for (int dx = -1; dx <= 1; dx++) {
|
||||
int tx = tileX + dx;
|
||||
int ty = tileY + dy;
|
||||
if (tx >= 0 && tx <= 63 && ty >= 0 && ty <= 63) {
|
||||
uniqueTiles.insert({tx, ty});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::pair<int, int>> tilesToLoad(uniqueTiles.begin(), uniqueTiles.end());
|
||||
LOG_INFO("Precaching ", tilesToLoad.size(), " tiles for taxi route");
|
||||
renderer->getTerrainManager()->precacheTiles(tilesToLoad);
|
||||
});
|
||||
|
||||
// Creature move callback (online mode) - update creature positions
|
||||
gameHandler->setCreatureMoveCallback([this](uint64_t guid, float x, float y, float z, uint32_t durationMs) {
|
||||
auto it = creatureInstances_.find(guid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue