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