[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The conventional suffix for OFF
files is `.off'.
Syntax:
[ST][C][N][4][n]OFF # Header keyword [Ndim] # Space dimension of vertices, present only if nOFF NVertices NFaces NEdges # NEdges not used or checked x[0] y[0] z[0] # Vertices, possibly with normals, # colors, and/or texture coordinates, in that order, # if the prefixes |
OFF
files (name for "object file format") represent collections
of planar polygons with possibly shared vertices, a convenient way to
describe polyhedra. The polygons may be concave but there's no
provision for polygons containing holes.
An OFF
file may begin with the keyword OFF
; it's
recommended but optional, as many existing files lack this keyword.
Three ASCII integers follow: NVertices, NFaces, and NEdges. Thse are the number of vertices, faces, and edges, respectively. Current software does not use nor check NEdges; it needn't be correct but must be present.
The vertex coordinates follow: dimension * Nvertices
floating-point values. They're implicitly numbered 0 through
NVertices-1. dimension is either 3 (default) or 4 (specified by
the key character 4
directly before OFF
in the keyword).
Following these are the face descriptions, typically written with one line per face. Each has the form
N Vert1 Vert2 ... VertN [color] |
The optional color may take several forms. Line breaks are significant here: the color description begins after VertN and ends with the end of the line (or the next # comment). A color may be:
For the one-integer case, the colormap is currently read from the file `cmap.fmap' in Geomview's `data' directory. Some better mechanism for supplying a colormap is likely someday.
The meaning of "default color" varies. If no face of the object has a color, all inherit the environment's default material color. If some but not all faces have colors, the default is gray (R,G,B,A=.666).
A [ST][C][N][n]OFF BINARY
format is accepted; See section 4.1.6 Binary format. It
resembles the ASCII format in almost the way you'd expect, with 32-bit
integers for all counters and vertex indices and 32-bit floats for
vertex positions (and texture coordinates or vertex colors or normals if
COFF
/NOFF
/CNOFF
/STCNOFF
/etc. format).
Exception: each face's vertex indices are followed by an integer indicating how many color components accompany it. Face color components must be floats, not integer values. Thus a colorless triangular face might be represented as
int int int int int 3 17 5 9 0 |
while the same face colored red might be
int int int int int float float float float 3 17 5 9 4 1.0 0.0 0.0 1.0 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |