Merge pull request #1314 from jamesgk/gltf-export
GLTF exporter: ensure buffer view byte offsets are correctly alignedpull/1318/head
commit
6aca0f86b4
|
@ -185,8 +185,11 @@ inline Ref<Accessor> ExportData(Asset& a, std::string& meshName, Ref<Buffer>& bu
|
||||||
unsigned int bytesPerComp = ComponentTypeSize(compType);
|
unsigned int bytesPerComp = ComponentTypeSize(compType);
|
||||||
|
|
||||||
size_t offset = buffer->byteLength;
|
size_t offset = buffer->byteLength;
|
||||||
|
// make sure offset is correctly byte-aligned, as required by spec
|
||||||
|
size_t padding = offset % bytesPerComp;
|
||||||
|
offset += padding;
|
||||||
size_t length = count * numCompsOut * bytesPerComp;
|
size_t length = count * numCompsOut * bytesPerComp;
|
||||||
buffer->Grow(length);
|
buffer->Grow(length + padding);
|
||||||
|
|
||||||
// bufferView
|
// bufferView
|
||||||
Ref<BufferView> bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));
|
Ref<BufferView> bv = a.bufferViews.Create(a.FindUniqueID(meshName, "view"));
|
||||||
|
|
Loading…
Reference in New Issue