react-three-renderer
react-three-renderer copied to clipboard
Are textures deallocated when removed from render tree?
I have a project that involves dynamically loading lots of textures into a scene when needed. I am slightly worried that loaded textures will not be deallocated with renderer.deallocateTexture( texture ) when the mesh and material is not in the render tree.
Is this something that I will have to do manually, with something like:
this.refs.renderer.deallocate(this.refs.texture)
before the mesh and texture is removed from the scene? This could be done in the componentWillUnmount function which is actually quite a tidy place to have it.
Just thought I'd check before powering on and implementing it.
Thanks.
When a texture gets unmounted it does call .dispose
which I'm hoping should trigger the deallocation, but I'll try to dig deeper , run some tests with breakpoints and confirm how it exactly works and if the deallocations happen properly.