lightmap Posted September 4, 2018 Posted September 4, 2018 Hello I need to do some analysis of geometry, and can't find how to get triangle vertex indices e.g. triangle[0].vert_a, triangle[0].vert_b, triangle[0].vert_c - I need vertex connections in triangle. thanks
andrey-kozlov Posted September 10, 2018 Posted September 10, 2018 Hello, lightmap If geometry is a triangle list, every three indices build one triangle. Vertex indices of the i-th triangle can be obtained as {indices[i * 3], indices[i * 3 + 1], indices[i * 3 + 2]}.
lightmap Posted September 10, 2018 Author Posted September 10, 2018 do Unigine give triangle vertex indices trough getCindex()? triangle_i_vertex_a = mesh.getCindex(triangle_i + 0, surface); triangle_i_vertex_b = mesh.getCindex(triangle_i + 1, surface); triangle_i_vertex_c = mesh.getCindex(triangle_i + 2, surface); right? 100% consecutive vertices for triangle or I need to use getTIndex some way? https://developer.unigine.com/en/docs/2.7.2/api/library/objects/class.objectmeshstatic?rlang=cpp&words=gettindex#getTIndex_int_int_int getTIndex() Return value : Triangle index
andrey-kozlov Posted September 10, 2018 Posted September 10, 2018 getTIndex actually returns TVertex index which contains info that can't be shared between adjacent triangles in general case. Here you can find more information about it: https://developer.unigine.com/en/docs/2.7.2/api/library/rendering/class.mesh?rlang=cpp#indices I suppose you need only vertex coordinates. Then you need work with only getCIndex method. Your snippet is correct except that triangle_i should be multiplied by 3 (if it doesn't contain multiplication already) 1
Recommended Posts