memory - How to dispose of multimaterial objects? -
i use multimaterial objects in scene, , wondering best way remove , dispose of them? i've read questions on how dispose of regular objects, , can use .dispose() on object, there no method multimaterial objects or regular objects(it's not listed in object3d document page).
is enough dispose geometry , materials? do after that, set object null? free memory? (this concern since use lot of objects , want make sure memory released).
.
edit: after experimenting, appears if way dispose objects follows sequence:
- scene.remove(mesh);
- mesh.geometry.dispose(); if want remove geometry (looping through children of multimaterial object , disposing of geometry seems okay)
- mesh.geometry = undefined;
- mesh = undefined;
if want remove materials used in multimaterial object, can remove each 1 material.dispose();
so if initialize material var material = new three.meshbasicmaterial();
material.dispose(); remove it.
then material = undefined;
textures disposed similarly.
if i'm wrong, let me know.
Comments
Post a Comment