| 1 |
gwlarson |
3.1 |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
| 2 |
|
|
|
| 3 |
|
|
/* SCCSid "$SunId$ SGI" */ |
| 4 |
|
|
|
| 5 |
|
|
/* |
| 6 |
|
|
* Header file for Radiance - OpenGL routines. |
| 7 |
|
|
*/ |
| 8 |
|
|
|
| 9 |
|
|
#include "standard.h" |
| 10 |
|
|
#include "color.h" |
| 11 |
|
|
#include "object.h" |
| 12 |
|
|
#include "otypes.h" |
| 13 |
|
|
#include "lookup.h" |
| 14 |
|
|
#include <GL/glu.h> |
| 15 |
|
|
|
| 16 |
|
|
#define MAXLIGHTS 8 /* number of OGL light sources */ |
| 17 |
|
|
|
| 18 |
|
|
#define MAXSPECEXP 128. /* maximum allowed specular exponent */ |
| 19 |
|
|
#define UNKSPECEXP 25. /* value to use when exponent unknown */ |
| 20 |
|
|
|
| 21 |
|
|
typedef struct { |
| 22 |
|
|
short type; /* material type (from otypes.h) */ |
| 23 |
|
|
short nlinks; /* number of links to this material */ |
| 24 |
|
|
union { |
| 25 |
|
|
struct { |
| 26 |
|
|
COLOR ambdiff; /* ambient and diffuse color */ |
| 27 |
|
|
COLOR specular; /* specular color */ |
| 28 |
|
|
GLfloat specexp; /* specular exponent */ |
| 29 |
|
|
} m; /* regular material */ |
| 30 |
|
|
struct { |
| 31 |
|
|
COLOR emission; /* emitting component */ |
| 32 |
|
|
GLfloat spotdir[3]; /* spot direction */ |
| 33 |
|
|
GLfloat spotang; /* spot cutoff angle */ |
| 34 |
|
|
} l; /* light source */ |
| 35 |
|
|
} u; /* union of types */ |
| 36 |
|
|
} MATREC; /* OGL material properties */ |
| 37 |
|
|
|
| 38 |
|
|
extern double expval; /* global exposure value */ |
| 39 |
|
|
extern COLOR ambval; /* global ambient value */ |
| 40 |
|
|
extern int dolights; /* are we outputting light sources? */ |
| 41 |
|
|
extern int domats; /* are we doing materials? */ |
| 42 |
|
|
|
| 43 |
|
|
extern LUTAB mtab; /* material/modifier lookup table */ |
| 44 |
|
|
|
| 45 |
|
|
extern MATREC *newmaterial(), *getmatp(); |
| 46 |
|
|
|
| 47 |
|
|
extern int newglist(); |
| 48 |
|
|
|
| 49 |
|
|
extern double checkoct(); |
| 50 |
|
|
|
| 51 |
|
|
#define issrcmat(m) ((m) != NULL && islight((m)->type) && \ |
| 52 |
|
|
(m)->type != MAT_GLOW) |