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:
Kelsi 2026-03-27 16:47:30 -07:00
parent b0466e9029
commit d26eed1e7c
9 changed files with 153 additions and 104 deletions

View file

@ -4540,6 +4540,8 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
char castLabel[72];
if (!castName.empty())
snprintf(castLabel, sizeof(castLabel), "%s (%.1fs)", castName.c_str(), castLeft);
else if (tspell != 0)
snprintf(castLabel, sizeof(castLabel), "Spell #%u (%.1fs)", tspell, castLeft);
else
snprintf(castLabel, sizeof(castLabel), "Casting... (%.1fs)", castLeft);
{
@ -4709,8 +4711,12 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
ImGui::PopStyleColor();
} else {
ImGui::PushStyleColor(ImGuiCol_Button, auraBorderColor);
char label[8];
snprintf(label, sizeof(label), "%u", aura.spellId);
const std::string& tAuraName = gameHandler.getSpellName(aura.spellId);
char label[32];
if (!tAuraName.empty())
snprintf(label, sizeof(label), "%.6s", tAuraName.c_str());
else
snprintf(label, sizeof(label), "%u", aura.spellId);
ImGui::Button(label, ImVec2(ICON_SIZE, ICON_SIZE));
ImGui::PopStyleColor();
}
@ -15449,8 +15455,12 @@ void GameScreen::renderBuffBar(game::GameHandler& gameHandler) {
ImGui::PopStyleColor();
} else {
ImGui::PushStyleColor(ImGuiCol_Button, borderColor);
char label[8];
snprintf(label, sizeof(label), "%u", aura.spellId);
const std::string& pAuraName = gameHandler.getSpellName(aura.spellId);
char label[32];
if (!pAuraName.empty())
snprintf(label, sizeof(label), "%.6s", pAuraName.c_str());
else
snprintf(label, sizeof(label), "%u", aura.spellId);
ImGui::Button(label, ImVec2(ICON_SIZE, ICON_SIZE));
ImGui::PopStyleColor();
}
@ -24142,7 +24152,13 @@ void GameScreen::renderWhoWindow(game::GameHandler& gameHandler) {
ImGui::TableSetColumnIndex(4);
if (e.zoneId != 0) {
std::string zoneName = gameHandler.getWhoAreaName(e.zoneId);
ImGui::TextUnformatted(zoneName.empty() ? "Unknown" : zoneName.c_str());
if (!zoneName.empty())
ImGui::TextUnformatted(zoneName.c_str());
else {
char zfb[32];
snprintf(zfb, sizeof(zfb), "Zone #%u", e.zoneId);
ImGui::TextUnformatted(zfb);
}
}
ImGui::PopID();