292{
295
296 fwrite(
bbcorn1,
sizeof(
float), 3, output);
297 fwrite(
bbcorn2,
sizeof(
float), 3, output);
299 int nColTriangles = 0;
301 {
302 char GRP[] = "GRP ";
303 fwrite(GRP, 1, 4, output);
304
305 int k = 0;
307 MobaEx =
new int[moba_batch * 4];
309 {
311 }
312 int moba_size_grp = moba_batch * 4 + 4;
313 fwrite(&moba_size_grp, 4, 1, output);
314 fwrite(&moba_batch, 4, 1, output);
315 fwrite(
MobaEx, 4, k, output);
317
319
320 if (fwrite("INDX", 4, 1, output) != 1)
321 {
322 printf("Error while writing file nbraches ID");
323 exit(0);
324 }
325 int wsize =
sizeof(
uint32) +
sizeof(
unsigned short) * nIdexes;
326 if (fwrite(&wsize, sizeof(int), 1, output) != 1)
327 {
328 printf("Error while writing file wsize");
329
330 }
331 if (fwrite(&nIdexes,
sizeof(
uint32), 1, output) != 1)
332 {
333 printf("Error while writing file nIndexes");
334 exit(0);
335 }
336 if (nIdexes > 0)
337 {
338 if (fwrite(
MOVI,
sizeof(
unsigned short), nIdexes, output) != nIdexes)
339 {
340 printf("Error while writing file indexarray");
341 exit(0);
342 }
343 }
344
345 if (fwrite("VERT", 4, 1, output) != 1)
346 {
347 printf("Error while writing file nbraches ID");
348 exit(0);
349 }
350 wsize =
sizeof(int) +
sizeof(
float) * 3 *
nVertices;
351 if (fwrite(&wsize, sizeof(int), 1, output) != 1)
352 {
353 printf("Error while writing file wsize");
354
355 }
356 if (fwrite(&
nVertices,
sizeof(
int), 1, output) != 1)
357 {
358 printf("Error while writing file nVertices");
359 exit(0);
360 }
362 {
364 {
365 printf("Error while writing file vectors");
366 exit(0);
367 }
368 }
369
371 }
372 else
373 {
374 char GRP[] = "GRP ";
375 fwrite(GRP, 1, 4, output);
376 int k = 0;
378 MobaEx =
new int[moba_batch * 4];
380 {
382 }
383
384 int moba_size_grp = moba_batch * 4 + 4;
385 fwrite(&moba_size_grp, 4, 1, output);
386 fwrite(&moba_batch, 4, 1, output);
387 fwrite(
MobaEx, 4, k, output);
389
390
391
394 memset(IndexRenum, 0xFF,
nVertices *
sizeof(
int));
396 {
397
400 if (!isCollision)
401 continue;
402
403 for (int j = 0; j < 3; ++j)
404 {
405 IndexRenum[
MOVI[3 * i + j]] = 1;
406 MoviEx[3 * nColTriangles + j] =
MOVI[3 * i + j];
407 }
408 ++nColTriangles;
409 }
410
411
412 int nColVertices = 0;
414 {
415 if (IndexRenum[i] == 1)
416 {
417 IndexRenum[i] = nColVertices;
418 ++nColVertices;
419 }
420 }
421
422
423 for (int i = 0; i < 3 * nColTriangles; ++i)
424 {
427 }
428
429
430 int INDX[] = {0x58444E49, nColTriangles * 6 + 4, nColTriangles * 3};
431 fwrite(INDX, 4, 3, output);
432 fwrite(
MoviEx, 2, nColTriangles * 3, output);
433
434
435 int VERT[] = {0x54524556, nColVertices * 3 * static_cast<int>(sizeof(float)) + 4, nColVertices};
436 int check = 3 * nColVertices;
437 fwrite(VERT, 4, 3, output);
439 if (IndexRenum[i] >= 0)
440 check -= fwrite(
MOVT + 3 * i,
sizeof(
float), 3, output);
441
442 assert(check == 0);
443
445 delete [] IndexRenum;
446 }
447
448
450 {
451 int LIQU_totalSize =
sizeof(
uint32);
453 {
457 }
458
459 int LIQU_h[] = { 0x5551494C, LIQU_totalSize };
460 fwrite(LIQU_h, 4, 2, output);
461
462
463
464
465
466
469 {
471
473 fwrite(&
LiquEx[i].height,
sizeof(
float), 1, output);
476 }
477 }
478
479 return nColTriangles;
480}
std::uint32_t uint32
Definition: Define.h:107
std::uint16_t uint16
Definition: Define.h:108
@ WMO_MATERIAL_DETAIL
Definition: wmo.h:34
@ WMO_MATERIAL_COLLISION
Definition: wmo.h:35
@ WMO_MATERIAL_RENDER
Definition: wmo.h:37
bool preciseVectorData
Definition: vmapexport.cpp:63
int ytiles
Definition: wmo.h:101
int xtiles
Definition: wmo.h:101