[glTF2] Implemented reading binary glTF2 (glb) files

This commit is contained in:
Patrick Dähne
2017-11-20 14:59:05 +01:00
parent e1837b6cc8
commit 6cbfd5b977
3 changed files with 120 additions and 16 deletions

View File

@@ -74,7 +74,7 @@ static const aiImporterDesc desc = {
"",
"",
"",
aiImporterFlags_SupportTextFlavour | aiImporterFlags_LimitedSupport | aiImporterFlags_Experimental,
aiImporterFlags_SupportTextFlavour | aiImporterFlags_SupportBinaryFlavour | aiImporterFlags_LimitedSupport | aiImporterFlags_Experimental,
0,
0,
0,
@@ -103,13 +103,13 @@ bool glTF2Importer::CanRead(const std::string& pFile, IOSystem* pIOHandler, bool
{
const std::string &extension = GetExtension(pFile);
if (extension != "gltf") // We currently can't read glTF2 binary files (.glb), yet
if (extension != "gltf" && extension != "glb")
return false;
if (checkSig && pIOHandler) {
glTF2::Asset asset(pIOHandler);
try {
asset.Load(pFile);
asset.Load(pFile, extension == "glb");
std::string version = asset.asset.version;
return !version.empty() && version[0] == '2';
} catch (...) {
@@ -639,7 +639,7 @@ void glTF2Importer::InternReadFile(const std::string& pFile, aiScene* pScene, IO
// read the asset file
glTF2::Asset asset(pIOHandler);
asset.Load(pFile);
asset.Load(pFile, GetExtension(pFile) == "glb");
//
// Copy the data out