HDF5: How to read tightly packed array of vertices into a struct of different size?

Viewed 91

I have the following format stored in an HDF5 file (tightly packed array of vertices):

struct DiskVertex
{
    float pos[3];
}

And I have a memory buffer of vertices I want to read this data into:

struct MemVertex
{
    float pos[3];
    float normal[3];
    float uv[2];
}

For example, if there were DiskVertex[1000] on disk, and a memory buffer of MemVertex[1000].

How can I read the data from DiskVertex into MemVertex? I want to avoid allocating a temporary buffer, reading the array into it, then copying that data into the destination.

0 Answers
Related