10 |
|
#include "rtio.h" |
11 |
|
#include "rtmath.h" |
12 |
|
#include "rterror.h" |
13 |
< |
|
13 |
> |
#include "paths.h" |
14 |
|
#include "octree.h" |
15 |
|
#include "object.h" |
16 |
|
#include "otypes.h" |
21 |
|
int fl; |
22 |
|
uint32 xyz[3]; |
23 |
|
int32 norm; |
24 |
< |
uint16 uv[2]; |
24 |
> |
uint32 uv[2]; |
25 |
|
} MCVERT; |
26 |
|
|
27 |
|
#define MPATCHBLKSIZ 128 /* patch allocation block size */ |
30 |
|
|
31 |
|
static MESH *mlist = NULL; /* list of loaded meshes */ |
32 |
|
|
33 |
+ |
static lut_keycmpf_t cvcmp; |
34 |
+ |
static lut_hashf_t cvhash; |
35 |
|
|
36 |
+ |
|
37 |
|
static unsigned long |
38 |
< |
cvhash(cvp) /* hash an encoded vertex */ |
39 |
< |
MCVERT *cvp; |
38 |
> |
cvhash(p) /* hash an encoded vertex */ |
39 |
> |
/* MCVERT *cvp; */ |
40 |
> |
const void *p; |
41 |
|
{ |
42 |
+ |
const MCVERT *cvp = (const MCVERT *)p; |
43 |
|
unsigned long hval; |
44 |
|
|
45 |
|
if (!(cvp->fl & MT_V)) |
54 |
|
|
55 |
|
|
56 |
|
static int |
57 |
< |
cvcmp(v1, v2) /* compare encoded vertices */ |
58 |
< |
register MCVERT *v1, *v2; |
57 |
> |
cvcmp(vv1, vv2) /* compare encoded vertices */ |
58 |
> |
/* register MCVERT *v1, *v2; */ |
59 |
> |
const void *vv1, *vv2; |
60 |
|
{ |
61 |
+ |
const MCVERT *v1 = vv1, *v2 = vv2; |
62 |
|
if (v1->fl != v2->fl) |
63 |
|
return(1); |
64 |
|
if (v1->xyz[0] != v2->xyz[0]) |
245 |
|
for (i = 0; i < 2; i++) |
246 |
|
vp->uv[i] = mp->uvlim[0][i] + |
247 |
|
(mp->uvlim[1][i] - mp->uvlim[0][i])* |
248 |
< |
(pp->uv[vid][i] + .5)*(1./65536.); |
248 |
> |
(pp->uv[vid][i] + .5)*(1./4294967296.); |
249 |
|
vp->fl |= MT_UV; |
250 |
|
} |
251 |
|
return(vp->fl); |
316 |
|
(vp->v[i] - mp->mcube.cuorg[i]) / |
317 |
|
mp->mcube.cusize); |
318 |
|
} |
319 |
< |
if (vp->fl & MT_N) |
319 |
> |
if (vp->fl & MT_N) /* assumes normalized! */ |
320 |
|
cv.norm = encodedir(vp->n); |
321 |
|
if (vp->fl & MT_UV) |
322 |
|
for (i = 0; i < 2; i++) { |
324 |
|
return(-1); |
325 |
|
if (vp->uv[i] >= mp->uvlim[1][i]) |
326 |
|
return(-1); |
327 |
< |
cv.uv[i] = (uint32)(65536. * |
327 |
> |
cv.uv[i] = (uint32)(4294967296. * |
328 |
|
(vp->uv[i] - mp->uvlim[0][i]) / |
329 |
|
(mp->uvlim[1][i] - mp->uvlim[0][i])); |
330 |
|
} |
382 |
|
} |
383 |
|
if (cv.fl & MT_UV) { |
384 |
|
if (pp->uv == NULL) { |
385 |
< |
pp->uv = (uint16 (*)[2])calloc(256, |
386 |
< |
2*sizeof(uint16)); |
385 |
> |
pp->uv = (uint32 (*)[2])calloc(256, |
386 |
> |
2*sizeof(uint32)); |
387 |
|
if (pp->uv == NULL) |
388 |
|
goto nomem; |
389 |
|
} |
553 |
|
if (nouvbounds && pp->uv != NULL) |
554 |
|
return("unreferenced uv coordinates"); |
555 |
|
} |
549 |
– |
if (pp->ntris + pp->nj1tris + pp->nj2tris <= 0) |
550 |
– |
error(WARNING, "no triangles in patch"); |
556 |
|
if (pp->ntris > 0 && pp->tri == NULL) |
557 |
|
return("missing patch triangle list"); |
558 |
|
if (pp->nj1tris > 0 && pp->j1tri == NULL) |
625 |
|
(ms->npatches*sizeof(MESHPATCH) + |
626 |
|
vcnt*3*sizeof(uint32) + |
627 |
|
nscnt*sizeof(int32) + |
628 |
< |
uvscnt*2*sizeof(uint16) + |
628 |
> |
uvscnt*2*sizeof(uint32) + |
629 |
|
tcnt*sizeof(struct PTri) + |
630 |
|
t1cnt*sizeof(struct PJoin1) + |
631 |
|
t2cnt*sizeof(struct PJoin2))/(1024.*1024.)); |