mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-26 21:13:51 +00:00
perf: constexpr reciprocals, cache redundant lookups, consolidate texture maps
- Hoist DBC field index lookups before loops in game_handler (7 DBC iteration loops) - Cache getSkybox()/getPosition() calls instead of redundant per-frame queries - Merge textureHasAlphaByPtr_ + textureColorKeyBlackByPtr_ into single map - Add constexpr for DEG_TO_RAD, reciprocal constants, physics delta - Add reserve() for WMO/M2 collision grid queries and portal BFS - Frustum plane normalize: inversesqrt instead of length+divide - M2 particle emission: inversesqrt for direction normalization - Parse creature display IDs from query response - UI: show spell names/IDs as fallback instead of "Unknown"
This commit is contained in:
parent
b0466e9029
commit
d26eed1e7c
9 changed files with 153 additions and 104 deletions
|
|
@ -5473,7 +5473,8 @@ void Renderer::renderWorld(game::World* world, game::GameHandler* gameHandler) {
|
|||
static const bool skipSky = (std::getenv("WOWEE_SKIP_SKY") != nullptr);
|
||||
|
||||
// Get time of day for sky-related rendering
|
||||
float timeOfDay = (skySystem && skySystem->getSkybox()) ? skySystem->getSkybox()->getTimeOfDay() : 12.0f;
|
||||
auto* skybox = skySystem ? skySystem->getSkybox() : nullptr;
|
||||
float timeOfDay = skybox ? skybox->getTimeOfDay() : 12.0f;
|
||||
|
||||
// ── Multithreaded secondary command buffer recording ──
|
||||
// Terrain, WMO, and M2 record on worker threads while main thread handles
|
||||
|
|
@ -6427,13 +6428,14 @@ void Renderer::renderReflectionPass() {
|
|||
bool canRenderScene = (vkCtx->getMsaaSamples() == VK_SAMPLE_COUNT_1_BIT);
|
||||
|
||||
// Find dominant water height near camera
|
||||
auto waterH = waterRenderer->getDominantWaterHeight(camera->getPosition());
|
||||
const glm::vec3 camPos = camera->getPosition();
|
||||
auto waterH = waterRenderer->getDominantWaterHeight(camPos);
|
||||
if (!waterH) return;
|
||||
|
||||
float waterHeight = *waterH;
|
||||
|
||||
// Skip reflection if camera is underwater (Z is up)
|
||||
if (camera->getPosition().z < waterHeight + 0.5f) return;
|
||||
if (camPos.z < waterHeight + 0.5f) return;
|
||||
|
||||
// Compute reflected view and oblique projection
|
||||
glm::mat4 reflView = WaterRenderer::computeReflectedView(*camera, waterHeight);
|
||||
|
|
@ -6448,7 +6450,7 @@ void Renderer::renderReflectionPass() {
|
|||
reflData.view = reflView;
|
||||
reflData.projection = reflProj;
|
||||
// Reflected camera position (Z is up)
|
||||
glm::vec3 reflPos = camera->getPosition();
|
||||
glm::vec3 reflPos = camPos;
|
||||
reflPos.z = 2.0f * waterHeight - reflPos.z;
|
||||
reflData.viewPos = glm::vec4(reflPos, 1.0f);
|
||||
std::memcpy(reflPerFrameUBOMapped, &reflData, sizeof(GPUPerFrameData));
|
||||
|
|
@ -6460,7 +6462,8 @@ void Renderer::renderReflectionPass() {
|
|||
// Render scene into reflection texture (sky + terrain + WMO only for perf)
|
||||
if (skySystem) {
|
||||
rendering::SkyParams skyParams;
|
||||
skyParams.timeOfDay = (skySystem->getSkybox()) ? skySystem->getSkybox()->getTimeOfDay() : 12.0f;
|
||||
auto* reflSkybox = skySystem->getSkybox();
|
||||
skyParams.timeOfDay = reflSkybox ? reflSkybox->getTimeOfDay() : 12.0f;
|
||||
if (lightingManager) {
|
||||
const auto& lp = lightingManager->getLightingParams();
|
||||
skyParams.directionalDir = lp.directionalDir;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue