mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-17 12:25:52 +08:00
[emissiveFactor] fix inconsistency with baseColorFactor where default values were set only for baseColorFactor and not emissiveFactor
This commit is contained in:
parent
2f044e77f1
commit
6df800d2b6
18
tiny_gltf.h
18
tiny_gltf.h
@ -3743,8 +3743,22 @@ static bool ParsePbrMetallicRoughness(PbrMetallicRoughness *pbr,
|
||||
static bool ParseMaterial(Material *material, std::string *err, const json &o) {
|
||||
ParseStringProperty(&material->name, err, o, "name", /* required */ false);
|
||||
|
||||
ParseNumberArrayProperty(&material->emissiveFactor, err, o, "emissiveFactor",
|
||||
/* required */ false);
|
||||
if(ParseNumberArrayProperty(&material->emissiveFactor, err, o, "emissiveFactor",
|
||||
/* required */ false)) {
|
||||
if (material->emissiveFactor.size() != 3) {
|
||||
if (err) {
|
||||
(*err) +=
|
||||
"Array length of `emissiveFactor` parameter in "
|
||||
"material must be 3, but got " +
|
||||
std::to_string(material->emissiveFactor.size()) + "\n";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// fill with default values
|
||||
material->emissiveFactor = {1.0, 1.0, 1.0};
|
||||
}
|
||||
|
||||
ParseStringProperty(&material->alphaMode, err, o, "alphaMode",
|
||||
/* required */ false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user