I am importing a large scene through GLTFLoader and computing its tangent with computeMikkTSpaceTangents() the same time. It seems to have failed and throw the error. Here is the whole error.
Uncaught (in promise) RangeError: offset is out of bounds
at Float32Array.set (<anonymous>)
at passArrayF32ToWasm0 (mikktspace.module.js:60:25)
at Object.generateTangents (mikktspace.module.js:86:20)
at computeMikkTSpaceTangents (BufferGeometryUtils.js:73:30)
at initMikkTSpace (engine6.js:105:11)
Sure. I prepared to use my own shader to render the scene, so I used RawShaderMaterial. The model contains normal map, so I need to compute the tangent to apply the normal map and obtain accurate normal. Then I tried to use computeMikkTSpaceTangents() to get its tangent.
Actually, I had run my code to render a less scale scene before, which performed as expect. When I tried to load this large-scale scene, it went wrong.
The model was exported from blender as GLTF. It can be imported into blender successfully once again. So, I think its data may be not corrupted.