297{
300
301 fwrite(
bbcorn1,
sizeof(
float), 3, output);
302 fwrite(
bbcorn2,
sizeof(
float), 3, output);
304 int nColTriangles = 0;
306 {
307 char GRP[] = "GRP ";
308 fwrite(GRP, 1, 4, output);
309
310 int k = 0;
312 MobaEx =
new int[moba_batch * 4];
314 {
316 }
317 int moba_size_grp = moba_batch * 4 + 4;
318 fwrite(&moba_size_grp, 4, 1, output);
319 fwrite(&moba_batch, 4, 1, output);
320 fwrite(
MobaEx, 4, k, output);
322
324
325 if (fwrite("INDX", 4, 1, output) != 1)
326 {
327 printf("Error while writing file nbraches ID");
328 exit(0);
329 }
330 int wsize =
sizeof(
uint32) +
sizeof(
unsigned short) * nIdexes;
331 if (fwrite(&wsize, sizeof(int), 1, output) != 1)
332 {
333 printf("Error while writing file wsize");
334
335 }
336 if (fwrite(&nIdexes,
sizeof(
uint32), 1, output) != 1)
337 {
338 printf("Error while writing file nIndexes");
339 exit(0);
340 }
341 if (nIdexes > 0)
342 {
343 if (fwrite(
MOVI,
sizeof(
unsigned short), nIdexes, output) != nIdexes)
344 {
345 printf("Error while writing file indexarray");
346 exit(0);
347 }
348 }
349
350 if (fwrite("VERT", 4, 1, output) != 1)
351 {
352 printf("Error while writing file nbraches ID");
353 exit(0);
354 }
355 wsize =
sizeof(int) +
sizeof(
float) * 3 *
nVertices;
356 if (fwrite(&wsize, sizeof(int), 1, output) != 1)
357 {
358 printf("Error while writing file wsize");
359
360 }
361 if (fwrite(&
nVertices,
sizeof(
int), 1, output) != 1)
362 {
363 printf("Error while writing file nVertices");
364 exit(0);
365 }
367 {
369 {
370 printf("Error while writing file vectors");
371 exit(0);
372 }
373 }
374
376 }
377 else
378 {
379 char GRP[] = "GRP ";
380 fwrite(GRP, 1, 4, output);
381 int k = 0;
383 MobaEx =
new int[moba_batch * 4];
385 {
387 }
388
389 int moba_size_grp = moba_batch * 4 + 4;
390 fwrite(&moba_size_grp, 4, 1, output);
391 fwrite(&moba_batch, 4, 1, output);
392 fwrite(
MobaEx, 4, k, output);
394
395
396
399 memset(IndexRenum, 0xFF,
nVertices *
sizeof(
int));
401 {
402
403
405 bool isCollisionOnlyFace =
static_cast<unsigned char>(
MOPY[(2 * i) + 1]) == 0xFF;
407 if (!isCollision)
408 continue;
409
410 for (int j = 0; j < 3; ++j)
411 {
412 IndexRenum[
MOVI[3 * i + j]] = 1;
413 MoviEx[3 * nColTriangles + j] =
MOVI[3 * i + j];
414 }
415 ++nColTriangles;
416 }
417
418
419 int nColVertices = 0;
421 {
422 if (IndexRenum[i] == 1)
423 {
424 IndexRenum[i] = nColVertices;
425 ++nColVertices;
426 }
427 }
428
429
430 for (int i = 0; i < 3 * nColTriangles; ++i)
431 {
434 }
435
436
437 int INDX[] = {0x58444E49, nColTriangles * 6 + 4, nColTriangles * 3};
438 fwrite(INDX, 4, 3, output);
439 fwrite(
MoviEx, 2, nColTriangles * 3, output);
440
441
442 int VERT[] = {0x54524556, nColVertices * 3 * static_cast<int>(sizeof(float)) + 4, nColVertices};
443 int check = 3 * nColVertices;
444 fwrite(VERT, 4, 3, output);
446 if (IndexRenum[i] >= 0)
447 check -= fwrite(
MOVT + 3 * i,
sizeof(
float), 3, output);
448
449 assert(check == 0);
450
452 delete [] IndexRenum;
453 }
454
455
457 {
458 int LIQU_totalSize =
sizeof(
uint32);
460 {
464 }
465
466 int LIQU_h[] = { 0x5551494C, LIQU_totalSize };
467 fwrite(LIQU_h, 4, 2, output);
468
469
470
471
472
473
476 {
478
480 fwrite(&
LiquEx[i].height,
sizeof(
float), 1, output);
483 }
484 }
485
486 return nColTriangles;
487}
std::uint32_t uint32
Definition Define.h:107
std::uint16_t uint16
Definition Define.h:108
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