home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / off / spec / off.txt < prev    next >
Text File  |  1994-06-01  |  57KB  |  1,579 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.                            OFF - A 3D Object File Format
  12.  
  13.  
  14.                                    Randi J. Rost
  15.                                   6-November-1986
  16.                               Updated 12-October-1989
  17.  
  18.                            Digital Equipment Corporation
  19.                           Workstation Systems Engineering
  20.                                  100 Hamilton Ave.
  21.                                 Palo Alto, Ca. 94301
  22.  
  23.  
  24.                       This  document  describes  the  data   format
  25.                  developed by WSE for the interchange and archiving
  26.                  of three-dimensional objects.  This format, called
  27.                  OFF  (for  Object File Format), is general, flexi-
  28.                  ble, and extensible.  It supports ASCII text  ver-
  29.                  sions  of  objects for the purpose of interchange,
  30.                  and binary versions for efficiency of reading  and
  31.                  writing.   It  is  assumed  that applications will
  32.                  develop  their  own,  more  efficient  format  for
  33.                  internal   storage   and   operation   on   three-
  34.                  dimensional objects.
  35.  
  36.  
  37.  
  38.  
  39.             1.  Introduction
  40.  
  41.                  One of the most time-consuming tasks in computer anima-
  42.             tion  projects is designing the 3D models that will be used.
  43.             Many computer animation houses  have  found  that  owning  a
  44.             large  number  of databases makes it easier for them to take
  45.             on new projects at a lower cost (time and $$$).  The cost of
  46.             initially  creating  an  object  can  be  amortized over the
  47.             number of times it can be re-used.  It is our  intention  to
  48.             promote  the  use of OFF files within (and perhaps even out-
  49.             side of) Digital in an effort to build up our collection  of
  50.             useful 3D models.
  51.  
  52.                  The file format itself is not limiting:  OFF files  can
  53.             be  used  for  a  wide variety of object types.  None of the
  54.             "policy decisions" are hard-wired in the design of the  file
  55.             format,  or in the support library routines that allow read-
  56.             ing and writing of OFF files.  Rather, the policy  decisions
  57.             have been left up to the designers since the format supports
  58.             "generic" object definitions.  We  have  developed  specific
  59.  
  60.  
  61.  
  62.  
  63.                                    March 17, 1994
  64.  
  65.  
  66.  
  67.  
  68.  
  69.                                        - 2 -
  70.  
  71.  
  72.  
  73.             conventions for objects that are defined by polygons for use
  74.             within WSE, and we'd encourage others to adopt these conven-
  75.             tions  as well in order to promote the interchange of useful
  76.             object data bases.  The dxmodel application (also  developed
  77.             by WSE) is an example of an application that permits reading
  78.             and writing of OFF files.
  79.  
  80.                  This paper describes the Object File Format itself, the
  81.             conventions we've adopted at WSE, and the library of support
  82.             routines that can be used to read and write OFF files.
  83.  
  84.  
  85.             2.  Design Goals and Non-Goals
  86.  
  87.             Design goals for the Object File Format include:
  88.  
  89.             1)   Simple.  Simple cases should be simple.  It  should  be
  90.                  possible  to type in all the data required for a simple
  91.                  object (such as a cube) by hand.
  92.  
  93.             2)   Powerful.  The Object File Format should be capable  of
  94.                  accomodating   complicated   objects   (many  vertices,
  95.                  polygons, and a wide range of attributes).
  96.  
  97.             3)   Portable.  ASCII text file representation required  for
  98.                  portability  across  operating  systems  and  hardware.
  99.                  This also allows operations on OFF  files  by  familiar
  100.                  system utilities (text editors and the like).
  101.  
  102.             4)   Efficient.  Binary text file representation required to
  103.                  allow  efficient  reading and writing of OFF files.  It
  104.                  is assumed that reading/writing an object is  a  costly
  105.                  operation,  but  reading and writing ASCII data is just
  106.                  too slow.
  107.  
  108.             5)   General.  The format should address the general case of
  109.                  the  three-dimensional  object, not a single particular
  110.                  case.
  111.  
  112.             6)   Extensibile.   Make  sure  the  format  can  be  easily
  113.                  extended to eventually support other primitives such as
  114.                  bezier patches.
  115.  
  116.             7)   No  Favors.   Avoid   hard-wiring   policy   decisions.
  117.                  Rather, provide generic building blocks capable of sup-
  118.                  porting several styles and document a set  of  strongly
  119.                  encouraged conventions that we have adopted.
  120.  
  121.             There are also things that were  specifically  non-goals  in
  122.             the design of the Object File Format.
  123.  
  124.  
  125.  
  126.  
  127.  
  128.                                    March 17, 1994
  129.  
  130.  
  131.  
  132.  
  133.  
  134.                                        - 3 -
  135.  
  136.  
  137.  
  138.             1)   Internal  Format.   The  Object  File  Format  is   not
  139.                  intended  to be forced upon applications as an internal
  140.                  format that must be used.  Rather, it  should  be  con-
  141.                  sidered  a  means  for  inputting and outputting object
  142.                  descriptions in a  device-,  language-,  and  operating
  143.                  system-independent  format.   Applications  should feel
  144.                  free to develop and maintain the most  useful/efficient
  145.                  data format they can, and only convert to/from OFF when
  146.                  input or output of a standardized object is desired.
  147.  
  148.             2)   Object Conventions.   OFF  conventions  are  documented
  149.                  only  for  objects in polygonal form at this point.  It
  150.                  is anticipated that  the  Object  File  Format  can  be
  151.                  easily  extended  to  handle bezier surface patches and
  152.                  other primitives in the future.
  153.  
  154.             3.  Objects
  155.  
  156.                  For the purposes of the Object File Format, we'll adopt
  157.             a very general definition of an object.  An object is simply
  158.             a list of properties (name, description,  author,  copyright
  159.             information, geometry data, colors, etc.)
  160.  
  161.                  The most important information about the object can  be
  162.             found in the header file for the object.  The header file is
  163.             always an ASCII text file  that,  by  convention,  is  named
  164.             name.aoff where name is the object name.  See Appendix B for
  165.             an example of an OFF object header file.
  166.  
  167.                  A few of these properties (name,  description,  author,
  168.             copyright,  type)  are common to every type of 3D object and
  169.             are considered standard properties.  The standard properties
  170.             are built into the routines that manipulate 3D objects.  The
  171.             rest of the properties may vary with the type of object, and
  172.             so are defined by convention only.
  173.  
  174.                  The name of an object is used to concisely describe the
  175.             object  itself.   For  example, we have objects named "x29",
  176.             "banana" and "vw".  By convention, this  name  also  becomes
  177.             the  prefix for OFF data filenames when an object is read or
  178.             written, so it is best to keep it fairly short.
  179.  
  180.                  The description is used  to  more  fully  describe  the
  181.             object itself.  It may contain the time and date of creation
  182.             or more prose describing the object.
  183.  
  184.                  The author should be the name of the  person  (or  com-
  185.             pany, or utility) that created the object.  We should always
  186.             try to give credit where credit is due.   This  field  tells
  187.             you  who to thank for spiffy objects or whose cage to rattle
  188.             when a problem with an OFF file is discovered.
  189.  
  190.  
  191.  
  192.  
  193.                                    March 17, 1994
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                                        - 4 -
  200.  
  201.  
  202.  
  203.                  The copyright field contains information  dealing  with
  204.             the  distribution of the object data.  Some object databases
  205.             will be regarded by a company as proprietary.  These objects
  206.             should  not be copied or distributed without consent.  Other
  207.             objects (vw, x29) were developed by companies or individuals
  208.             and  can  be  copied or used as long as the copyright notice
  209.             appears and proper credit is  given.   Still  other  objects
  210.             (cube,  sphere, etc.) have been placed in the public domain.
  211.             We have tried to be as careful  as  possible  in  preserving
  212.             copyright  and  author  information  for the objects we have
  213.             collected, but sometimes the information was  lost  or  una-
  214.             vailable.   Be  sure  and  honor  copyright notices.  If you
  215.             don't, you (or your company) could end up in big trouble.
  216.  
  217.                  The type field contains the type of  the  object.   For
  218.             now,  only one type of object is supported: polygon objects.
  219.             It is  anticipated  that  polyline  and  surface  patch-type
  220.             objects will be supported in the future as well.
  221.  
  222.                  Also contained in the object header file are lines that
  223.             describe the various properties of the object.  Each line in
  224.             the object header file that describes an  attribute  of  the
  225.             object other than a standard attribute must contain the pro-
  226.             perty name, the property type, the data format and either  a
  227.             file  name or a string containing default data, depending on
  228.             the property type.  Each of these four  items  is  an  ASCII
  229.             string, separated by white space.
  230.  
  231.                  The property  name  uniquely  describes  the  property.
  232.             Property  names  for  which we have defined conventions (see
  233.             Appendix A) include geometry, polygon_colors, vertex_colors,
  234.             back_faces,  vertex_order,  polygon_normals, vertex_normals,
  235.             diffuse_coef, specular_coef, and specular_power.
  236.  
  237.                  OFF currently supports four  property  types:  default,
  238.             generic,  indexed, and indexed_poly.  If a property is indi-
  239.             cated to be of type default, the part of the line after  the
  240.             data  format  is  assumed  to contain some default data that
  241.             will be applied to the entire object.  For instance, it  may
  242.             make  sense  to  give  the entire object a default color and
  243.             default diffuse and specular coefficients.
  244.  
  245.                  If the property type is  either  generic,  indexed,  or
  246.             indexed_poly  (described more fully below), the remainder of
  247.             the line is taken to be a file name that can be  opened  and
  248.             read to obtain the information for the property.
  249.  
  250.                  The data format indicates what type  of  data  will  be
  251.             found  on  the remainder of the line if the property type is
  252.             default, otherwise what kind of data will be  found  in  the
  253.             specified  file.   The data format is a string of characters
  254.  
  255.  
  256.  
  257.  
  258.                                    March 17, 1994
  259.  
  260.  
  261.  
  262.  
  263.  
  264.                                        - 5 -
  265.  
  266.  
  267.  
  268.             (no spaces) that indicate the order and type  of  the  data.
  269.             Supported primitive data types are:
  270.  
  271.             f -  A number stored internally as a 32-bit  floating  point
  272.                  number
  273.  
  274.             d -  A number stored internally as a 64-bit double-precision
  275.                  floating point number
  276.  
  277.             i -  A number stored internally as a 32-bit integer value
  278.  
  279.             h -  A number stored internally as a 16-bit integer value
  280.  
  281.             b -  A number stored internally as an 8-bit integer value
  282.  
  283.             s -  A 32-bit pointer to a null-terminated string of charac-
  284.                  ters
  285.  
  286.                  If, for instance, you were interested in  using  32-bit
  287.             floating  values  for  r, g, and b default color values, you
  288.             might have a line in the object header file that reads
  289.  
  290.                     polygon_colors   default   fff   1.0   0.8   0.0
  291.  
  292.  
  293.                  It is important to understand that in  all  cases,  the
  294.             "string"  (s)  data  primitive  will indicate a pointer to a
  295.             string that is stored internally in the data  block  for  an
  296.             object and not the string itself.
  297.  
  298.             4.  ASCII Property Files
  299.  
  300.                  OFF supports ASCII text files as a way of providing for
  301.             language-,   hardware-,   and  operating  system-independent
  302.             object data files.  The three types of data files  currently
  303.             supported by OFF are generic, indexed, and indexed_poly.
  304.  
  305.             4.1.  Generic Files
  306.  
  307.                  Generic files contain only a count  value  followed  by
  308.             count  data  items of the type specified by the data format.
  309.             Each data item can be comprised of some combination  of  the
  310.             primitive  data  types described in Section 3.  Generic data
  311.             files are useful for storing attributes which are unique  at
  312.             every vertex or polygon (such as color or normals).
  313.  
  314.                  String data items in ASCII generic files may  not  con-
  315.             tain  spaces  or  other white space.  8-bit integers must be
  316.             listed in the range 0-255.
  317.  
  318.                  See Appendix D for an example of an ASCII generic  data
  319.  
  320.  
  321.  
  322.  
  323.                                    March 17, 1994
  324.  
  325.  
  326.  
  327.  
  328.  
  329.                                        - 6 -
  330.  
  331.  
  332.  
  333.             file.
  334.  
  335.  
  336.             4.2.  Indexed Files
  337.  
  338.                  Indexed files make use of a list of indices in order to
  339.             reduce  the amount of data required to store a property, and
  340.             to provide a useful level  of  indirection.   For  instance,
  341.             indexed  files  are  commonly  used  to maintain per-polygon
  342.             color information.  If an object has just five  colors,  the
  343.             indexed  data file would contain the list of the five colors
  344.             followed by an index from  one  to  five  for  each  of  the
  345.             polygons  in  the  object.   If an application maintains the
  346.             indirection, it is possible for the user  to  easily  select
  347.             five different colors to be used on the model.
  348.  
  349.                  An indexed file begins with two integers  separated  by
  350.             white  space:  the  number  of  data items and the number of
  351.             indices that will be provided.  Following these  two  values
  352.             is  the  list  of  data items that is to be used.  Each data
  353.             item in this list can be some combination of  the  primitive
  354.             types described in Section 3.  Following the data items is a
  355.             list of indices each of which is a pointer  to  one  of  the
  356.             items  in the list of data items.  The list of data items is
  357.             assumed to begin starting at one, not zero.
  358.  
  359.  
  360.             4.3.  Indexed_Poly Files
  361.  
  362.                  Indexed_poly files take  advantage  of  a  connectivity
  363.             list  to  reduce the amount of information needed to store a
  364.             list  of  polylines,  polygons,  or  normals.   The   unique
  365.             geometry items (e.g., vertices) are listed in the first part
  366.             of the file.  Following this list is  a  connectivity  list.
  367.             Each  line  in  the connectivity list contains a count value
  368.             followed by count indices (pointers) to information  in  the
  369.             geometry  list.   (Items  in  the  geometry list are indexed
  370.             starting from one, not zero.)
  371.  
  372.                  The first line of an indexed_poly  data  file  contains
  373.             three  integers, separated by white space.  The first number
  374.             on  this  line  indicates   the   number   of   data   items
  375.             (vertices/normals)  that follow, the second number indicates
  376.             the number of polylines/polygons that follow the data  list,
  377.             and  the  third indicates the total number of edges that are
  378.             contained in the polyline/polygon connectivity list.
  379.  
  380.                  String data items in ASCII indexed_poly files  may  not
  381.             contain spaces or other white space.  8-bit integers must be
  382.             listed in the range 0-255.
  383.  
  384.  
  385.  
  386.  
  387.  
  388.                                    March 17, 1994
  389.  
  390.  
  391.  
  392.  
  393.  
  394.                                        - 7 -
  395.  
  396.  
  397.  
  398.                  See Appendix C for an example of an ASCII  indexed_poly
  399.             file.
  400.  
  401.  
  402.             5.  Binary OFF Files
  403.  
  404.                  The same three types of data files described above  are
  405.             also  supported  in  binary  format.   There are a few minor
  406.             differences.
  407.  
  408.  
  409.             5.1.  Generic Files
  410.  
  411.                  Binary generic files begin with the first  32-bit  word
  412.             equal  to  OFF_GENERIC_MAGIC  as defined in the include file
  413.             off.h.  The second word in the file is the count (number  of
  414.             data  items  in  the file).  Following the count is the data
  415.             itself.
  416.  
  417.                  The data format in the header file describes the primi-
  418.             tives  that make up each data item in the list.  Within each
  419.             data item, floats,  doubles,  32-bit  integers,  and  string
  420.             pointers will all begin on a word boundary.  16-bit integers
  421.             will all begin on a half-word boundary.  Thus, if your  data
  422.             format  for  the  data items in a generic data file is "bbb"
  423.             (three byte values), each data item will be stored as  three
  424.             bytes  followed  by  a null byte so that each data item will
  425.             begin on a word boundary.  Strings begin with a 32-bit count
  426.             followed  by  count characters followed by a null character.
  427.             The string is null-padded so it will end on a word boundary.
  428.  
  429.                  (It is assumed that for strings,  the  length  will  be
  430.             read and then the necessary memory will be allocated and the
  431.             string read in.   This  eliminates  a  problem  with  having
  432.             variable-length  data in the data files.  Anyway, strings in
  433.             files are  really  only  there  for  symmetry  with  default
  434.             values,  where  strings  are really useful.  The performance
  435.             implications for files containing strings will  probably  be
  436.             enough to prevent people from using them.)
  437.  
  438.  
  439.  
  440.             5.2.  Indexed Files
  441.  
  442.                  Binary indexed files begin with the first  32-bit  word
  443.             equal  to  OFF_INDEXED_MAGIC  as defined in the include file
  444.             off.h.  The second word in the file is the count (number  of
  445.             data  items  in  the  file).   The third word in the file is
  446.             num_indices (number of indices in the index list).
  447.  
  448.                  Following these two integers is the data for  the  data
  449.  
  450.  
  451.  
  452.  
  453.                                    March 17, 1994
  454.  
  455.  
  456.  
  457.  
  458.  
  459.                                        - 8 -
  460.  
  461.  
  462.  
  463.             item  list.  Each item in the data item list will begin on a
  464.             word boundary.  The data format in the header file describes
  465.             the  primitives  that  make  up  each data item in the list.
  466.             Within each data item, floats, doubles, 32-bit integers, and
  467.             string  pointers  will all begin on a word boundary.  16-bit
  468.             integers will all begin on a half-word boundary.   Thus,  if
  469.             your  data format for the data items in an indexed data file
  470.             is "bbb" (three byte values), each data item will be  stored
  471.             as  three  bytes  followed  by a null byte so that each data
  472.             item will begin on a word boundary.  Strings  begin  with  a
  473.             32-bit count followed by count characters followed by a null
  474.             character.  The string is null-padded so it will  end  on  a
  475.             word boundary.
  476.  
  477.                  Following the data item list is a list of index values.
  478.             This  list  will also begin on a word boundary, however, the
  479.             index values within this list are short integers and will be
  480.             packed two to each 32-bit word.
  481.  
  482.  
  483.             5.3.  Indexed_Poly Files
  484.  
  485.                  Binary indexed_poly files begin with the  first  32-bit
  486.             word  equal  to  OFF_INDEXED_POLY_MAGIC  as  defined  in the
  487.             include file off.h.  The second word is the number  of  data
  488.             items  in  the  vertex  list  (npts),  the third word is the
  489.             number of polylines/polygons in the list (npolys),  and  the
  490.             fourth  word is the number of edges contained in the connec-
  491.             tivity list (nconnects).
  492.  
  493.                  Starting at the fifth word in the file  is  a  list  of
  494.             npts  data items, followed by npolys short integers contain-
  495.             ing polyline/polygon vertex counts,  followed  by  nconnects
  496.             short  integers  which  are  indices  into the array of data
  497.             items.  (This arrangement is slightly  different  than  that
  498.             used  for  indexed_poly files in ASCII format for efficiency
  499.             reasons.)
  500.  
  501.                  The same restrictions that apply to the data types  for
  502.             generic  binary  files apply to indexed_poly binary files as
  503.             well.  In addition, the vertex count array which follows the
  504.             geometry data in an indexed_poly file will always begin on a
  505.             word boundary.  The connectivity array that follows the ver-
  506.             tex  count  array will not necessarily start on a word boun-
  507.             dary, but will always begin  npolys  *  sizeof(short)  bytes
  508.             after the start of the vertex count array.
  509.  
  510.  
  511.             6.  Off.a and Objects.h
  512.  
  513.                  An include file and a  library  of  routines  has  been
  514.  
  515.  
  516.  
  517.  
  518.                                    March 17, 1994
  519.  
  520.  
  521.  
  522.  
  523.  
  524.                                        - 9 -
  525.  
  526.  
  527.  
  528.             provided  for  UNIX/C  programmers to more easily manipulate
  529.             OFF files.  The basic concepts of  "reading"  and  "writing"
  530.             OFF  files  are  supported in this library of routines.  The
  531.             library is a software layer on top of the  operating  system
  532.             file  I/O  interface,  with  special knowledge of OFF files.
  533.             This subroutine library provides a mechanism  for  accessing
  534.             the  syntactical  elements  of  an object file, but makes no
  535.             attempt to understand the semantics.   Higher  level  inter-
  536.             faces can be layered on top.
  537.  
  538.                  The subroutine library refers to an object as a pointer
  539.             to  an OFFObjDesc.  This structure contains a pointer to the
  540.             first property in the property list.  It is defined as  fol-
  541.             lows:
  542.  
  543.                     typedef struct
  544.                         {
  545.                         OFFProperty *FirstProp;     /* Pointer to first property in list */
  546.                         } OFFObjDesc;
  547.  
  548.  
  549.                  The information that describes the object is  contained
  550.             in  a  linked  list  of property structures.  The first such
  551.             structure in the list is pointed at by an OFFObjDesc  struc-
  552.             ture.  The property structures have the form:
  553.  
  554.                     typedef struct _OFFProp
  555.                         {
  556.                         char        PropName[40];
  557.                         int         PropType;
  558.                         char        PropFileName[256];
  559.                         int         PropCount;
  560.                         char        DataFormat[40];
  561.                         char        *PropData;
  562.                         struct _OFFProp *NextProp;
  563.                         } OFFProperty;
  564.  
  565.  
  566.                  PropName contains a string defining one of the property
  567.             types  for  which  a  convention  has  been  defined.   This
  568.             includes the property names "name", "author", "description",
  569.             "copyright",    "comment",   "geometry",   "polygon_colors",
  570.             "polygon_normal", etc.  For  a  complete  list  of  property
  571.             names,  see  Appendix  A.  (The special attribute type "com-
  572.             ment" is supported so that blank lines and comment lines can
  573.             be preserved if an object file is read and then written.)
  574.  
  575.                  The  PropType  field  contains   a   value   equal   to
  576.             OFF_DEFAULT_DATA,   OFF_GENERIC_DATA,  OFF_INDEXED_DATA,  or
  577.             OFF_INDEXED_POLY_DATA which defines the basic type  for  the
  578.             property.
  579.  
  580.  
  581.  
  582.  
  583.                                    March 17, 1994
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                        - 10 -
  590.  
  591.  
  592.  
  593.                  The PropFileName is required if PropType  is  something
  594.             other   than   OFF_DEFAULT_DATA.    It   contains  a  string
  595.             representing the name of the file  to  be  read/written  for
  596.             this  attribute.   This  file name should not contain a path
  597.             leading up to the file itself, only the  actual  file  name.
  598.             The  object  search path mechanism (see Section 7) should be
  599.             used instead.
  600.  
  601.                  The PropCount indicates the actual number of data items
  602.             associated with this particular attribute.  After reading in
  603.             an object, properties of type OFF_DEFAULT_DATA will  have  a
  604.             PropCount  of  one, properties of type OFF_GENERIC_DATA will
  605.             have a PropCount equal to the number of generic  data  items
  606.             in the list, properties of type OFF_INDEXED_DATA will have a
  607.             PropCount equal to the number of  items  in  the  data  item
  608.             list, and properties of type OFF_INDEXED_POLY_DATA will have
  609.             a PropCount equal  to  the  number  of  data  items  in  the
  610.             geometry list.
  611.  
  612.                  The DataFormat field contains a  string  of  characters
  613.             corresponding  to  primitive data items.  The composite type
  614.             of the data for this property can then be deduced by looking
  615.             at this field and applying the rules for padding to word and
  616.             half-word boundaries.
  617.  
  618.                  The PropData field contains a pointer  to  a  block  of
  619.             memory  containing  the actual data for this property.  This
  620.             data will have the same data  alignment  restrictions  as  a
  621.             binary  file has, with the exception of strings.  As strings
  622.             are read in, memory is malloc'ed to hold them and a  pointer
  623.             to the string is stored in the appropriate field in the data
  624.             list.  This means that all primitive data types will have  a
  625.             fixed  size  and lengths and alignments can be computed more
  626.             easily.
  627.  
  628.                  The NextProp field contains a pointer to the next  pro-
  629.             perty structure in the property list.
  630.  
  631.                  The routines contained in the  subroutine  library  are
  632.             defined below.
  633.  
  634.  
  635.             #include "off.h"
  636.  
  637.             int OFFReadObj(Obj, FileName)
  638.                     OFFObjDesc *Obj;
  639.                     char *FileName;
  640.  
  641.             int OFFWriteObj(Obj, FileName, Directory, FileType);
  642.                     OFFObjDesc *Obj;
  643.                     char *FileName;
  644.  
  645.  
  646.  
  647.  
  648.                                    March 17, 1994
  649.  
  650.  
  651.  
  652.  
  653.  
  654.                                        - 11 -
  655.  
  656.  
  657.  
  658.                     char *Directory;
  659.                     int FileType;
  660.  
  661.             void OFFPackObj(Obj)
  662.                     OFFObjDesc *Obj;
  663.  
  664.             void OFFPackProperty(Property)
  665.                     OFFProperty *Property;
  666.  
  667.             int OFFReadGeneric(Property, FileName)
  668.                     OFFProperty *Property;
  669.                     char *FileName;
  670.  
  671.             int OFFWriteGeneric(Property, FileName, FileType)
  672.                     OFFProperty *Property;
  673.                     char *FileName;
  674.                     int FileType;
  675.  
  676.             int OFFReadIndexed(Property, FileName)
  677.                     OFFProperty *Property;
  678.                     char *FileName;
  679.  
  680.             int OFFWriteIndexed(Property, FileName, FileType)
  681.                     OFFProperty *Property;
  682.                     char *FileName;
  683.                     int FileType;
  684.  
  685.             int OFFReadIndexedPoly(Property, FileName)
  686.                     OFFProperty *Property;
  687.                     char *FileName;
  688.  
  689.             int OFFWriteIndexedPoly(Property, FileName, FileType)
  690.                     OFFProperty *Property;
  691.                     char *FileName;
  692.                     int FileType;
  693.  
  694.             OFFObjDesc *OFFCreateObj()
  695.  
  696.             int OFFDestroyObj(Obj)
  697.                     OFFObjDesc *Obj;
  698.  
  699.             OFFProperty *OFFAddProperty(Obj)
  700.                     OFFObjDesc *Obj;
  701.  
  702.             int OFFRemoveProperty(Obj, PropertyName)
  703.                     OFFObjDesc *Obj;
  704.                     char *PropertyName;
  705.  
  706.             int OFFFreeProperty(Property)
  707.                     OFFProperty *Property;
  708.  
  709.  
  710.  
  711.  
  712.  
  713.                                    March 17, 1994
  714.  
  715.  
  716.  
  717.  
  718.  
  719.                                        - 12 -
  720.  
  721.  
  722.  
  723.                  OFFReadObj will attempt to open the object header  file
  724.             named  FileName  and  read  the  object data it contains.  A
  725.             pointer to the constructed object structure will be returned
  726.             in  Obj  when  the object has been read.  An attempt will be
  727.             made to open the specified file first as  given,  then  con-
  728.             catenated  in turn with each of the directories specified by
  729.             the environment search path variable OBJ_PATH.  The property
  730.             list  for  the  object  is  built as the file is read.  Upon
  731.             return, the client need only traverse the property list  and
  732.             select the data it needs.  This routine calls OFFReadGeneric
  733.             and OFFReadIndexedPoly in  order  to  read  associated  data
  734.             files.   OFFReadObj  will return 0 if the read operation was
  735.             successful, -1 otherwise.
  736.  
  737.                  OFFWriteObj will attempt to write the object pointed at
  738.             by  Obj  using the filename specified by FileName.  The file
  739.             will be written in the directory indicated by Directory.  If
  740.             FileType  is OFF_ASCII, the file will be written as an ASCII
  741.             text OFF file.  If FileType is OFF_BINARY, the file will  be
  742.             written  as  a  binary  OFF file.  The property list for the
  743.             object is traversed and each property of the object is writ-
  744.             ten  out  in  turn.   This routine calls OFFWriteGeneric and
  745.             OFFWriteIndexedPoly in order to write associated data files.
  746.             OFFWriteObj  will  return  0 if the write operation was suc-
  747.             cessful, -1 otherwise.
  748.  
  749.                  OFFPackObj attempts to pack the object  pointed  at  by
  750.             Obj.  Packing only applies to geometry and normals stored in
  751.             indexed_polygon format.  See OFFPackProperty below.
  752.  
  753.                  OFFPackProperty packs the property pointed at  by  Pro-
  754.             perty.   Packing can only be applied to indexed_polygon pro-
  755.             perties with format ``fff''.  (This is normally the case for
  756.             geometry  and  normals properties.) Packing works by sharing
  757.             common data (vertex or normal) values.   Since  each  vertex
  758.             and vertex normal of an object is usually shared by three or
  759.             more polygons, this can save  a  great  deal  of  space  and
  760.             rendering  time.  If Property could not be packed, it is not
  761.             modified; otherwise the property data is changed in-place.
  762.  
  763.                  OFFReadGeneric will read the generic  data  file  named
  764.             FileName  (here  FileName  contains the full path name) into
  765.             the property structure pointed at by Property.  This routine
  766.             will  allocate  the  space  it needs in order to read in the
  767.             data.  A pointer to this allocated data space will be stored
  768.             in the PropData field of the specified property as described
  769.             earlier.  The entire object, including all allocated  memory
  770.             resources can later be deallocated by calling OFFDestroyObj.
  771.             This routine will not typically be called directly by appli-
  772.             cations.  OFFReadGeneric will return 0 if the read operation
  773.             was successful, -1 otherwise.
  774.  
  775.  
  776.  
  777.  
  778.                                    March 17, 1994
  779.  
  780.  
  781.  
  782.  
  783.  
  784.                                        - 13 -
  785.  
  786.  
  787.  
  788.                  OFFWriteGeneric will write the generic data  associated
  789.             with Property into the file FileName (here FileName contains
  790.             the full path name of the file to be written).  If  FileType
  791.             is OFF_ASCII, the file will be written as an ASCII text gen-
  792.             eric data file.  If FileType is OFF_BINARY, the file will be
  793.             written  as  a  binary generic data file.  This routine will
  794.             not typically be called directly by  applications.   OFFWri-
  795.             teGeneric  will return 0 if the write operation was success-
  796.             ful, -1 otherwise.
  797.  
  798.                  OFFReadIndexed will read the indexed  data  file  named
  799.             FileName  (here  FileName  contains the full path name) into
  800.             the property structure pointed at by Property.  This routine
  801.             will  allocate  the  space  it needs in order to read in the
  802.             data.  A pointer to this allocated data space will be stored
  803.             in the PropData field of the specified property as described
  804.             earlier.  The entire object, including all allocated  memory
  805.             resources can later be deallocated by calling OFFDestroyObj.
  806.             This routine will not typically be called directly by appli-
  807.             cations.  OFFReadIndexed will return 0 if the read operation
  808.             was successful, -1 otherwise.
  809.  
  810.                  OFFWriteIndexed will write the indexed data  associated
  811.             with Property into the file FileName (here FileName contains
  812.             the full path name of the file to be written).  If  FileType
  813.             is  OFF_ASCII,  the  file  will  be written as an ASCII text
  814.             indexed data file.  If FileType is OFF_BINARY, the file will
  815.             be written as a binary indexed data file.  This routine will
  816.             not typically be called directly by  applications.   OFFWri-
  817.             teIndexed  will return 0 if the write operation was success-
  818.             ful, -1 otherwise.
  819.  
  820.                  OFFReadIndexedPoly will read the indexed_poly data file
  821.             named  FileName  (here FileName contains the full path name)
  822.             into the property structure pointed at  by  Property.   This
  823.             routine will allocate the space it needs in order to read in
  824.             the data.  A pointer to this allocated data  space  will  be
  825.             stored  in  the  PropData field of the specified property as
  826.             described earlier.  The entire object, including  all  allo-
  827.             cated  memory  resources can later be deallocated by calling
  828.             OFFDestroyObj.  This routine will not  typically  be  called
  829.             directly  by applications.  OFFReadIndexedPoly will return 0
  830.             if the read operation was successful, -1 otherwise.
  831.  
  832.                  OFFWriteIndexedPoly will write  the  indexed_poly  data
  833.             associated  with  Property  into  the  file  FileName  (here
  834.             FileName contains the full path name of the file to be writ-
  835.             ten).  If FileType is OFF_ASCII, the file will be written as
  836.             an ASCII  text  indexed_poly  data  file.   If  FileType  is
  837.             OFF_BINARY,   the   file   will   be  written  as  a  binary
  838.             indexed_poly data file.  This routine will not typically  be
  839.  
  840.  
  841.  
  842.  
  843.                                    March 17, 1994
  844.  
  845.  
  846.  
  847.  
  848.  
  849.                                        - 14 -
  850.  
  851.  
  852.  
  853.             called  directly  by applications.  OFFWriteIndexedPoly will
  854.             return 0 if the write operation was  successful,  -1  other-
  855.             wise.
  856.  
  857.                  OFFCreateObj allocates and  initializes  an  OFFObjDesc
  858.             structure  A  pointer  to  the  newly-created  structure  is
  859.             returned.  The null pointer is returned if the operation was
  860.             unsuccessful.
  861.  
  862.                  OFFDestroyObj deallocates all memory resources  associ-
  863.             ated with the object pointed at by Obj.  It works by calling
  864.             OFFFreeProperty for each property in the property  list  for
  865.             the specified object.
  866.  
  867.                  OFFAddProperty adds a property structure  to  the  pro-
  868.             perty  list  associated  with  the object pointed at by Obj,
  869.             initializes it, and returns  a  pointer  to  it.   The  null
  870.             pointer is returned if the operation was unsuccessful.
  871.  
  872.                  OFFRemoveProperty deletes the named property  from  the
  873.             object  pointed  at  by Obj.  This routine returns -1 if the
  874.             named property is not found in the  property  list  for  the
  875.             specified object.
  876.  
  877.                  OFFFreeProperty frees all the  memory  resources  allo-
  878.             cated  to  the  property  structure specified by Property as
  879.             well as the property structure itself.   This  routine  will
  880.             not typically be called directly by applications.
  881.  
  882.             7.  Object Search Path
  883.  
  884.                  It is important to avoid embedding path names in object
  885.             files.   When  an  object  is transported to another system,
  886.             chances are slim that  the  same  directory  structure  will
  887.             exist.   The  OFFReadObj  routine in libobj.a knows about an
  888.             environment variable named OBJ_PATH that is used to overcome
  889.             this problem.
  890.  
  891.                  When an object is read, an attempt  is  first  made  to
  892.             open  it  in the current working directory.  If that attempt
  893.             fails, the directories specified in the OBJ_PATH environment
  894.             variable  are  tried  in turn until the file is successfully
  895.             opened or the directory list is  exhausted.   OBJ_PATH  con-
  896.             tains  a  list of directories, separated by spaces, that are
  897.             to be searched for the named objects.
  898.  
  899.                  The name of  the  directory  where  a  successful  open
  900.             operation occurred is used for opening associated data files
  901.             as well.  This means that all of the data files for  a  par-
  902.             ticular object must reside in the same directory.
  903.  
  904.  
  905.  
  906.  
  907.  
  908.                                    March 17, 1994
  909.  
  910.  
  911.  
  912.  
  913.  
  914.                                        - 15 -
  915.  
  916.  
  917.  
  918.                  It is hoped that in this way, users  will  be  able  to
  919.             draw  on  one  or  more collections of "standard" objects in
  920.             addition to their own private collections of objects.
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.  
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.                                    March 17, 1994
  974.  
  975.  
  976.  
  977.  
  978.  
  979.                                        - 16 -
  980.  
  981.  
  982.  
  983.             8.  Appendix A: Conventions for Polygonal Objects
  984.  
  985.                  This list contains the conventions we have adopted  for
  986.             describing  3D  polygonal  objects which are defined in some
  987.             three-dimensional model coordinate system.  Items in regular
  988.             type  are string literal, printed as they would appear in an
  989.             OFF file, and item in italics indicate data values that will
  990.             vary  from  object to object.  By convention, the header for
  991.             an ASCII OFF file is suffixed with ".aoff"  and  the  header
  992.             for  a  binary  OFF file is suffixed with ".off".  There are
  993.             two choices for how colors  may  be  stored.   If  they  are
  994.             stored as generic data, the suffixes used are ".{b}pcol" for
  995.             polygon colors and ".{b}vcol" for vertex  colors.   If  they
  996.             are   stored   as   indexed  data,  the  suffixes  used  are
  997.             ".{b}ipcol" and ".{b}ivcol".
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.             Property        Type    Format  Defaults        ASCII   Binary
  1004.                                                             filename filename
  1005.  
  1006.             name            *****   *****   objname         *****   *****
  1007.             author          *****   *****   author          *****   *****
  1008.             description     *****   *****   description     *****   *****
  1009.             copyright       *****   *****   copyright       *****   *****
  1010.             type            *****   *****   polyline        *****   *****
  1011.                             *****   *****   polygon         *****   *****
  1012.             geometry        indexed
  1013.                             _poly   fff     *****        name.geom  name.bgeom
  1014.             polygon_colors  generic fff     *****        name.pcol  name.bpcol
  1015.             vertex_colors   generic fff     *****        name.vcol  name.bvcol
  1016.             polygon_colors  indexed fff     *****        name.ipcol name.bipcol
  1017.             vertex_colors   indexed fff     *****        name.ivcol name.bivcol
  1018.             back_faces      default s       cull            *****   *****
  1019.                                             display         *****   *****
  1020.                                             reverse         *****   *****
  1021.             vertex_order    default s       clockwise       *****   *****
  1022.                                             counter-
  1023.                                             clockwise       *****   *****
  1024.                                             counter-
  1025.                                             clockwise       *****   *****
  1026.             polygon_normals generic fff     *****        name.pnorm name.bpnorm
  1027.             vertex_normals  generic fff     *****        name.vnorm name.bvnorm
  1028.             diffuse_coef    default f       value           *****   *****
  1029.             specular_coef   default f       value           *****   *****
  1030.             specular_power  default f       value           *****   *****
  1031.             bounding_box    default ffffff  value           *****   *****
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.                                    March 17, 1994
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.                                        - 17 -
  1049.  
  1050.  
  1051.  
  1052.             9.  Appendix B: OFF Header File For a Cube (cube.aoff)
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.         name            cube    
  1062.         author          Randi J. Rost
  1063.             description     cube  with  sides of red, green, blue, cyan, yellow, magenta      
  1064.         copyright       public domain
  1065.             type            polygon
  1066.  
  1067.  
  1068.             #Prop.          data type       format  filename or default data
  1069.             #_______        _________       ______  ________________________
  1070.  
  1071.             geometry        indexed_poly    fff     cube.geom
  1072.             vertex_order    default         s       clockwise
  1073.             polygon_colors  generic         fff     cube.pcol
  1074.             back_faces      default         s       cull
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.                                    March 17, 1994
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.                                        - 18 -
  1114.  
  1115.  
  1116.  
  1117.             10.  Appendix C: Listing of cube.geom
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.             8       6      24  
  1127.            -1.0    -1.0     1.0
  1128.            -1.0     1.0     1.0
  1129.             1.0     1.0     1.0
  1130.             1.0    -1.0     1.0
  1131.            -1.0    -1.0    -1.0
  1132.            -1.0     1.0    -1.0
  1133.             1.0     1.0    -1.0
  1134.             1.0    -1.0    -1.0                       
  1135.             4       1       2       3       4
  1136.             4       5       6       2       1
  1137.             4       3       2       6       7
  1138.             4       3       7       8       4
  1139.             4       1       4       8       5
  1140.             4       8       7       6       5
  1141.  
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.  
  1152.  
  1153.  
  1154.  
  1155.  
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.                                    March 17, 1994
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.                                        - 19 -
  1184.  
  1185.  
  1186.  
  1187.             11.  Appendix D: Listing of cube.pcol
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.             6            
  1197.             1.0        0.0      0.0
  1198.             0.0        1.0      0.0 
  1199.             0.0        0.0      1.0 
  1200.             0.0        1.0      1.0 
  1201.             1.0        1.0      0.0  
  1202.             1.0        0.0      1.0
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.                                    March 17, 1994
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.                                        - 20 -
  1252.  
  1253.  
  1254.  
  1255.             12.  Appendix E: Listing of off.h
  1256.  
  1257.  
  1258.  
  1259.             #define OFF_INDEXED_POLY_MAGIC  0xFEEDFEEDL
  1260.             #define OFF_GENERIC_MAGIC       0xBEEFBEEFL
  1261.             #define OFF_INDEXED_MAGIC       0xBADBADBAL
  1262.  
  1263.             #define OFF_BIGSTR              256
  1264.             #define OFF_SMSTR               40
  1265.  
  1266.             #define OFF_ASCII               0
  1267.             #define OFF_BINARY              1
  1268.  
  1269.  
  1270.             /* Types of data for object properties  */
  1271.  
  1272.             #define OFF_UNKNOWN_TYPE_DATA   0
  1273.             #define OFF_STANDARD_DATA       1
  1274.             #define OFF_COMMENT_DATA        2
  1275.             #define OFF_DEFAULT_DATA        3
  1276.             #define OFF_GENERIC_DATA        4
  1277.             #define OFF_INDEXED_POLY_DATA   5
  1278.             #define OFF_INDEXED_DATA        6
  1279.  
  1280.  
  1281.             typedef struct _OFFProp
  1282.                 {
  1283.                 char        PropName[OFF_SMSTR];     /* Name of property (or attribute)  */
  1284.                 int         PropType;                /* Type of data for property        */
  1285.                 char        PropFileName[OFF_BIGSTR];/* Name of file that has prop data  */
  1286.                 char        DataFormat[OFF_SMSTR];   /* Pointer to property data format  */
  1287.                 int         PropCount;               /* Number of data items for property*/
  1288.                 char        *PropData;               /* Pointer to property data         */
  1289.                 struct _OFFProp *NextProp;           /* Pointer to next property in list */
  1290.                 } OFFProperty;
  1291.  
  1292.             typedef struct
  1293.                 {
  1294.                 OFFProperty *FirstProp;              /* Pointer to first property in list*/
  1295.                 } OFFObjDesc;
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.                                    March 17, 1994
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.                                        - 21 -
  1317.  
  1318.  
  1319.  
  1320.             13.  Appendix F: Data Structure Format
  1321.  
  1322.                  The following diagram depicts some of the  data  struc-
  1323.             tures   for   the  object  cube.aoff  after  being  read  by
  1324.             OFFReadObj() (or just prior  to  being  written  by  OFFWri-
  1325.             teObj()). 
  1326.  
  1327.             NOTE:  To see this figure, refer to the PostScript output
  1328.             or use the pic (troff) program to process the following commands. 
  1329.  
  1330.  
  1331.             move to 0.0, 14.5 Object:         [         boxht
  1332.             = 0.3i; boxwid = 2.0i         moveht = 0.3i; movewid =  0.0i
  1333.                         down          A: box "FirstProp"            move
  1334.             up 0.3i; move right  2.0i              down          B:  box
  1335.                     ]
  1336.  
  1337.             move to 1.0, 13.0 Prop1:          [          boxht  =  0.3i;
  1338.             boxwid = 1.5i         moveht = 0.3i; movewid = 0.0i
  1339.             down         A: box "PropName"              down          B:
  1340.             box "PropType"            down         C: box "PropFileName"
  1341.                        down         D: box "DataFormat"             down
  1342.                     E:  box  "PropCount"             down         F: box
  1343.             "PropData"              down           H:   box   "NextProp"
  1344.                         move  up  2.1i;              move  right  2.25i;
  1345.                        boxht = 0.3i; boxwid = 3.0i             moveht  =
  1346.             0.3i;  movewid  = 0.0i            down         I: box "name"
  1347.                        down         J: box "OFF_STANDARD_DATA"
  1348.             down         K: box "null string"            down         L:
  1349.             box  "null  string"              down          M:  box   "0"
  1350.                         down          N:  box            down         O:
  1351.             box         ]
  1352.  
  1353.             move to 1.0, 10.0 Prop2:          [          boxht  =  0.3i;
  1354.             boxwid = 1.5i         moveht = 0.3i; movewid = 0.0i
  1355.             down         A: box "PropName"              down          B:
  1356.             box "PropType"            down         C: box "PropFileName"
  1357.                        down         D: box "DataFormat"             down
  1358.                     E:  box  "PropCount"             down         F: box
  1359.             "PropData"              down           H:   box   "NextProp"
  1360.                         move  up  2.1i;              move  right  2.25i;
  1361.                        boxht = 0.3i; boxwid = 3.0i             moveht  =
  1362.             0.3i; movewid = 0.0i            down         I: box "author"
  1363.                        down         J: box "OFF_STANDARD_DATA"
  1364.             down         K: box "null string"            down         L:
  1365.             box  "null  string"              down          M:  box   "0"
  1366.                         down          N:  box            down         O:
  1367.             box         ]
  1368.  
  1369.             move to 1.0, 7.0  Prop3:          [          boxht  =  0.3i;
  1370.             boxwid = 1.5i         moveht = 0.3i; movewid = 0.0i
  1371.             down         A: box "PropName"              down          B:
  1372.             box "PropType"            down         C: box "PropFileName"
  1373.                        down         D: box "DataFormat"             down
  1374.                     E:  box  "PropCount"             down         F: box
  1375.             "PropData"              down           H:   box   "NextProp"
  1376.                         move  up  2.1i;              move  right  2.25i;
  1377.  
  1378.  
  1379.  
  1380.  
  1381.                                    March 17, 1994
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.                                        - 22 -
  1388.  
  1389.  
  1390.  
  1391.                        boxht = 0.3i; boxwid = 3.0i             moveht  =
  1392.             0.3i;   movewid   =  0.0i              down          I:  box
  1393.             "geometry"                     down              J:      box
  1394.             "OFF_INDEXED_POLY_DATA"                down          K:  box
  1395.             "cube.geom"            down         L:  box  "fff"
  1396.             down          M:  box  "6"              down          N: box
  1397.                        down         O: box         ]
  1398.  
  1399.             move to 1.0, 4.0  Prop4:          [          boxht  =  0.3i;
  1400.             boxwid = 1.5i         moveht = 0.3i; movewid = 0.0i
  1401.             down         A: box "PropName"              down          B:
  1402.             box "PropType"            down         C: box "PropFileName"
  1403.                        down         D: box "DataFormat"             down
  1404.                     E:  box  "PropCount"             down         F: box
  1405.             "PropData"              down           H:   box   "NextProp"
  1406.                         move  up  2.1i;              move  right  2.25i;
  1407.                        boxht = 0.3i; boxwid = 3.0i             moveht  =
  1408.             0.3i;   movewid   =  0.0i              down          I:  box
  1409.             "polygon_colors"                  down            J:     box
  1410.             "OFF_GENERIC_DATA"                  down            K:   box
  1411.             "cube.pcol"            down         L:  box  "fff"
  1412.             down          M:  box  "6"              down          N: box
  1413.                        down         O: box         ]
  1414.  
  1415.             move to 1.0, 1.0  Prop5:          [          boxht  =  0.3i;
  1416.             boxwid = 1.5i         moveht = 0.3i; movewid = 0.0i
  1417.             down         A: box "PropName"              down          B:
  1418.             box "PropType"            down         C: box "PropFileName"
  1419.                        down         D: box "DataFormat"             down
  1420.                     E:  box  "PropCount"             down         F: box
  1421.             "PropData"              down           H:   box   "NextProp"
  1422.                         move  up  2.1i;              move  right  2.25i;
  1423.                        boxht = 0.3i; boxwid = 3.0i             moveht  =
  1424.             0.3i;   movewid   =  0.0i              down          I:  box
  1425.             "back_faces"                    down             J:      box
  1426.             "OFF_DEFAULT_DATA"              down          K:  box  "null
  1427.             string"            down         L: box "s"              down
  1428.                     M:  box  "0"            down         N: box
  1429.             down         O: box "null pointer"         ]
  1430.  
  1431.             line from Prop1.O.c to Prop1.O.c.x, (Prop1.s.y +  Prop2.n.y)
  1432.             /  2.0  line  to  0.5, (Prop1.s.y + Prop2.n.y) / 2.0 line to
  1433.             0.5, Prop2.A.c.y arrow to Prop2.A.w
  1434.  
  1435.             line from Prop2.O.c to Prop2.O.c.x, (Prop2.s.y +  Prop3.n.y)
  1436.             / 2.0 line to 0.5, (Prop2.s.y + Prop3.n.y) / 2.0 line dashed
  1437.             to 0.5, Prop3.A.c.y arrow to Prop3.A.w
  1438.  
  1439.             line from Prop3.O.c to Prop3.O.c.x, (Prop3.s.y +  Prop4.n.y)
  1440.             / 2.0 line to 0.5, (Prop3.s.y + Prop4.n.y) / 2.0 line dashed
  1441.             to 0.5, Prop4.A.c.y arrow to Prop4.A.w
  1442.  
  1443.  
  1444.  
  1445.  
  1446.                                    March 17, 1994
  1447.  
  1448.  
  1449.  
  1450.  
  1451.  
  1452.                                        - 23 -
  1453.  
  1454.  
  1455.  
  1456.             line from Prop4.O.c to Prop4.O.c.x, (Prop4.s.y +  Prop5.n.y)
  1457.             /  2.0  line  to  0.5, (Prop4.s.y + Prop5.n.y) / 2.0 line to
  1458.             0.5, Prop5.A.c.y arrow to Prop5.A.w
  1459.  
  1460.             line  from  Object.B.c  to   Object.B.c.x,   (Object.s.y   +
  1461.             Prop1.n.y) / 2.0 line to 0.5, (Object.s.y + Prop1.n.y) / 2.0
  1462.             line to 0.5, Prop1.A.c.y arrow to Prop1.A.w
  1463.  
  1464.             boxht = 0.3i; boxwid = 2.0i P1: box "cube" at Prop1.N.e.x  +
  1465.             1.5i, Prop1.N.e.y arrow from Prop1.N.c to P1.w
  1466.  
  1467.             P2: box "Randi J. Rost" at Prop2.N.e.x +  1.5i,  Prop2.N.e.y
  1468.             arrow from Prop2.N.c to P2.w
  1469.  
  1470.             P3: box "  8    6    24 -1.0 -1.0" at  Prop3.N.e.x  +  1.5i,
  1471.             Prop3.N.e.y  P4:  box " 1.0 -1.0  1.0  1.0  1.0" with .nw at
  1472.             P3.sw P5: box " 1.0  1.0  1.0 -1.0  1.0" with .nw  at  P4.sw
  1473.             P6: box "-1.0 -1.0 -1.0 -1.0  1.0" with .nw at P5.sw P7: box
  1474.             "-1.0  1.0  1.0 -1.0  1.0" with .nw at P6.sw P8:  box  "-1.0
  1475.             -1.0  4  4  4 4  4  4" with .nw at P7.sw P9: box "1  2  3  4
  1476.             5  6  2  1" with .nw at P8.sw Pa: box "3  2  6  7  3   7   8
  1477.             4"  with  .nw at P9.sw Pb: box "1  4  8  5  8  7  6  5" with
  1478.             .nw at Pa.sw arrow from Prop3.N.c to P3.w
  1479.  
  1480.             Pc: box "6    1.0  0.0  0.0  0.0"  at  Prop4.N.e.x  +  1.5i,
  1481.             Prop4.N.e.y  Pd:  box  "1.0  0.0  0.0  0.0  1.0" with .nw at
  1482.             Pc.sw Pe: box "0.0  1.0  1.0  1.0  1.0" with  .nw  at  Pd.sw
  1483.             Pf:  box  "0.0   1.0  0.0  1.0     " with .nw at Pe.sw arrow
  1484.             from Prop4.N.c to Pc.w
  1485.  
  1486.             boxht = 0.3i; boxwid = 0.5i Pg: box at Prop5.N.e.x  +  1.0i,
  1487.             Prop5.N.e.y  Ph:  box  "cull"  at Pg.e.x + 1.0i, Prop5.N.e.y
  1488.             arrow from Pg.c to Ph.w arrow from Prop5.N.c to Pg.w
  1489.  
  1490.             "Object" at Object.A.n above
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.                                    March 17, 1994
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.                                        - 24 -
  1518.  
  1519.  
  1520.  
  1521.             14.  Acknowledgements
  1522.  
  1523.                  OFF is a derivative of an object file  format  used  at
  1524.             Ohio  State University.  Special thanks to Allen Akin of WSE
  1525.             for helpful ideas  and  suggestions.  Thanks  also  to  Jeff
  1526.             Friedberg  of  Digital's High-Performance Workstation (HPWS)
  1527.             group and Shaun Ho  of  WSE  who  also  contributed  to  the
  1528.             design.  Danny Shapiro of WSE provided suggestions for addi-
  1529.             tional enhancements and conventions.
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.                                    March 17, 1994
  1577.  
  1578.  
  1579.