|
@@ -1432,6 +1432,12 @@ inline void Asset::Load(const std::string& pFile, bool isBinary)
|
|
|
// Load the metadata
|
|
|
asset.Read(doc);
|
|
|
ReadExtensionsUsed(doc);
|
|
|
+ ReadExtensionsRequired(doc);
|
|
|
+
|
|
|
+ // Currently Draco is not supported
|
|
|
+ if (extensionsRequired.KHR_draco_mesh_compression) {
|
|
|
+ throw DeadlyImportError("GLTF: Draco mesh compression not currently supported.");
|
|
|
+ }
|
|
|
|
|
|
// Prepare the dictionaries
|
|
|
for (size_t i = 0; i < mDicts.size(); ++i) {
|
|
@@ -1478,6 +1484,29 @@ inline void Asset::SetAsBinary()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// As required extensions are only a concept in glTF 2.0, this is here
|
|
|
+// instead of glTFCommon.h
|
|
|
+#define CHECK_REQUIRED_EXT(EXT) \
|
|
|
+ if (exts.find(#EXT) != exts.end()) extensionsRequired.EXT = true;
|
|
|
+
|
|
|
+inline void Asset::ReadExtensionsRequired(Document& doc)
|
|
|
+{
|
|
|
+ Value* extsRequired = FindArray(doc, "extensionsRequired");
|
|
|
+ if (nullptr == extsRequired) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ std::gltf_unordered_map<std::string, bool> exts;
|
|
|
+ for (unsigned int i = 0; i < extsRequired->Size(); ++i) {
|
|
|
+ if ((*extsRequired)[i].IsString()) {
|
|
|
+ exts[(*extsRequired)[i].GetString()] = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ CHECK_REQUIRED_EXT(KHR_draco_mesh_compression);
|
|
|
+
|
|
|
+ #undef CHECK_REQUIRED_EXT
|
|
|
+}
|
|
|
|
|
|
inline void Asset::ReadExtensionsUsed(Document& doc)
|
|
|
{
|