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

Comparing ray/src/common/rglsrc.c (file contents):
Revision 3.1 by gwlarson, Tue Jun 9 11:18:36 1998 UTC vs.
Revision 3.6 by schorsch, Fri Nov 14 17:22:06 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1998 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Routines for handling OpenGL light sources
6   */
7  
8 + #include "copyright.h"
9 +
10   #include "radogl.h"
11  
12   double  expval = 0.;                    /* global exposure value */
# Line 16 | Line 15 | COLOR  ambval = {0.2, 0.2, 0.2};       /* global ambient valu
15  
16   int     dolights = MAXLIGHTS;           /* do how many more light sources? */
17  
18 < static int      lightid[MAXLIGHTS] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2,
18 > int     glightid[MAXLIGHTS] = {GL_LIGHT0, GL_LIGHT1, GL_LIGHT2,
19                          GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7};
20  
21   static int      lightlist;              /* light list id */
# Line 37 | Line 36 | static struct {
36  
37   static int      nlights;                /* number of defined lights */
38  
39 < static int      l_flatsrc(), l_spheresrc(), l_source();
39 > static void     l_flatsrc(int), l_sphsrc(int), l_source(int);
40  
41  
42 + void
43   lightinit()                     /* initialize lighting */
44   {
45          GLfloat ambv[4];
46        register int    i;
46  
47          if (!dolights)
48                  return;
# Line 61 | Line 60 | lightinit()                    /* initialize lighting */
60   }
61  
62  
63 + void
64   lightclean()                    /* clean up light source commands */
65   {
66          if ((dolights += nlights) <= 0)
# Line 69 | Line 69 | lightclean()                   /* clean up light source commands */
69   }
70  
71  
72 + void
73   lightdefs()                     /* define light source list */
74   {
74        register int    i;
75
75          if (!nlights)
76                  return;
77          glNewList(lightlist, GL_COMPILE);
# Line 98 | Line 97 | lightdefs()                    /* define light source list */
97   }
98  
99  
100 + int
101   o_source(o)                     /* record a distant source */
102   register OBJREC *o;
103   {
# Line 158 | Line 158 | double area;
158   }
159  
160  
161 < static
161 > static void
162   l_source(n)                     /* convert a distant source */
163   register int    n;
164   {
165          register MATREC *m = lightrec[n].m;
166 <        int     thislight = lightid[n];
166 >        int     thislight = glightid[n];
167          GLfloat vec[4];
168                                                  /* assign direction */
169          VCOPY(vec, lightrec[n].pos);
# Line 182 | Line 182 | register int   n;
182   }
183  
184  
185 < static
185 > static void
186   l_flatsrc(n)                    /* convert a flat source */
187   register int    n;
188   {
189          GLfloat vec[4];
190          register MATREC *m = lightrec[n].m;
191 <        int     thislight = lightid[n];
191 >        int     thislight = glightid[n];
192                                                  /* assign position */
193          VCOPY(vec, lightrec[n].pos); vec[3] = 1.;
194          glLightfv(thislight, GL_POSITION, vec);
# Line 217 | Line 217 | register int   n;
217   }
218  
219  
220 < static
220 > static void
221   l_sphsrc(n)                     /* convert a spherical source */
222   register int    n;
223   {
224          GLfloat vec[4];
225          register MATREC *m = lightrec[n].m;
226 <        int     thislight = lightid[n];
226 >        int     thislight = glightid[n];
227                                                  /* assign position */
228          VCOPY(vec, lightrec[n].pos); vec[3] = 1.;
229          glLightfv(thislight, GL_POSITION, vec);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines