INNER CODE UNIT · JavaScript
clearThree
alexlenail/NN-SVG · AlexNet.js:282
function clearThree(obj) {
while(obj.children.length > 0) {
clearThree( obj.children[0] )
obj.remove( obj.children[0] );
}
if ( obj.geometry ) { obj.geometry.dispose(); }
if (obj.material) {
if (Array.isArray(obj.material)) {
obj.material.forEach(material => {
if (material && typeof material.dispose === 'function') {
material.dispose();
}
});
} else {
if (typeof obj.material.dispose === 'function') {
obj.material.dispose();