Deallocating Object3D

前端 未结 3 1540
太阳男子
太阳男子 2021-02-11 04:18

I load a model from an obj file using in addition the mtl file. How do I properly dispose off or deallocate all the geometry/materials/textures from the returned Object3D in r55

3条回答
  •  春和景丽
    2021-02-11 04:51

    Try this:

    object.traverse( function ( child ) {
    
        if ( child.geometry !== undefined ) {
    
            child.geometry.dispose();
            child.material.dispose();
    
        }
    
    } );
    

提交回复
热议问题