Work on heightmap optimizations

Signed-off-by: Paul Holden <paulholden2@gmail.com>

- Render triangle fans, using less detail for smoother areas.

- Uses steepness to determine roughness, will change to check for
  coplanarity.

- Generate triangle fans via hmap_gen_patch() function. Recursively
  generates patches of appropriate detail. Need to consider detaching the
  index buffer from the hmap object and using a generic interface, as
  different situations may need different types of buffers (dynamic draw,
  persistent mapped, orphan, etc).

- Heightmap dimensions must be of the form 2^n + 1, to play nicely with
  the quad-tree patch generation algorithm.
Reworking a large portion of heightmap code

Signed-off-by: Paul Holden <paulholden2@gmail.com>

- Reworked and fixed roughness function, was calculating wrong row
  index (Y-coord of patch). Now properly checks average elevation
  difference between edges and corners. Differs slightly from technique
  being implemented here, but for now it provides an accurate enough
  roughness factor for patches.

- Added new functions for adding indices to the heightmap buffer. In an
  ideal implementation this index buffer would not be attached to the
  heightmap; the heightmap mesh would be generated in real-time based on
  viewer distance, point, etc. and fill the contents of an index buffer
  object that provides a generic interface, but can use orphan, persistent
  mapped buffers, etc. Might be preferable to have an object that can
  append variable numbers of elements with a single function call since a
  patch will be drawn by no fewer than 6 (corners, complete fan, restart
  index) and no greater than 11 (center, corners, edges, complete fan,
  restart index).

- Added a refinement matrix to the heightmap struct. Stores refinement
  information for patches (stored at what would be the ostensible center
  of the patch) in a matrix.

- Add a Y buffer that stores elevation data points; removes the need for
  the hmap_point() function. hmap_roughness() was extremely slow since it
  made so many calls to hmap_point() to calculate average elevations and
  such. hmap_roughness() can still be improved by storing patch roughness
  information in a matrix similar to the refinement matrix.

- Added a smaller heightmap patch to test things on a scale a little more
  friendly on the eyes and thought process.

- Add function to calculate sibling patch indices, and associated enum
  values for which patch to calculate. Added an error code
  HMAP_PATCH_OUT_OF_BOUNDS for patches that are on an edge or corner.

- Adjusted heightmap shader to use the new, smaller heightmap that wasn't
  generated with specific scaling values in mind for each of the RGB
  channels.
Finish heightmap technique

Signed-off-by: Paul Holden <paulholden2@gmail.com>

- Still lots of room for improvement, especially with roughness
  propagation. Propagation is a depth-first algorithm, which causes
  roughness from the subtrees processed last to not affect the subtrees
  processed earlier.

- Added some new heightmaps to test with.

- Minor changes to heightmap shaders.
Rework hmap_propagate()

Signed-off-by: Paul Holden <paulholden2@gmail.com>

- No longer a recursive function, but one that must be called for each
  order of the heightmap, i.e. 9 to 0 for a heightmap of max order 10.
  Iterates through the heightmap elements and propagates roughness values
  from adjacent siblings of next heighest order into the current patch.

- Small tweaks to heightmap vertex shader and minimum roughness value.
Merge branch 'hmap-opt'

Signed-off-by: Paul Holden <paulholden2@gmail.com>

* hmap-opt:
  Rework hmap_propagate()
  Finish heightmap technique
  Reworking a large portion of heightmap code
  Work on heightmap optimizations