jxxcarlson/elm-cell-grid/6.0.0

NOTE: the latest version is 8.0.1

CellGrid.WebGL

The CellGrid.WebGL package provides functions for rendereing CellGrid to WebGL

Types

type alias Colorizer =
( Int, Int ) -> Vec3

The type of a function which assigns a color to a cell, the latter given by its row and column indices

type alias Vertex =
{ position : Vec3
, color : Vec3
}

The type of vertices of triangles: define position and color.

Rendering functions

cellGridToHtml : Int -> Int -> CellGrid Float -> (Float -> Vec3) -> Html msg

Render a CellGrid to a width_ x height_ rectangle on the screen using a function temperatureMap which transforms scalars to color vectors

meshToHtml : Int -> Int -> Mesh Vertex -> Html msg

Render a WebGL "drawing" to a given rectangle on the screen.

Work with cells

meshFromCellGrid : ( Float, Float ) -> (Float -> Vec3) -> CellGrid Float -> Mesh Vertex

Create a mesh from a cell grid using a temperatureMap. The latter assigns to a temperature a triple of RGB values.

meshWithColorizer : Colorizer -> ( Int, Int ) -> ( Float, Float ) -> Mesh Vertex

Crreate a rows x cols Vertex Mesh representing an array of rectanagles of size (dw, dh). The vertex colors (uniform over a rectangular cell) are determined by the colorizer functionion which has type (Int, Int) -> Vec3