syoyo / tinyobjloader-c

Header only tiny wavefront .obj loader in pure C99
412 stars 60 forks source link

Swapped values in returned attribs ? #36

Closed PeterOGB closed 4 years ago

PeterOGB commented 4 years ago

Are the returned values for attrib.num_face_num_verts and attrib.num_faces swapped ? Loading a simple object that has only a cube and a plane I get attrib.num_face_num_verts = 14 attrib.num_faces = 42

There are 7 square faces, so 14 triangles, each with 3 vertices, so attrib.num_face_num_verts = 42 attrib.num_faces = 14 would seem more sensible values.

syoyo commented 4 years ago

Returned value is correct.

attrib.num_faces is actually the array length of vertex indices. 14 triangles * 3 vertex = 42 attrib.num_face_num_verts is the array length of the number of vertices per face(= the number of faces = 14)

Naming of these variables are confusing. I need to find a good naming for it.

https://github.com/syoyo/tinyobjloader-c/issues/16

PeterOGB commented 4 years ago

Either the names need swapping or the values need swapping because at the moment the name and value pairings are very confusing.

PeterOGB commented 4 years ago

I've closed this issue because I'm no longer using this library. I've gone back to my own code where at least I understand what the variable names mean.