解除分配Object3D [英] Deallocating Object3D

查看:104
本文介绍了解除分配Object3D的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用另外的mtl文件从obj文件加载模型。如何在r55中正确处理或取消分配返回的Object3D中的所有几何/材质/纹理?

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?

推荐答案

试试这个:

object.traverse( function ( child ) {

    if ( child.geometry !== undefined ) {

        child.geometry.dispose();
        child.material.dispose();

    }

} );

这篇关于解除分配Object3D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆