From d48bbdcd90779df770cac724bd290d4e2e1d00f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Chatelain?= Date: Wed, 24 May 2017 09:54:18 +0000 Subject: [PATCH] Updates asset object (glTF 2.0) --- tiny_gltf_loader.h | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/tiny_gltf_loader.h b/tiny_gltf_loader.h index 9f647f1..3ae05c9 100644 --- a/tiny_gltf_loader.h +++ b/tiny_gltf_loader.h @@ -482,12 +482,11 @@ typedef struct { } Buffer; typedef struct { + std::string version; // required std::string generator; - std::string version; - std::string profile_api; - std::string profile_version; - bool premultipliedAlpha; - char pad[7]; + std::string minVersion; + std::string copyright; + ParameterMap extensions; Value extras; } Asset; @@ -1347,22 +1346,12 @@ static bool ParseJSONProperty(std::map *ret, std::string *e static bool ParseAsset(Asset *asset, std::string *err, const picojson::object &o) { + ParseStringProperty(&asset->version, err, o, "version", true); ParseStringProperty(&asset->generator, err, o, "generator", false); - ParseBooleanProperty(&asset->premultipliedAlpha, err, o, "premultipliedAlpha", - false); + ParseStringProperty(&asset->minVersion, err, o, "minVersion", false); - ParseStringProperty(&asset->version, err, o, "version", false); - - picojson::object::const_iterator profile = o.find("profile"); - if (profile != o.end()) { - const picojson::value &v = profile->second; - if (v.contains("api") & v.get("api").is()) { - asset->profile_api = v.get("api").get(); - } - if (v.contains("version") & v.get("version").is()) { - asset->profile_version = v.get("version").get(); - } - } + // Unity exporter version is added as extra here + ParseExtrasProperty(&(asset->extras), o); return true; }