Let's say we have an ArrayBuffer containing vertices and normals, as displayed in the screenshot below:
https://i.sstatic.net/LyNfW.png
//recompute object from vertices and normals
const verticesBuffer:ArrayBuffer = e.data.verticesBufferArray;
const normalsBuffer:ArrayBuffer = e.data.normalsBufferArray;
const vertices = new Float32Array(verticesBuffer);
const normals = new Float32Array(normalsBuffer);
However, at this stage, the 'vertices' and 'normals' variables are undefined. This is interesting because 'verticesBuffer' and 'normalsBuffer' seem to be fine.
Upon attempting the conversion, the following error is encountered:
const vertices = new Float32Array(verticesBuffer);
Uncaught RangeError: Invalid typed array length: 39744
So, the question arises - how can we successfully convert from verticesBuffer:ArrayBuffer to vertices:Float32Array?
Thank you!