| 1 | < | .\" SCCSid "$SunId$ LBL" | 
| 1 | > | .\" RCSid "$Id$" | 
| 2 |  | .nr PS 11 | 
| 3 |  | .ps 11 | 
| 4 |  | .nr VS 12 | 
| 233 |  | n       dx dy dz        set surface normal for current vertex | 
| 234 |  | _       _       _ | 
| 235 |  | f       v1 v2 v3 ...    polygon using current material, spec. vertices | 
| 236 | + | fh      v1 v2 v3 - ...  face with explicit holes | 
| 237 |  | sph     vc radius       sphere | 
| 238 |  | cyl     v1 radius v2    truncated right cylinder (open-ended) | 
| 239 |  | cone    v1 rad1 v2 rad2 truncated right cone (open-ended) | 
| 279 |  | =       =       =       =       = | 
| 280 |  | Object  o       -       -       - | 
| 281 |  | Transform       xf      -       -       T{ | 
| 282 | < | f, sph, cyl, cone, | 
| 282 | > | f, fh, sph, cyl, cone, | 
| 283 |  | ring, torus, prism | 
| 284 |  | T} | 
| 285 |  | Material        m       2-sided black   T{ | 
| 286 |  | sides, rd, td, | 
| 287 | < | ed, rs, ts | 
| 287 | > | ed, rs, ts, ir | 
| 288 |  | T}      T{ | 
| 289 | < | f, sph, cyl, cone, | 
| 289 | > | f, fh, sph, cyl, cone, | 
| 290 |  | ring, torus, prism | 
| 291 |  | T} | 
| 292 |  | Color   c       neutral grey    T{ | 
| 298 |  | (0,0,0), | 
| 299 |  | no normal | 
| 300 |  | T}      p, n    T{ | 
| 301 | < | f, sph, cyl, cone, | 
| 301 | > | f, fh, sph, cyl, cone, | 
| 302 |  | ring, torus, prism | 
| 303 |  | T} | 
| 304 |  | .TE | 
| 817 |  | .TS | 
| 818 |  | lw(.75i) lw(1.75i) lw(3i). | 
| 819 |  | f       v1 v2 v3 ...    polygon using current material, spec. vertices | 
| 820 | + | fh      v1 v2 v3 - ...  face with explicit holes | 
| 821 |  | sph     vc radius       sphere | 
| 822 |  | cyl     v1 radius v2    truncated right cylinder (open-ended) | 
| 823 |  | cone    v1 rad1 v2 rad2 truncated right cone (open-ended) | 
| 1677 |  | # A 100-watt incandescent bulb (1600 lumens) modeled as a sphere | 
| 1678 |  | m | 
| 1679 |  | c | 
| 1680 | < | cct 3000 | 
| 1680 | > | cct 3000 | 
| 1681 |  | ed 87712 | 
| 1682 |  | v cent = | 
| 1683 |  | p 0 0 0 | 
| 1903 |  | require a normal direction. | 
| 1904 |  | An | 
| 1905 |  | .UL f | 
| 1906 | + | or | 
| 1907 | + | .UL fh | 
| 1908 |  | entity will interpolate vertex normals if given, and | 
| 1909 |  | use the polygon plane normal otherwise. | 
| 1910 |  | See the | 
| 1944 |  | .UL cone, | 
| 1945 |  | .UL cyl, | 
| 1946 |  | .UL f, | 
| 1947 | + | .UL fh, | 
| 1948 |  | .UL n, | 
| 1949 |  | .UL p, | 
| 1950 |  | .UL prism, | 
| 1989 |  | .UL cone, | 
| 1990 |  | .UL cyl, | 
| 1991 |  | .UL f, | 
| 1992 | + | .UL fh, | 
| 1993 |  | .UL n, | 
| 1994 |  | .UL prism, | 
| 1995 |  | .UL ring, | 
| 2036 |  | SEE ALSO | 
| 2037 |  | .LP | 
| 2038 |  | .UL f, | 
| 2039 | + | .UL fh, | 
| 2040 |  | .UL p, | 
| 2041 |  | .UL prism, | 
| 2042 |  | .UL ring, | 
| 2076 |  | Also, specified normals should point in the general direction of the | 
| 2077 |  | surface for best results. | 
| 2078 |  | .LP | 
| 2079 | < | There is no explicit representation of holes in MGF.  A hole must be | 
| 2080 | < | represented implicitly by connecting vertices to form "seams."  For | 
| 2079 | > | There is no explicit representation of holes in this entity, but see | 
| 2080 | > | the | 
| 2081 | > | .UL fh | 
| 2082 | > | entity for an alternative specification. | 
| 2083 | > | .LP | 
| 2084 | > | A hole may be represented implicitly in a face entity | 
| 2085 | > | by connecting vertices to form "seams." | 
| 2086 | > | For | 
| 2087 |  | example, a wall with a window in it might look as shown in Figure 1. | 
| 2088 |  | In many systems, the wall itself would be represented with the first | 
| 2089 |  | list of vertices, (v1,v2,v3,v4) and the hole associated with that | 
| 2090 | < | wall as a second set of vertices (v5,v6,v7,v8).  In MGF, we must | 
| 2090 | > | wall as a second set of vertices (v5,v6,v7,v8). | 
| 2091 | > | Using the face entity, we must | 
| 2092 |  | give the whole thing as a single polygon, connecting the vertices so | 
| 2093 |  | as to create a "seam," as shown in Figure 2. | 
| 2094 | < | This could be written in MGF as "f v1 v2 v3 v4 v5 v6 v7 v8 v5 v4". | 
| 2094 | > | This could be written as "f v1 v2 v3 v4 v5 v6 v7 v8 v5 v4". | 
| 2095 |  | .LP | 
| 2096 |  | It is very important that the order of the hole be opposite to the | 
| 2097 |  | order of the outer perimeter, otherwise the polygon will be | 
| 2140 |  | .LP | 
| 2141 |  | .UL cone, | 
| 2142 |  | .UL cyl, | 
| 2143 | + | .UL fh, | 
| 2144 |  | .UL m, | 
| 2145 |  | .UL prism, | 
| 2146 |  | .UL ring, | 
| 2147 |  | .UL sph, | 
| 2148 |  | .UL torus, | 
| 2149 |  | .UL v | 
| 2150 | + | .ds RH FH | 
| 2151 | + | .bp | 
| 2152 | + | .SH | 
| 2153 | + | NAME | 
| 2154 | + | .LP | 
| 2155 | + | fh - create a polygonal face with explicit holes | 
| 2156 | + | .SH | 
| 2157 | + | SYNOPSIS | 
| 2158 | + | .LP | 
| 2159 | + | .B fh | 
| 2160 | + | .I "p1 p2 ... - h1.1 h1.2 ... - h2.1 h2.2 ..." | 
| 2161 | + | .SH | 
| 2162 | + | DESCRIPTION | 
| 2163 | + | .LP | 
| 2164 | + | Create a polygonal face with optional holes made of the current material. | 
| 2165 | + | The first contour is the outer perimeter, with vertices given in | 
| 2166 | + | counter-clockwise order as seen from the front side (the same as the | 
| 2167 | + | .UL f | 
| 2168 | + | entity). | 
| 2169 | + | A hole is indicated by a hyphen ('-') followed by the hole's | 
| 2170 | + | vertices, given in clockwise order as seen from the front side. | 
| 2171 | + | Multiple hole contours are separated by additional hyphens. | 
| 2172 | + | There must be at least three vertices for each contour, and the | 
| 2173 | + | last vertex is implicitly connected to the first. | 
| 2174 | + | If any vertex is undefined, an error will result. | 
| 2175 | + | .LP | 
| 2176 | + | If any vertices have associated surface normals, they will be used | 
| 2177 | + | instead of the average plane normal, though it is safest to specify | 
| 2178 | + | either all normals or no normals, and to stick with triangles | 
| 2179 | + | when normals are used. | 
| 2180 | + | Also, specified normals should point in the general direction of the | 
| 2181 | + | surface for best results. | 
| 2182 | + | .LP | 
| 2183 | + | Vertices should not be shared between any two contours. | 
| 2184 | + | I.e., a hole should not share a vertex or edge with the perimeter or | 
| 2185 | + | another hole, or incorrect rendering may result. | 
| 2186 | + | .SH | 
| 2187 | + | EXAMPLE | 
| 2188 | + | .DS | 
| 2189 | + | # Make a wall with a window using an explicit hole. | 
| 2190 | + | # (See Figures 1 and 2.) | 
| 2191 | + | fh v1 v2 v3 v4 - v5 v6 v7 v8 | 
| 2192 | + | .DE | 
| 2193 | + | .SH | 
| 2194 | + | SEE ALSO | 
| 2195 | + | .LP | 
| 2196 | + | .UL cone, | 
| 2197 | + | .UL cyl, | 
| 2198 | + | .UL f, | 
| 2199 | + | .UL m, | 
| 2200 | + | .UL prism, | 
| 2201 | + | .UL ring, | 
| 2202 | + | .UL sph, | 
| 2203 | + | .UL torus, | 
| 2204 | + | .UL v | 
| 2205 |  | .ds RH SPH | 
| 2206 |  | .bp | 
| 2207 |  | .SH | 
| 2250 |  | .UL cone, | 
| 2251 |  | .UL cyl, | 
| 2252 |  | .UL f, | 
| 2253 | + | .UL fh, | 
| 2254 |  | .UL m, | 
| 2255 |  | .UL prism, | 
| 2256 |  | .UL ring, | 
| 2308 |  | .LP | 
| 2309 |  | .UL cone, | 
| 2310 |  | .UL f, | 
| 2311 | + | .UL fh, | 
| 2312 |  | .UL m, | 
| 2313 |  | .UL prism, | 
| 2314 |  | .UL ring, | 
| 2381 |  | .LP | 
| 2382 |  | .UL cyl, | 
| 2383 |  | .UL f, | 
| 2384 | + | .UL fh, | 
| 2385 |  | .UL m, | 
| 2386 |  | .UL prism, | 
| 2387 |  | .UL ring, | 
| 2448 |  | .UL cyl, | 
| 2449 |  | .UL cone, | 
| 2450 |  | .UL f, | 
| 2451 | + | .UL fh, | 
| 2452 |  | .UL m, | 
| 2453 |  | .UL ring, | 
| 2454 |  | .UL sph, | 
| 2505 |  | .UL cyl, | 
| 2506 |  | .UL cone, | 
| 2507 |  | .UL f, | 
| 2508 | + | .UL fh, | 
| 2509 |  | .UL m, | 
| 2510 |  | .UL prism, | 
| 2511 |  | .UL sph, | 
| 2566 |  | .UL cyl, | 
| 2567 |  | .UL cone, | 
| 2568 |  | .UL f, | 
| 2569 | + | .UL fh, | 
| 2570 |  | .UL m, | 
| 2571 |  | .UL prism, | 
| 2572 |  | .UL ring, | 
| 3510 |  | #define MG_EUNK         1               /* unknown entity */ | 
| 3511 |  | #define MG_EARGC                2               /* wrong number of arguments */ | 
| 3512 |  | #define MG_ETYPE                3               /* argument type error */ | 
| 3513 | < | #define MG_EILL                         4               /* illegal argument value */ | 
| 3513 | > | #define MG_EILL                 4               /* illegal argument value */ | 
| 3514 |  | #define MG_EUNDEF               5               /* undefined reference */ | 
| 3515 |  | #define MG_ENOFILE              6               /* cannot open input file */ | 
| 3516 |  | #define MG_EINCL                7               /* error in included file */ | 
| 3520 |  | #define MG_ELINE                11              /* input line too long */ | 
| 3521 |  | #define MG_ECNTXT               12              /* unmatched context close */ | 
| 3522 |  |  | 
| 3523 | < | #define MG_NERRS        13 | 
| 3523 | > | #define MG_NERRS                13 | 
| 3524 |  | .DE | 
| 3525 |  | If it is inappropriate to send output to standard error, the calling | 
| 3526 |  | program should use the routines listed under | 
| 3927 |  |  | 
| 3928 |  | typedef struct { | 
| 3929 |  | int     clock;                  /* incremented each change -- resettable */ | 
| 3930 | + | char    *client_data;   /* pointer to private client data */ | 
| 3931 |  | FVECT   p, n;           /* point and normal */ | 
| 3932 |  | } C_VERTEX;             /* vertex context */ | 
| 3933 |  | .DE | 
| 3944 |  | transform has not changed, which is uniquely identified by the | 
| 3945 |  | global | 
| 3946 |  | .I xf_context->xid | 
| 3947 | < | variable, but only if one is using the parser libraries transform | 
| 3947 | > | variable, but only if one is using the parser library's transform | 
| 3948 |  | handler. | 
| 3949 |  | (See the | 
| 3950 |  | .I xf_handler | 
| 3951 |  | page.)\0 | 
| 3952 | + | The | 
| 3953 | + | .I client_data | 
| 3954 | + | pointer may be used to index private application data for vertex | 
| 3955 | + | linking, etc. | 
| 3956 | + | This pointer is initialized to NULL when the context is created, | 
| 3957 | + | and otherwise ignored by the parser library. | 
| 3958 |  | .LP | 
| 3959 | < | It is possible but not recommended to alter the contents of the | 
| 3959 | > | It is possible but not recommended to alter the shared contents of the | 
| 3960 |  | vertex structure returned by | 
| 3961 |  | .I c_getvert. | 
| 3962 |  | Normally it is read during the | 
| 4077 |  |  | 
| 4078 |  | typedef struct { | 
| 4079 |  | int     clock;                  /* incremented each change */ | 
| 4080 | + | char    *client_data;   /* pointer to private client data */ | 
| 4081 |  | short   flags;                  /* what's been set */ | 
| 4082 |  | short   ssamp[C_CNSS];  /* spectral samples, min wl to max */ | 
| 4083 |  | long    ssum;                   /* straight sum of spectral values */ | 
| 4093 |  | This is a convenient way to keep track of whether or not a color has | 
| 4094 |  | changed since its last use. | 
| 4095 |  | The | 
| 4096 | + | .I client_data | 
| 4097 | + | pointer may be used to index private application data. | 
| 4098 | + | This pointer is initialized to NULL when the context is created, | 
| 4099 | + | and otherwise ignored by the parser library. | 
| 4100 | + | The | 
| 4101 |  | .I flags | 
| 4102 |  | member indicates which color representations have been assigned, | 
| 4103 |  | and is an inclusive OR of one or more of the following: | 
| 4242 |  |  | 
| 4243 |  | typedef struct { | 
| 4244 |  | int     clock;          /* incremented each change -- resettable */ | 
| 4245 | + | char    *client_data;   /* pointer to private client data */ | 
| 4246 |  | int     sided;          /* 1 if surface is 1-sided, 0 for 2-sided */ | 
| 4247 |  | float   nr, ni;         /* index of refraction, real and imaginary */ | 
| 4248 |  | float   rd;             /* diffuse reflectance */ | 
| 4266 |  | desired. | 
| 4267 |  | This is a convenient way to keep track of whether or not a material has | 
| 4268 |  | changed since its last use. | 
| 4269 | + | The | 
| 4270 | + | .I client_data | 
| 4271 | + | pointer may be used to index private application data. | 
| 4272 | + | This pointer is initialized to NULL when the context is created, | 
| 4273 | + | and otherwise ignored by the parser library. | 
| 4274 |  | .LP | 
| 4275 |  | All reflectance and transmittance values correspond to normal | 
| 4276 |  | incidence, and may vary as a function of angle depending on the | 
| 4693 |  | The hardest part is translating the specular power to a roughness value. | 
| 4694 |  | For this, we recommend the following approximation: | 
| 4695 |  | .IP | 
| 4696 | < | roughness = 0.6/sqrt(specular_power) | 
| 4696 | > | roughness = sqrt(2/specular_power) | 
| 4697 |  | .LP | 
| 4698 |  | It is not a perfect correlation, but it is about as close as one can get. | 
| 4699 |  | .NH 3 |