mischief-render
Safe HaskellNone
LanguageGHC2024

Mischief.Shader.Functions

Synopsis

Documentation

unsafeCall :: forall (a :: Types). SingI a => Text -> [Param] -> Expr a Source #

(&) :: forall (a :: Types). (Algebric a ~ 'True, Integral a ~ 'True) => Expr a -> Expr a -> Expr a Source #

class Num (a :: Types) where Source #

Minimal complete definition

Nothing

Methods

(+) :: Expr a -> Expr a -> Expr a Source #

(-) :: Expr a -> Expr a -> Expr a Source #

(*) :: Expr a -> Expr a -> Expr a Source #

Instances

Instances details
Num ('Primitive a) Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(+) :: Expr ('Primitive a) -> Expr ('Primitive a) -> Expr ('Primitive a) Source #

(-) :: Expr ('Primitive a) -> Expr ('Primitive a) -> Expr ('Primitive a) Source #

(*) :: Expr ('Primitive a) -> Expr ('Primitive a) -> Expr ('Primitive a) Source #

Num ('MatrixType n m) Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(+) :: Expr ('MatrixType n m) -> Expr ('MatrixType n m) -> Expr ('MatrixType n m) Source #

(-) :: Expr ('MatrixType n m) -> Expr ('MatrixType n m) -> Expr ('MatrixType n m) Source #

(*) :: Expr ('MatrixType n m) -> Expr ('MatrixType n m) -> Expr ('MatrixType n m) Source #

Num ('VectorType n a) Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(+) :: Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

(-) :: Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

(*) :: Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

(^+) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #

(+^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

(^-) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #

(-^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

(^*) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #

(*^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

(*!) :: forall (n :: Nat) (m :: Nat). Float -> Mat n m -> Mat n m Source #

(!*) :: forall (n :: Nat) (m :: Nat). Mat n m -> Float -> Mat n m Source #

(^*!) :: forall (m :: Nat) (n :: Nat). Vec m Float -> Mat n m -> Vec n Float Source #

(!*^) :: forall (n :: Nat) (m :: Nat). Mat n m -> Vec n Float -> Vec m Float Source #

(!*!) :: forall (k :: Nat) (r :: Nat) (c :: Nat). Mat k r -> Mat c k -> Mat c r Source #

class Div (a :: Types) where Source #

Minimal complete definition

Nothing

Methods

(/) :: Expr a -> Expr a -> Expr a Source #

Instances

Instances details
Algebric a ~ 'True => Div a Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(/) :: Expr a -> Expr a -> Expr a Source #

(^/) :: forall (n :: Nat) (a :: PrimitiveTypes). Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #

(/^) :: forall (a :: PrimitiveTypes) (n :: Nat). Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

class Modulo (a :: Types) where Source #

Minimal complete definition

Nothing

Methods

(%) :: Expr a -> Expr a -> Expr a Source #

Instances

Instances details
Integral a ~ 'True => Modulo a Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(%) :: Expr a -> Expr a -> Expr a Source #

(^%) :: forall (a :: PrimitiveTypes) (n :: Nat). Integral ('Primitive a) ~ 'True => Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType n a) Source #

(%^) :: forall (a :: PrimitiveTypes) (n :: Nat). Integral ('Primitive a) ~ 'True => Expr ('Primitive a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

type family ChangePrimitive a (b :: PrimitiveTypes) :: Types where ... Source #

Equations

ChangePrimitive (Expr ('Primitive a)) b = 'Primitive b 
ChangePrimitive (Expr ('VectorType n a)) b = 'VectorType n b 

class Equal (a :: Types) where Source #

Minimal complete definition

Nothing

Methods

(==) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(/=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

Instances

Instances details
Algebric a ~ 'True => Equal a Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(==) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(/=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

Equal ('Primitive 'TBool) Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(==) :: forall (b :: Types). ChangePrimitive (Expr ('Primitive 'TBool)) 'TBool ~ b => Expr ('Primitive 'TBool) -> Expr ('Primitive 'TBool) -> Expr b Source #

(/=) :: forall (b :: Types). ChangePrimitive (Expr ('Primitive 'TBool)) 'TBool ~ b => Expr ('Primitive 'TBool) -> Expr ('Primitive 'TBool) -> Expr b Source #

Equal ('VectorType n 'TBool) Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(==) :: forall (b :: Types). ChangePrimitive (Expr ('VectorType n 'TBool)) 'TBool ~ b => Expr ('VectorType n 'TBool) -> Expr ('VectorType n 'TBool) -> Expr b Source #

(/=) :: forall (b :: Types). ChangePrimitive (Expr ('VectorType n 'TBool)) 'TBool ~ b => Expr ('VectorType n 'TBool) -> Expr ('VectorType n 'TBool) -> Expr b Source #

class Comparable (a :: Types) where Source #

Minimal complete definition

Nothing

Methods

(<) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(<=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(>) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(>=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

Instances

Instances details
Algebric a ~ 'True => Comparable a Source # 
Instance details

Defined in Mischief.Shader.Functions

Methods

(<) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(<=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(>) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

(>=) :: forall (b :: Types). ChangePrimitive (Expr a) 'TBool ~ b => Expr a -> Expr a -> Expr b Source #

all :: forall (n :: Nat). KnownNat n => Expr ('VectorType n 'TBool) -> Boolean Source #

any :: forall (n :: Nat). KnownNat n => Expr ('VectorType n 'TBool) -> Boolean Source #

pick :: forall (a :: Types) m. SingI a => [(Boolean, Shader m (Expr a))] -> Shader m (Expr a) -> Shader m (Expr a) Source #

Pass a list of tuples of conditions and branches, and an extra branch that will act as the default. Will return the result of the first branch in the list that has a positive condition. Otherwise the default.

Follow the same guidelines as for select.

Example

let x = undefined :: Float
let y = undefined :: Float
let z = undefined :: Float

r <- pick
  [(x > y, pure $ vec2 5 5),
   (y > z, pure $ vec2 6 6)
  ]
  (pure $ vec2 1 9)

pickM :: forall (a :: Types) m. SingI a => [(Shader m Boolean, Shader m (Expr a))] -> Shader m (Expr a) -> Shader m (Expr a) Source #

abs :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a Source #

acos :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

acosh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

asin :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a Source #

asinh :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a Source #

atan :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

atanh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

atan2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a Source #

ceil :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

clamp :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a Source #

cos :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

cosh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

countLeadingZeros :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a Source #

countOneBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a Source #

countTrailingZeros :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a Source #

cross :: forall (a :: PrimitiveTypes). (SingI ('VectorType 3 a), Fractional (Expr ('Primitive a)) ~ 'True) => Expr ('VectorType 3 a) -> Expr ('VectorType 3 a) -> Expr ('VectorType 3 a) Source #

degrees :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

determinant :: forall (n :: Nat). SingI n => Expr ('MatrixType n n) -> Float Source #

distance :: forall (a :: Types) (b :: PrimitiveTypes). (SingI a, Fractional (Expr a) ~ 'True, VectorOrSingleOf a ~ b) => Expr a -> Expr a -> Expr ('Primitive b) Source #

dot :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI ('VectorType n a), SingI a, SingI n, Algebric ('Primitive a) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('Primitive a) Source #

exp :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

exp2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

extractBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Uint -> Uint -> Expr a Source #

faceForward :: forall (a :: PrimitiveTypes) (n :: Nat). (SingI a, SingI n, Fractional (Expr ('Primitive a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

firstLeadingBit :: forall {k} (a :: Types) (n :: k). (SingI a, SingI n, Integral a ~ 'True) => Expr a -> Expr a Source #

firstTrailingBit :: forall {k} (a :: Types) (n :: k). (SingI a, SingI n, Integral a ~ 'True) => Expr a -> Expr a Source #

floor :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

fma :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a Source #

fract :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

insertBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a -> Uint -> Uint -> Expr a Source #

inverseSqrt :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

length :: forall {k} (a :: PrimitiveTypes) (b :: Types) (n :: k). (SingI a, SingI b, SingI n, VectorOrSingleOf b ~ a) => Expr b -> Expr ('Primitive a) Source #

log :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

log2 :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

max :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a Source #

min :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a -> Expr a Source #

class Mix (a :: k) (b :: k1) Source #

Instances

Instances details
Mix (a :: k) (a :: k) Source # 
Instance details

Defined in Mischief.Shader.Functions

Mix ('VectorType n a :: Types) ('Primitive a :: Types) Source # 
Instance details

Defined in Mischief.Shader.Functions

mix :: forall (a :: Types) (b :: Types). (SingI a, SingI b, Fractional (Expr a) ~ 'True, Fractional (Expr b) ~ 'True, Mix a b) => Expr a -> Expr a -> Expr b -> Expr a Source #

normalize :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI n, SingI a, Fractional (Expr ('VectorType n a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

pow :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a Source #

quantizeToF16 :: forall (a :: Types). (SingI a, VectorOrSingleOf a ~ 'TFloat) => Expr a -> Expr a Source #

radians :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

reflect :: forall (n :: Nat) (a :: PrimitiveTypes). (SingI n, SingI a, Fractional (Expr ('VectorType n a)) ~ 'True) => Expr ('VectorType n a) -> Expr ('VectorType n a) -> Expr ('VectorType n a) Source #

refract :: forall (a :: Types) (b :: PrimitiveTypes). (SingI a, SingI b, VectorOrSingleOf a ~ b) => Expr a -> Expr a -> Expr ('Primitive b) -> Expr a Source #

reverseBits :: forall (a :: Types). (SingI a, Integral a ~ 'True) => Expr a -> Expr a Source #

round :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

saturate :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

sign :: forall (a :: Types). (SingI a, Algebric a ~ 'True) => Expr a -> Expr a Source #

sin :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

sinh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

smoothstep :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a -> Expr a Source #

sqrt :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

step :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a -> Expr a Source #

tan :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

tanh :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #

transpose :: forall (n :: Nat) (m :: Nat). (SingI n, SingI m) => Expr ('MatrixType n m) -> Expr ('MatrixType m n) Source #

trunc :: forall (a :: Types). (SingI a, Fractional (Expr a) ~ 'True) => Expr a -> Expr a Source #