Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
466 B
0
Indexable
Never
MeshHeader header;
	memset(&header, 0, sizeof(header));
	FILE* f = fopen(fileName, "rb");
	fread(&header, sizeof(header), 1, f);

	if (header.Version != MESH_VERSION)
	{
		printf("Mesh version mismatch for %s\n", fileName);

		return 0;
	}

	Mesh* ret = new Mesh();
	ret->NumVertices = header.NumVertices;
	ret->Vertices = new MeshVertex[header.NumVertices];
	fread(ret->Vertices, sizeof(MeshVertex), ret->NumVertices, f);
	fclose(f);

	return ret;
Leave a Comment