Skip to content

Commit

Permalink
wip add SHORT support (for exporting meshopt-compressed meshes, not w…
Browse files Browse the repository at this point in the history
…orking yet)
  • Loading branch information
hybridherbst committed Sep 6, 2022
1 parent f351244 commit 45322ce
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/jsm/exporters/GLTFExporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const WEBGL_CONSTANTS = {

BYTE: 0x1400,
UNSIGNED_BYTE: 0x1401,
SHORT: 0x1402,
UNSIGNED_SHORT: 0x1403,
FLOAT: 0x1406,
UNSIGNED_INT: 0x1405,
Expand Down Expand Up @@ -952,6 +953,10 @@ class GLTFWriter {

dataView.setInt8( offset, value );

} else if ( componentType === WEBGL_CONSTANTS.SHORT ) {

dataView.setInt16( offset, value );

}

offset += componentSize;
Expand Down Expand Up @@ -1074,6 +1079,10 @@ class GLTFWriter {

componentType = WEBGL_CONSTANTS.BYTE;

} else if ( attribute.array.constructor === Int16Array ) {

componentType = WEBGL_CONSTANTS.SHORT;

} else {

throw new Error( 'THREE.GLTFExporter: Unsupported bufferAttribute component type: ' + attribute.array.constructor );
Expand Down

0 comments on commit 45322ce

Please sign in to comment.