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.4 by greg, Sat Feb 22 02:07:22 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 + /* ====================================================================
9 + * The Radiance Software License, Version 1.0
10 + *
11 + * Copyright (c) 1990 - 2002 The Regents of the University of California,
12 + * through Lawrence Berkeley National Laboratory.   All rights reserved.
13 + *
14 + * Redistribution and use in source and binary forms, with or without
15 + * modification, are permitted provided that the following conditions
16 + * are met:
17 + *
18 + * 1. Redistributions of source code must retain the above copyright
19 + *         notice, this list of conditions and the following disclaimer.
20 + *
21 + * 2. Redistributions in binary form must reproduce the above copyright
22 + *       notice, this list of conditions and the following disclaimer in
23 + *       the documentation and/or other materials provided with the
24 + *       distribution.
25 + *
26 + * 3. The end-user documentation included with the redistribution,
27 + *           if any, must include the following acknowledgment:
28 + *             "This product includes Radiance software
29 + *                 (http://radsite.lbl.gov/)
30 + *                 developed by the Lawrence Berkeley National Laboratory
31 + *               (http://www.lbl.gov/)."
32 + *       Alternately, this acknowledgment may appear in the software itself,
33 + *       if and wherever such third-party acknowledgments normally appear.
34 + *
35 + * 4. The names "Radiance," "Lawrence Berkeley National Laboratory"
36 + *       and "The Regents of the University of California" must
37 + *       not be used to endorse or promote products derived from this
38 + *       software without prior written permission. For written
39 + *       permission, please contact [email protected].
40 + *
41 + * 5. Products derived from this software may not be called "Radiance",
42 + *       nor may "Radiance" appear in their name, without prior written
43 + *       permission of Lawrence Berkeley National Laboratory.
44 + *
45 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
46 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
47 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
48 + * DISCLAIMED.   IN NO EVENT SHALL Lawrence Berkeley National Laboratory OR
49 + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
50 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
51 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
52 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
53 + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
54 + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
55 + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
56 + * SUCH DAMAGE.
57 + * ====================================================================
58 + *
59 + * This software consists of voluntary contributions made by many
60 + * individuals on behalf of Lawrence Berkeley National Laboratory.   For more
61 + * information on Lawrence Berkeley National Laboratory, please see
62 + * <http://www.lbl.gov/>.
63 + */
64 +
65   #include "radogl.h"
66  
67   #ifndef NSLICES
# Line 29 | Line 83 | static char    *glu_rout = "unk";      /* active GLU routine *
83   #define NOPOLY()        if (curpolysize) {glEnd(); curpolysize = 0;} else
84  
85  
86 + void
87   setmaterial(mp, cent, ispoly)   /* prepare for new material */
88   register MATREC *mp;
89   FVECT   cent;
# Line 80 | Line 135 | register FVECT v[];    /* vertex list */
135   }
136  
137  
138 < static
138 > static void
139   glu_error(en)                   /* report an error as a warning */
140   GLenum  en;
141   {
# Line 111 | Line 166 | newtess()                      /* allocate GLU tessellation object */
166   {
167          if ((gluto = gluNewTess()) == NULL)
168                  error(INTERNAL, "gluNewTess failed");
169 <        gluTessCallback(gluto, GLU_TESS_BEGIN, glBegin);
170 <        gluTessCallback(gluto, GLU_TESS_VERTEX, glVertex3dv);
169 >        gluTessCallback(gluto, GLU_TESS_BEGIN, (_GLUfuncptr)glBegin);
170 >        gluTessCallback(gluto, GLU_TESS_VERTEX, (_GLUfuncptr)glVertex3dv);
171          gluTessCallback(gluto, GLU_TESS_END, glEnd);
172          gluTessCallback(gluto, GLU_TESS_COMBINE, myCombine);
173          gluTessCallback(gluto, GLU_TESS_ERROR, glu_error);
# Line 130 | Line 185 | newquadric()                   /* allocate GLU quadric structure */
185   }
186  
187  
188 + int
189   o_face(o)                       /* convert a face */
190   register OBJREC *o;
191   {
# Line 143 | Line 199 | register OBJREC        *o;
199          if (area <= FTINY)
200                  return;
201          if (dolights)                                   /* check for source */
202 <                doflatsrc(o->os, cent, norm, area);
203 <        setmaterial(o->os, cent, 1);                    /* set material */
202 >                doflatsrc((MATREC *)o->os, cent, norm, area);
203 >        setmaterial((MATREC *)o->os, cent, 1);          /* set material */
204          if (o->oargs.nfargs/3 != curpolysize) {
205                  if (curpolysize) glEnd();
206                  curpolysize = o->oargs.nfargs/3;
# Line 179 | Line 235 | register OBJREC        *o;
235   }
236  
237  
238 + void
239   surfclean()                     /* clean up surface routines */
240   {
241          setmaterial(NULL, NULL, 0);
# Line 194 | Line 251 | surfclean()                    /* clean up surface routines */
251   }
252  
253  
254 + int
255   o_sphere(o)                     /* convert a sphere */
256   register OBJREC *o;
257   {
# Line 206 | Line 264 | register OBJREC        *o;
264          } else if (o->oargs.farg[3] <= FTINY)
265                  return;
266          if (dolights)
267 <                dosphsrc(o->os, o->oargs.farg,
267 >                dosphsrc((MATREC *)o->os, o->oargs.farg,
268                                  PI*o->oargs.farg[3]*o->oargs.farg[3]);
269 <        setmaterial(o->os, o->oargs.farg, 0);
269 >        setmaterial((MATREC *)o->os, o->oargs.farg, 0);
270          if (gluqo == NULL) newquadric();
271          glu_rout = "making sphere";
272          gluQuadricOrientation(gluqo,
# Line 223 | Line 281 | register OBJREC        *o;
281   }
282  
283  
284 + int
285   o_cone(o)                       /* convert a cone or cylinder */
286   register OBJREC *o;
287   {
# Line 232 | Line 291 | register OBJREC *o;
291  
292          iscyl = o->otype==OBJ_CYLINDER | o->otype==OBJ_TUBE;
293          if (o->oargs.nfargs != (iscyl ? 7 : 8))
294 <                objerror(o, "bad # real arguments");
294 >                objerror(o, USER, "bad # real arguments");
295          if (o->oargs.farg[6] < -FTINY) {
296                  o->oargs.farg[6] = -o->oargs.farg[6];
297                  if (iscyl)
# Line 256 | Line 315 | register OBJREC *o;
315          cent[0] = .5*(o->oargs.farg[0] + o->oargs.farg[3]);
316          cent[1] = .5*(o->oargs.farg[1] + o->oargs.farg[4]);
317          cent[2] = .5*(o->oargs.farg[2] + o->oargs.farg[5]);
318 <        setmaterial(o->os, cent, 0);
318 >        setmaterial((MATREC *)o->os, cent, 0);
319          if (gluqo == NULL) newquadric();
320          glu_rout = "making cylinder";
321          gluQuadricOrientation(gluqo, o->otype==OBJ_CUP | o->otype==OBJ_TUBE ?
# Line 285 | Line 344 | register OBJREC *o;
344   }
345  
346  
347 + int
348   o_ring(o)                       /* convert a ring */
349   register OBJREC *o;
350   {
351          double  x1, y1, d;
352  
353          if (o->oargs.nfargs != 8)
354 <                objerror(o, "bad # real arguments");
354 >                objerror(o, USER, "bad # real arguments");
355          if (o->oargs.farg[7] < o->oargs.farg[6]) {
356                  register double d = o->oargs.farg[7];
357                  o->oargs.farg[7] = o->oargs.farg[6];
# Line 304 | Line 364 | register OBJREC        *o;
364          if (o->oargs.farg[7] - o->oargs.farg[6] <= FTINY)
365                  return;
366          if (dolights)
367 <                doflatsrc(o->os, o->oargs.farg, o->oargs.farg+3,
367 >                doflatsrc((MATREC *)o->os, o->oargs.farg, o->oargs.farg+3,
368                                  PI*(o->oargs.farg[7]*o->oargs.farg[7] -
369                                          o->oargs.farg[6]*o->oargs.farg[6]));
370 <        setmaterial(o->os, o->oargs.farg, 0);
370 >        setmaterial((MATREC *)o->os, o->oargs.farg, 0);
371          if (gluqo == NULL) newquadric();
372          glu_rout = "making disk";
373          gluQuadricOrientation(gluqo, GLU_OUTSIDE);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines