fix(rendering): emote animations, WMO portal culling, transport teleport

Emote animations: fix DBC chain for /laugh, /flirt, /sleep, /fart, /stink.
Previously all emotes with AnimID=0 used emoteRef as animId (wrong DBC
record IDs). Now resolves through Emotes.dbc properly, with per-emote
overrides for emotes whose DBC chain yields 0. Adds Emotes.dbc load
failure warning and diagnostic logging.

WMO culling: skip portal culling when camera is outside all groups (fixes
vanishing Stormwind ground tiles). Also handle indoor/outdoor AABB overlap
by showing all groups when position is in both indoor and outdoor AABBs.

Transport: clear ONTRANSPORT flag and transport state when transport not
found, preventing stale transport data from teleporting player to map
origin. Add area trigger safety net near (0,0,0) on Eastern Kingdoms.
This commit is contained in:
Kelsi 2026-04-05 17:25:25 -07:00
parent fe29ccad3f
commit aff545edef
5 changed files with 101 additions and 10 deletions

View file

@ -1418,6 +1418,17 @@ void WMORenderer::render(VkCommandBuffer cmd, VkDescriptorSet perFrameSet, const
// Portal-based visibility — reuse member scratch buffers (avoid per-frame alloc)
portalVisibleGroups_.clear();
bool usePortalCulling = doPortalCull && !model.portals.empty() && !model.portalRefs.empty();
if (usePortalCulling) {
// If the actual camera is outside all groups, skip portal culling.
// The character position (portalViewerPos) may fall inside a group's
// loose AABB while visually outside the WMO, causing the BFS to start
// from an interior group whose portals aren't in the frustum — hiding
// the entire WMO.
glm::vec3 localRealCam = glm::vec3(instance.invModelMatrix * glm::vec4(camPos, 1.0f));
if (findContainingGroup(model, localRealCam) < 0) {
usePortalCulling = false;
}
}
if (usePortalCulling) {
portalVisibleGroupSet_.clear();
glm::vec4 localCamPos = instance.invModelMatrix * glm::vec4(portalViewerPos, 1.0f);
@ -2135,6 +2146,23 @@ void WMORenderer::getVisibleGroupsViaPortals(const ModelData& model,
}
return;
}
// Best-fit group is indoor-only, but the position might also be inside an
// outdoor group's AABB (e.g., standing on a street near a building whose
// indoor AABB extends outward). If any outdoor group also contains the
// position, treat this as an outdoor location and show all groups.
for (size_t gi = 0; gi < model.groups.size(); gi++) {
if (static_cast<int>(gi) == cameraGroup) continue;
const auto& g = model.groups[gi];
if (!(g.groupFlags & WMO_GROUP_FLAG_OUTDOOR)) continue;
if (cameraLocalPos.x >= g.boundingBoxMin.x && cameraLocalPos.x <= g.boundingBoxMax.x &&
cameraLocalPos.y >= g.boundingBoxMin.y && cameraLocalPos.y <= g.boundingBoxMax.y &&
cameraLocalPos.z >= g.boundingBoxMin.z && cameraLocalPos.z <= g.boundingBoxMax.z) {
for (size_t gj = 0; gj < model.groups.size(); gj++) {
outVisibleGroups.insert(static_cast<uint32_t>(gj));
}
return;
}
}
}
// If the camera group has no portal refs, it's a dead-end group (utility/transition group).