1 |
greg |
3.9 |
/* RCSid $Id: radogl.h,v 3.8 2003/06/26 00:58:09 schorsch Exp $ */ |
2 |
gwlarson |
3.1 |
/* |
3 |
|
|
* Header file for Radiance - OpenGL routines. |
4 |
|
|
*/ |
5 |
schorsch |
3.7 |
#ifndef _RAD_RADOGL_H_ |
6 |
|
|
#define _RAD_RADOGL_H_ |
7 |
|
|
#ifdef __cplusplus |
8 |
|
|
extern "C" { |
9 |
|
|
#endif |
10 |
greg |
3.4 |
|
11 |
gwlarson |
3.1 |
#include "standard.h" |
12 |
gwlarson |
3.3 |
#include <GL/glu.h> |
13 |
gwlarson |
3.1 |
#include "color.h" |
14 |
|
|
#include "object.h" |
15 |
|
|
#include "otypes.h" |
16 |
|
|
#include "lookup.h" |
17 |
|
|
|
18 |
|
|
#define MAXLIGHTS 8 /* number of OGL light sources */ |
19 |
|
|
|
20 |
|
|
#define MAXSPECEXP 128. /* maximum allowed specular exponent */ |
21 |
|
|
#define UNKSPECEXP 25. /* value to use when exponent unknown */ |
22 |
|
|
|
23 |
|
|
typedef struct { |
24 |
|
|
short type; /* material type (from otypes.h) */ |
25 |
|
|
short nlinks; /* number of links to this material */ |
26 |
|
|
union { |
27 |
|
|
struct { |
28 |
|
|
COLOR ambdiff; /* ambient and diffuse color */ |
29 |
|
|
COLOR specular; /* specular color */ |
30 |
|
|
GLfloat specexp; /* specular exponent */ |
31 |
|
|
} m; /* regular material */ |
32 |
|
|
struct { |
33 |
|
|
COLOR emission; /* emitting component */ |
34 |
|
|
GLfloat spotdir[3]; /* spot direction */ |
35 |
|
|
GLfloat spotang; /* spot cutoff angle */ |
36 |
|
|
} l; /* light source */ |
37 |
|
|
} u; /* union of types */ |
38 |
|
|
} MATREC; /* OGL material properties */ |
39 |
|
|
|
40 |
|
|
extern double expval; /* global exposure value */ |
41 |
|
|
extern COLOR ambval; /* global ambient value */ |
42 |
gwlarson |
3.2 |
extern int glightid[MAXLIGHTS]; /* OpenGL GL_LIGHTi values */ |
43 |
gwlarson |
3.1 |
extern int dolights; /* are we outputting light sources? */ |
44 |
|
|
extern int domats; /* are we doing materials? */ |
45 |
|
|
|
46 |
|
|
extern LUTAB mtab; /* material/modifier lookup table */ |
47 |
|
|
|
48 |
greg |
3.4 |
#define issrcmat(m) ((m) != NULL && islight((m)->type) && \ |
49 |
|
|
(m)->type != MAT_GLOW) |
50 |
|
|
|
51 |
|
|
/* defined in rgldomat.c */ |
52 |
|
|
extern void domatobj(MATREC *mp, FVECT cent); |
53 |
|
|
extern void domatvert(MATREC *mp, FVECT v, FVECT n); |
54 |
|
|
/* defined in rglfile.c */ |
55 |
|
|
extern int newglist(void); |
56 |
|
|
extern void rgl_checkerr(char *where); |
57 |
|
|
extern int rgl_filelist(int ic, char **inp, int *nl); |
58 |
schorsch |
3.8 |
extern int rgl_octlist(char *fname, FVECT cent, RREAL *radp, int *nl); |
59 |
greg |
3.4 |
extern void rgl_load(char *inpspec); |
60 |
|
|
extern void rgl_object(char *name, FILE *fp); |
61 |
|
|
/* defined in rglinst.c */ |
62 |
|
|
extern int o_instance(OBJREC *o); |
63 |
|
|
extern int loadoctrees(void); |
64 |
|
|
extern double checkoct(char *fname, FVECT cent); |
65 |
|
|
extern int loadoct(char *fname); |
66 |
|
|
/* defined in rglmat.c */ |
67 |
|
|
extern void rgl_matclear(void); |
68 |
|
|
extern MATREC *getmatp(char *nam); |
69 |
|
|
extern int o_default(OBJREC *o); |
70 |
greg |
3.6 |
extern int o_unsupported(OBJREC *o); |
71 |
greg |
3.4 |
extern MATREC *newmaterial(char *nam); |
72 |
|
|
extern void freemtl(MATREC *mp); |
73 |
|
|
extern int m_normal(OBJREC *o); |
74 |
|
|
extern int m_aniso(OBJREC *o); |
75 |
|
|
extern int m_glass(OBJREC *o); |
76 |
|
|
extern int m_brdf(OBJREC *o); |
77 |
|
|
extern int m_brdf2(OBJREC *o); |
78 |
|
|
extern int m_light(OBJREC *o); |
79 |
|
|
extern int m_mirror(OBJREC *o); |
80 |
|
|
extern int m_prism(OBJREC *o); |
81 |
|
|
/* defined in rglsrc.c */ |
82 |
|
|
extern void lightinit(void); |
83 |
|
|
extern void lightclean(void); |
84 |
|
|
extern void lightdefs(void); |
85 |
|
|
extern int o_source(OBJREC *o); |
86 |
|
|
extern int doflatsrc(MATREC *m, FVECT pos, FVECT norm, double area); |
87 |
|
|
extern int dosphsrc(MATREC *m, FVECT pos, double area); |
88 |
|
|
/* defined in rglsurf.c */ |
89 |
|
|
extern void setmaterial(MATREC *mp, FVECT cent, int ispoly); |
90 |
|
|
extern double polyarea(FVECT cent, FVECT norm, int n, FVECT v[]); |
91 |
|
|
extern int o_face(OBJREC *o); |
92 |
|
|
extern void surfclean(void); |
93 |
|
|
extern int o_sphere(OBJREC *o); |
94 |
|
|
extern int o_cone(OBJREC *o); |
95 |
|
|
extern int o_ring(OBJREC *o); |
96 |
gwlarson |
3.1 |
|
97 |
schorsch |
3.7 |
|
98 |
|
|
#ifdef __cplusplus |
99 |
|
|
} |
100 |
greg |
3.4 |
#endif |
101 |
schorsch |
3.7 |
#endif /* _RAD_RADOGL_H_ */ |
102 |
|
|
|