home *** CD-ROM | disk | FTP | other *** search
/ Virtual Reality Homebrewer's Handbook / vr.iso / rend386 / doc / world.doc < prev   
Text File  |  1996-03-19  |  14KB  |  310 lines

  1.                                World File Format
  2.                          Version 2.00 -- August, 1992
  3.                             Written by Bernie Roehl
  4.  
  5. The "demo4" program supports a very simple kind of world description file
  6. format in order to specify the location of objects in a virtual environment
  7. as well as various other scene characteristics.
  8.  
  9. The file is entirely ascii.  Each 'record' is one line; anything after the
  10. first '#' is treated as a comment and ignored.  Blank lines are also ignored.
  11.  
  12. The format is intended to be highly extensible; any line which cannot be
  13. recognized should simply be ignored.
  14.  
  15. Each line (i.e. record) contains some information about the scene; the
  16. possible types of records are listed below.  Note that new ones may be
  17. added at any time, but that the definitions given below should not change.
  18.  
  19. Everything is case-insensitive; keywords are shown below in uppercase, but
  20. are generally entered in lowercase.
  21.  
  22. LOADPATH path
  23.      Specifies a path prefix for loading files.  Any files (whether specified
  24.      in the world file itself, subsequent world files, or in referenced .fig
  25.      files) will be loaded from the specified directory.  However, if a
  26.      filename contains '\' or '/' characters, it is used verbatim (i.e. the
  27.      LOADPATH setting is ignored).
  28.  
  29. PALETTE filename
  30.      Loads a 256-entry binary palette file (3 bytes (R,G,B) for each entry).
  31.      The file is binary.  Note that alternate palettes may not handle shading
  32.      as well as the default.
  33.  
  34. SKYCOLOR index
  35.      Specifies which of the 256 available colors should be used for the "sky".
  36.      
  37. GROUNDCOLOR index
  38.      Specifies which of the 256 available colors should be used for the
  39.      "ground". If the sky and ground color are identical, a solid screen
  40.      clear is used; this is a bit faster.
  41.  
  42. SCREENCLEAR value
  43.      If the specified value is non-zero, then the screen will be cleared
  44.      before each frame; if it's zero, the screen clearing is not done (this
  45.      is useful if you know that the entire window will be covered by the
  46.      image, and that no background will show through; in such a situation,
  47.      specifying this option will improve performance).
  48.  
  49. AMBIENT value
  50.      Specifies the level of the ambient light; 76 is the default, and a good
  51.      value to use.
  52.  
  53. AMBIENTCOLOR r,g,b
  54.      Specifies the color of the ambient light; currently not used in REND386.
  55.  
  56. WORLDSCALE value
  57.      Specifies the world scale as a floating-point number.  The value is
  58.      expressed in millimeters per unit.  The default is 1.00, probably a
  59.      good choice.  This is only used for stereoscopic viewing.
  60.  
  61. LIGHT x,y,z
  62.      Specifies the location of the light source in long integer world
  63.      coordinates.
  64.  
  65. WINDOW x,y,width,height
  66.      Specifies the location and size of the viewing window in screen
  67.      coordinates.  In REND386 using Mode Y, the window's left and right
  68.      edges must be on an 8-pixel boundary (i.e. x must be a multiple of 8,
  69.      and (x+width-1) must be a multiple of 8).
  70.  
  71. START x,y,z pan,tilt,roll zoom
  72.      Specifies your starting location, viewing direction and zoom factor.
  73.      The x,y,z values are long integers giving coordinates, the
  74.      pan,tilt,roll values are floating-point angles, and the zoom is a
  75.      floating-point number.
  76.  
  77. HITHER value
  78.      Specifies the near clipping distance as a long integer in world
  79.      coordinates.  The value should typically be 10 or more.
  80.  
  81. YON value
  82.      Specifies the far clipping distance as a long integer in world
  83.      coordinates.  The value should typically be 1000000 or more.
  84.  
  85. EYESPACING value
  86.      Specifies the distance between your eyes in millimeters (only needed
  87.      for steroscopic viewing).  The default value is 55.
  88.  
  89. SCREENDIST value
  90.      Specifies the distance from your eyes to the screen in millimeters
  91.      (only needed for stereoscopic viewing).  The default value is 700.
  92.  
  93. SCREENWIDTH value
  94.      Specifies the width of the screen in pixels (only needed for stereoscopic
  95.      viewing).  The default is 250.
  96.  
  97. CONVERGENCE value
  98.      Specifies the convergence distance (only needed for stereoscopic
  99.      viewing).  Should usually be the same as the SCREENDIST value;
  100.      however, 1200 or so may be easier on the eyes.
  101.  
  102. OBJECT [objname=]filename sx,sy,sz rx,ry,rz tx,ty,tz depthtype mappings parent
  103.      Loads an object from a .plg file with the given filename.  If the
  104.      "objname=" is present, it assigns the newly-loaded object that name for
  105.      future reference.  The sx,sy,sz values are floating-point scale factors
  106.      to increase or decrease the size of the object as it's loaded.  The rx,
  107.      ry,rz values are the angles to rotate the object around each of the three
  108.      axes; rx is done first, then ry and finally rz.  The tx,ty,tz values
  109.      translate (move) the object to a new location; this is done after the
  110.      scaling and rotation.  The depthtype field controls how the depth-
  111.      sorting for the object is to be handled, and is described elsewhere.
  112.      The "mappings" feature is explained below.  The "parent" field is
  113.      the name of the object that this object is a child of.  If omitted,
  114.      the child moves independently.  If the parentname is the word "fixed",
  115.      then the object is fixed in space and cannot be moved; this is more
  116.      efficient in terms of memory usage, since no segment (i.e. motion
  117.      control) structure needs to be allocated.  All fields are
  118.      optional, but you must include all the fields prior to the last one
  119.      you wish to use (i.e. you can only leave things off the end, not off
  120.      the beginning or out of the middle).
  121.  
  122. FIGURE [figname=]filename sx,sy,sz rx,ry,rz tx,ty,tz parentname
  123.      Loads a segmented figure from a .fig file with the given filename.
  124.      All the parameters have the same meaning as for the OBJECT record
  125.      described above.
  126.  
  127. POLYOBJ npts surface x1,y1,z1 x2,y2,z2 [...] x8,y8,z8
  128.     Directly specifies a polygon to be placed in the scene.  The value
  129.     npts is the number of points (maximum 8), the surface is a surface name
  130.     (see below on surfaces) and the vertices are given in long integer
  131.     world coordinate form.
  132.  
  133. INCLUDE filename
  134.      Includes the specified file as if its contents appeared at the current
  135.      point in the current file.
  136.  
  137. SPLIT x,y,z nx,ny,nz flags
  138.      Defines a split; see "split.doc" for details.  All objects defined
  139.      after a SPLIT line and before an ENDSPLITS line (or another SPLIT line)
  140.      will be considered to be "on" that split.  The x,y,z values are the
  141.      location of a point (in long integer world coordinates), and the
  142.      nx,ny,nz values are a normal to the plane.
  143.  
  144. SPLITPTS x1,y1,z1 x2,y2,z2 x3,y3,z3 flags
  145.      An alternative way of defining a split, by giving three vertices (again,
  146.      in long integer world coordinates).
  147.  
  148. ENDSPLITS
  149.      Marks the end of a sequence of splits.
  150.  
  151. AREA x,y,z name
  152.      Assigns a name to an area (a chunk of space created by a set of
  153.      clipping planes).  The x,y,z are again long integer world coordintes,
  154.      and specify any point within the area.
  155.  
  156. FLOOR name a,b,c,d
  157.      Specifies the coordinates of a plane equation describing the slope of
  158.      the floor in the area of the given name.
  159.  
  160. FLOORPTS name x1,y1,z1 x2,y2,z2 x3,y3,z3
  161.      An alternative way of specifying the floor plane equation, by giving
  162.      three points in the plane.
  163.  
  164. CEILING name a,b,c,d
  165.      As for FLOOR, but for the ceiling.
  166.  
  167. CEILINGPTS name x1,y1,z1 x2,y2,z2 x3,y3,z3
  168.      As for FLOORPTS, but for the ceiling.
  169.  
  170. POSITION objname x,y,z
  171.      Moves (i.e. translates) the specified object to the given x,y,z location.
  172.  
  173. ROTATE objname rx,ry,rz
  174.      Rotates the specified object to the given angles about each of the
  175.      axes.  The angles are specified in floating point, and are measured in
  176.      degrees.
  177.  
  178.                        Configuration Settings
  179.  
  180. VIDEODEV name
  181.      Loads a video driver (.rvd file) of the given name.
  182.  
  183. MOUSEDEV name
  184.      Loads a mouse driver (.mpd file) of the given name.
  185.  
  186. HEADDEV name x y z rx ry rz
  187.      Loads a head pointer device of the given name, specifying scaling
  188.      values for translation and rotation.
  189.  
  190. GLOVEDEV name x y z rx ry rz
  191.      Loads a glove pointer device of the given name, specifying scaling
  192.      values for translation and rotation.
  193.  
  194. PTRDEV name x y z rx ry rz
  195.      Loads a generic pointer device of the given name, specifying translation
  196.      and rotation offsets.
  197.  
  198. SWITCHDEV name
  199.      Loads a device driver to control the switch of left eye/right eye images.
  200.  
  201. GLOVECURSOR filename
  202.      Specifies a .fig file containing a visual represenation of a glove
  203.      cursor.
  204.  
  205. PTRCURSOR filename
  206.      Specifies a .plg file containing a visual representation of a generic
  207.      pointer device.
  208.  
  209. SEGAPORT port mask left right off image
  210.      Allows configuration of the Sega driver; 'port' is the hardware port
  211.      address used to control the eye-switching. The 'mask' determines what
  212.      bits should be changeable at that address (since the port may be used
  213.      for more than just the Sega glasses).  The 'left', 'right' and 'off'
  214.      values are the bit patterns to write to clear the left lens (only),
  215.      the right lens (only) and both lenses.  The 'image' value is what
  216.      should be written to the other bits in the byte.
  217.  
  218. PGLOVEPORT in out writemask nonemask latchmask clkmask clklatch datamask image
  219.      Allows configuration of the PowerGlove driver.  The 'in' and 'out'
  220.      values specify the hardware port addresses for reading and writing to the
  221.      glove.  The writemask determines what bits should be changeable at the
  222.      write address (since the port may be used for more than just the
  223.      PowerGlove).  The 'nonemask', 'latchmask', 'clkmask' and 'clklatch'
  224.      values are the bit patterns to write to the glove.  The datamask selects
  225.      the bit in the 'in' port that has the data, and the 'image' value is
  226.      the bit pattern that should be written to the unused portion of the byte
  227.      sent to the 'out' port address.
  228.  
  229. PGLOVETIME bitdelay bytedelay
  230.      Allows you to configure the PowerGlove timing.
  231.  
  232. STEREOSET physdist screenwidth pixelwidth eyespacing convergence
  233.      Allows you to set the stereo parameters in one line instead of
  234.      with a series of lines; the meaning of each of the parameters
  235.      is described in the individual entries above.
  236.      
  237. STEREOTYPE [SWITCH | SEPARATE | SPLIT]
  238.      Specifies the type of stereoscopic display being used.  SWITCH means
  239.      a system for alternate left eye/right eye frames.  SEPARATE means that
  240.      you have multiple VGA cards (supported by a .rvd driver) that can
  241.      display left and right eye images simultaneously.  SPLIT means a
  242.      split-screen mode, with the left and right eye images displayed
  243.      simultaneously in different parts of the screen.
  244.  
  245. STEREOLEFT xoff xflip xrot left top right bottom
  246.    and
  247. STEREORIGHT xoff xflip xrot left top right bottom
  248.      Allows you to further configure steroscopic viewing parameters.  The
  249.      xoff value gives a horizontal displacement for the image in pixels; 
  250.      the xflip value allows you to flip (mirror image) the image for that
  251.      eye.  The xrot value specifies an outward rotation in degrees, and the
  252.      [left,top,right,bottom] values  specify a window in the physical
  253.      display.
  254.  
  255.  
  256.                         Surfaces and Mappings
  257.  
  258. A two-level scheme for mapping surface colors is used; at first it may seem
  259. complex, but it provides greater flexibility for the future.
  260.  
  261. Each polygon in a .plg file can have either an ordinary color value as
  262. described in "colors.doc" (e.g. 0x1234), or a value with the top bit set
  263. (e.g. 0x8007) which indicates that the bottom 15 bits are intended as an
  264. index into a color mapping table.  There can be a number of these mapping
  265. tables, and each object can refer to a different map.
  266.  
  267. The color mapping table maps the index into a surface name; if one were
  268. going to a ray-tracing application, this could be used as-is.  In the case
  269. of REND386, we must map that surface name into a color value of the type
  270. described in "colors.doc".
  271.  
  272. So, the first-stage mapping is from index to name, and the second is from
  273. name to value.
  274.  
  275. The first stage is done with any of several mapping tables
  276. (possibly one per object, though in most cases multiple objects will
  277. use the same mapping table).  A map is created with a SURFACEMAP record,
  278. and entries are placed in it with SURFACE records.  Note that when you load
  279. an object, the color mapping table name can be specified; this allows you to
  280. have (for example) five chairs all loaded from the same .plg file but with
  281. different coloration).
  282.      
  283. The second stage is done with a single, global mapping table created by
  284. a series of SURFACEDEF records.
  285.  
  286. The record formats are as follows:
  287.  
  288. SURFACEDEF name value
  289.      Defines a new surface; maps a surface name (such as "wood") to a numeric
  290.      value of the type described in "colors.doc" (such as 0x12DF).
  291.  
  292. SURFACEMAP name
  293.      Marks the start of a new surface map.  All subsequent SURFACE entries
  294.      will be placed in this map.
  295.  
  296. SURFACE index name
  297.      Defines an entry in the current surface map, which takes an index value
  298.      (the bottom 15 bits of the value in the .plg file) and maps it into a
  299.      surface name (which is in turn mapped to a 16-bit color value).
  300.  
  301.      
  302.                                Future Work
  303.  
  304. That's it; other types exist, but they're purely experimental at this stage.
  305. Future releases of the REND386 demo program may or may not support this
  306. format, and if they do they will certainly implement extensions to it.
  307.  
  308. As usual, direct any questions to Bernie (broehl@sunee.uwaterloo.ca) or to
  309. Dave (dstampe@sunee.uwaterloo.ca).
  310.