Fix NPC body parts by applying baked texture to all skin slots

Baked NPC textures must be applied to all skin-related texture slots
(type 1 char skin, type 2 object skin, type 6 hair) since body parts
use different texture slots. Removed separate hair texture lookup as
baked textures already include the complete NPC appearance.
This commit is contained in:
Kelsi 2026-02-05 23:48:06 -08:00
parent ec937bc6d3
commit 9de3f2d327
2 changed files with 19 additions and 52 deletions

View file

@ -1217,10 +1217,21 @@ void CharacterRenderer::render(const Camera& camera, const glm::mat4& view, cons
// Draw batches (submeshes) with per-batch textures
// Geoset filtering: Group = submeshId / 100, Variation = submeshId % 100
// Group 0 (body parts): render if texture is valid (skip duplicates with white/fallback texture)
// Group 0 (body parts): always render all (different body parts, not variations)
// Other groups: render only if exact submeshId is in activeGeosets
for (const auto& batch : gpuModel.data.batches) {
// Resolve texture for this batch first (needed for body part filtering)
if (!instance.activeGeosets.empty()) {
uint16_t group = batch.submeshId / 100;
if (group != 0) {
// Non-body groups: require exact match in activeGeosets
if (instance.activeGeosets.find(batch.submeshId) == instance.activeGeosets.end()) {
continue;
}
}
// Group 0 (body): always render
}
// Resolve texture for this batch
GLuint texId = whiteTexture;
if (batch.textureIndex < gpuModel.data.textureLookup.size()) {
uint16_t lookupIdx = gpuModel.data.textureLookup[batch.textureIndex];
@ -1229,21 +1240,6 @@ void CharacterRenderer::render(const Camera& camera, const glm::mat4& view, cons
}
}
if (!instance.activeGeosets.empty()) {
uint16_t group = batch.submeshId / 100;
if (group == 0) {
// Body parts: skip if texture is white/fallback (duplicate mesh for compositing)
if (texId == whiteTexture) {
continue;
}
} else {
// Non-body groups: require exact match in activeGeosets
if (instance.activeGeosets.find(batch.submeshId) == instance.activeGeosets.end()) {
continue;
}
}
}
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texId);