cnr-isti-vclab / nexus

Nexus is a c++/javascript library for creation and visualization of a batched multiresolution mesh
GNU General Public License v3.0
213 stars 86 forks source link

RangeError offset is out of bounds - Float32Array.set #170

Open loicroybon opened 1 week ago

loicroybon commented 1 week ago

Hello,

I've this issue only with certain meshes.

RangeError offset is out of bounds - Float32Array.set

Stack Trace

../node_modules/***/src/modules/nexus/Nexus3D.js dans Nexus3D.createNodeGeometry à la ligne 491:18

        const m = this.mesh;
        const nv = m.nvertices[id];
        const indices = data.index;
        const vertices = new ArrayBuffer(nv * m.vsize);
        const position = new Float32Array(vertices, 0, nv * 3);
        position.set(data.position);
        let off = nv * 12;
        if (m.vertex.texCoord) {
            const uv = new Float32Array(vertices, off, nv * 2);
            uv.set(data.uv);
            off += nv * 8;

../node_modules/***/src/modules/nexus/Nexus3D.js dans this.mesh.createNodeGeometry à la ligne 124:15


    open(url) {
        const t = this;
        this.mesh.open(url);
        this.mesh.createNode = (/* id */) => {};
        this.mesh.createNodeGeometry = (id, geometry) => {
            t.createNodeGeometry(id, geometry);
        };
        this.mesh.createTexture = (id, image) => {
            t.createTexture(id, image);
        };
        this.mesh.deleteNodeGeometry = id => {

../node_modules/***/src/modules/nexus/Cache.js dans _Cache.prototypereadyGeometryNode à la ligne 466:14


            }
        } else {
            geometry = buffer;
        }
        mesh.createNodeGeometry(id, geometry);
        mesh.status[id]--;
        if (mesh.status[id] === 2) {
            this.readyNode(mesh, id);
        }

../node_modules/***/src/modules/nexus/Cache.js dans corto.onmessage à la ligne 124:24


        corto.onmessage = function (e) {
            const request = e.data.request;
            const node = this.requests[request];
            delete this.requests[request];
            node.model = e.data.model;
            node.cache.readyGeometryNode(node.mesh, node.id, node.model);
        };
        this.corto = corto;
    },

Any idea ?

ponchio commented 1 week ago

Hard to say, its seems like nexus expected texture coordinates while corto didn't. Could you provide a sample?