chore: set gltf material default metallicness to 0

This commit is contained in:
Jan 2024-05-04 22:10:58 +02:00
parent 1a35152098
commit a0138c8abc
No known key found for this signature in database
GPG Key ID: 44B581F78FF5C57C
2 changed files with 9 additions and 2 deletions

View File

@ -206,9 +206,10 @@ namespace gltf
{
public:
std::optional<JsonTextureInfo> baseColorTexture;
std::optional<float> metallicFactor;
};
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonPbrMetallicRoughness, baseColorTexture);
NLOHMANN_DEFINE_TYPE_EXTENSION(JsonPbrMetallicRoughness, baseColorTexture, metallicFactor);
class JsonNormalTextureInfo
{

View File

@ -127,7 +127,13 @@ namespace
material.name = modelMaterial.name;
if (!modelMaterial.colorMapName.empty())
material.pbrMetallicRoughness.emplace().baseColorTexture.emplace().index = CreateTexture(gltf, modelMaterial.colorMapName);
{
material.pbrMetallicRoughness.emplace();
material.pbrMetallicRoughness->baseColorTexture.emplace();
material.pbrMetallicRoughness->baseColorTexture->index = CreateTexture(gltf, modelMaterial.colorMapName);
material.pbrMetallicRoughness->metallicFactor = 0.0f;
}
if (!modelMaterial.normalMapName.empty())
material.normalTexture.emplace().index = CreateTexture(gltf, modelMaterial.colorMapName);