293{
296
297 fwrite(
bbcorn1,
sizeof(
float), 3, output);
298 fwrite(
bbcorn2,
sizeof(
float), 3, output);
300 int nColTriangles = 0;
302 {
303 char GRP[] = "GRP ";
304 fwrite(GRP, 1, 4, output);
305
306 int k = 0;
308 MobaEx =
new int[moba_batch * 4];
310 {
312 }
313 int moba_size_grp = moba_batch * 4 + 4;
314 fwrite(&moba_size_grp, 4, 1, output);
315 fwrite(&moba_batch, 4, 1, output);
316 fwrite(
MobaEx, 4, k, output);
318
320
321 if (fwrite("INDX", 4, 1, output) != 1)
322 {
323 printf("Error while writing file nbraches ID");
324 exit(0);
325 }
326 int wsize =
sizeof(
uint32) +
sizeof(
unsigned short) * nIdexes;
327 if (fwrite(&wsize, sizeof(int), 1, output) != 1)
328 {
329 printf("Error while writing file wsize");
330
331 }
332 if (fwrite(&nIdexes,
sizeof(
uint32), 1, output) != 1)
333 {
334 printf("Error while writing file nIndexes");
335 exit(0);
336 }
337 if (nIdexes > 0)
338 {
339 if (fwrite(
MOVI,
sizeof(
unsigned short), nIdexes, output) != nIdexes)
340 {
341 printf("Error while writing file indexarray");
342 exit(0);
343 }
344 }
345
346 if (fwrite("VERT", 4, 1, output) != 1)
347 {
348 printf("Error while writing file nbraches ID");
349 exit(0);
350 }
351 wsize =
sizeof(int) +
sizeof(
float) * 3 *
nVertices;
352 if (fwrite(&wsize, sizeof(int), 1, output) != 1)
353 {
354 printf("Error while writing file wsize");
355
356 }
357 if (fwrite(&
nVertices,
sizeof(
int), 1, output) != 1)
358 {
359 printf("Error while writing file nVertices");
360 exit(0);
361 }
363 {
365 {
366 printf("Error while writing file vectors");
367 exit(0);
368 }
369 }
370
372 }
373 else
374 {
375 char GRP[] = "GRP ";
376 fwrite(GRP, 1, 4, output);
377 int k = 0;
379 MobaEx =
new int[moba_batch * 4];
381 {
383 }
384
385 int moba_size_grp = moba_batch * 4 + 4;
386 fwrite(&moba_size_grp, 4, 1, output);
387 fwrite(&moba_batch, 4, 1, output);
388 fwrite(
MobaEx, 4, k, output);
390
391
392
395 memset(IndexRenum, 0xFF,
nVertices *
sizeof(
int));
397 {
398
401 if (!isCollision)
402 continue;
403
404 for (int j = 0; j < 3; ++j)
405 {
406 IndexRenum[
MOVI[3 * i + j]] = 1;
407 MoviEx[3 * nColTriangles + j] =
MOVI[3 * i + j];
408 }
409 ++nColTriangles;
410 }
411
412
413 int nColVertices = 0;
415 {
416 if (IndexRenum[i] == 1)
417 {
418 IndexRenum[i] = nColVertices;
419 ++nColVertices;
420 }
421 }
422
423
424 for (int i = 0; i < 3 * nColTriangles; ++i)
425 {
428 }
429
430
431 int INDX[] = {0x58444E49, nColTriangles * 6 + 4, nColTriangles * 3};
432 fwrite(INDX, 4, 3, output);
433 fwrite(
MoviEx, 2, nColTriangles * 3, output);
434
435
436 int VERT[] = {0x54524556, nColVertices * 3 * static_cast<int>(sizeof(float)) + 4, nColVertices};
437 int check = 3 * nColVertices;
438 fwrite(VERT, 4, 3, output);
440 if (IndexRenum[i] >= 0)
441 check -= fwrite(
MOVT + 3 * i,
sizeof(
float), 3, output);
442
443 assert(check == 0);
444
446 delete [] IndexRenum;
447 }
448
449
451 {
452 int LIQU_totalSize =
sizeof(
uint32);
454 {
458 }
459
460 int LIQU_h[] = { 0x5551494C, LIQU_totalSize };
461 fwrite(LIQU_h, 4, 2, output);
462
463
464
465
466
467
470 {
472
474 fwrite(&
LiquEx[i].height,
sizeof(
float), 1, output);
477 }
478 }
479
480 return nColTriangles;
481}
bool preciseVectorData
Definition: vmapexport.cpp:63
@ WMO_MATERIAL_DETAIL
Definition: wmo.h:34
@ WMO_MATERIAL_COLLISION
Definition: wmo.h:35
@ WMO_MATERIAL_RENDER
Definition: wmo.h:37
std::uint32_t uint32
Definition: Define.h:107
std::uint16_t uint16
Definition: Define.h:108
int ytiles
Definition: wmo.h:101
int xtiles
Definition: wmo.h:101