From c98e77907c850f4c5337b09b35e2bfc78ce37e62 Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Fri, 10 Jun 2016 09:49:04 -0400 Subject: [PATCH 1/2] fixed some small bugs in the gltf exporter: byteOffsets in accessors/bufferViews, logic problem with bufferView targets --- code/glTFExporter.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index ca606ecdc..352d94287 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -152,14 +152,14 @@ inline Ref ExportData(Asset& a, std::string& meshName, Ref& bu // bufferView Ref bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view")); bv->buffer = buffer; - bv->byteOffset = 0; - bv->byteLength = length; //! The target that the WebGL buffer should be bound to. + bv->byteOffset = unsigned(offset); + bv->byteLength = length; //! The target that the WebGL buffer should be bound to. bv->target = isIndices ? BufferViewTarget_ELEMENT_ARRAY_BUFFER : BufferViewTarget_ARRAY_BUFFER; // accessor Ref acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor")); acc->bufferView = bv; - acc->byteOffset = unsigned(offset); + acc->byteOffset = 0; acc->byteStride = 0; acc->componentType = compType; acc->count = count; @@ -292,7 +292,7 @@ void glTFExporter::ExportMeshes() indices[i*nIndicesPerFace + j] = uint16_t(aim->mFaces[i].mIndices[j]); } } - p.indices = ExportData(*mAsset, meshId, b, unsigned(indices.size()), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_SHORT); + p.indices = ExportData(*mAsset, meshId, b, unsigned(indices.size()), &indices[0], AttribType::SCALAR, AttribType::SCALAR, ComponentType_UNSIGNED_SHORT, true); } switch (aim->mPrimitiveTypes) { From f15b6177f7f5ffbd155d11474d287898293a2c11 Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Fri, 10 Jun 2016 13:41:59 -0400 Subject: [PATCH 2/2] glTFExporter fixes: spaces to tabs --- code/glTFExporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/glTFExporter.cpp b/code/glTFExporter.cpp index 352d94287..7f0c086cf 100644 --- a/code/glTFExporter.cpp +++ b/code/glTFExporter.cpp @@ -152,14 +152,14 @@ inline Ref ExportData(Asset& a, std::string& meshName, Ref& bu // bufferView Ref bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view")); bv->buffer = buffer; - bv->byteOffset = unsigned(offset); - bv->byteLength = length; //! The target that the WebGL buffer should be bound to. + bv->byteOffset = unsigned(offset); + bv->byteLength = length; //! The target that the WebGL buffer should be bound to. bv->target = isIndices ? BufferViewTarget_ELEMENT_ARRAY_BUFFER : BufferViewTarget_ARRAY_BUFFER; // accessor Ref acc = a.accessors.Create(a.FindUniqueID(meshName, "accessor")); acc->bufferView = bv; - acc->byteOffset = 0; + acc->byteOffset = 0; acc->byteStride = 0; acc->componentType = compType; acc->count = count;