Skip to content

Commit

Permalink
added missing padding to integer vertex attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
grzesiekmq committed Oct 26, 2023
1 parent 9d26154 commit 3d8c603
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion examples/jsm/exporters/GLTFExporter.js
Expand Up @@ -1054,10 +1054,16 @@ class GLTFWriter {
if ( target !== undefined ) bufferViewDef.target = target;

if ( target === WEBGL_CONSTANTS.ARRAY_BUFFER ) {

// Only define byteStride for vertex attributes.

bufferViewDef.byteStride = attribute.itemSize * componentSize;

if(componentSize === 1){
const paddedArray = new Uint8Array(getPaddedArrayBuffer(attribute.array.buffer));
attribute.array = paddedArray;
}

}

this.byteOffset += byteLength;
Expand Down

0 comments on commit 3d8c603

Please sign in to comment.