Skip to content

Commit d73e1dc

Browse files
querieloMugen87
andauthored
GLTFExporter: Fix skinIndex export for InterleavedBufferAttribute (mrdoob#32607)
Co-authored-by: Michael Herzog <michael.herzog@human-interactive.org>
1 parent ebd9792 commit d73e1dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/jsm/exporters/GLTFExporter.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,12 +1852,12 @@ class GLTFWriter {
18521852
! ( array instanceof Uint8Array ) ) {
18531853

18541854
console.warn( 'GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.' );
1855-
modifiedAttribute = new BufferAttribute( new Uint16Array( array ), attribute.itemSize, attribute.normalized );
1855+
modifiedAttribute = GLTFExporter.Utils.toTypedBufferAttribute( attribute, Uint16Array );
18561856

18571857
} else if ( ( array instanceof Uint32Array || array instanceof Int32Array ) && ! attributeName.startsWith( '_' ) ) {
18581858

18591859
console.warn( `GLTFExporter: Attribute "${ attributeName }" converted to type FLOAT.` );
1860-
modifiedAttribute = GLTFExporter.Utils.toFloat32BufferAttribute( attribute );
1860+
modifiedAttribute = GLTFExporter.Utils.toTypedBufferAttribute( attribute, Float32Array );
18611861

18621862
}
18631863

@@ -3538,9 +3538,9 @@ GLTFExporter.Utils = {
35383538

35393539
},
35403540

3541-
toFloat32BufferAttribute: function ( srcAttribute ) {
3541+
toTypedBufferAttribute: function ( srcAttribute, TypedArray ) {
35423542

3543-
const dstAttribute = new BufferAttribute( new Float32Array( srcAttribute.count * srcAttribute.itemSize ), srcAttribute.itemSize, false );
3543+
const dstAttribute = new BufferAttribute( new TypedArray( srcAttribute.count * srcAttribute.itemSize ), srcAttribute.itemSize, false );
35443544

35453545
if ( ! srcAttribute.normalized && ! srcAttribute.isInterleavedBufferAttribute ) {
35463546

0 commit comments

Comments
 (0)