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

Safe HaskellNone
LanguageHaskell2010

FWGL.Shader.Language

Synopsis

Documentation

data Action

Expressions that have to be compiled to a statement.

Constructors

Store String Expr 
If Expr String Expr Expr 
For CInt String Expr (Expr -> Expr -> (Expr, Expr)) 

Instances

newtype Unknown

The type of a generic expression.

Constructors

Unknown Expr 

Instances

newtype Sampler2D

A GPU sampler (sampler2D in GLSL).

Constructors

Sampler2D Expr 

data V2

A GPU 2D vector. NB: This is a different type from FWGL.Vector.V2.

Constructors

V2 Float Float 

data V3

A GPU 3D vector.

Constructors

V3 Float Float Float 

data V4

A GPU 4D vector.

Constructors

V4 Float Float Float Float 

data M2

A GPU 2x2 matrix.

Constructors

M2 V2 V2 

data M3

A GPU 3x3 matrix.

Constructors

M3 V3 V3 V3 

data M4

A GPU 4x4 matrix.

Constructors

M4 V4 V4 V4 V4 

class Mul a b c | a b -> c

Types that can be multiplied.

(*) :: (Mul a b c, ShaderType a, ShaderType b, ShaderType c) => a -> b -> c infixl 7

(/) :: (Mul a b c, ShaderType a, ShaderType b, ShaderType c) => a -> b -> c infixl 7

class Sum a

Types that can be added.

Instances

(+) :: (Sum a, ShaderType a) => a -> a -> a infixl 6

(-) :: (Sum a, ShaderType a) => a -> a -> a infixl 6

(^) :: (ShaderType a, ShaderType b) => a -> b -> a infixr 8

(&&) :: Bool -> Bool -> Bool infixr 3

(||) :: Bool -> Bool -> Bool infixr 2

(==) :: ShaderType a => a -> a -> Bool infix 4

(>=) :: ShaderType a => a -> a -> Bool infix 4

(<=) :: ShaderType a => a -> a -> Bool infix 4

(<) :: ShaderType a => a -> a -> Bool infix 4

(>) :: ShaderType a => a -> a -> Bool infix 4

ifThenElse :: ShaderType a => Bool -> a -> a -> a

Rebinded if.

loop

Arguments

:: ShaderType a 
=> Float

Maximum number of iterations (should be as low as possible, must be an integer literal)

-> a

Initial value

-> (Float -> a -> (a, Bool))

Iteration -> Old value -> (Next, Stop)

-> a 

true :: Bool

false :: Bool

store :: ShaderType a => a -> a

Avoid executing this expression more than one time. Conditionals and loops imply it.

radians :: GenType a => a -> a

degrees :: GenType a => a -> a

sin :: GenType a => a -> a

cos :: GenType a => a -> a

tan :: GenType a => a -> a

asin :: GenType a => a -> a

acos :: GenType a => a -> a

atan :: GenType a => a -> a

atan2 :: GenType a => a -> a -> a

exp :: GenType a => a -> a

log :: GenType a => a -> a

exp2 :: GenType a => a -> a

log2 :: GenType a => a -> a

sqrt :: GenType a => a -> a

inversesqrt :: GenType a => a -> a

abs :: GenType a => a -> a

sign :: GenType a => a -> a

floor :: GenType a => a -> a

ceil :: GenType a => a -> a

fract :: GenType a => a -> a

mod :: (GenType a, GenType b) => a -> b -> a

min :: GenType a => a -> a -> a

max :: GenType a => a -> a -> a

clamp :: (GenType a, GenType b) => a -> b -> b -> a

mix :: (GenType a, GenType b) => a -> a -> b -> a

step :: GenType a => a -> a -> a

smoothstep :: (GenType a, GenType b) => b -> b -> a -> a

length :: GenType a => a -> Float

distance :: GenType a => a -> a -> Float

dot :: GenType a => a -> a -> Float

cross :: V3 -> V3 -> V3

normalize :: GenType a => a -> a

faceforward :: GenType a => a -> a -> a -> a

reflect :: GenType a => a -> a -> a

refract :: GenType a => a -> a -> Float -> a

matrixCompMult :: (Matrix a, Matrix b, Matrix c) => a -> b -> c

position :: V4

The position of the vertex (only works in the vertex shader).

fragColor :: V4

The color of the fragment (only works in the fragment shader).