--- ray/src/cv/mgflib/parser.h 1994/07/01 10:18:36 1.12 +++ ray/src/cv/mgflib/parser.h 1994/09/01 09:17:46 1.15 @@ -28,18 +28,19 @@ #define MG_E_RD 16 #define MG_E_RING 17 #define MG_E_RS 18 -#define MG_E_SPH 19 -#define MG_E_TD 20 -#define MG_E_TORUS 21 -#define MG_E_TS 22 -#define MG_E_VERTEX 23 -#define MG_E_XF 24 +#define MG_E_SIDES 19 +#define MG_E_SPH 20 +#define MG_E_TD 21 +#define MG_E_TORUS 22 +#define MG_E_TS 23 +#define MG_E_VERTEX 24 +#define MG_E_XF 25 -#define MG_NENTITIES 25 +#define MG_NENTITIES 26 #define MG_NAMELIST {"#","c","cone","cmix","cspec","cxy","cyl","ed","f",\ "i","ies","m","n","o","p","prism","rd","ring","rs",\ - "sph","td","torus","ts","v","xf"} + "sides","sph","td","torus","ts","v","xf"} #define MG_MAXELEN 6 @@ -83,10 +84,10 @@ extern char *mg_err[MG_NERRS]; * the mg_handle function rather than the mg_ehand routines directly. * (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, and mg_rewind - * 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. + * 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_load will report the error to stderr. The mg_read routine + * returns 0 when the end of file has been reached. */ #define MG_MAXLINE 512 /* maximum input line length */ @@ -236,10 +237,11 @@ typedef struct { 11,8,3,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},\ 106770L, .167, .009 } -#define c_cval(c,l) ((double)(c)->ssamp[((l)-C_MINWL)/C_CWLI] / (c)->sum) +#define c_cval(c,l) ((double)(c)->ssamp[((l)-C_MINWL)/C_CWLI] / (c)->ssum) typedef struct { int clock; /* incremented each change -- resettable */ + int sided; /* 1 if surface is 1-sided, 0 for 2-sided */ float rd; /* diffuse reflectance */ C_COLOR rd_c; /* diffuse reflectance color */ float td; /* diffuse transmittance */ @@ -259,7 +261,7 @@ typedef struct { FVECT p, n; /* point and normal */ } C_VERTEX; /* vertex context */ -#define C_DEFMATERIAL {1,0.,C_DEFCOLOR,0.,C_DEFCOLOR,0.,C_DEFCOLOR,\ +#define C_DEFMATERIAL {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.}} @@ -328,8 +330,8 @@ extern MAT4 m4ident; /* regular transformation */ typedef struct { - MAT4 xfm; /* transform matrix */ - FLOAT sca; /* scalefactor */ + MAT4 xfm; /* transform matrix */ + FLOAT sca; /* scalefactor */ } XF; #define identxf(xp) (void)(setident4((xp)->xfm),(xp)->sca=1.0) @@ -349,6 +351,7 @@ typedef struct xf_spec { long xid; /* unique transform id */ short xav0; /* zeroeth argument in xf_argv array */ short xac; /* transform argument count */ + short rev; /* boolean true if vertices reversed */ XF xf; /* cumulative transformation */ struct xf_array *xarr; /* transformation array pointer */ struct xf_spec *prev; /* previous transformation context */