| 60 |
|
#define MG_EINCL 7 /* error in included file */ |
| 61 |
|
#define MG_EMEM 8 /* out of memory */ |
| 62 |
|
#define MG_ESEEK 9 /* file seek error */ |
| 63 |
+ |
#define MG_EBADMAT 10 /* bad material specification */ |
| 64 |
|
|
| 65 |
< |
#define MG_NERRS 10 |
| 65 |
> |
#define MG_NERRS 11 |
| 66 |
|
|
| 67 |
|
extern char *mg_err[MG_NERRS]; |
| 68 |
|
|
| 141 |
|
* Definitions for 3-d vector manipulation functions |
| 142 |
|
*/ |
| 143 |
|
|
| 144 |
< |
typedef double FVECT[3]; |
| 144 |
> |
#ifdef SMLFLT |
| 145 |
> |
#define FLOAT float |
| 146 |
> |
#else |
| 147 |
> |
#define FLOAT double |
| 148 |
> |
#endif |
| 149 |
|
|
| 150 |
+ |
typedef FLOAT FVECT[3]; |
| 151 |
+ |
|
| 152 |
|
#ifdef NOPROTO |
| 153 |
|
extern double normalize(); /* normalize a vector */ |
| 154 |
|
#else |
| 161 |
|
*/ |
| 162 |
|
|
| 163 |
|
typedef struct { |
| 164 |
< |
double cx, cy; /* XY chromaticity coordinates */ |
| 164 |
> |
float cx, cy; /* XY chromaticity coordinates */ |
| 165 |
|
} C_COLOR; /* color context */ |
| 166 |
|
|
| 167 |
|
typedef struct { |
| 168 |
< |
double rd; /* diffuse reflectance */ |
| 168 |
> |
char *name; /* material name */ |
| 169 |
> |
int clock; /* incremented each change -- resettable */ |
| 170 |
> |
float rd; /* diffuse reflectance */ |
| 171 |
|
C_COLOR rd_c; /* diffuse reflectance color */ |
| 172 |
< |
double td; /* diffuse transmittance */ |
| 172 |
> |
float td; /* diffuse transmittance */ |
| 173 |
|
C_COLOR td_c; /* diffuse transmittance color */ |
| 174 |
< |
double ed; /* diffuse emittance */ |
| 174 |
> |
float ed; /* diffuse emittance */ |
| 175 |
|
C_COLOR ed_c; /* diffuse emittance color */ |
| 176 |
< |
double rs; /* specular reflectance */ |
| 176 |
> |
float rs; /* specular reflectance */ |
| 177 |
|
C_COLOR rs_c; /* specular reflectance color */ |
| 178 |
< |
double rs_a; /* specular reflectance roughness */ |
| 179 |
< |
double ts; /* specular transmittance */ |
| 178 |
> |
float rs_a; /* specular reflectance roughness */ |
| 179 |
> |
float ts; /* specular transmittance */ |
| 180 |
|
C_COLOR ts_c; /* specular transmittance color */ |
| 181 |
< |
double ts_a; /* specular transmittance roughness */ |
| 181 |
> |
float ts_a; /* specular transmittance roughness */ |
| 182 |
|
} C_MATERIAL; /* material context */ |
| 183 |
|
|
| 184 |
|
typedef struct { |
| 186 |
|
} C_VERTEX; /* vertex context */ |
| 187 |
|
|
| 188 |
|
#define C_DEFCOLOR {.333,.333} |
| 189 |
< |
#define C_DEFMATERIAL {0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ |
| 190 |
< |
0.,C_DEFCOLOR,0.,0.,C_DEFCOLOR,0.} |
| 189 |
> |
#define C_DEFMATERIAL {NULL,1,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ |
| 190 |
> |
0.,C_DEFCOLOR,0.,0.,C_DEFCOLOR,0.} |
| 191 |
|
#define C_DEFVERTEX {{0.,0.,0.},{0.,0.,0.}} |
| 192 |
|
|
| 193 |
|
extern C_COLOR *c_ccolor; /* the current color */ |
| 217 |
|
|
| 218 |
|
#ifdef NOPROTO |
| 219 |
|
extern int obj_handler(); /* handle an object entity */ |
| 220 |
+ |
extern void obj_clear(); /* clear object stack */ |
| 221 |
|
#else |
| 222 |
|
extern int obj_handler(int, char **); /* handle an object entity */ |
| 223 |
+ |
extern void obj_clear(void); /* clear object stack */ |
| 224 |
|
#endif |
| 225 |
|
|
| 226 |
|
/************************************************************************** |
| 227 |
|
* Definitions for hierarchical transformation handler |
| 228 |
|
*/ |
| 229 |
|
|
| 230 |
< |
typedef double MAT4[4][4]; |
| 230 |
> |
typedef FLOAT MAT4[4][4]; |
| 231 |
|
|
| 232 |
|
#ifdef BSD |
| 233 |
|
#define copymat4(m4a,m4b) bcopy((char *)m4b,(char *)m4a,sizeof(MAT4)) |
| 246 |
|
/* regular transformation */ |
| 247 |
|
typedef struct { |
| 248 |
|
MAT4 xfm; /* transform matrix */ |
| 249 |
< |
double sca; /* scalefactor */ |
| 249 |
> |
FLOAT sca; /* scalefactor */ |
| 250 |
|
} XF; |
| 251 |
|
|
| 252 |
|
#define identxf(xp) (void)(setident4((xp)->xfm),(xp)->sca=1.0) |
| 281 |
|
extern void xf_xfmvect(); /* transform vector */ |
| 282 |
|
extern void xf_rotvect(); /* rotate vector */ |
| 283 |
|
extern double xf_scale(); /* scale a value */ |
| 284 |
+ |
extern void xf_clear(); /* clear xf stack */ |
| 285 |
|
|
| 286 |
|
/* The following are support routines you probably won't call directly */ |
| 287 |
|
|
| 292 |
|
|
| 293 |
|
#else |
| 294 |
|
|
| 295 |
< |
extern int xf_handler(); /* handle xf entity */ |
| 296 |
< |
extern void xf_xfmpoint(); /* transform point */ |
| 297 |
< |
extern void xf_xfmvect(); /* transform vector */ |
| 298 |
< |
extern void xf_rotvect(); /* rotate vector */ |
| 299 |
< |
extern double xf_scale(); /* scale a value */ |
| 295 |
> |
extern int xf_handler(int, char **); /* handle xf entity */ |
| 296 |
> |
extern void xf_xfmpoint(FVECT, FVECT); /* transform point */ |
| 297 |
> |
extern void xf_xfmvect(FVECT, FVECT); /* transform vector */ |
| 298 |
> |
extern void xf_rotvect(FVECT, FVECT); /* rotate vector */ |
| 299 |
> |
extern double xf_scale(double); /* scale a value */ |
| 300 |
> |
extern void xf_clear(void); /* clear xf stack */ |
| 301 |
|
|
| 302 |
|
/* The following are support routines you probably won't call directly */ |
| 303 |
|
|