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 onm_puiTriangleCountPerFace
andm_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.