cc.journeyman.the-great-game.world.heightmap

Functions dealing with the tessellated multi-layer heightmap.

*base-map*

dynamic

TODO: write docs

*noise-map*

dynamic

TODO: write docs

excerpt-grid

(excerpt-grid grid x-offset y-offset width height)

Return that section of this grid where the :x co-ordinate of each cell is greater than or equal to this x-offset, the :y co-ordinate is greater than or equal to this y-offset, whose width is not greater than this width, and whose height is not greater than this height.

get-surface

(get-surface cell-size x-offset y-offset width height)(get-surface base-map noise-map cell-size x-offset y-offset width height)

Return, as a vector of vectors of cells represented as Clojure maps, a segment of surface from this base-map as modified by this noise-map at this cell-size starting at this x-offset and y-offset and having this width and height.

If base-map and noise-map are not supplied, the bindings of *base-map* and *noise-map* will be used, respectively.

base-map and noise-map may be passed either as strings, assumed to be file paths of PNG files, or as MicroWorld style world arrays. It is assumed that one pixel in base-map represents one square kilometre in the game world. It is assumed that cell-size, x-offset, y-offset, width and height are integer numbers of metres.

interpolate-altitude

(interpolate-altitude cell grid src-width x-offset y-offset)

Return the altitude of the point at x-offset, y-offset within this cell having this src-width, taken from this grid.

interpolate-cell

(interpolate-cell cell grid src-width target-width)

Construct a grid (array of arrays) of cells each of width target-width from this cell, of width src-width, taken from this grid

interpolate-grid

(interpolate-grid grid src-width target-width)

Return a grid interpolated from this grid of rows, cols given scaling from this src-width to this target-width

scale-grid

(scale-grid grid n)

multiply all :x and :y values in this grid by this n.