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

Comparing ray/src/common/spec_rgb.c (file contents):
Revision 2.3 by greg, Wed Jun 29 18:16:58 1994 UTC vs.
Revision 2.4 by greg, Thu Jul 7 15:21:25 1994 UTC

# Line 51 | Line 51 | static float  xyz2rgbmat[3][3] = {     /* XYZ to RGB */
51           (CIE_x_r*CIE_y_g - CIE_x_g*CIE_y_r)/CIE_C_bD}
52   };
53  
54 + static float  rgb2xyzmat[3][3] = {      /* RGB to XYZ */
55 +        {CIE_x_r*CIE_C_rD/CIE_D,CIE_x_g*CIE_C_gD/CIE_D,CIE_x_b*CIE_C_bD/CIE_D},
56 +        {CIE_y_r*CIE_C_rD/CIE_D,CIE_y_g*CIE_C_gD/CIE_D,CIE_y_b*CIE_C_bD/CIE_D},
57 +        {(1.-CIE_x_r-CIE_y_r)*CIE_C_rD/CIE_D,
58 +         (1.-CIE_x_g-CIE_y_g)*CIE_C_gD/CIE_D,
59 +         (1.-CIE_x_b-CIE_y_b)*CIE_C_bD/CIE_D}
60 + };
61  
62  
63 +
64   spec_rgb(col, s, e)             /* compute RGB color from spectral range */
65   COLOR  col;
66   int  s, e;
# Line 110 | Line 118 | register COLOR  rgbcolor, ciecolor;
118                  if (rgbcolor[i] < 0.0)
119                          rgbcolor[i] = 0.0;
120          }
121 + }
122 +
123 +
124 + rgb_cie(ciecolor, rgbcolor)             /* convert RGB to CIE */
125 + register COLOR  ciecolor, rgbcolor;
126 + {
127 +        register int  i;
128 +
129 +        for (i = 0; i < 3; i++)
130 +                ciecolor[i] =   rgb2xyzmat[i][0]*rgbcolor[0] +
131 +                                rgb2xyzmat[i][1]*rgbcolor[1] +
132 +                                rgb2xyzmat[i][2]*rgbcolor[2] ;
133   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines