All offsets are relative to the beginning of the data block (excluding headers with Mesh list)
| 12 | |
| 13 | // All offsets are relative to the beginning of the data block (excluding headers with Mesh list) |
| 14 | struct Mesh final |
| 15 | { |
| 16 | /* Number of LODs in this mesh. Strictly less than MAX_LODS, last LOD offset is used as a marker only */ |
| 17 | uint32_t lodCount = 1; |
| 18 | |
| 19 | /* Number of vertex data streams */ |
| 20 | uint32_t streamCount = 0; |
| 21 | |
| 22 | /* The total count of all previous vertices in this mesh file */ |
| 23 | uint32_t indexOffset = 0; |
| 24 | |
| 25 | uint32_t vertexOffset = 0; |
| 26 | |
| 27 | /* Vertex count (for all LODs) */ |
| 28 | uint32_t vertexCount = 0; |
| 29 | |
| 30 | /* Offsets to LOD data. Last offset is used as a marker to calculate the size */ |
| 31 | uint32_t lodOffset[kMaxLODs] = { 0 }; |
| 32 | |
| 33 | inline uint32_t getLODIndicesCount(uint32_t lod) const { return lodOffset[lod + 1] - lodOffset[lod]; } |
| 34 | |
| 35 | /* All the data "pointers" for all the streams */ |
| 36 | uint32_t streamOffset[kMaxStreams] = { 0 }; |
| 37 | |
| 38 | /* Information about stream element (size pretty much defines everything else, the "semantics" is defined by the shader) */ |
| 39 | uint32_t streamElementSize[kMaxStreams] = { 0 }; |
| 40 | |
| 41 | /* We could have included the streamStride[] array here to allow interleaved storage of attributes. |
| 42 | For this book we assume tightly-packed (non-interleaved) vertex attribute streams */ |
| 43 | |
| 44 | /* Additional information, like mesh name, can be added here */ |
| 45 | }; |
| 46 | |
| 47 | struct MeshFileHeader |
| 48 | { |
nothing calls this directly
no outgoing calls
no test coverage detected