--- ray/src/cv/mgflib/parser.h 1995/03/10 15:16:42 1.19 +++ ray/src/cv/mgflib/parser.h 1995/05/10 17:46:05 1.22 @@ -1,4 +1,4 @@ -/* Copyright (c) 1994 Regents of the University of California */ +/* Copyright (c) 1995 Regents of the University of California */ /* SCCSid "$SunId$ LBL" */ @@ -9,39 +9,40 @@ /* must include stdio.h before us */ /* Entities (order doesn't really matter) */ -#define MG_E_COMMENT 0 -#define MG_E_COLOR 1 -#define MG_E_CCT 2 -#define MG_E_CONE 3 -#define MG_E_CMIX 4 -#define MG_E_CSPEC 5 -#define MG_E_CXY 6 -#define MG_E_CYL 7 -#define MG_E_ED 8 -#define MG_E_FACE 9 -#define MG_E_INCLUDE 10 -#define MG_E_IES 11 -#define MG_E_MATERIAL 12 -#define MG_E_NORMAL 13 -#define MG_E_OBJECT 14 -#define MG_E_POINT 15 -#define MG_E_PRISM 16 -#define MG_E_RD 17 -#define MG_E_RING 18 -#define MG_E_RS 19 -#define MG_E_SIDES 20 -#define MG_E_SPH 21 -#define MG_E_TD 22 -#define MG_E_TORUS 23 -#define MG_E_TS 24 -#define MG_E_VERTEX 25 -#define MG_E_XF 26 +#define MG_E_COMMENT 0 /* # */ +#define MG_E_COLOR 1 /* c */ +#define MG_E_CCT 2 /* cct */ +#define MG_E_CONE 3 /* cone */ +#define MG_E_CMIX 4 /* cmix */ +#define MG_E_CSPEC 5 /* cspec */ +#define MG_E_CXY 6 /* cxy */ +#define MG_E_CYL 7 /* cyl */ +#define MG_E_ED 8 /* ed */ +#define MG_E_FACE 9 /* f */ +#define MG_E_INCLUDE 10 /* i */ +#define MG_E_IES 11 /* ies */ +#define MG_E_IR 12 /* ir */ +#define MG_E_MATERIAL 13 /* m */ +#define MG_E_NORMAL 14 /* n */ +#define MG_E_OBJECT 15 /* o */ +#define MG_E_POINT 16 /* p */ +#define MG_E_PRISM 17 /* prism */ +#define MG_E_RD 18 /* rd */ +#define MG_E_RING 19 /* ring */ +#define MG_E_RS 20 /* rs */ +#define MG_E_SIDES 21 /* sides */ +#define MG_E_SPH 22 /* sph */ +#define MG_E_TD 23 /* td */ +#define MG_E_TORUS 24 /* torus */ +#define MG_E_TS 25 /* ts */ +#define MG_E_VERTEX 26 /* v */ +#define MG_E_XF 27 /* xf */ -#define MG_NENTITIES 27 +#define MG_NENTITIES 28 /* total # entities */ #define MG_NAMELIST {"#","c","cct","cone","cmix","cspec","cxy","cyl","ed",\ - "f","i","ies","m","n","o","p","prism","rd","ring",\ - "rs","sides","sph","td","torus","ts","v","xf"} + "f","i","ies","ir","m","n","o","p","prism","rd",\ + "ring","rs","sides","sph","td","torus","ts","v","xf"} #define MG_MAXELEN 6 @@ -86,7 +87,7 @@ extern char *mg_err[MG_NERRS]; * (The first argument to mg_handle is the entity #, or -1.) * To free any data structures and clear the parser, use mg_clear. * If there is an error, mg_load, mg_open, mg_parse, mg_handle and - * mg_rewind will return an error from the list above. In addition, + * mg_fgoto will return an error from the list above. In addition, * mg_load will report the error to stderr. The mg_read routine * returns 0 when the end of file has been reached. */ @@ -149,10 +150,12 @@ extern int mg_nqcdivs; /* divisions per quarter circl extern int mg_entity(); /* get entity number from its name */ extern int isint(); /* non-zero if integer format */ extern int isflt(); /* non-zero if floating point format */ +extern int isname(); /* non-zero if legal identifier name */ #else extern int mg_entity(char *); /* get entity number from its name */ extern int isint(char *); /* non-zero if integer format */ extern int isflt(char *); /* non-zero if floating point format */ +extern int isname(char *); /* non-zero if legal identifier name */ #endif /************************************************************************ @@ -225,9 +228,12 @@ typedef struct { #define c_cval(c,l) ((double)(c)->ssamp[((l)-C_MINWL)/C_CWLI] / (c)->ssum) +#define C_1SIDEDTHICK 0.005 /* assumed thickness of 1-sided mat. */ + typedef struct { int clock; /* incremented each change -- resettable */ int sided; /* 1 if surface is 1-sided, 0 for 2-sided */ + float nr, ni; /* index of refraction, real and imaginary */ float rd; /* diffuse reflectance */ C_COLOR rd_c; /* diffuse reflectance color */ float td; /* diffuse transmittance */ @@ -247,7 +253,7 @@ typedef struct { FVECT p, n; /* point and normal */ } C_VERTEX; /* vertex context */ -#define C_DEFMATERIAL {1,0,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ +#define C_DEFMATERIAL {1,0,1.,0.,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ 0.,C_DEFCOLOR,0.,0.,C_DEFCOLOR,0.} #define C_DEFVERTEX {1,{0.,0.,0.},{0.,0.,0.}}