Deallocating Object3D

前端 未结 3 1686
太阳男子
太阳男子 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

    I use this:

    function removeReferences(removeme){
      try{
        removeme.traverse(function(ob){
          try{
            renderer.deallocateObject(ob);
          }catch(e){} 
          try{
            ob.geometry.deallocate();
          }catch(e){}
          try{
            ob.material.deallocate();
          }catch(e){} 
          try{
            ob.deallocate()
          }catch(e){}
        });
      }catch(e){}
    }
    

提交回复
热议问题