From cd038209dd9cc2d75ce59c0e01ff79a88fa60353 Mon Sep 17 00:00:00 2001 From: johnmaf Date: Wed, 14 Sep 2016 18:14:23 -0400 Subject: [PATCH] Add all glTF data to single buffer --- code/glTFExporter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index e333272..960dd3b 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -267,6 +267,13 @@ void glTFExporter::ExportMaterials() void glTFExporter::ExportMeshes() { + std::string bufferId = mAsset->FindUniqueID("", "buffer"); + + Ref b = mAsset->GetBodyBuffer(); + if (!b) { + b = mAsset->buffers.Create(bufferId); + } + for (unsigned int i = 0; i < mScene->mNumMeshes; ++i) { const aiMesh* aim = mScene->mMeshes[i]; @@ -277,13 +284,6 @@ void glTFExporter::ExportMeshes() p.material = mAsset->materials.Get(aim->mMaterialIndex); - std::string bufferId = mAsset->FindUniqueID(meshId, "buffer"); - - Ref b = mAsset->GetBodyBuffer(); - if (!b) { - b = mAsset->buffers.Create(bufferId); - } - Ref v = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mVertices, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT); if (v) p.attributes.position.push_back(v); -- 2.7.4