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

Comparing ray/src/common/rglsurf.c (file contents):
Revision 3.3 by gwlarson, Fri Dec 11 13:53:32 1998 UTC vs.
Revision 3.6 by greg, Thu Mar 27 04:16:33 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   * Convert Radiance -> OpenGL surfaces.
6   */
7  
8 + #include "copyright.h"
9 +
10   #include "radogl.h"
11  
12   #ifndef NSLICES
# Line 29 | Line 28 | static char    *glu_rout = "unk";      /* active GLU routine *
28   #define NOPOLY()        if (curpolysize) {glEnd(); curpolysize = 0;} else
29  
30  
31 + void
32   setmaterial(mp, cent, ispoly)   /* prepare for new material */
33   register MATREC *mp;
34   FVECT   cent;
# Line 80 | Line 80 | register FVECT v[];    /* vertex list */
80   }
81  
82  
83 < static
83 > static void
84   glu_error(en)                   /* report an error as a warning */
85   GLenum  en;
86   {
# Line 130 | Line 130 | newquadric()                   /* allocate GLU quadric structure */
130   }
131  
132  
133 + int
134   o_face(o)                       /* convert a face */
135   register OBJREC *o;
136   {
# Line 143 | Line 144 | register OBJREC        *o;
144          if (area <= FTINY)
145                  return;
146          if (dolights)                                   /* check for source */
147 <                doflatsrc(o->os, cent, norm, area);
148 <        setmaterial(o->os, cent, 1);                    /* set material */
147 >                doflatsrc((MATREC *)o->os, cent, norm, area);
148 >        setmaterial((MATREC *)o->os, cent, 1);          /* set material */
149          if (o->oargs.nfargs/3 != curpolysize) {
150                  if (curpolysize) glEnd();
151                  curpolysize = o->oargs.nfargs/3;
# Line 179 | Line 180 | register OBJREC        *o;
180   }
181  
182  
183 + void
184   surfclean()                     /* clean up surface routines */
185   {
186          setmaterial(NULL, NULL, 0);
# Line 194 | Line 196 | surfclean()                    /* clean up surface routines */
196   }
197  
198  
199 + int
200   o_sphere(o)                     /* convert a sphere */
201   register OBJREC *o;
202   {
# Line 206 | Line 209 | register OBJREC        *o;
209          } else if (o->oargs.farg[3] <= FTINY)
210                  return;
211          if (dolights)
212 <                dosphsrc(o->os, o->oargs.farg,
212 >                dosphsrc((MATREC *)o->os, o->oargs.farg,
213                                  PI*o->oargs.farg[3]*o->oargs.farg[3]);
214 <        setmaterial(o->os, o->oargs.farg, 0);
214 >        setmaterial((MATREC *)o->os, o->oargs.farg, 0);
215          if (gluqo == NULL) newquadric();
216          glu_rout = "making sphere";
217          gluQuadricOrientation(gluqo,
# Line 223 | Line 226 | register OBJREC        *o;
226   }
227  
228  
229 + int
230   o_cone(o)                       /* convert a cone or cylinder */
231   register OBJREC *o;
232   {
# Line 232 | Line 236 | register OBJREC *o;
236  
237          iscyl = o->otype==OBJ_CYLINDER | o->otype==OBJ_TUBE;
238          if (o->oargs.nfargs != (iscyl ? 7 : 8))
239 <                objerror(o, "bad # real arguments");
239 >                objerror(o, USER, "bad # real arguments");
240          if (o->oargs.farg[6] < -FTINY) {
241                  o->oargs.farg[6] = -o->oargs.farg[6];
242                  if (iscyl)
# Line 256 | Line 260 | register OBJREC *o;
260          cent[0] = .5*(o->oargs.farg[0] + o->oargs.farg[3]);
261          cent[1] = .5*(o->oargs.farg[1] + o->oargs.farg[4]);
262          cent[2] = .5*(o->oargs.farg[2] + o->oargs.farg[5]);
263 <        setmaterial(o->os, cent, 0);
263 >        setmaterial((MATREC *)o->os, cent, 0);
264          if (gluqo == NULL) newquadric();
265          glu_rout = "making cylinder";
266          gluQuadricOrientation(gluqo, o->otype==OBJ_CUP | o->otype==OBJ_TUBE ?
# Line 285 | Line 289 | register OBJREC *o;
289   }
290  
291  
292 + int
293   o_ring(o)                       /* convert a ring */
294   register OBJREC *o;
295   {
296          double  x1, y1, d;
297  
298          if (o->oargs.nfargs != 8)
299 <                objerror(o, "bad # real arguments");
299 >                objerror(o, USER, "bad # real arguments");
300          if (o->oargs.farg[7] < o->oargs.farg[6]) {
301                  register double d = o->oargs.farg[7];
302                  o->oargs.farg[7] = o->oargs.farg[6];
# Line 304 | Line 309 | register OBJREC        *o;
309          if (o->oargs.farg[7] - o->oargs.farg[6] <= FTINY)
310                  return;
311          if (dolights)
312 <                doflatsrc(o->os, o->oargs.farg, o->oargs.farg+3,
312 >                doflatsrc((MATREC *)o->os, o->oargs.farg, o->oargs.farg+3,
313                                  PI*(o->oargs.farg[7]*o->oargs.farg[7] -
314                                          o->oargs.farg[6]*o->oargs.farg[6]));
315 <        setmaterial(o->os, o->oargs.farg, 0);
315 >        setmaterial((MATREC *)o->os, o->oargs.farg, 0);
316          if (gluqo == NULL) newquadric();
317          glu_rout = "making disk";
318          gluQuadricOrientation(gluqo, GLU_OUTSIDE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines