71{
72 int N[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
73 FILE* output = fopen(outfilename, "wb");
74 if (!output)
75 {
76 printf("Can't create the output file '%s'\n", outfilename);
77 return false;
78 }
81 fwrite(&nVertices, sizeof(int), 1, output);
83 fwrite(&nofgroups,
sizeof(
uint32), 1, output);
84 fwrite(N, 4 * 3, 1, output);
85 fwrite(N, sizeof(float), 3 * 2, output);
86 fwrite(N, 4, 1, output);
87 fwrite("GRP ", 4, 1, output);
89 int wsize;
90 wsize =
sizeof(branches) +
sizeof(
uint32) * branches;
91 fwrite(&wsize, sizeof(int), 1, output);
92 fwrite(&branches, sizeof(branches), 1, output);
94 fwrite(&nIndexes,
sizeof(
uint32), 1, output);
95 fwrite("INDX", 4, 1, output);
96 wsize =
sizeof(
uint32) +
sizeof(
unsigned short) * nIndexes;
97 fwrite(&wsize, sizeof(int), 1, output);
98 fwrite(&nIndexes,
sizeof(
uint32), 1, output);
99 if (nIndexes > 0)
100 {
101 for (
uint32 i = 0; i < nIndexes; ++i)
102 {
103 if ((i % 3) - 1 == 0 && i + 1 < nIndexes)
104 {
108 }
109 }
110 fwrite(
indices,
sizeof(
unsigned short), nIndexes, output);
111 }
112 fwrite("VERT", 4, 1, output);
113 wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
114 fwrite(&wsize, sizeof(int), 1, output);
115 fwrite(&nVertices, sizeof(int), 1, output);
116 if (nVertices > 0)
117 {
118 for (
uint32 vpos = 0; vpos < nVertices; ++vpos)
119 {
123 }
124
125 fwrite(
vertices,
sizeof(
float) * 3, nVertices, output);
126 }
127
128 fclose(output);
129
130 return true;
131}
std::uint32_t uint32
Definition: Define.h:108
std::uint16_t uint16
Definition: Define.h:109
const char RAW_VMAP_MAGIC[]
Definition: VMapDefinitions.h:27
uint32 nBoundingVertices
Definition: modelheaders.h:75
uint32 nBoundingTriangles
Definition: modelheaders.h:73
float y
Definition: vec3d.h:27
float z
Definition: vec3d.h:27