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
398
400 bool isCollisionOnlyFace =
static_cast<unsigned char>(
MOPY[(2 * i) + 1]) == 0xFF;
402 if (!isCollision)
403 continue;
404
405 for (int j = 0; j < 3; ++j)
406 {
407 IndexRenum[
MOVI[3 * i + j]] = 1;
408 MoviEx[3 * nColTriangles + j] =
MOVI[3 * i + j];
409 }
410 ++nColTriangles;
411 }
412
413
414 int nColVertices = 0;
416 {
417 if (IndexRenum[i] == 1)
418 {
419 IndexRenum[i] = nColVertices;
420 ++nColVertices;
421 }
422 }
423
424
425 for (int i = 0; i < 3 * nColTriangles; ++i)
426 {
429 }
430
431
432 int INDX[] = {0x58444E49, nColTriangles * 6 + 4, nColTriangles * 3};
433 fwrite(INDX, 4, 3, output);
434 fwrite(
MoviEx, 2, nColTriangles * 3, output);
435
436
437 int VERT[] = {0x54524556, nColVertices * 3 * static_cast<int>(sizeof(float)) + 4, nColVertices};
438 int check = 3 * nColVertices;
439 fwrite(VERT, 4, 3, output);
441 if (IndexRenum[i] >= 0)
442 check -= fwrite(
MOVT + 3 * i,
sizeof(
float), 3, output);
443
444 assert(check == 0);
445
447 delete [] IndexRenum;
448 }
449
450
452 {
453 int LIQU_totalSize =
sizeof(
uint32);
455 {
459 }
460
461 int LIQU_h[] = { 0x5551494C, LIQU_totalSize };
462 fwrite(LIQU_h, 4, 2, output);
463
464
465
466
467
468
471 {
473
475 fwrite(&
LiquEx[i].height,
sizeof(
float), 1, output);
478 }
479 }
480
481 return nColTriangles;
482}
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