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

@ -414,6 +414,7 @@ bool WMORenderer::loadModel(const pipeline::WMOModel& model, uint32_t id) {
modelData.id = id;
modelData.boundingBoxMin = model.boundingBoxMin;
modelData.boundingBoxMax = model.boundingBoxMax;
modelData.wmoAmbientColor = model.ambientColor;
{
glm::vec3 ext = model.boundingBoxMax - model.boundingBoxMin;
float horiz = std::max(ext.x, ext.y);
@ -681,6 +682,9 @@ bool WMORenderer::loadModel(const pipeline::WMOModel& model, uint32_t id) {
matData.heightMapVariance = mb.heightMapVariance;
matData.normalMapStrength = normalMapStrength_;
matData.isLava = mb.isLava ? 1 : 0;
matData.wmoAmbientR = modelData.wmoAmbientColor.r;
matData.wmoAmbientG = modelData.wmoAmbientColor.g;
matData.wmoAmbientB = modelData.wmoAmbientColor.b;
if (matBuf.info.pMappedData) {
memcpy(matBuf.info.pMappedData, &matData, sizeof(matData));
}