Skip to content

Commit

Permalink
gltfio: do not set clear coat in GLTFIO_LITE config.
Browse files Browse the repository at this point in the history
This avoids an assertion in debug builds. We will document this behavior
much more thoroughly in a subsequent PR.

Fixes #4143.
  • Loading branch information
prideout committed Jun 17, 2021
1 parent 2e9080a commit 17da2dc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion libs/gltfio/src/UbershaderLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,12 @@ MaterialInstance* UbershaderLoader::createMaterialInstance(MaterialKey* config,
mi->setDoubleSided(config->doubleSided);
mi->setCullingMode(config->doubleSided ? CullingMode::NONE : CullingMode::BACK);

#if !GLTFIO_LITE

// Initially, assume that the clear coat texture can be honored. This is changed to false when
// running into a sampler count limitation. TODO: check if these constraints can now be relaxed.
bool clearCoatNeedsTexture = true;

#if !GLTFIO_LITE
mat3f identity;
mi->setParameter("baseColorUvMatrix", identity);
mi->setParameter("metallicRoughnessUvMatrix", identity);
Expand Down Expand Up @@ -229,6 +232,14 @@ MaterialInstance* UbershaderLoader::createMaterialInstance(MaterialKey* config,
getUvIndex(config->transmissionUV, config->hasTransmissionTexture));
}
}
#else

// In the GLTFIO_LITE configuration we do not support UV matrices, clear coat, sheen, specular
// glossiness, or transmission. For more details, see `gltflite.mat.in`. To configure a custom
// set of features, create your own MaterialProvider class, perhaps using UbershaderLoader as a
// starting point.
const bool clearCoatNeedsTexture = false;

#endif

TextureSampler sampler;
Expand Down

0 comments on commit 17da2dc

Please sign in to comment.