mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Add texture fallback for body parts with white texture
For body part batches (group 0) that resolve to white/fallback texture, fall back to the first valid texture in the model. This handles humanoid NPCs where body parts use different texture slots that may not be set.
This commit is contained in:
parent
9de3f2d327
commit
4c77f7ee7b
1 changed files with 16 additions and 0 deletions
|
|
@ -1240,6 +1240,22 @@ void CharacterRenderer::render(const Camera& camera, const glm::mat4& view, cons
|
|||
}
|
||||
}
|
||||
|
||||
// For body parts with white/fallback texture, use first valid texture
|
||||
// This handles humanoid models where some body parts use different texture slots
|
||||
// that may not be set (e.g., baked NPC textures only set slot 0)
|
||||
if (texId == whiteTexture) {
|
||||
uint16_t group = batch.submeshId / 100;
|
||||
if (group == 0) {
|
||||
// Find first non-white texture in the model
|
||||
for (GLuint tid : gpuModel.textureIds) {
|
||||
if (tid != whiteTexture && tid != 0) {
|
||||
texId = tid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, texId);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue