ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/rad2mgf.c
(Generate patch)

Comparing ray/src/cv/rad2mgf.c (file contents):
Revision 2.3 by greg, Fri Jul 8 16:39:22 1994 UTC vs.
Revision 2.4 by greg, Sat Jul 9 09:42:48 1994 UTC

# Line 33 | Line 33 | double unit_mult = 1.;                         /* units multiplier */
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;
# Line 244 | Line 264 | char   *id;
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);
# Line 281 | Line 302 | uninit()                       /* mark end of MGF file */
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  
# Line 301 | Line 323 | int    (*func)();
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;
# Line 331 | Line 332 | FVECT  vp;
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)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines