mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-08-14 03:55:53 +08:00
Merge pull request #193 from Selmar/emissiveFactor_defaults
Emissive factor defaults
This commit is contained in:
commit
8b56c016ab
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 = {0.0, 0.0, 0.0};
|
||||
}
|
||||
|
||||
ParseStringProperty(&material->alphaMode, err, o, "alphaMode",
|
||||
/* required */ false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user