fwgl-0.1.2.1: FRP 2D/3D game engine

Safe HaskellNone
LanguageHaskell2010

FWGL.Graphics.Custom

Synopsis

Documentation

data Object gs is

An object is a set of geometries associated with some uniforms. For example, if you want to draw a rotating cube, its vertices, normals, etc. would be the Geometry, the combination of the geometry and the value of the model matrix would be the Object, and the combination of the object with a Program would be the Layer. In fact, Objects are just descriptions of the actions to perform to draw something. Instead, the Element types in FWGL.Graphics.D2 and FWGL.Graphics.D3 represent managed (high level) objects, and they are ultimately converted to them.

(~~) :: (Equal gs gs', Equal is is') => Object gs is -> Object gs' is' -> Object (Union gs gs') (Union is is')

Join two objects.

unsafeJoin :: (Equal gs'' (Union gs gs'), Equal is'' (Union is is')) => Object gs is -> Object gs' is' -> Object gs'' is''

Join two objects, even if they don't provide the same variables.

nothing :: Object [] []

An empty custom object.

geom :: Geometry i -> Object [] i

A custom object with a specified Geometry.

data Program gs is

A vertex shader associated with a compatible fragment shader.

Instances

Eq (Program gs is) 
Hashable (Program gs is) 

program :: (ValidVertex vgs vis vos, Valid fgs vos [], Equal pgs (Union vgs fgs)) => VertexShader vgs vis vos -> FragmentShader fgs vos -> Program pgs vis

Create a Program from the shaders.

global :: (Typeable g, UniformCPU c g) => g -> c -> Object gs is -> Object (g : gs) is

Sets a global variable (uniform) of an object.

globalDraw :: (Typeable g, UniformCPU c g) => g -> Draw c -> Object gs is -> Object (g : gs) is

Sets a global (uniform) of an object using the Draw monad.

globalTexture :: (BackendIO, Typeable g, UniformCPU ActiveTexture g) => g -> Texture -> Object gs is -> Object (g : gs) is

Sets a global (uniform) of an object using a Texture.

globalTexSize :: (BackendIO, Typeable g, UniformCPU c g) => g -> Texture -> ((Int, Int) -> c) -> Object gs is -> Object (g : gs) is

Sets a global (uniform) of an object using the dimensions of a Texture.

data Layer

An object associated with a program. It can also be a layer included in another.

layer :: (Subset oi pi, Subset og pg) => Program pg pi -> Object og oi -> Layer

Associate an object with a program.

subLayer

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture.

-> (Texture -> [Layer])

Layer to draw on the screen.

-> Layer 

Use a Layer as a Texture on another.

depthSubLayer

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture.

-> (Texture -> [Layer])

Layer to draw on the screen.

-> Layer 

Use the depth Layer as a Texture on another.

data Geometry is

A set of attributes and indices.

Instances

data AttrList is where

Constructors

AttrListNil :: AttrList [] 
AttrListCons :: (Hashable c, AttributeCPU c g) => g -> [c] -> AttrList gs -> AttrList (g : gs) 

Instances

mkGeometry :: GLES => AttrList is -> [Word16] -> Geometry is

Create a custom Geometry.

data Texture

A texture.

Instances

mkTexture

Arguments

:: GLES 
=> Int

Width.

-> Int

Height.

-> [Color]

List of pixels

-> Texture 

Creates a Texture from a list of pixels.

textureURL

Arguments

:: String

URL

-> Texture 

Creates a Texture from an URL or a local file.

data Color

An RGBA 32-bit color.

Constructors

Color !Word8 !Word8 !Word8 !Word8 

colorTex :: GLES => Color -> Texture

Generate a 1x1 texture.