3d - How to handle COLLADA indices? -
3d - How to handle COLLADA indices? -
i wrote simple reader collada
file format, , seems work ok. now, have blender-exported cube mesh edge-splitted , triangulated, should have 12 triangles (2 per face), 24 vertices (4 per face) , 36 indices (6 per face). mesh has normal info , uv maps.
the collada
file has 24 vertices, 12 normals, , 36 uvs, assume normals per-triangle , uvs per-index. polylist
count triangles 12, correct, , vcount
has twelve '3's, that's right too. now, <p>
index list has 108 entries, 0, 3, 6 etc. vertex indices, 1, 4, 7 etc. normal indices , 2, 5, 8 etc. uv indices.
i have internal struct vertices, consists of position (vec3
), normal (vec3
) , uv coordinate (vec2
). draw meshes, utilize opengl's vertex buffers, , have separate list of indices.
the thing is, shouldn't have 24 vertices after loading mesh? 108 entries in <p>
translates 36 vertices. what's problem here indices?
i may missing simple here, can't see it.
the collada
file here.
okay, found solution, had clear mind simple plane. every face triangle, final count of vertices 3 times count described in polylist's count attribute. so, cube, 36 - not 24. in end, 36 draw cube correctly. so, brain going nuts.
3d mesh collada indices
Comments
Post a Comment