'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function clearScene(scene) { scene.traverse((child) => { clearGroup(child); }); } function clearGroup(group) { const clearCache = (mesh) => { if (mesh.geometry) { mesh.geometry.dispose(); } if (mesh.material && mesh.material.dispose) { mesh.material.dispose(); } if (mesh.material.texture && mesh.material.texture.dispose) { mesh.material.texture.dispose(); } }; const removeObj = (item) => { let array = item.children.filter((x) => x); array.forEach((v) => { if (v.children.length) { removeObj(v); } else { if (v.isMesh) { clearCache(v); } } }); array = null; }; removeObj(group); } exports.clearGroup = clearGroup; exports.clearScene = clearScene; //# sourceMappingURL=threeUtil.js.map