linsyking/elm-regl/8.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

REGL

This module exposes basic primitives for rendering with REGL.

Basics

An empty renderable object.

User Configuration

type alias REGLConfig =
{ timeInterval : TimeInterval }

The user configuration for REGL. Differing from the starting options. Users could change this at runtime.

= AnimationFrame
| Millisecond Float

A time interval for the REGL configuration.

Use Millisecond for fixed time intervals, and AnimationFrame for rendering at the refresh rate of the display.

Millisecond should be considered as a debugging tool, and AnimationFrame should be used for production.

configREGL : REGLConfig -> ExecPort msg -> Cmd msg

Reconfigure REGL at runtime.

Direct REGL Commands

type alias REGLStartConfig =
{ virtWidth : Float
, virtHeight : Float
, fboNum : Int
, builtinPrograms : Maybe (List String)
}

The configuration for starting REGL.

virtWidth and virtHeight are the virtual width and height users defined.

fboNum is the number of framebuffers created.

builtinPrograms is a list of built-in programs that users want to enable.

= MagNearest
| MagLinear

The magnification option for textures.

Users should use MagLinear for most cases. However, if pixel art is used, MagNearest should be used.

= MinNearest
| MinLinear
| NearestMipmapNearest
| LinearMipmapNearest
| NearestMipmapLinear
| LinearMipmapLinear

The minification option for textures.

Similar to the magnification option, users should use MinLinear for most cases.

type alias TextureOptions =
{ mag : Maybe TextureMagOption
, min : Maybe TextureMinOption
, crop : Maybe ( ( Int, Int ), ( Int, Int ) )
}

The texture options.

batchExec : ExecPort msg -> List (ExecPort msg -> Cmd msg) -> List (Cmd msg)

Execute a batch of commands.

createREGLProgram : String -> REGLProgram -> ExecPort msg -> Cmd msg

Create a user-defined REGL program.

loadTexture : String -> String -> Maybe TextureOptions -> ExecPort msg -> Cmd msg

Load a texture with name, url and options.

startREGL : REGLStartConfig -> ExecPort msg -> Cmd msg

Execute the start command for REGL.

loadMSDFFont : String -> String -> String -> ExecPort msg -> Cmd msg

Load a MSDF font.

decodeRecvMsg : Value -> Maybe REGLRecvMsg

Decode a received message.

type alias Texture =
{ name : String
, width : Int
, height : Int
}

Texture Information

= REGLTextureLoaded Texture
| REGLFontLoaded String
| REGLProgramCreated String

Receive messages from REGL.

Miscellaneous

{ width : Int
, height : Int
}
-> List (Attribute msg)
-> Html msg

Create the canvas HTML element.