获取模型的面数

521 阅读1分钟
  • 主要是计算attribute position/index
let faceCount=0;
for (let index = 0; index < d4.componentGroup.children.length; index++) {
        const element = d4.componentGroup.children[index];
        const attirbute = element.geometry 
        if (attirbute.index) {
                faceCount += attirbute.index.array.length/3;
        }
        else{
                faceCount += attirbute.attirbutes.position.array.length/9;
        }
}
console.log(faceCount);