I am looking to incorporate basic information about the model into my model viewer. Specifically, I need to obtain the vertex, edge, face, and triangle count of the object, or at the very least, the vertex count.
My attempted approach involves using the following code:
gltf.scene.traverse( function ( child ) {
if ( child.isMesh ) {
console.log(child.geometry.vertices)
}
})
Unfortunately, this code returns undefined
, indicating that it is not functioning as intended. The geometry
attribute belongs to the Type BufferGeometry, but I have been unable to retrieve the necessary information.
Another method I explored was:
console.log(child.geometry.attributes.position.count)
This line does yield a numerical value, but I am unsure if it represents the vertex count or another metric altogether.
Is there a clear way to obtain the vertex count of the model and ideally extract data on edges, faces, and triangles as well?