Add all glTF data to single buffer
parent
c98915e382
commit
cd038209dd
|
@ -267,6 +267,13 @@ void glTFExporter::ExportMaterials()
|
||||||
|
|
||||||
void glTFExporter::ExportMeshes()
|
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) {
|
for (unsigned int i = 0; i < mScene->mNumMeshes; ++i) {
|
||||||
const aiMesh* aim = mScene->mMeshes[i];
|
const aiMesh* aim = mScene->mMeshes[i];
|
||||||
|
|
||||||
|
@ -277,13 +284,6 @@ void glTFExporter::ExportMeshes()
|
||||||
|
|
||||||
p.material = mAsset->materials.Get(aim->mMaterialIndex);
|
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);
|
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);
|
if (v) p.attributes.position.push_back(v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue