Can't properly clear scene

 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: