Support booleans in glTF extras
This commit is contained in:
parent
c1c9e304da
commit
0718282dda
2 changed files with 5 additions and 3 deletions
|
|
@ -19,7 +19,7 @@ namespace psemek::gfx
|
|||
|
||||
struct gltf_asset
|
||||
{
|
||||
using extra = std::variant<float, std::vector<float>, std::string>;
|
||||
using extra = std::variant<bool, float, std::vector<float>, std::string>;
|
||||
using extras_map = util::hash_map<util::hstring, extra>;
|
||||
|
||||
struct node
|
||||
|
|
|
|||
|
|
@ -90,7 +90,9 @@ namespace psemek::gfx
|
|||
|
||||
bool error = false;
|
||||
|
||||
if (extra.value.IsNumber())
|
||||
if (extra.value.IsBool())
|
||||
value = extra.value.GetBool();
|
||||
else if (extra.value.IsNumber())
|
||||
value = extra.value.GetFloat();
|
||||
else if (extra.value.IsString())
|
||||
value = extra.value.GetString();
|
||||
|
|
@ -110,7 +112,7 @@ namespace psemek::gfx
|
|||
error = true;
|
||||
|
||||
if (error)
|
||||
log::warning() << "every 'extras' value must be either a number, an array of numbers, or a string (while parting glTF)";
|
||||
log::warning() << "every 'extras' value must be either a boolean, a number, an array of numbers, or a string (while parsing glTF)";
|
||||
else
|
||||
result[name] = std::move(value);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue