wmo: apply MOHD ambient color to interior group lighting

Read the ambient color from the MOHD chunk (BGRA uint32) and store it
on WMOModel as a normalized RGB vec3.  Pass it through ModelData into
the per-batch WMOMaterialUBO (replacing the unused pad[3] bytes, keeping
the struct at 64 bytes).  The GLSL interior branch now floors vertex
colors against the WMO ambient instead of a hardcoded 0.5, so dungeon
interiors respect the artist-specified ambient tint from the WMO root
rather than always clamping to grey.
This commit is contained in:
Kelsi 2026-03-09 21:27:01 -07:00
parent 8561d5c58c
commit 4d1be18c18
6 changed files with 24 additions and 3 deletions

View file

@ -109,7 +109,11 @@ WMOModel WMOLoader::load(const std::vector<uint8_t>& wmoData) {
model.nDoodadDefs = read<uint32_t>(wmoData, offset);
model.nDoodadSets = read<uint32_t>(wmoData, offset);
[[maybe_unused]] uint32_t ambColor = read<uint32_t>(wmoData, offset); // Ambient color (BGRA)
uint32_t ambColor = read<uint32_t>(wmoData, offset); // Ambient color (BGRA)
// Unpack BGRA bytes to normalized [0,1] RGB
model.ambientColor.r = ((ambColor >> 16) & 0xFF) / 255.0f;
model.ambientColor.g = ((ambColor >> 8) & 0xFF) / 255.0f;
model.ambientColor.b = ((ambColor >> 0) & 0xFF) / 255.0f;
[[maybe_unused]] uint32_t wmoID = read<uint32_t>(wmoData, offset);
model.boundingBoxMin.x = read<float>(wmoData, offset);