Fix gltf parser in case a material doesn't have 'pbrMetallicRoughness' field
This commit is contained in:
parent
ff7eb827fe
commit
156a58a59a
1 changed files with 29 additions and 25 deletions
|
|
@ -228,11 +228,14 @@ namespace psemek::gfx
|
|||
|
||||
target.name = material["name"].GetString();
|
||||
|
||||
target.two_sided = false;
|
||||
if (material.HasMember("doubleSided"))
|
||||
target.two_sided = material["doubleSided"].GetBool();
|
||||
else
|
||||
target.two_sided = false;
|
||||
|
||||
// Material can omit pbrMetallicRoughness entry if
|
||||
// all the values are defaulted
|
||||
if (material.HasMember("pbrMetallicRoughness"))
|
||||
{
|
||||
auto const & pbr = material["pbrMetallicRoughness"];
|
||||
|
||||
if (pbr.HasMember("baseColorFactor"))
|
||||
|
|
@ -262,6 +265,7 @@ namespace psemek::gfx
|
|||
{
|
||||
target.material_texture = document["textures"].GetArray()[pbr["metallicRoughnessTexture"]["index"].GetUint64()]["source"].GetInt64();
|
||||
}
|
||||
}
|
||||
|
||||
if (material.HasMember("emissiveFactor"))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue