Fix previous fix.
This commit is contained in:
parent
d2f7d0e270
commit
46f6234af5
|
@ -266,13 +266,17 @@ ModelData* Raw2Gltf(
|
||||||
bool hasMetallicMap = material.textures[RAW_TEXTURE_USAGE_METALLIC] >= 0;
|
bool hasMetallicMap = material.textures[RAW_TEXTURE_USAGE_METALLIC] >= 0;
|
||||||
bool hasRoughnessMap = material.textures[RAW_TEXTURE_USAGE_ROUGHNESS] >= 0;
|
bool hasRoughnessMap = material.textures[RAW_TEXTURE_USAGE_ROUGHNESS] >= 0;
|
||||||
bool hasOcclusionMap = material.textures[RAW_TEXTURE_USAGE_OCCLUSION] >= 0;
|
bool hasOcclusionMap = material.textures[RAW_TEXTURE_USAGE_OCCLUSION] >= 0;
|
||||||
aoMetRoughTex = hasMetallicMap
|
bool atLeastTwoMaps = hasMetallicMap ? (hasRoughnessMap || hasOcclusionMap)
|
||||||
? simpleTex(RAW_TEXTURE_USAGE_METALLIC)
|
: (hasRoughnessMap && hasMetallicMap);
|
||||||
: (hasRoughnessMap
|
if (!atLeastTwoMaps) {
|
||||||
? simpleTex(RAW_TEXTURE_USAGE_ROUGHNESS)
|
// this handles the case of 0 or 1 maps supplied
|
||||||
: (hasOcclusionMap ? simpleTex(RAW_TEXTURE_USAGE_OCCLUSION) : nullptr));
|
aoMetRoughTex = hasMetallicMap
|
||||||
if (aoMetRoughTex == nullptr) {
|
? simpleTex(RAW_TEXTURE_USAGE_METALLIC)
|
||||||
// merge occlusion into the red channel, metallic into blue channel, and
|
: (hasRoughnessMap
|
||||||
|
? simpleTex(RAW_TEXTURE_USAGE_ROUGHNESS)
|
||||||
|
: (hasOcclusionMap ? simpleTex(RAW_TEXTURE_USAGE_OCCLUSION) : nullptr));
|
||||||
|
} else {
|
||||||
|
// otherwise merge occlusion into the red channel, metallic into blue channel, and
|
||||||
// roughness into the green, of a new combinatory texture
|
// roughness into the green, of a new combinatory texture
|
||||||
aoMetRoughTex = textureBuilder.combine(
|
aoMetRoughTex = textureBuilder.combine(
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue