| 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 |
|
* Load Radiance object(s) and create OpenGL display lists |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include "copyright.h" |
| 9 |
+ |
|
| 10 |
|
#include "radogl.h" |
| 11 |
|
|
| 12 |
|
#ifndef NLIST2ALLOC |
| 13 |
|
#define NLIST2ALLOC 16 /* batch of display lists to get */ |
| 14 |
|
#endif |
| 15 |
|
|
| 17 |
– |
extern int o_sphere(), o_face(), o_cone(), o_ring(), |
| 18 |
– |
o_source(), o_instance(); |
| 19 |
– |
|
| 20 |
– |
extern int m_normal(), m_glass(), m_aniso(), m_brdf(), m_brdf2(), |
| 21 |
– |
m_light(), m_prism(), m_mirror(); |
| 22 |
– |
|
| 16 |
|
FUN ofun[NUMOTYPE] = INIT_OTYPE; |
| 17 |
|
|
| 18 |
|
static int nextlist, nlistleft = 0; |
| 19 |
|
|
| 20 |
|
|
| 21 |
< |
static |
| 21 |
> |
static void |
| 22 |
|
initotypes() /* initialize ofun array */ |
| 23 |
|
{ |
| 24 |
|
if (ofun[OBJ_SPHERE].funp == o_sphere) |
| 74 |
|
} |
| 75 |
|
|
| 76 |
|
|
| 77 |
+ |
void |
| 78 |
|
rgl_checkerr(where) /* check for GL or GLU error */ |
| 79 |
|
char *where; |
| 80 |
|
{ |
| 143 |
|
} |
| 144 |
|
|
| 145 |
|
|
| 146 |
+ |
void |
| 147 |
|
rgl_load(inpspec) /* convert scene description into OGL calls */ |
| 148 |
|
char *inpspec; |
| 149 |
|
{ |
| 186 |
|
} |
| 187 |
|
|
| 188 |
|
|
| 189 |
+ |
void |
| 190 |
|
rgl_object(name, fp) /* read the next object */ |
| 191 |
|
char *name; |
| 192 |
|
FILE *fp; |
| 198 |
|
strcpy(sbuf, "EOF"); |
| 199 |
|
fgetword(sbuf, MAXSTR, fp); |
| 200 |
|
ob.omod = 0; /* use ob.os for pointer to material */ |
| 201 |
< |
if (!strcmp(sbuf, VOIDID)) |
| 201 |
> |
if (!strcmp(sbuf, VOIDID) || !strcmp(sbuf, ALIASMOD)) |
| 202 |
|
ob.os = NULL; |
| 203 |
|
else |
| 204 |
|
ob.os = (char *)getmatp(sbuf); |
| 205 |
|
/* get type */ |
| 206 |
|
strcpy(sbuf, "EOF"); |
| 207 |
|
fgetword(sbuf, MAXSTR, fp); |
| 208 |
< |
if (!strcmp(sbuf, ALIASID)) |
| 213 |
< |
ob.otype = -1; |
| 214 |
< |
else if ((ob.otype = otype(sbuf)) < 0) { |
| 208 |
> |
if ((ob.otype = otype(sbuf)) < 0) { |
| 209 |
|
sprintf(errmsg, "(%s): unknown type \"%s\"", name, sbuf); |
| 210 |
|
error(USER, errmsg); |
| 211 |
|
} |
| 214 |
|
fgetword(sbuf, MAXSTR, fp); |
| 215 |
|
ob.oname = sbuf; |
| 216 |
|
/* get arguments */ |
| 217 |
< |
if (ob.otype == -1) { |
| 217 |
> |
if (ob.otype == MOD_ALIAS) { |
| 218 |
|
char sbuf2[MAXSTR]; /* get alias */ |
| 219 |
|
strcpy(sbuf2, "EOF"); |
| 220 |
|
fgetword(sbuf2, MAXSTR, fp); |