Skip to content

Commit 905f339

Browse files
committed
GLTFExporter: Ensure joints are uint8 or uint16.
1 parent 87f4134 commit 905f339

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

examples/js/exporters/GLTFExporter.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,15 @@ THREE.GLTFExporter.prototype = {
926926
var attribute = geometry.attributes[ attributeName ];
927927
attributeName = nameConversion[ attributeName ] || attributeName.toUpperCase();
928928

929+
// JOINTS_0 must be UNSIGNED_BYTE or UNSIGNED_SHORT.
930+
if ( attributeName === 'JOINTS_0' &&
931+
! ( attribute instanceof THREE.Uint16BufferAttribute ) &&
932+
! ( attribute instanceof THREE.Uint8BufferAttribute ) ) {
933+
934+
attribute = new THREE.Uint16BufferAttribute( new Uint16Array( attribute.array ), attribute.itemSize, attribute.normalized );
935+
936+
}
937+
929938
if ( attributeName.substr( 0, 5 ) !== 'MORPH' ) {
930939

931940
attributes[ attributeName ] = processAccessor( attribute, geometry );

0 commit comments

Comments
 (0)