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.4 by greg, Sat Jul 9 09:42:48 1994 UTC vs.
Revision 2.9 by greg, Tue Apr 11 13:33:10 1995 UTC

# Line 15 | Line 15 | static char SCCSid[] = "$SunId$ LBL";
15   #include "color.h"
16   #include "lookup.h"
17  
18 + #define PI      3.14159265358979323846
19 +
20   int     o_face(), o_cone(), o_sphere(), o_ring(), o_cylinder();
21   int     o_instance(), o_source(), o_illum();
22   int     o_plastic(), o_metal(), o_glass(), o_mirror(), o_trans(), o_light();
# Line 37 | Line 39 | double unit_mult = 1.;                         /* units multiplier */
39   * Stuff for tracking and reusing vertices:
40   */
41  
42 < char    VKFMT[] = "%+1.9e %+1.9e %+1.9e";
42 > char    VKFMT[] = "%+16.9e %+16.9e %+16.9e";
43   #define VKLEN           64
44  
45   #define mkvkey(k,v)     sprintf(k, VKFMT, (v)[0], (v)[1], (v)[2])
46  
47   #define NVERTS          256
48  
49 < long    clock;          /* incremented at each vertex request */
49 > long    vclock;         /* incremented at each vertex request */
50  
51   struct vert {
52          long    lused;          /* when last used (0 if unassigned) */
# Line 80 | Line 82 | char   **argv;
82                                  goto unkopt;
83                          }
84                          break;
85 +                default:
86 +                        goto unkopt;
87                  }
88          init();
89          if (i >= argc)
# Line 306 | Line 310 | uninit()                       /* mark end of MGF file */
310   }
311  
312  
313 + clrverts()                      /* clear vertex table */
314 + {
315 +        register int    i;
316 +
317 +        lu_done(&vertab);
318 +        for (i = 0; i < NVERTS; i++)
319 +                vert[i].lused = 0;
320 +        lu_init(&vertab, NVERTS);
321 + }
322 +
323 +
324   add2dispatch(name, func)        /* add function to dispatch table */
325   char    *name;
326   int     (*func)();
# Line 328 | Line 343 | getvertid(vname, vp)           /* get/set vertex ID for this po
343   char    *vname;
344   FVECT   vp;
345   {
346 <        char    vkey[VKLEN];
346 >        static char     vkey[VKLEN];
347          register LUENT  *lp;
348          register int    i, vndx;
349  
350 <        clock++;                        /* increment counter */
350 >        vclock++;                       /* increment counter */
351          mkvkey(vkey, vp);
352          if ((lp = lu_find(&vertab, vkey)) == NULL)
353                  goto memerr;
# Line 358 | Line 373 | FVECT  vp;
373                  lp->data = (char *)&vert[vndx];                 /* set it */
374          } else
375                  vndx = (struct vert *)lp->data - vert;
376 <        vert[vndx].lused = clock;               /* record this use */
376 >        vert[vndx].lused = vclock;              /* record this use */
377          sprintf(vname, "v%d", vndx);
378          return(vname);
379   memerr:
# Line 511 | Line 526 | FUNARGS        *fa;
526                  fputs(fa->sarg[i], stdout);
527          }
528          putchar('\n');
529 +        clrverts();                     /* vertex id's no longer reliable */
530          return(0);
531   }
532  
# Line 714 | Line 730 | register FUNARGS       *fa;
730          puts("\tc");
731          if (d > FTINY)
732                  printf("\t\tcxy %.4f %.4f\n", cxyz[0]/d, cxyz[1]/d);
733 <        printf("\ted %.4g\n", cxyz[1]*WHTEFFICACY);
733 >        printf("\ted %.4g\n", cxyz[1]*(PI*WHTEFFICACY));
734          return(0);
735   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines