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

Comparing ray/src/common/lamps.c (file contents):
Revision 2.2 by greg, Tue Nov 10 10:29:22 1992 UTC vs.
Revision 2.5 by greg, Mon Oct 16 09:21:46 1995 UTC

# Line 10 | Line 10 | static char SCCSid[] = "$SunId$ LBL";
10  
11   #include  <stdio.h>
12   #include  <ctype.h>
13 + #include  "color.h"
14  
15   extern char     *eindex(), *expsave(), *malloc();
16 < extern FILE     *fropen();
16 > extern FILE     *frlibopen();
17  
18   typedef struct lamp {
19          char    *pattern;                       /* search pattern */
# Line 48 | Line 49 | char   *file;
49          char    buf[128], str[128];
50          register char   *cp1, *cp2;
51  
52 <        if ((fp = fropen(file)) == NULL)
52 >        if ((fp = frlibopen(file)) == NULL)
53                  return(0);
54          lastp = NULL;
55          while (fgets(buf, sizeof(buf), fp) != NULL) {
# Line 92 | Line 93 | char   *file;
93                                  goto fmterr;
94                          }
95                  } else {                        /* or read specificaion */
96 <                        if ((lp->color=(float *)malloc(3*sizeof(float)))==NULL)
96 >                        if ((lp->color=(float *)malloc(6*sizeof(float)))==NULL)
97                                  goto memerr;
98 <                        if (sscanf(cp1, "%f %f %f", &lp->color[0], &
99 <                                        lp->color[1], &lp->color[2]) != 3) {
98 >                        if (sscanf(cp1, "%f %f %f", &lp->color[3], &
99 >                                        lp->color[4], &lp->color[5]) != 3) {
100                                  cp1 = "bad lamp data";
101                                  goto fmterr;
102                          }
103                                                  /* convert xyY to XYZ */
104 <                        xyz[1] = lp->color[2];
105 <                        xyz[0] = lp->color[0]/lp->color[1] * xyz[1];
106 <                        xyz[2] = xyz[1]*(1./lp->color[1] - 1.) - xyz[0];
104 >                        xyz[1] = lp->color[5];
105 >                        xyz[0] = lp->color[3]/lp->color[4] * xyz[1];
106 >                        xyz[2] = xyz[1]*(1./lp->color[4] - 1.) - xyz[0];
107                                                  /* XYZ to RGB */
108                          cie_rgb(lp->color, xyz);
109                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines