Loading `m_puiTextureUVIndicesPerFace`

I am trying to understand the memory layout described by the docs, talking about A3DMeshData.

It says:

Array of texture indices.
Indices are ordered per face and per triangle. Size depends on m_puiTriangleCountPerFace and m_puiTextureCountPerFace.

But this confuses me. There’s two possible ways in which the uvs are going to be distributed.

Either one has one uv per triangle vertex, or one has one uv per face vertex.

If we assume the first, then there’s no need for m_puiTextureCountPerFace since we know that in a given face the total number of uv indices will be triangle_count * 3.

If we assume the second then there’s no need for m_puiTriangleCountPerFace since the number of triangles is irrelevant.

To be clear, I am trying to load the data into a vector, what I have currently looks like this:

        std::vector<std::vector<uint32_t>> texture_topology;
		{
			uint accumulator = 0;
			texture_topology.resize(mesh_data.m_uiFaceSize);
			for (uint i=0; i < mesh_data.m_uiFaceSize; i++) {
				texture_topology[i].resize(texture_count_per_face[i]);
				memcpy(&texture_topology[i][0], mesh_data.m_puiTextureUVIndicesPerFace + accumulator, texture_count_per_face[i] * 3);
				accumulator += texture_topology[i].size();
			}
		}

Which I know is incorrect. Could you help me figure out what the correct logic should be? I don’t see anything in the examples that shows how to properly load this data.

Hello @camilo.talero
The length of m_puiTextureUVIndicesPerFace[f] is calculated as m_puiTextureCountPerFace[f] * 3 * m_puiTriangleCountPerFace[f].

This reflects how the memory is organized, where each face holds the texture indices for its triangles. For more details on how the memory representation is structured, you can refer to the documentation.

Please let me know if you need further assistance. Thank you!

Best Regards,
Man

Thank you enormously!