(file)
| 1388 | splatData[3] == 10; |
| 1389 | |
| 1390 | const selectFile = (file) => { |
| 1391 | const fr = new FileReader(); |
| 1392 | if (/\.json$/i.test(file.name)) { |
| 1393 | fr.onload = () => { |
| 1394 | cameras = JSON.parse(fr.result); |
| 1395 | viewMatrix = getViewMatrix(cameras[0]); |
| 1396 | projectionMatrix = getProjectionMatrix( |
| 1397 | camera.fx / downsample, |
| 1398 | camera.fy / downsample, |
| 1399 | canvas.width, |
| 1400 | canvas.height, |
| 1401 | ); |
| 1402 | gl.uniformMatrix4fv(u_projection, false, projectionMatrix); |
| 1403 | |
| 1404 | console.log("Loaded Cameras"); |
| 1405 | }; |
| 1406 | fr.readAsText(file); |
| 1407 | } else { |
| 1408 | stopLoading = true; |
| 1409 | fr.onload = () => { |
| 1410 | splatData = new Uint8Array(fr.result); |
| 1411 | console.log("Loaded", Math.floor(splatData.length / rowLength)); |
| 1412 | |
| 1413 | if (isPly(splatData)) { |
| 1414 | // ply file magic header means it should be handled differently |
| 1415 | worker.postMessage({ ply: splatData.buffer, save: true }); |
| 1416 | } else { |
| 1417 | worker.postMessage({ |
| 1418 | buffer: splatData.buffer, |
| 1419 | vertexCount: Math.floor(splatData.length / rowLength), |
| 1420 | }); |
| 1421 | } |
| 1422 | }; |
| 1423 | fr.readAsArrayBuffer(file); |
| 1424 | } |
| 1425 | }; |
| 1426 | |
| 1427 | window.addEventListener("hashchange", (e) => { |
| 1428 | try { |
no test coverage detected