UG(5) FILE FORMATS UG(5) UG ug - UNIGRAFIX file format DESCRIPTION The following is a pseudo BNF description of the UNIGRAFIX file format. Literals are in boldface, except for punctua- tion which is enclosed in single quotes ` '. Variables are are in italics. Optional parts are enclosed in square brackets, [ ]. Zero or more repetitions are enclosed in curly braces, { }. Alternatives are separated by vertical bars, |. By default, all variables are real numbers, with the follow- ing exceptions: size and line_no are integers; text and filename are arbitrary strings; id is a string consisting of upper and lowercase chars, digits, colon (:), underscore (_) and sharp (#) - but not beginning with a digit; color_id, vertex_id and definition_id are id's. Left curly brace, {, and right curly brace, }, are comment delimiters and may be nested. White space is always ignored except to separate fields. file: statements statements: statement { statement } statement: vertex | wire | face | instance | array | light | color | escape | execute | camera | include | definition | cpp_stmt vertex: v id x y z ';' wire: w [ id ] contours [ color_id ] ';' face: f [ id ] contours [ color_id ] ';' instance: i [ id ] '(' definition_id [color_id ] [ tforms ] ')' ';' array: a [ id ] '(' definition_id [color_id ] [ tforms ] ')' size [ tforms ] ';' light: l [ id ] intensity [ x y z [[radius ]]] [ color_id ] ';' color: c [ id ] lightness [ hue [ saturation [ translucency ]]] ';' escape: ( [ text ] [ escape ] [text ] ')' camera: cam [ id ] [ -vc x y z ] [ -ep x y z ] [ -ud dx dy dz ] [ -cl hither yon ] [ -ph minx miny maxx maxy ] [ -og | -ps ] (any 2 of: [ -va sx sy ] [ -fs sx sy ] [ -fl len ]) ';' include: include filename ';' execute: execute filename ';' definition: def id ';' statements end ';' cpp_stmt: '#' line_no '"'filename'"' contour: '(' vertex_id {vertex_id ')' tforms: tform { tform } tform: -sx amt | -sy amt | -sz amt | -sa amt | -sv x y z amt | -tx amt | -ty amt | -tz amt | -ta x_amt y_amt z_amt | -tv x y z amt | -rx amt | -ry amt | -rz amt | -rv x y z amt | -mx | -my | -mz | -ma | -mv x y z | -M3 a11 a12 a13 a21 a22 a23 a31 a32 a33 | -M4 a11 a12 a13 a14 a21 a22 a23 a24 a31 a32 a33 a34 a41 a42 a43 a44 UNIGRAFIX uses a right-handed coordinate system with the vertices in the outermost contour of a face given in clock- wise order (ccw order when viewed from outside). CAMERA OPTIONS -og set orthographic mode (the default). -ps sets perspective mode. World to Eye Coordinates -vc sets the view center (the look at point). -ep sets the eye point (the look from point). -ud sets the up direction (not a point). Eye Coordinates to Canonical View Volume -va sets the viewing angles. -fs sets the film size. -fl sets the focal length. -cl sets the hither and yon clipping planes (in view volume coordinates). -ph sets the porthole in the viewport to render (espressed in normalized device coordinates). TRANSFORMS All transformations follow a regular two letter code except for -M3 and -M4 which concatenate an arbitrary 3 by 3 or 4 by 4 matrix respectively. The possibilities for the first letter are: s is for scal- ing, t is for translation, r is for rotation, and m if for mirroring (negative scaling with face vertex reversal). The possibilities for the second letter are: x is for about/along the x-axis, y is for about/along the y-axis, z is for about/along the z-axis, a is for about/along all of the axes, and v is for about/along a particular vector. EXTENSIONS TO FILE FORMAT: Subject: Texture extension to Firewalk Date: Wed, 20 Jan 1999 13:50:46 -0500 (EST) From: Rick Bukowski To: Seth Teller I have successfully extended Firewalk's UG parser and WK object generators to allow the specification of texture coordinates per-vertex on facets of UG objects being imported into Firewalk. The new format allows a new translation rule for face statements with a material specification: face_stmt -> "f" "[" "]" ";" where the texture coord list is of the form [ ... ]. Example: deftex T_MIT; t_file mit_campus.tif; end; c_rgb M_MIT 0.8 0.8 0.8 T_MIT; f x ( v1 v2 v3 v4 ) M_MIT [0 0 0.7 0 0.9 0.8 0 1]; This will create a facet where the vertices have the following texture coordinates on the texture found in the TIFF file mit_campus.tif: v1 has coords (0, 0) v2 has coords (0.7, 0) v3 has coords (0.9, 0.8) v4 has coords (0, 1) There must be exactly 2 times as many tex coords as the total number of vertices in the contours of the face. If not, the WK object generator will complain, and map the texture in the canonical fashion onto the facet. If there is no texture coord list on the statement, i.e. f x ( v1 v2 v3 v4 ) M_MIT; Then the texture will be mapped in the canonical fashion (i.e. using the existing code for mapping tex coords onto facets). This means that the extension will not break any existing UG files. The capability has been tested & confirmed that it works, and checked into the CVS repository here at MIT. Karianne is going to use this capability to allow her Inventor->UG translator to map textures over without loss of information. Rick