MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / saveMeshData

Function saveMeshData

shared/scene/VtxData.cpp:55–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void saveMeshData(const char* fileName, const MeshData& m)
56{
57 FILE *f = fopen(fileName, "wb");
58
59 const MeshFileHeader header = {
60 .magicValue = 0x12345678,
61 .meshCount = (uint32_t)m.meshes_.size(),
62 .dataBlockStartOffset = (uint32_t )(sizeof(MeshFileHeader) + m.meshes_.size() * sizeof(Mesh)),
63 .indexDataSize = (uint32_t)(m.indexData_.size() * sizeof(uint32_t)),
64 .vertexDataSize = (uint32_t)(m.vertexData_.size() * sizeof(float))
65 };
66
67 fwrite(&header, 1, sizeof(header), f);
68 fwrite(m.meshes_.data(), sizeof(Mesh), header.meshCount, f);
69 fwrite(m.boxes_.data(), sizeof(BoundingBox), header.meshCount, f);
70 fwrite(m.indexData_.data(), 1, header.indexDataSize, f);
71 fwrite(m.vertexData_.data(), 1, header.vertexDataSize, f);
72
73 fclose(f);
74}
75
76void saveBoundingBoxes(const char* fileName, const std::vector<BoundingBox>& boxes)
77{

Callers 4

processSceneFunction · 0.85
mergeBistroFunction · 0.85
generateMeshFileFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected