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) |
34 |
|
ofun[OBJ_RING].funp = o_ring; |
35 |
|
ofun[OBJ_SOURCE].funp = o_source; |
36 |
|
ofun[OBJ_INSTANCE].funp = o_instance; |
37 |
+ |
ofun[OBJ_MESH].funp = o_unsupported; |
38 |
|
/* assign material types */ |
39 |
|
ofun[MAT_TRANS].funp = |
40 |
|
ofun[MAT_PLASTIC].funp = |
75 |
|
} |
76 |
|
|
77 |
|
|
78 |
+ |
void |
79 |
|
rgl_checkerr(where) /* check for GL or GLU error */ |
80 |
|
char *where; |
81 |
|
{ |
118 |
|
rgl_octlist(fname, cent, radp, nl) /* load scen into display list */ |
119 |
|
char *fname; |
120 |
|
FVECT cent; /* returned octree center (optional) */ |
121 |
< |
FLOAT *radp; /* returned octree size (optional) */ |
121 |
> |
RREAL *radp; /* returned octree size (optional) */ |
122 |
|
int *nl; /* returned number of lists (optional) */ |
123 |
|
{ |
124 |
|
double r; |
144 |
|
} |
145 |
|
|
146 |
|
|
147 |
+ |
void |
148 |
|
rgl_load(inpspec) /* convert scene description into OGL calls */ |
149 |
|
char *inpspec; |
150 |
|
{ |
187 |
|
} |
188 |
|
|
189 |
|
|
190 |
+ |
void |
191 |
|
rgl_object(name, fp) /* read the next object */ |
192 |
|
char *name; |
193 |
|
FILE *fp; |
199 |
|
strcpy(sbuf, "EOF"); |
200 |
|
fgetword(sbuf, MAXSTR, fp); |
201 |
|
ob.omod = 0; /* use ob.os for pointer to material */ |
202 |
< |
if (!strcmp(sbuf, VOIDID)) |
202 |
> |
if (!strcmp(sbuf, VOIDID) || !strcmp(sbuf, ALIASMOD)) |
203 |
|
ob.os = NULL; |
204 |
|
else |
205 |
|
ob.os = (char *)getmatp(sbuf); |
206 |
|
/* get type */ |
207 |
|
strcpy(sbuf, "EOF"); |
208 |
|
fgetword(sbuf, MAXSTR, fp); |
209 |
< |
if (!strcmp(sbuf, ALIASID)) |
213 |
< |
ob.otype = -1; |
214 |
< |
else if ((ob.otype = otype(sbuf)) < 0) { |
209 |
> |
if ((ob.otype = otype(sbuf)) < 0) { |
210 |
|
sprintf(errmsg, "(%s): unknown type \"%s\"", name, sbuf); |
211 |
|
error(USER, errmsg); |
212 |
|
} |
215 |
|
fgetword(sbuf, MAXSTR, fp); |
216 |
|
ob.oname = sbuf; |
217 |
|
/* get arguments */ |
218 |
< |
if (ob.otype == -1) { |
218 |
> |
if (ob.otype == MOD_ALIAS) { |
219 |
|
char sbuf2[MAXSTR]; /* get alias */ |
220 |
|
strcpy(sbuf2, "EOF"); |
221 |
|
fgetword(sbuf2, MAXSTR, fp); |