How can we get number of triangles, vertices, faces of GLB model

Hello guys,
I need to add GUI to show number of triangles, vertices and faces of GLB model is there any way in THREEJS to get all the values of loaded GLB file, I also tried renderer.info.render.triangles but it prints 0 triangles any suggestion or reference helps me a lot. Thanks

Triangles and faces are the same in three.js.

I suggest you use the same approach like the three.js editor. When adding a 3D object to the scene, you see the total number of vertices and triangles in the lower left corner. Consider to use the same approach for computing these data in your project:

Thanks for reply sir, one thing I wanna clear line No. 52 object.geometry it gives me an error Property ‘geometry’ does not exist on type 'Object3D’ how to resolve it?

Are you using typescript? You probably have to cast the object to a mesh.

yes sir I am using typescript and I need to cast into? and one more thing sir I want to display values of triangles, vertices and object without using html is there any other way or with the help of Dat.GUI to display the values. Thanks

Hello How are you Mugen87. I am very interested what format() does (this codes come after the lines of code that you send, I checked it Number don’t have format() method )
objectsText.setValue( objects.format() );
verticesText.setValue( vertices.format() );
trianglesText.setValue( triangles.format() );