| 7 |  |  | 
| 8 |  | #include <string.h> | 
| 9 |  |  | 
| 10 | < | #include "standard.h" | 
| 10 | > | #include "rtio.h" | 
| 11 | > | #include "rtmath.h" | 
| 12 | > | #include "rterror.h" | 
| 13 | > | #include "paths.h" | 
| 14 |  | #include "octree.h" | 
| 15 |  | #include "object.h" | 
| 16 |  | #include "otypes.h" | 
| 32 |  |  | 
| 33 |  |  | 
| 34 |  | static unsigned long | 
| 35 | < | cvhash(cvp)                             /* hash an encoded vertex */ | 
| 33 | < | MCVERT  *cvp; | 
| 35 | > | cvhash(const char *p)                   /* hash an encoded vertex */ | 
| 36 |  | { | 
| 37 | + | const MCVERT    *cvp = (const MCVERT *)p; | 
| 38 |  | unsigned long   hval; | 
| 39 |  |  | 
| 40 |  | if (!(cvp->fl & MT_V)) | 
| 49 |  |  | 
| 50 |  |  | 
| 51 |  | static int | 
| 52 | < | cvcmp(v1, v2)                           /* compare encoded vertices */ | 
| 50 | < | register MCVERT *v1, *v2; | 
| 52 | > | cvcmp(const char *vv1, const char *vv2)         /* compare encoded vertices */ | 
| 53 |  | { | 
| 54 | + | const MCVERT    *v1 = (const MCVERT *)vv1, *v2 = (const MCVERT *)vv2; | 
| 55 | + |  | 
| 56 |  | if (v1->fl != v2->fl) | 
| 57 |  | return(1); | 
| 58 |  | if (v1->xyz[0] != v2->xyz[0]) | 
| 74 |  |  | 
| 75 |  |  | 
| 76 |  | MESH * | 
| 77 | < | getmesh(mname, flags)                   /* get new mesh data reference */ | 
| 78 | < | char    *mname; | 
| 79 | < | int     flags; | 
| 77 | > | getmesh(                                /* get new mesh data reference */ | 
| 78 | > | char    *mname, | 
| 79 | > | int     flags | 
| 80 | > | ) | 
| 81 |  | { | 
| 82 |  | char  *pathname; | 
| 83 | < | register MESH  *ms; | 
| 83 | > | MESH  *ms; | 
| 84 |  |  | 
| 85 |  | flags &= IO_LEGAL; | 
| 86 |  | for (ms = mlist; ms != NULL; ms = ms->next) | 
| 100 |  | } | 
| 101 |  | if ((pathname = getpath(mname, getrlibpath(), R_OK)) == NULL) { | 
| 102 |  | sprintf(errmsg, "cannot find mesh file \"%s\"", mname); | 
| 103 | < | error(USER, errmsg); | 
| 103 | > | error(SYSTEM, errmsg); | 
| 104 |  | } | 
| 105 |  | flags &= ~ms->ldflags; | 
| 106 |  | if (flags) | 
| 110 |  |  | 
| 111 |  |  | 
| 112 |  | MESHINST * | 
| 113 | < | getmeshinst(o, flags)                   /* create mesh instance */ | 
| 114 | < | OBJREC  *o; | 
| 115 | < | int     flags; | 
| 113 | > | getmeshinst(                            /* create mesh instance */ | 
| 114 | > | OBJREC  *o, | 
| 115 | > | int     flags | 
| 116 | > | ) | 
| 117 |  | { | 
| 118 | < | register MESHINST  *ins; | 
| 118 | > | MESHINST  *ins; | 
| 119 |  |  | 
| 120 |  | flags &= IO_LEGAL; | 
| 121 |  | if ((ins = (MESHINST *)o->os) == NULL) { | 
| 144 |  |  | 
| 145 |  |  | 
| 146 |  | int | 
| 147 | < | getmeshtrivid(tvid, mo, mp, ti)         /* get triangle vertex ID's */ | 
| 148 | < | int32   tvid[3]; | 
| 149 | < | OBJECT  *mo; | 
| 150 | < | MESH    *mp; | 
| 145 | < | OBJECT  ti; | 
| 147 | > | nextmeshtri(                            /* get next triangle ID */ | 
| 148 | > | OBJECT *tip, | 
| 149 | > | MESH *mp | 
| 150 | > | ) | 
| 151 |  | { | 
| 152 | + | int             pn; | 
| 153 | + | MESHPATCH       *pp; | 
| 154 | + |  | 
| 155 | + | pn = ++(*tip) >> 10;                    /* next triangle (OVOID init) */ | 
| 156 | + | while (pn < mp->npatches) { | 
| 157 | + | pp = &mp->patch[pn]; | 
| 158 | + | if (!(*tip & 0x200)) {          /* local triangle? */ | 
| 159 | + | if ((*tip & 0x1ff) < pp->ntris) | 
| 160 | + | return(1); | 
| 161 | + | *tip &= ~0x1ff;         /* move on to single-joiners */ | 
| 162 | + | *tip |= 0x200; | 
| 163 | + | } | 
| 164 | + | if (!(*tip & 0x100)) {          /* single joiner? */ | 
| 165 | + | if ((*tip & 0xff) < pp->nj1tris) | 
| 166 | + | return(1); | 
| 167 | + | *tip &= ~0xff;          /* move on to double-joiners */ | 
| 168 | + | *tip |= 0x100; | 
| 169 | + | } | 
| 170 | + | if ((*tip & 0xff) < pp->nj2tris) | 
| 171 | + | return(1); | 
| 172 | + | *tip = ++pn << 10;              /* first in next patch */ | 
| 173 | + | } | 
| 174 | + | return(0);                              /* out of patches */ | 
| 175 | + | } | 
| 176 | + |  | 
| 177 | + | int | 
| 178 | + | getmeshtrivid(                          /* get triangle vertex ID's */ | 
| 179 | + | int32   tvid[3], | 
| 180 | + | OBJECT  *mo, | 
| 181 | + | MESH    *mp, | 
| 182 | + | OBJECT  ti | 
| 183 | + | ) | 
| 184 | + | { | 
| 185 |  | int             pn = ti >> 10; | 
| 186 |  | MESHPATCH       *pp; | 
| 187 |  |  | 
| 237 |  |  | 
| 238 |  |  | 
| 239 |  | int | 
| 240 | < | getmeshvert(vp, mp, vid, what)  /* get triangle vertex from ID */ | 
| 241 | < | MESHVERT        *vp; | 
| 242 | < | MESH            *mp; | 
| 243 | < | int32           vid; | 
| 244 | < | int             what; | 
| 240 | > | getmeshvert(                            /* get triangle vertex from ID */ | 
| 241 | > | MESHVERT        *vp, | 
| 242 | > | MESH            *mp, | 
| 243 | > | int32           vid, | 
| 244 | > | int             what | 
| 245 | > | ) | 
| 246 |  | { | 
| 247 |  | int             pn = vid >> 8; | 
| 248 |  | MESHPATCH       *pp; | 
| 249 |  | double          vres; | 
| 250 | < | register int    i; | 
| 250 | > | int     i; | 
| 251 |  |  | 
| 252 |  | vp->fl = 0; | 
| 253 |  | if (pn >= mp->npatches) | 
| 282 |  |  | 
| 283 |  |  | 
| 284 |  | OBJREC * | 
| 285 | < | getmeshpseudo(mp, mo)           /* get mesh pseudo object for material */ | 
| 286 | < | MESH    *mp; | 
| 287 | < | OBJECT  mo; | 
| 285 | > | getmeshpseudo(                  /* get mesh pseudo object for material */ | 
| 286 | > | MESH    *mp, | 
| 287 | > | OBJECT  mo | 
| 288 | > | ) | 
| 289 |  | { | 
| 290 | < | if (mo < mp->mat0 || mo >= mp->mat0 + mp->nmats) | 
| 290 | > | if ((mo < mp->mat0) | (mo >= mp->mat0 + mp->nmats)) | 
| 291 |  | error(INTERNAL, "modifier out of range in getmeshpseudo"); | 
| 292 |  | if (mp->pseudo == NULL) { | 
| 293 | < | register int    i; | 
| 293 | > | int     i; | 
| 294 |  | mp->pseudo = (OBJREC *)calloc(mp->nmats, sizeof(OBJREC)); | 
| 295 |  | if (mp->pseudo == NULL) | 
| 296 |  | error(SYSTEM, "out of memory in getmeshpseudo"); | 
| 305 |  |  | 
| 306 |  |  | 
| 307 |  | int | 
| 308 | < | getmeshtri(tv, mo, mp, ti, wha) /* get triangle vertices */ | 
| 309 | < | MESHVERT        tv[3]; | 
| 310 | < | OBJECT          *mo; | 
| 311 | < | MESH            *mp; | 
| 312 | < | OBJECT          ti; | 
| 313 | < | int             wha; | 
| 308 | > | getmeshtri(                     /* get triangle vertices */ | 
| 309 | > | MESHVERT        tv[3], | 
| 310 | > | OBJECT          *mo, | 
| 311 | > | MESH            *mp, | 
| 312 | > | OBJECT          ti, | 
| 313 | > | int             wha | 
| 314 | > | ) | 
| 315 |  | { | 
| 316 |  | int32   tvid[3]; | 
| 317 |  |  | 
| 327 |  |  | 
| 328 |  |  | 
| 329 |  | int32 | 
| 330 | < | addmeshvert(mp, vp)             /* find/add a mesh vertex */ | 
| 331 | < | register MESH   *mp; | 
| 332 | < | MESHVERT        *vp; | 
| 330 | > | addmeshvert(                    /* find/add a mesh vertex */ | 
| 331 | > | MESH            *mp, | 
| 332 | > | MESHVERT        *vp | 
| 333 | > | ) | 
| 334 |  | { | 
| 335 | < | LUENT           *lvp; | 
| 336 | < | MCVERT          cv; | 
| 337 | < | register int    i; | 
| 335 | > | LUENT   *lvp; | 
| 336 | > | MCVERT  cv; | 
| 337 | > | int     i; | 
| 338 |  |  | 
| 339 |  | if (!(vp->fl & MT_V)) | 
| 340 |  | return(-1); | 
| 348 |  | (vp->v[i] - mp->mcube.cuorg[i]) / | 
| 349 |  | mp->mcube.cusize); | 
| 350 |  | } | 
| 351 | < | if (vp->fl & MT_N) | 
| 351 | > | if (vp->fl & MT_N)              /* assumes normalized! */ | 
| 352 |  | cv.norm = encodedir(vp->n); | 
| 353 |  | if (vp->fl & MT_UV) | 
| 354 |  | for (i = 0; i < 2; i++) { | 
| 374 |  | goto nomem; | 
| 375 |  | if (lvp->key == NULL) { | 
| 376 |  | lvp->key = (char *)malloc(sizeof(MCVERT)+sizeof(int32)); | 
| 377 | < | memcpy((void *)lvp->key, (void *)&cv, sizeof(MCVERT)); | 
| 377 | > | memcpy(lvp->key, &cv, sizeof(MCVERT)); | 
| 378 |  | } | 
| 379 |  | if (lvp->data == NULL) {        /* new vertex */ | 
| 380 | < | register MESHPATCH      *pp; | 
| 380 | > | MESHPATCH       *pp; | 
| 381 |  | if (mp->npatches <= 0) { | 
| 382 |  | mp->patch = (MESHPATCH *)calloc(MPATCHBLKSIZ, | 
| 383 |  | sizeof(MESHPATCH)); | 
| 385 |  | goto nomem; | 
| 386 |  | mp->npatches = 1; | 
| 387 |  | } else if (mp->patch[mp->npatches-1].nverts >= 256) { | 
| 388 | + | if (mp->npatches >= 1L<<22) | 
| 389 | + | error(INTERNAL, "too many mesh patches"); | 
| 390 |  | if (mp->npatches % MPATCHBLKSIZ == 0) { | 
| 391 | < | mp->patch = (MESHPATCH *)realloc( | 
| 392 | < | (void *)mp->patch, | 
| 393 | < | (mp->npatches + MPATCHBLKSIZ)* | 
| 394 | < | sizeof(MESHPATCH)); | 
| 351 | < | memset((void *)(mp->patch + mp->npatches), '\0', | 
| 391 | > | mp->patch = (MESHPATCH *)realloc(mp->patch, | 
| 392 | > | (mp->npatches + MPATCHBLKSIZ)* | 
| 393 | > | sizeof(MESHPATCH)); | 
| 394 | > | memset((mp->patch + mp->npatches), '\0', | 
| 395 |  | MPATCHBLKSIZ*sizeof(MESHPATCH)); | 
| 396 |  | } | 
| 397 | < | if (mp->npatches++ >= 1L<<22) | 
| 355 | < | error(INTERNAL, "too many mesh patches"); | 
| 397 | > | mp->npatches++; | 
| 398 |  | } | 
| 399 |  | pp = &mp->patch[mp->npatches-1]; | 
| 400 |  | if (pp->xyz == NULL) { | 
| 434 |  |  | 
| 435 |  |  | 
| 436 |  | OBJECT | 
| 437 | < | addmeshtri(mp, tv, mo)          /* add a new mesh triangle */ | 
| 438 | < | MESH            *mp; | 
| 439 | < | MESHVERT        tv[3]; | 
| 440 | < | OBJECT          mo; | 
| 437 | > | addmeshtri(                     /* add a new mesh triangle */ | 
| 438 | > | MESH            *mp, | 
| 439 | > | MESHVERT        tv[3], | 
| 440 | > | OBJECT          mo | 
| 441 | > | ) | 
| 442 |  | { | 
| 443 | < | int32                   vid[3], t; | 
| 444 | < | int                     pn[3], i; | 
| 445 | < | register MESHPATCH      *pp; | 
| 443 | > | int32           vid[3], t; | 
| 444 | > | int             pn[3], i; | 
| 445 | > | MESHPATCH       *pp; | 
| 446 |  |  | 
| 447 |  | if (!(tv[0].fl & tv[1].fl & tv[2].fl & MT_V)) | 
| 448 |  | return(OVOID); | 
| 453 |  | pn[i] = vid[i] >> 8; | 
| 454 |  | } | 
| 455 |  | /* normalize material index */ | 
| 456 | < | if (mo != OVOID) | 
| 456 | > | if (mo != OVOID) { | 
| 457 |  | if ((mo -= mp->mat0) >= mp->nmats) | 
| 458 |  | mp->nmats = mo+1; | 
| 459 |  | else if (mo < 0) | 
| 460 |  | error(INTERNAL, "modifier range error in addmeshtri"); | 
| 461 | + | } | 
| 462 |  | /* assign triangle */ | 
| 463 | < | if (pn[0] == pn[1] && pn[1] == pn[2]) { /* local case */ | 
| 463 | > | if ((pn[0] == pn[1]) & (pn[1] == pn[2])) {      /* local case */ | 
| 464 |  | pp = &mp->patch[pn[0]]; | 
| 465 |  | if (pp->tri == NULL) { | 
| 466 |  | pp->tri = (struct PTri *)malloc( | 
| 486 |  | pp->trimat[pp->ntris] = mo; | 
| 487 |  | return(pn[0] << 10 | pp->ntris++); | 
| 488 |  | } | 
| 489 | < | } | 
| 446 | < | if (pn[0] == pn[1]) { | 
| 489 | > | } else if (pn[0] == pn[1]) { | 
| 490 |  | t = vid[2]; vid[2] = vid[1]; vid[1] = vid[0]; vid[0] = t; | 
| 491 |  | i = pn[2]; pn[2] = pn[1]; pn[1] = pn[0]; pn[0] = i; | 
| 492 |  | } else if (pn[0] == pn[2]) { | 
| 510 |  | } | 
| 511 |  | } | 
| 512 |  | /* double link */ | 
| 513 | < | pp = &mp->patch[pn[2]]; | 
| 513 | > | pp = &mp->patch[pn[i=0]]; | 
| 514 | > | if (pp->nj2tris >= 256) | 
| 515 | > | pp = &mp->patch[pn[i=1]]; | 
| 516 | > | if (pp->nj2tris >= 256) | 
| 517 | > | pp = &mp->patch[pn[i=2]]; | 
| 518 | > | if (pp->nj2tris >= 256) | 
| 519 | > | error(INTERNAL, "too many patch triangles in addmeshtri"); | 
| 520 |  | if (pp->j2tri == NULL) { | 
| 521 |  | pp->j2tri = (struct PJoin2 *)malloc( | 
| 522 |  | 256*sizeof(struct PJoin2)); | 
| 523 |  | if (pp->j2tri == NULL) | 
| 524 |  | goto nomem; | 
| 525 |  | } | 
| 477 | – | if (pp->nj2tris >= 256) | 
| 478 | – | error(INTERNAL, "too many patch triangles in addmeshtri"); | 
| 479 | – | pp->j2tri[pp->nj2tris].v1j = vid[0]; | 
| 480 | – | pp->j2tri[pp->nj2tris].v2j = vid[1]; | 
| 481 | – | pp->j2tri[pp->nj2tris].v3 = vid[2] & 0xff; | 
| 526 |  | pp->j2tri[pp->nj2tris].mat = mo; | 
| 527 | < | return(pn[2] << 10 | 0x300 | pp->nj2tris++); | 
| 527 | > | switch (i) { | 
| 528 | > | case 0: | 
| 529 | > | pp->j2tri[pp->nj2tris].v3 = vid[0] & 0xff; | 
| 530 | > | pp->j2tri[pp->nj2tris].v1j = vid[1]; | 
| 531 | > | pp->j2tri[pp->nj2tris].v2j = vid[2]; | 
| 532 | > | return(pn[0] << 10 | 0x300 | pp->nj2tris++); | 
| 533 | > | case 1: | 
| 534 | > | pp->j2tri[pp->nj2tris].v2j = vid[0]; | 
| 535 | > | pp->j2tri[pp->nj2tris].v3 = vid[1] & 0xff; | 
| 536 | > | pp->j2tri[pp->nj2tris].v1j = vid[2]; | 
| 537 | > | return(pn[1] << 10 | 0x300 | pp->nj2tris++); | 
| 538 | > | case 2: | 
| 539 | > | pp->j2tri[pp->nj2tris].v1j = vid[0]; | 
| 540 | > | pp->j2tri[pp->nj2tris].v2j = vid[1]; | 
| 541 | > | pp->j2tri[pp->nj2tris].v3 = vid[2] & 0xff; | 
| 542 | > | return(pn[2] << 10 | 0x300 | pp->nj2tris++); | 
| 543 | > | } | 
| 544 |  | nomem: | 
| 545 |  | error(SYSTEM, "out of memory in addmeshtri"); | 
| 546 |  | return(OVOID); | 
| 548 |  |  | 
| 549 |  |  | 
| 550 |  | char * | 
| 551 | < | checkmesh(mp)                           /* validate mesh data */ | 
| 492 | < | register MESH   *mp; | 
| 551 | > | checkmesh(MESH *mp)                     /* validate mesh data */ | 
| 552 |  | { | 
| 553 |  | static char     embuf[128]; | 
| 554 |  | int             nouvbounds = 1; | 
| 555 | < | register int    i; | 
| 555 | > | int             i; | 
| 556 |  | /* basic checks */ | 
| 557 |  | if (mp == NULL) | 
| 558 |  | return("NULL mesh pointer"); | 
| 592 |  | if (mp->npatches <= 0) | 
| 593 |  | error(WARNING, "no patches in mesh"); | 
| 594 |  | for (i = 0; i < mp->npatches; i++) { | 
| 595 | < | register MESHPATCH      *pp = &mp->patch[i]; | 
| 595 | > | MESHPATCH       *pp = &mp->patch[i]; | 
| 596 |  | if (pp->nverts <= 0) | 
| 597 |  | error(WARNING, "no vertices in patch"); | 
| 598 |  | else { | 
| 601 |  | if (nouvbounds && pp->uv != NULL) | 
| 602 |  | return("unreferenced uv coordinates"); | 
| 603 |  | } | 
| 545 | – | if (pp->ntris + pp->nj1tris + pp->nj2tris <= 0) | 
| 546 | – | error(WARNING, "no triangles in patch"); | 
| 604 |  | if (pp->ntris > 0 && pp->tri == NULL) | 
| 605 |  | return("missing patch triangle list"); | 
| 606 |  | if (pp->nj1tris > 0 && pp->j1tri == NULL) | 
| 614 |  |  | 
| 615 |  |  | 
| 616 |  | static void | 
| 617 | < | tallyoctree(ot, ecp, lcp, ocp)  /* tally octree size */ | 
| 618 | < | OCTREE  ot; | 
| 619 | < | int     *ecp, *lcp, *ocp; | 
| 617 | > | tallyoctree(                    /* tally octree size */ | 
| 618 | > | OCTREE  ot, | 
| 619 | > | int     *ecp, | 
| 620 | > | int     *lcp, | 
| 621 | > | int     *ocp | 
| 622 | > | ) | 
| 623 |  | { | 
| 624 |  | int     i; | 
| 625 |  |  | 
| 640 |  |  | 
| 641 |  |  | 
| 642 |  | void | 
| 643 | < | printmeshstats(ms, fp)          /* print out mesh statistics */ | 
| 644 | < | MESH    *ms; | 
| 645 | < | FILE    *fp; | 
| 643 | > | printmeshstats(                 /* print out mesh statistics */ | 
| 644 | > | MESH    *ms, | 
| 645 | > | FILE    *fp | 
| 646 | > | ) | 
| 647 |  | { | 
| 648 |  | int     lfcnt=0, lecnt=0, locnt=0; | 
| 649 |  | int     vcnt=0, ncnt=0, uvcnt=0; | 
| 653 |  |  | 
| 654 |  | tallyoctree(ms->mcube.cutree, &lecnt, &lfcnt, &locnt); | 
| 655 |  | for (i = 0; i < ms->npatches; i++) { | 
| 656 | < | register MESHPATCH      *pp = &ms->patch[i]; | 
| 656 | > | MESHPATCH       *pp = &ms->patch[i]; | 
| 657 |  | vcnt += pp->nverts; | 
| 658 |  | if (pp->norm != NULL) { | 
| 659 |  | for (j = pp->nverts; j--; ) | 
| 672 |  | t2cnt += pp->nj2tris; | 
| 673 |  | } | 
| 674 |  | fprintf(fp, "Mesh statistics:\n"); | 
| 675 | < | fprintf(fp, "\t%ld materials\n", ms->nmats); | 
| 675 | > | fprintf(fp, "\t%ld materials\n", (long)ms->nmats); | 
| 676 |  | fprintf(fp, "\t%d patches (%.2f MBytes)\n", ms->npatches, | 
| 677 |  | (ms->npatches*sizeof(MESHPATCH) + | 
| 678 |  | vcnt*3*sizeof(uint32) + | 
| 695 |  |  | 
| 696 |  |  | 
| 697 |  | void | 
| 698 | < | freemesh(ms)                    /* free mesh data */ | 
| 638 | < | register MESH   *ms; | 
| 698 | > | freemesh(MESH *ms)              /* free mesh data */ | 
| 699 |  | { | 
| 700 |  | MESH    mhead; | 
| 701 |  | MESH    *msp; | 
| 723 |  | octfree(ms->mcube.cutree); | 
| 724 |  | lu_done(&ms->lut); | 
| 725 |  | if (ms->npatches > 0) { | 
| 726 | < | register MESHPATCH      *pp = ms->patch + ms->npatches; | 
| 726 | > | MESHPATCH       *pp = ms->patch + ms->npatches; | 
| 727 |  | while (pp-- > ms->patch) { | 
| 728 |  | if (pp->j2tri != NULL) | 
| 729 | < | free((void *)pp->j2tri); | 
| 729 | > | free(pp->j2tri); | 
| 730 |  | if (pp->j1tri != NULL) | 
| 731 | < | free((void *)pp->j1tri); | 
| 731 | > | free(pp->j1tri); | 
| 732 |  | if (pp->tri != NULL) | 
| 733 | < | free((void *)pp->tri); | 
| 733 | > | free(pp->tri); | 
| 734 |  | if (pp->uv != NULL) | 
| 735 | < | free((void *)pp->uv); | 
| 735 | > | free(pp->uv); | 
| 736 |  | if (pp->norm != NULL) | 
| 737 | < | free((void *)pp->norm); | 
| 737 | > | free(pp->norm); | 
| 738 |  | if (pp->xyz != NULL) | 
| 739 | < | free((void *)pp->xyz); | 
| 739 | > | free(pp->xyz); | 
| 740 | > | if (pp->trimat != NULL) | 
| 741 | > | free(pp->trimat); | 
| 742 |  | } | 
| 743 | < | free((void *)ms->patch); | 
| 743 | > | free(ms->patch); | 
| 744 |  | } | 
| 745 |  | if (ms->pseudo != NULL) | 
| 746 | < | free((void *)ms->pseudo); | 
| 747 | < | free((void *)ms); | 
| 746 | > | free(ms->pseudo); | 
| 747 | > | free(ms); | 
| 748 |  | } | 
| 749 |  |  | 
| 750 |  |  | 
| 751 |  | void | 
| 752 | < | freemeshinst(o)                 /* free mesh instance */ | 
| 691 | < | OBJREC  *o; | 
| 752 | > | freemeshinst(OBJREC *o)         /* free mesh instance */ | 
| 753 |  | { | 
| 754 |  | if (o->os == NULL) | 
| 755 |  | return; | 
| 756 |  | freemesh((*(MESHINST *)o->os).msh); | 
| 757 | < | free((void *)o->os); | 
| 757 | > | free(o->os); | 
| 758 |  | o->os = NULL; | 
| 759 |  | } |