| 28 |
|
#define MG_E_RD 16 |
| 29 |
|
#define MG_E_RING 17 |
| 30 |
|
#define MG_E_RS 18 |
| 31 |
< |
#define MG_E_SPH 19 |
| 32 |
< |
#define MG_E_TD 20 |
| 33 |
< |
#define MG_E_TORUS 21 |
| 34 |
< |
#define MG_E_TS 22 |
| 35 |
< |
#define MG_E_VERTEX 23 |
| 36 |
< |
#define MG_E_XF 24 |
| 31 |
> |
#define MG_E_SIDES 19 |
| 32 |
> |
#define MG_E_SPH 20 |
| 33 |
> |
#define MG_E_TD 21 |
| 34 |
> |
#define MG_E_TORUS 22 |
| 35 |
> |
#define MG_E_TS 23 |
| 36 |
> |
#define MG_E_VERTEX 24 |
| 37 |
> |
#define MG_E_XF 25 |
| 38 |
|
|
| 39 |
< |
#define MG_NENTITIES 25 |
| 39 |
> |
#define MG_NENTITIES 26 |
| 40 |
|
|
| 41 |
|
#define MG_NAMELIST {"#","c","cone","cmix","cspec","cxy","cyl","ed","f",\ |
| 42 |
|
"i","ies","m","n","o","p","prism","rd","ring","rs",\ |
| 43 |
< |
"sph","td","torus","ts","v","xf"} |
| 43 |
> |
"sides","sph","td","torus","ts","v","xf"} |
| 44 |
|
|
| 45 |
|
#define MG_MAXELEN 6 |
| 46 |
|
|
| 202 |
|
#define C_CDXY 010 /* flag if defined w/ xy */ |
| 203 |
|
|
| 204 |
|
typedef struct { |
| 204 |
– |
char *name; /* material name */ |
| 205 |
|
int clock; /* incremented each change */ |
| 206 |
|
short flags; /* what's been set */ |
| 207 |
|
short ssamp[C_CNSS]; /* spectral samples, min wl to max */ |
| 209 |
|
float cx, cy; /* xy chromaticity value */ |
| 210 |
|
} C_COLOR; |
| 211 |
|
|
| 212 |
< |
#define C_DEFCOLOR { NULL, 0, C_CDXY|C_CSXY|C_CSSPEC,\ |
| 212 |
> |
#define C_DEFCOLOR { 1, C_CDXY|C_CSXY|C_CSSPEC,\ |
| 213 |
|
{C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
| 214 |
|
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
| 215 |
|
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,\ |
| 219 |
|
C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV,C_CMAXV},\ |
| 220 |
|
(long)C_CNSS*C_CMAXV, 1./3., 1./3. } |
| 221 |
|
|
| 222 |
< |
#define C_CIEX { "_cie_x", 0, C_CDSPEC|C_CSSPEC|C_CSXY,\ |
| 222 |
> |
#define C_CIEX { 1, C_CDSPEC|C_CSSPEC|C_CSXY,\ |
| 223 |
|
{14,42,143,435,1344,2839,3483,3362,2908,1954,956,\ |
| 224 |
|
320,49,93,633,1655,2904,4334,5945,7621,9163,10263,\ |
| 225 |
|
10622,10026,8544,6424,4479,2835,1649,874,468,227,\ |
| 226 |
|
114,58,29,14,7,3,2,1,0}, 106836L, .735, .265 } |
| 227 |
|
|
| 228 |
< |
#define C_CIEY { "_cie_y", 0, C_CDSPEC|C_CSSPEC|C_CSXY,\ |
| 228 |
> |
#define C_CIEY { 1, C_CDSPEC|C_CSSPEC|C_CSXY,\ |
| 229 |
|
{0,1,4,12,40,116,230,380,600,910,1390,2080,3230,\ |
| 230 |
|
5030,7100,8620,9540,9950,9950,9520,8700,7570,6310,\ |
| 231 |
|
5030,3810,2650,1750,1070,610,320,170,82,41,21,10,\ |
| 232 |
|
5,2,1,1,0,0}, 106856L, .274, .717 } |
| 233 |
|
|
| 234 |
< |
#define C_CIEZ { "_cie_z", 0, C_CDSPEC|C_CSSPEC|C_CSXY,\ |
| 234 |
> |
#define C_CIEZ { 1, C_CDSPEC|C_CSSPEC|C_CSXY,\ |
| 235 |
|
{65,201,679,2074,6456,13856,17471,17721,16692,\ |
| 236 |
|
12876,8130,4652,2720,1582,782,422,203,87,39,21,17,\ |
| 237 |
|
11,8,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\ |
| 240 |
|
#define c_cval(c,l) ((double)(c)->ssamp[((l)-C_MINWL)/C_CWLI] / (c)->sum) |
| 241 |
|
|
| 242 |
|
typedef struct { |
| 243 |
– |
char *name; /* material name */ |
| 243 |
|
int clock; /* incremented each change -- resettable */ |
| 244 |
+ |
int sided; /* 1 if surface is 1-sided, 0 for 2-sided */ |
| 245 |
|
float rd; /* diffuse reflectance */ |
| 246 |
|
C_COLOR rd_c; /* diffuse reflectance color */ |
| 247 |
|
float td; /* diffuse transmittance */ |
| 257 |
|
} C_MATERIAL; /* material context */ |
| 258 |
|
|
| 259 |
|
typedef struct { |
| 260 |
– |
char *name; /* vector name */ |
| 260 |
|
int clock; /* incremented each change -- resettable */ |
| 261 |
|
FVECT p, n; /* point and normal */ |
| 262 |
|
} C_VERTEX; /* vertex context */ |
| 263 |
|
|
| 264 |
< |
#define C_DEFMATERIAL {NULL,0,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ |
| 264 |
> |
#define C_DEFMATERIAL {1,0,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ |
| 265 |
|
0.,C_DEFCOLOR,0.,0.,C_DEFCOLOR,0.} |
| 266 |
< |
#define C_DEFVERTEX {NULL,0,{0.,0.,0.},{0.,0.,0.}} |
| 266 |
> |
#define C_DEFVERTEX {1,{0.,0.,0.},{0.,0.,0.}} |
| 267 |
|
|
| 268 |
|
extern C_COLOR *c_ccolor; /* the current color */ |
| 269 |
+ |
extern char *c_ccname; /* current color name */ |
| 270 |
|
extern C_MATERIAL *c_cmaterial; /* the current material */ |
| 271 |
+ |
extern char *c_cmname; /* current material name */ |
| 272 |
|
extern C_VERTEX *c_cvertex; /* the current vertex */ |
| 273 |
+ |
extern char *c_cvname; /* current vertex name */ |
| 274 |
|
|
| 275 |
|
#ifdef NOPROTO |
| 276 |
|
extern int c_hcolor(); /* handle color entity */ |
| 277 |
|
extern int c_hmaterial(); /* handle material entity */ |
| 278 |
|
extern int c_hvertex(); /* handle vertex entity */ |
| 279 |
|
extern void c_clearall(); /* clear context tables */ |
| 280 |
+ |
extern C_MATERIAL *c_getmaterial(); /* get a named material */ |
| 281 |
|
extern C_VERTEX *c_getvert(); /* get a named vertex */ |
| 282 |
|
extern C_COLOR *c_getcolor(); /* get a named color */ |
| 283 |
|
extern void c_ccvt(); /* fix color representation */ |
| 287 |
|
extern int c_hmaterial(int, char **); /* handle material entity */ |
| 288 |
|
extern int c_hvertex(int, char **); /* handle vertex entity */ |
| 289 |
|
extern void c_clearall(void); /* clear context tables */ |
| 290 |
+ |
extern C_MATERIAL *c_getmaterial(char *); /* get a named material */ |
| 291 |
|
extern C_VERTEX *c_getvert(char *); /* get a named vertex */ |
| 292 |
|
extern C_COLOR *c_getcolor(char *); /* get a named color */ |
| 293 |
|
extern void c_ccvt(C_COLOR *, int); /* fix color representation */ |