sortWork.js crashed when 'dynamicScene': true, with add-->remove-->add opterations. 'dynamicScene': false。 all be OK
when i want read splat file and want rotate the splat scene, i found the bug(maybe).
code: gsViewer = new GaussianSplats3D.Viewer({ 'selfDrivenMode': false, 'useBuiltInControls': false, 'dynamicScene': true, 'renderer':renderer, 'camera':camera, 'threeScene':scene, 'sphericalHarmonicsDegree': 2, 'rootElement': splatContainer.value }); //--------------------------------------------------------------
/* ----copyed from demo code---*/ function runViewer(splatBufferData:ArrayBuffer, format:GaussianSplats3D.SceneFormat, alphaRemovalThreshold:number, sphericalHarmonicsDegree:number) { const splatBufferOptions = { 'splatAlphaRemovalThreshold': alphaRemovalThreshold }; const splatBufferPromise = fileBufferToSplatBuffer({data: splatBufferData}, format, alphaRemovalThreshold, 0, undefined, undefined, undefined, undefined, sphericalHarmonicsDegree );
splatBufferPromise.then((splatBuffer:GaussianSplats3D.splatBuffer) => {
gsViewer.addSplatBuffers([splatBuffer], [splatBufferOptions])
.then(() => {
hasSplatInViewer=true;
console.info('splat is added in viewer');
emit('added',null);
});
});
} //---------------------------------------------------------------------
use runViewer() to add splatFile , is OK. Then use removeSplatScene(0) remove a scene,is OK. and use runViewer() to add splat File again , crashed.
error info:
Uncaught RangeError: offset is out of bounds
at Int32Array.set (
crashed code (2 places) :
(1) ----> new Float32Array(wasmMemory, modelViewProjOffset, 16).set(modelViewProj);
(2) ---->
if (e.data.centers) {
centers = e.data.centers;
sceneIndexes = e.data.sceneIndexes;
if (integerBasedSort) {
new Int32Array(
wasmMemory,
centersOffset + e.data.range.from * Constants2.BytesPerInt * 4,
e.data.range.count * 4
).set(new Int32Array(centers));
} else {