Skip to content

Commit 655fc34

Browse files
donmccurdyDon McCurdy
authored andcommitted
GLTFExporter: Ensure joints are uint8 or uint16.
1 parent 87f4134 commit 655fc34

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

examples/js/exporters/GLTFExporter.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,17 @@ 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+
console.warn( 'GLTFExporter: Attribute "skinIndex" converted to type UNSIGNED_SHORT.' );
935+
936+
attribute = new THREE.Uint16BufferAttribute( attribute.array, attribute.itemSize, attribute.normalized );
937+
938+
}
939+
929940
if ( attributeName.substr( 0, 5 ) !== 'MORPH' ) {
930941

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

0 commit comments

Comments
 (0)