fwgl-0.1.3.1: Game engine

Safe HaskellNone
LanguageHaskell2010

FWGL.Graphics.Generic

Contents

Synopsis

Objects

data Object gs is where Source

A geometry associated with some uniforms.

Constructors

(:~>) :: Global g -> Object gs is -> Object (g : gs) is infixr 2 

class MemberGlobal g gs where Source

Methods

(~~>) infixr 2 Source

Arguments

:: UniformCPU c g 
=> (Draw c -> Global g)

Changing function

-> Object gs is 
-> Object gs is 

Modify the global of an Object.

Instances

((~) Bool ((==) * g g1) False, MemberGlobal g gs) => MemberGlobal g ((:) * g1 gs) 
MemberGlobal g ((:) * g gs) 

class RemoveGlobal g gs gs' where Source

Methods

(*~>) :: (a -> g) -> Object gs is -> Object gs' is infixr 2 Source

Remove a global from an Object.

Instances

RemoveGlobal g ((:) * g gs) gs 
((~) Bool ((==) * g g1) False, RemoveGlobal g gs gs') => RemoveGlobal g ((:) * g1 gs) ((:) * g1 gs') 

nothing :: Object [] [] Source

An empty object.

geom :: Geometry i -> Object [] i Source

An object with a specified Geometry.

modifyGeometry :: (Empty is ~ False) => (Geometry is -> Geometry is') -> Object gs is -> Object gs is' Source

Modify the geometry of an Object.

Groups

data Group gs is Source

A group of Objects.

group :: (Set is, Set gs) => [Object is gs] -> Group is gs Source

Create a Group from a list of Objects.

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

Join two groups.

unsafeJoin :: Group gs is -> Group gs' is' -> Group (Union gs gs') (Union is is') Source

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

emptyGroup :: Group is gs Source

An empty group.

globalGroup :: UniformCPU c g => Global g -> Group gs is -> Group (g : gs) is Source

Set a global uniform for a Group.

Layers

data Layer Source

A Group associated with a program.

layer :: (Subset progAttr grpAttr, Subset progUni grpUni) => Program progUni progAttr -> Group grpUni grpAttr -> Layer Source

Associate a group with a program.

combineLayers :: [Layer] -> Layer Source

Combine some layers.

Sublayers

subLayer Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture.

-> (Texture -> [Layer])

Layers using the texture.

-> Layer 

Use a Layer as a Texture on another. Based on renderColor.

depthSubLayer Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a depth Texture.

-> (Texture -> [Layer])

Layers using the texture.

-> Layer 

Use a Layer as a depth Texture on another. Based on renderDepth.

Render layers

renderColor Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture.

-> (Texture -> a)

Function using the texture.

-> RenderLayer a 

Render a Layer in a Texture.

renderDepth Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a depth Texture.

-> (Texture -> a)

Function using the texture.

-> RenderLayer a 

Render a Layer in a depth Texture

renderColorDepth Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture

-> (Texture -> Texture -> a)

Color, depth.

-> RenderLayer a 

Combination of renderColor and renderDepth.

renderColorInspect Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture.

-> Int

First pixel to read X

-> Int

First pixel to read Y

-> Int

Width of the rectangle to read

-> Int

Height of the rectangle to read

-> (Texture -> [Color] -> a)

Function using the texture.

-> RenderLayer a 

Render a Layer in a Texture, reading the content of the texture.

renderDepthInspect Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a depth Texture.

-> Int

First pixel to read X

-> Int

First pixel to read Y

-> Int

Width of the rectangle to read

-> Int

Height of the rectangle to read

-> (Texture -> [Word8] -> a)

Layers using the texture.

-> RenderLayer a 

Render a Layer in a depth Texture, reading the content of the texture. Not supported on WebGL.

renderColorDepthInspect Source

Arguments

:: Int

Texture width.

-> Int

Texture height.

-> Layer

Layer to draw on a Texture

-> Int

First pixel to read X

-> Int

First pixel to read Y

-> Int

Width of the rectangle to read

-> Int

Height of the rectangle to read

-> (Texture -> Texture -> [Color] -> [Word8] -> a)

Layers using the texture.

-> RenderLayer a 

Combination of renderColorInspect and renderDepthInspect. Not supported on WebGL.

Shaders

data Program gs is Source

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 Source

Create a Program from the shaders.

data Global g where Source

The value of a GPU uniform.

Constructors

(:=) :: (Typeable g, UniformCPU c g) => (a -> g) -> Draw c -> Global g infix 3 

(-=) :: (Typeable g, UniformCPU c g) => (a -> g) -> c -> Global g infixr 4 Source

Create a Global from a pure value. The first argument is ignored, it just provides the type (you can use the constructor of the GPU type).

globalTexture :: (BackendIO, Typeable g, UniformCPU ActiveTexture g) => (a -> g) -> Texture -> Global g Source

Create a Global of CPU type ActiveTexture using a Texture.

globalTexSize :: (BackendIO, Typeable g, UniformCPU c g) => (a -> g) -> Texture -> ((Int, Int) -> c) -> Global g Source

Create a Global using the size of a Texture.

globalFramebufferSize :: (BackendIO, Typeable g, UniformCPU c g) => (a -> g) -> (Vec2 -> c) -> Global g Source

Create a Global using the size of the framebuffer.

Geometries

data Geometry is Source

A set of attributes and indices.

Instances

data AttrList is where Source

A heterogeneous list of attributes.

Constructors

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

Instances

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

Create a custom Geometry.

Textures

data Texture Source

A texture.

Instances

mkTexture Source

Arguments

:: GLES 
=> Int

Width.

-> Int

Height.

-> [Color]

List of pixels

-> Texture 

Creates a Texture from a list of pixels.

textureURL Source

Arguments

:: String

URL

-> Texture 

Creates a Texture from an URL or a local file.

Colors

data Color Source

An RGBA 32-bit color.

Constructors

Color !Word8 !Word8 !Word8 !Word8 

colorTex :: GLES => Color -> Texture Source

Generate a 1x1 texture.