Merge pull request #999 from johnmaf/feature/single-glTF-buffer

Add all glTF data to single buffer
pull/972/head
Kim Kulling 2016-09-20 09:52:54 +02:00 committed by GitHub
commit 097743880c
1 changed files with 7 additions and 7 deletions

View File

@ -267,6 +267,13 @@ void glTFExporter::ExportMaterials()
void glTFExporter::ExportMeshes()
{
std::string bufferId = mAsset->FindUniqueID("", "buffer");
Ref<Buffer> 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<Buffer> b = mAsset->GetBodyBuffer();
if (!b) {
b = mAsset->buffers.Create(bufferId);
}
Ref<Accessor> v = ExportData(*mAsset, meshId, b, aim->mNumVertices, aim->mVertices, AttribType::VEC3, AttribType::VEC3, ComponentType_FLOAT);
if (v) p.attributes.position.push_back(v);