Back to index

radiance  4R0+20100331
radogl.h
Go to the documentation of this file.
00001 /* RCSid $Id: radogl.h,v 3.11 2003/09/16 06:31:48 greg Exp $ */
00002 /*
00003  * Header file for Radiance - OpenGL routines.
00004  */
00005 #ifndef _RAD_RADOGL_H_
00006 #define _RAD_RADOGL_H_
00007 
00008 #include "standard.h"
00009 #include <GL/glu.h>
00010 #include "color.h"
00011 #include "object.h"
00012 #include "otypes.h"
00013 #include "lookup.h"
00014 
00015 #ifdef __cplusplus
00016 extern "C" {
00017 #endif
00018 
00019 #define MAXLIGHTS    8      /* number of OGL light sources */
00020 
00021 #define MAXSPECEXP   128.   /* maximum allowed specular exponent */
00022 #define UNKSPECEXP   25.    /* value to use when exponent unknown */
00023 
00024 typedef struct {
00025        short  type;         /* material type (from otypes.h) */
00026        short  nlinks;              /* number of links to this material */
00027        union {
00028               struct {
00029                      COLOR  ambdiff;      /* ambient and diffuse color */
00030                      COLOR  specular;     /* specular color */
00031                      GLfloat       specexp;      /* specular exponent */
00032               }      m;            /* regular material */
00033               struct {
00034                      COLOR  emission;     /* emitting component */
00035                      GLfloat       spotdir[3];   /* spot direction */
00036                      GLfloat       spotang;      /* spot cutoff angle */
00037               }      l;            /* light source */
00038        }      u;            /* union of types */
00039 }      MATREC;              /* OGL material properties */
00040 
00041 extern double expval;              /* global exposure value */
00042 extern COLOR  ambval;              /* global ambient value */
00043 extern int    glightid[MAXLIGHTS]; /* OpenGL GL_LIGHTi values */
00044 extern int    dolights;     /* are we outputting light sources? */
00045 extern int    domats;              /* are we doing materials? */
00046 
00047 extern LUTAB  mtab;         /* material/modifier lookup table */
00048 
00049 #define issrcmat(m)  ((m) != NULL && islight((m)->type) && \
00050                             (m)->type != MAT_GLOW)
00051 
00052                             /* defined in rgldomat.c */
00053 extern void   domatobj(MATREC *mp, FVECT cent);
00054 extern void   domatvert(MATREC *mp, FVECT v, FVECT n);
00055                             /* defined in rglfile.c */
00056 extern int    newglist(void);
00057 extern void   rgl_checkerr(char *where);
00058 extern int    rgl_filelist(int ic, char **inp, int *nl);
00059 extern int    rgl_octlist(char *fname, FVECT cent, RREAL *radp, int *nl);
00060 extern void   rgl_load(char *inpspec);
00061 extern void   rgl_object(char *name, FILE *fp);
00062                             /* defined in rglinst.c */
00063 extern int    o_instance(OBJREC *o);
00064 extern int    loadoctrees(void);
00065 extern double checkoct(char *fname, FVECT cent);
00066 extern int    loadoct(char *fname);
00067                             /* defined in rglmat.c */
00068 extern void   rgl_matclear(void);
00069 extern MATREC *getmatp(char *nam);
00070 extern int    o_default(OBJREC *o);
00071 extern int    o_unsupported(OBJREC *o);
00072 extern MATREC *newmaterial(char *nam);
00073 extern void   freemtl(void *p);
00074 extern int    m_normal(OBJREC *o);
00075 extern int    m_aniso(OBJREC *o);
00076 extern int    m_glass(OBJREC *o);
00077 extern int    m_brdf(OBJREC *o);
00078 extern int    m_brdf2(OBJREC *o);
00079 extern int    m_light(OBJREC *o);
00080 extern int    m_mirror(OBJREC *o);
00081 extern int    m_prism(OBJREC *o);
00082                             /* defined in rglsrc.c */
00083 extern void   lightinit(void);
00084 extern void   lightclean(void);
00085 extern void   lightdefs(void);
00086 extern int    o_source(OBJREC *o);
00087 extern int    doflatsrc(MATREC *m, FVECT pos, FVECT norm, double area);
00088 extern int    dosphsrc(MATREC *m, FVECT pos, double area);
00089                             /* defined in rglsurf.c */
00090 extern void   setmaterial(MATREC *mp, FVECT cent, int ispoly);
00091 extern double polyarea(FVECT cent, FVECT norm, int n, FVECT v[]);
00092 extern int    o_face(OBJREC *o);
00093 extern void   surfclean(void);
00094 extern int    o_sphere(OBJREC *o);
00095 extern int    o_cone(OBJREC *o);
00096 extern int    o_ring(OBJREC *o);
00097 
00098 
00099 #ifdef __cplusplus
00100 }
00101 #endif
00102 #endif /* _RAD_RADOGL_H_ */
00103