linsyking/elm-regl/6.0.0

NOTE: the latest version is 10.0.0

Renamed to elm-messenger/elm-regl. That is where the repository lives now. It has not been published as a package under the new name.

Versions published as linsyking/elm-regl still install under that name. 5 versions of 15 come from the new location (see their notes).

REGL.Common

Common Type Definitions

= AtomicRenderable ProgramCall
| GroupRenderable (List Effect) (List Renderable)

A renderable object that can be rendered by REGL.

type alias Effect =
ProgramCall

A post-processing effect.

type alias ProgramCall =
List ( String, Value )

A call to the real REGL program.

Common functions

genProg : ProgramCall -> Renderable

Generate a renderable object from settings. Users can use this function to create custom renderable generators.

group : List Effect -> List Renderable -> Renderable

Group a list of renderables into a single renderable with effects.

render : Renderable -> Value

Render a renderable object. Users need to use it to pass the render result to REGL in JS through a port.

renderWithCamera : List Float -> Renderable -> Value

Render a renderable object with a camera.

Only use this function in the outermost renderable object. The camera is a list of 4 floats:

  1. The x position of the camera.

  2. The y position of the camera.

  3. The scaling factor of the camera.

  4. The rotation angle of the camera in radians.

Convenient helper functions

getField : String -> Renderable -> Maybe Value

A handy function to get a field of AtomicRenderable.

updateField : String -> Value -> Renderable -> Renderable

A handy function to update a field of AtomicRenderable.