I’m back since the issue is still not resolved for me. So, this is my loader
data
comes as arrayBuffer
after new TextDecoder().decode(data)
// it becomes as this object
const decoded = {
"asset": {
"generator": "Khronos glTF Blender I/O v1.6.16",
"version": "2.0"
},
"extensionsUsed": [
"KHR_texture_transform"
],
"extensionsRequired": [
"KHR_texture_transform"
],
"scene": 0,
"scenes": [
{
"name": "Scene",
"nodes": [
0
]
}
],
"nodes": [
{
"mesh": 0,
"name": "sphere_gltf"
}
],
"materials": [
{
"doubleSided": true,
"name": "yellow_plaster",
"normalTexture": {
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
-1
],
"scale": [
2,
2
]
}
},
"index": 0
},
"pbrMetallicRoughness": {
"baseColorTexture": {
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
-1
],
"scale": [
2,
2
]
}
},
"index": 1
},
"metallicFactor": 0,
"metallicRoughnessTexture": {
"extensions": {
"KHR_texture_transform": {
"offset": [
0,
-1
],
"scale": [
2,
2
]
}
},
"index": 2
}
}
}
],
"meshes": [
{
"name": "Sphere.001",
"primitives": [
{
"attributes": {
"POSITION": 0,
"NORMAL": 1,
"TEXCOORD_0": 2
},
"indices": 3,
"material": 0
}
]
}
],
"textures": [
{
"sampler": 0,
"source": 0
},
{
"sampler": 0,
"source": 1
},
{
"sampler": 0,
"source": 2
}
],
"images": [
{
"mimeType": "image/jpeg",
"name": "yellow_plaster_nor_gl_4k",
"uri": "textures/yellow_plaster_nor_gl_4k.jpg"
},
{
"mimeType": "image/jpeg",
"name": "yellow_plaster_diff_4k",
"uri": "textures/yellow_plaster_diff_4k.jpg"
},
{
"mimeType": "image/jpeg",
"name": "yellow_plaster_rough_4k",
"uri": "textures/yellow_plaster_rough_4k.jpg"
}
],
"accessors": [
{
"bufferView": 0,
"componentType": 5126,
"count": 53924,
"max": [
0.997482419013977,
1.004236102104187,
0.9975455403327942
],
"min": [
-0.9974827766418457,
-1.0036455392837524,
-0.9975481629371643
],
"type": "VEC3"
},
{
"bufferView": 1,
"componentType": 5126,
"count": 53924,
"type": "VEC3"
},
{
"bufferView": 2,
"componentType": 5126,
"count": 53924,
"type": "VEC2"
},
{
"bufferView": 3,
"componentType": 5123,
"count": 322170,
"type": "SCALAR"
}
],
"bufferViews": [
{
"buffer": 0,
"byteLength": 647088,
"byteOffset": 0
},
{
"buffer": 0,
"byteLength": 647088,
"byteOffset": 647088
},
{
"buffer": 0,
"byteLength": 431392,
"byteOffset": 1294176
},
{
"buffer": 0,
"byteLength": 644340,
"byteOffset": 1725568
}
],
"samplers": [
{
"magFilter": 9729,
"minFilter": 9987
}
],
"buffers": [
{
"byteLength": 2369908,
"uri": "yellow_plaster.bin"
}
]
}
GLTFLoader.parse(
new TextDecoder().decode(data),
'',
(result) => {
processObject(result);
},
(err) => {
onMessage({ type: 'error', err }); // RangeError: Invalid typed array length: 161772
at new Float32Array
throw Error(err);
}