mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix lamp posts rendering as glass by using texture name for window detection
Instead of relying on material flag 0x40 (F_CLAMP_S, not F_WINDOW) to identify glass materials, detect windows by checking for "window" in the texture path. This correctly applies glass to window textures while leaving lamp posts and other geometry opaque.
This commit is contained in:
parent
a7cf0d0c4e
commit
4511de8d38
2 changed files with 17 additions and 2 deletions
|
|
@ -427,6 +427,11 @@ bool WMORenderer::loadModel(const pipeline::WMOModel& model, uint32_t id) {
|
|||
core::Logger::getInstance().debug(" Loading texture ", i, ": ", texPath);
|
||||
VkTexture* tex = loadTexture(texPath);
|
||||
modelData.textures.push_back(tex);
|
||||
// Store lowercase texture name for material detection
|
||||
std::string lowerPath = texPath;
|
||||
std::transform(lowerPath.begin(), lowerPath.end(), lowerPath.begin(),
|
||||
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||
modelData.textureNames.push_back(lowerPath);
|
||||
}
|
||||
core::Logger::getInstance().debug(" Loaded ", modelData.textures.size(), " textures for WMO");
|
||||
}
|
||||
|
|
@ -588,8 +593,17 @@ bool WMORenderer::loadModel(const pipeline::WMOModel& model, uint32_t id) {
|
|||
unlit = (matFlags & 0x01) != 0;
|
||||
}
|
||||
|
||||
// F_WINDOW = 0x40, renders as transparent glass.
|
||||
bool isWindow = (matFlags & 0x40) != 0;
|
||||
// Detect window/glass materials by texture name.
|
||||
// Flag 0x10 (F_SIDN) marks night-glow materials (windows AND lamps),
|
||||
// so we additionally check for "window" in the texture path to
|
||||
// distinguish actual glass from lamp post geometry.
|
||||
bool isWindow = false;
|
||||
if (batch.materialId < modelData.materialTextureIndices.size()) {
|
||||
uint32_t ti = modelData.materialTextureIndices[batch.materialId];
|
||||
if (ti < modelData.textureNames.size()) {
|
||||
isWindow = (modelData.textureNames[ti].find("window") != std::string::npos);
|
||||
}
|
||||
}
|
||||
|
||||
BatchKey key{ reinterpret_cast<uintptr_t>(tex), alphaTest, unlit, isWindow };
|
||||
auto& mb = batchMap[key];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue