if (
node.material instanceof THREE.MeshFaceMaterial ||
node.material instanceof THREE.MultiMaterial
) {
This code can not be used with a latest version of three.js
. MeshFaceMaterial
and MultiMaterial
has been deprecated. You also miss potentially set texture properties. Try it with the code from:
Alright, the following is what I have so far, and I’m doing it to see if there’s any difference in memory use compared to not doing it (my guess is there won’t be and the Garbage Collector will work great, but just in case). Am I missing anything?
console.log('dispose renderer!')
renderer.dispose()
scene.traverse(object => {
if (!object.isMesh) return
console.log('dispose geometry!')
object.geometry.dispose()
if (object.material.isMaterial) {
cleanMaterial(object.material)
} else {
…