12/31/2017: KENVEX by Ken Silverman.
------------------------------------------------------------------------------
History:

I worked on KENVEX mainly during the summer of 1998. It was my 2nd attempt at
writing a successor to Build. For the record, my first attempt was POLYTEX in
1994-1995, and my 3rd attempt was BUILD2 from 2006-2011.

KENVEX was a very unfinished demo. I never got it past basic rendering and
some very limited editing. Some of the features of KENVEX were:

* Portals for hidden surface removal. Portals had to either be convex, or
concave in certain situations. For example, imagine a simple donut-shaped
room. If you render the inner loop of the donut first, then you get a proper
sort order of walls in front to back, no matter the viewpoint. This assumes
back-face culling is used. At the time, I thought I could extend this to
support any room. I learned the hard way that this was not the case.

* Used 8x8 boxes for texture map interpolation. This is slightly faster than
8x1 interpolation as it only requires 1 divide for every 64 pixels instead of
for every 8. While I did have an MMX supporting machine at the time (Pentium
II), I couldn't find a way to use MMX instructions to speed up 8-bit paletted
graphics. So I optimized the texture mapping loop instead for the Pentium Pro.

* Horizontal span buffer with tagging - basically a list of horizontal line
segments, each with an integer value associated with it. While rendering the
portals, I would either delete the spans if they were end walls, or rename the
tags in the rasterized horizontal spans if they were part of a window to
another portal.

* In an attempt to enhance editing, I added support for drawing a polygon
directly on an existing surface in 3D mode. It only worked correctly in
limited circumstances and I had no idea how to fix all the cases, such as
automatically connecting regions (essentially 3D CSG) when one region dug into
another.

-Ken S.

------------------------------------------------------------------------------
Requires: DOS or DOS emulator such as DosBox.

Command line examples:
   kenvex              //default is boards.map at 640x480
   kenvex 320 200
   kenvex polyuse.map 320 200
------------------------------------------------------------------------------
Camera controls:
   ESC: quit
   Arrows/R.Ctrl/KP0: move
   Mouse: rotate
   RMB: tilt screen (move mouse left/right)

Texture editing controls:
   Tab: grab texture under cursor to memory
   L.Enter: write texture under cursor from memory
   KP-/+: decrement/increment texture under cursor
   /: reset texture coordinates to default
   KP2/4/6/8: change texture scale (not sure why it's so fast)
   Shift+KP2/4/6/8: change texture offset

Useful geometry editing controls:
   Space: draw next vertex for new polygon. NOTE: Only works inside polygons -
          can't touch edge!
   Backspace: undo last vertex plotted with Space
   L: toggle grid lock (for plotting vertices with Space bar)
   PGUP/PGDN: move plane in/out. WARNING: Over-use may result in glitches

Buggy or ridiculous editing controls:
   J: join plane (press once on first plane, then once on 2nd plane). Planes
      should be coplanar. Buggy!
   ': press to move all vertices randomly - for when you wish to instantly
      destroy your map and crash.
   N: re-load board (for when you destroy it - assuming the program hasn't yet
      frozen :-)

Rendering options:
   KPEnter: toggle texture mode (textured vs. solid color (shows portal
            boundaries as lines))
   \: toggle "1-region" mode, which renders only the current portal
   G: toggle: show polygon edges and map structure debug text
   F: move polygon under cursor to front. This is a hack to fix glitches for
      certain viewpoints.
   B: move polygon under cursor to back. "

Other controls:
   R: remove collinear planes (some kind of internal map structure cleanup?)
   Scroll Lock: panic quit
------------------------------------------------------------------------------
Interesting things to try:

* Run in 320x200 mode and turn up the cycles to max if using DosBox.

* Run 'kenvex polyuse.map' for a map showing sector over sector (implemented
  as a hard-coded hack).

* Try drawing a polygon in the middle of a wall (or ceiling or floor) polygon
  by pressing Space bar on each vertex - just like in Build's 2D editor. Once
  finished, you can push or pull it using PGUP/PGDN - just like in Build's 3D
  editor.
