| 33 |  |  | 
| 34 |  | #define hasmult         (unit_mult < .999 || unit_mult > 1.001) | 
| 35 |  |  | 
| 36 | + | /* | 
| 37 | + | * Stuff for tracking and reusing vertices: | 
| 38 | + | */ | 
| 39 |  |  | 
| 40 | + | char    VKFMT[] = "%+1.9e %+1.9e %+1.9e"; | 
| 41 | + | #define VKLEN           64 | 
| 42 | + |  | 
| 43 | + | #define mkvkey(k,v)     sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2]) | 
| 44 | + |  | 
| 45 | + | #define NVERTS          256 | 
| 46 | + |  | 
| 47 | + | long    clock;          /* incremented at each vertex request */ | 
| 48 | + |  | 
| 49 | + | struct vert { | 
| 50 | + | long    lused;          /* when last used (0 if unassigned) */ | 
| 51 | + | FVECT   p;              /* track point position only */ | 
| 52 | + | } vert[NVERTS];         /* our vertex cache */ | 
| 53 | + |  | 
| 54 | + | LUTAB   vertab = LU_SINIT(free,NULL);   /* our vertex lookup table */ | 
| 55 | + |  | 
| 56 | + |  | 
| 57 |  | main(argc, argv) | 
| 58 |  | int     argc; | 
| 59 |  | char    **argv; | 
| 264 |  |  | 
| 265 |  | init()                  /* initialize dispatch table and output */ | 
| 266 |  | { | 
| 267 | + | lu_init(&vertab, NVERTS); | 
| 268 |  | lu_init(&rdispatch, 22); | 
| 269 |  | add2dispatch("polygon", o_face); | 
| 270 |  | add2dispatch("cone", o_cone); | 
| 302 |  | puts("# End of data converted from Radiance scene input"); | 
| 303 |  | lu_done(&rdispatch); | 
| 304 |  | lu_done(&rmats); | 
| 305 | + | lu_done(&vertab); | 
| 306 |  | } | 
| 307 |  |  | 
| 308 |  |  | 
| 323 |  | } | 
| 324 |  |  | 
| 325 |  |  | 
| 304 | – | /* | 
| 305 | – | * Stuff for tracking and reusing vertices: | 
| 306 | – | */ | 
| 307 | – |  | 
| 308 | – | char    VKFMT[] = "%+1.9e %+1.9e %+1.9e"; | 
| 309 | – | #define VKLEN           64 | 
| 310 | – |  | 
| 311 | – | #define mkvkey(k,v)     sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2]) | 
| 312 | – |  | 
| 313 | – | #define NVERTS          256 | 
| 314 | – |  | 
| 315 | – | long    clock;          /* incremented at each vertex request */ | 
| 316 | – |  | 
| 317 | – | struct vert { | 
| 318 | – | long    lused;          /* when last used (0 if unassigned) */ | 
| 319 | – | FVECT   p;              /* track point position only */ | 
| 320 | – | } vert[NVERTS]; | 
| 321 | – |  | 
| 322 | – | LUTAB   vertab = LU_SINIT(free,NULL);   /* our vertex lookup table */ | 
| 323 | – |  | 
| 324 | – |  | 
| 326 |  | char * | 
| 327 |  | getvertid(vname, vp)            /* get/set vertex ID for this point */ | 
| 328 |  | char    *vname; | 
| 332 |  | register LUENT  *lp; | 
| 333 |  | register int    i, vndx; | 
| 334 |  |  | 
| 334 | – | if (!vertab.tsiz && !lu_init(&vertab, NVERTS)) | 
| 335 | – | goto memerr; | 
| 335 |  | clock++;                        /* increment counter */ | 
| 336 |  | mkvkey(vkey, vp); | 
| 337 |  | if ((lp = lu_find(&vertab, vkey)) == NULL) |