Hi,
I’m getting this error on mobile:
Error loading GLB: RangeError: Invalid typed array length: 81717
at new Uint8Array (<anonymous>)
at eval (GLTFLoader.js:1307:20)
My loader:
this.gltfLoader = new GLTFLoader();
this.gltfLoader.setMeshoptDecoder(MeshoptDecoder);
this.gltfLoader.load(url, function(gltf) {
if (gltf) {
callback(gltf);
} else {
callback(null);
}
}, undefined, function(error) {
console.error('Error loading GLB:', error);
callback(null);
});
The error appears to happen here:
class GLTFMeshoptCompression {
constructor( parser ) {
this.name = EXTENSIONS.EXT_MESHOPT_COMPRESSION;
this.parser = parser;
}
loadBufferView( index ) {
const json = this.parser.json;
const bufferView = json.bufferViews[ index ];
if ( bufferView.extensions && bufferView.extensions[ this.name ] ) {
const extensionDef = bufferView.extensions[ this.name ];
const buffer = this.parser.getDependency( 'buffer', extensionDef.buffer );
const decoder = this.parser.options.meshoptDecoder;
if ( ! decoder || ! decoder.supported ) {
if ( json.extensionsRequired && json.extensionsRequired.indexOf( this.name ) >= 0 ) {
throw new Error( 'THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files' );
} else {
return null;
}
}
return buffer.then( function ( res ) {
const byteOffset = extensionDef.byteOffset || 0;
const byteLength = extensionDef.byteLength || 0;
const count = extensionDef.count;
const stride = extensionDef.byteStride;
const source = new Uint8Array( res, byteOffset, byteLength ); // <--- here
Model: Blender Gltf export compressed with gltfpack:
./gltfpack -cc -sa -mm -kn -i test.glb -o test2.glb
Render info:
memory: geometries: 40, textures: 17
programs: 17
render: frame: 4338, calls: 62, triangles: 31324, points: 0, lines: 0
gltfpack 0.19
three r148
Phone: Samsung Galaxy A32 / google chrome
Thank you for any suggestions