| 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]) |
| 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) |
| 152 |
|
int pn; |
| 153 |
|
MESHPATCH *pp; |
| 154 |
|
|
| 155 |
< |
if (*tip == OVOID) { /* check for first index */ |
| 156 |
< |
*tip = 0; |
| 157 |
< |
return(mp->npatches > 0); /* assumes 1 local triangle */ |
| 158 |
< |
} |
| 159 |
< |
pn = *tip >> 10; |
| 160 |
< |
if (pn >= mp->npatches) /* past end? */ |
| 161 |
< |
return(0); |
| 162 |
< |
pp = &mp->patch[pn]; |
| 162 |
< |
if (!(*tip & 0x200)) { /* local triangle? */ |
| 163 |
< |
if ((*tip & 0x1ff) < pp->ntris-1) { |
| 164 |
< |
++*tip; |
| 165 |
< |
return(1); |
| 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 |
< |
*tip &= ~0x1ff; /* move on to single-joiners */ |
| 165 |
< |
*tip |= 0x200; |
| 166 |
< |
if (pp->nj1tris) /* is there at least one? */ |
| 167 |
< |
return(1); |
| 168 |
< |
} |
| 172 |
< |
if (!(*tip & 0x100)) { /* single joiner? */ |
| 173 |
< |
if ((*tip & 0xff) < pp->nj1tris-1) { |
| 174 |
< |
++*tip; |
| 175 |
< |
return(1); |
| 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 |
< |
*tip &= ~0xff; /* move on to double-joiners */ |
| 178 |
< |
*tip |= 0x100; |
| 179 |
< |
if (pp->nj2tris) /* is there one? */ |
| 170 |
> |
if ((*tip & 0xff) < pp->nj2tris) |
| 171 |
|
return(1); |
| 172 |
+ |
*tip = ++pn << 10; /* first in next patch */ |
| 173 |
|
} |
| 174 |
< |
if ((*tip & 0xff) < pp->nj2tris-1) { /* double-joiner? */ |
| 183 |
< |
++*tip; |
| 184 |
< |
return(1); |
| 185 |
< |
} |
| 186 |
< |
*tip = ++pn << 10; /* first in next patch */ |
| 187 |
< |
return(pn < mp->npatches); |
| 174 |
> |
return(0); /* out of patches */ |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
int |
| 328 |
|
|
| 329 |
|
int32 |
| 330 |
|
addmeshvert( /* find/add a mesh vertex */ |
| 331 |
< |
MESH *mp, |
| 331 |
> |
MESH *mp, |
| 332 |
|
MESHVERT *vp |
| 333 |
|
) |
| 334 |
|
{ |
| 335 |
< |
LUENT *lvp; |
| 336 |
< |
MCVERT cv; |
| 335 |
> |
LUENT *lvp; |
| 336 |
> |
MCVERT cv; |
| 337 |
|
int i; |
| 338 |
|
|
| 339 |
|
if (!(vp->fl & MT_V)) |
| 440 |
|
OBJECT mo |
| 441 |
|
) |
| 442 |
|
{ |
| 443 |
< |
int32 vid[3], t; |
| 444 |
< |
int pn[3], i; |
| 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)) |
| 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 |
< |
} |
| 503 |
< |
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]) { |
| 535 |
|
{ |
| 536 |
|
static char embuf[128]; |
| 537 |
|
int nouvbounds = 1; |
| 538 |
< |
int i; |
| 538 |
> |
int i; |
| 539 |
|
/* basic checks */ |
| 540 |
|
if (mp == NULL) |
| 541 |
|
return("NULL mesh pointer"); |