potree / potree

WebGL point cloud viewer for large datasets
http://potree.org
Other
4.53k stars 1.18k forks source link

Completely remove Pointcloud (opposite of Scene.js addPointCloud) #507

Open pyarza opened 6 years ago

pyarza commented 6 years ago

Is there any option to do the opposite effect of adding a pointcloud to a scene? Removing it completely?

I have seen that the addPointCloud method:

https://github.com/potree/potree/blob/e175d81d90876d327445d5246f9acd427c9fede7/src/viewer/Scene.js#L109

triggers quite a few event listeners, so manually removing the pointcloud from the pointclouds array doen´t seem like the best option.

I also guess that the option of just hidding the pointcloiud, something like:

viewer.scene.pointclouds[0].visible=false

that has been discused here: https://github.com/potree/potree/issues/239#issuecomment-240972227 isn´t perfect regarding memory usage.

Any better ideas?

Thank you!

koala365 commented 6 years ago

my code is here,you may try it!

window.viewer.scene.pointclouds.forEach(function(layer) { window.viewer.scene.scenePointCloud.remove(layer); }); window.viewer.scene.pointclouds = [];

HeadLessHUN commented 4 years ago

Hi there!

I load pointclouds dinamically and i need to remove them as well because its too big to visualize them together. And of course there is no registration issue if there is only one cloud.

I tried to remove from scene as youbut suggest but i think it's not getting removed completelly, maybe some lru bug or somethings like that, because my viewer gets slower after a period of time. For example like 30-50 cloud and each contains around 10m points loaded.

Maybe the best way is to create a completely new scene, and remove ifts not needed. Or maybe create new potree instance that is the cleanest i think, but its not ideal...

So the question is that how should i remove a cloud completelly from potree?

Any information @m-schuetz ?