src/SceneHelper.js
/**
     * frees memory and removes the mesh (by making it available for the garbage collegtor)
     */
frees memory and removes the mesh (by making it available for the garbage collegtor)
frees memory and removes the mesh ( by making it available for the garbage collegtor )
disposeMesh(mesh)
    {   
        if(mesh)
        {
            if(mesh.geometry)
                mesh.geometry.dispose()
            if(mesh.material)
            {
                if(!mesh.material.length && mesh.material)
                    mesh.material.dispose()
                if(!isNaN(mesh.material.length))
                {
                    for(let i = 0;i < mesh.material.length; i++)
                        mesh.material[i].dispose()
                }
            }
            if(mesh.texture)
                mesh.texture.dispose()
            for(let i = 0;i < mesh.children.length; i++)
                this.disposeMesh(mesh.children[i])
            if(mesh.parent !== null)
                mesh.parent.remove(mesh)
            mesh.remove()
        }
    }
disposeMesh ( mesh ) { if ( mesh ) { if ( mesh . geometry ) mesh . geometry . dispose ( ) if ( mesh . material ) { if ( ! mesh . material . length && mesh . material ) mesh . material . dispose ( ) if ( ! isNaN ( mesh . material . length ) ) { for ( let i = 0 ; i < mesh . material . length ; i ++ ) mesh . material [ i ] . dispose ( ) } } if ( mesh . texture ) mesh . texture . dispose ( ) for ( let i = 0 ; i < mesh . children . length ; i ++ ) this . disposeMesh ( mesh . children [ i ] ) if ( mesh . parent !== null ) mesh . parent . remove ( mesh ) mesh . remove ( ) } }
frees memory and removes the mesh (by making it available for the garbage collegtor)
frees memory and removes the mesh ( by making it available for the garbage collegtor )
// disppose material // material is an array // for sprites material.map.dispose() seems to be important // recursively clear the children