mkkellogg / GaussianSplats3D

Three.js-based implementation of 3D Gaussian splatting
MIT License
1.37k stars 168 forks source link

trigger action on load #262

Closed lewibs closed 2 months ago

lewibs commented 3 months ago

I have an action which I want to run after the splat is loaded and also the tree has been initialized is there a method for doing this?

mkkellogg commented 3 months ago

so I admit I don't have a nice, clean way of doing this -- maybe I need to add one. What you can do in the meantime is add a callback to be executed whenever the splat tree is constructed, something like:

const viewer = new GaussianSplats3D.Viewer();
viewer.splatMesh.onSplatTreeReady(() => {
  console.log("splat tree ready")
});
viewer.addSplatScene(<path>)
.then(() => {
    viewer.start();
});
mkkellogg commented 2 months ago

I'm going to close this for now, hopefully in a not-too-far-in-the-future update I will add a nicer way of doing this :)