mischief-render
Safe HaskellNone
LanguageGHC2024

Mischief.Shader.Types

Documentation

vec2 :: (Expr ('Primitive (DesugarPrimitiveExpr a)) ~ a, SingI (DesugarPrimitiveExpr a), PrintVecElements 2 (DesugarPrimitiveExpr a)) => Expr ('Primitive (DesugarPrimitiveExpr a)) -> Expr ('Primitive (DesugarPrimitiveExpr a)) -> Vec 2 a Source #

vec3 :: (Expr ('Primitive (DesugarPrimitiveExpr a)) ~ a, SingI (DesugarPrimitiveExpr a), PrintVecElements 3 (DesugarPrimitiveExpr a)) => Expr ('Primitive (DesugarPrimitiveExpr a)) -> Expr ('Primitive (DesugarPrimitiveExpr a)) -> Expr ('Primitive (DesugarPrimitiveExpr a)) -> Vec 3 a Source #

vec4 :: (Expr ('Primitive (DesugarPrimitiveExpr a)) ~ a, SingI (DesugarPrimitiveExpr a), PrintVecElements 4 (DesugarPrimitiveExpr a)) => Expr ('Primitive (DesugarPrimitiveExpr a)) -> Expr ('Primitive (DesugarPrimitiveExpr a)) -> Expr ('Primitive (DesugarPrimitiveExpr a)) -> Expr ('Primitive (DesugarPrimitiveExpr a)) -> Vec 4 a Source #

(+:) :: forall (a :: PrimitiveTypes) (n :: Natural). (SingI a, PrintVecElements (n + 1) a, KnownNat (n + 1)) => Expr ('VectorType n a) -> Expr ('Primitive a) -> Expr ('VectorType (n + 1) a) Source #

(<>) :: forall (a :: PrimitiveTypes) (n :: Natural) (m :: Natural). (SingI a, PrintVecElements (n + m) a, KnownNat (n + m)) => Expr ('VectorType n a) -> Expr ('VectorType m a) -> Expr ('VectorType (n + m) a) Source #

array :: SingI (DesugarExpr a) => [Expr (DesugarExpr a)] -> Array a Source #

(!!) :: forall (a :: Types). SingI a => Array (Expr a) -> Uint -> Expr a Source #

type Boolean = Expr 'TBool Source #

type Int = Expr ('Primitive 'TInt) Source #

type Float = Expr ('Primitive 'TFloat) Source #

type Uint = Expr ('Primitive 'TUInt) Source #

type family DesugarExpr a :: Types where ... Source #

Equations

DesugarExpr (Expr a) = a 

type family DesugarPrimitiveExpr a :: PrimitiveTypes where ... Source #

type Array b = Expr ('ArrayType (DesugarExpr b)) Source #

type Vec (n :: Nat) a = Expr ('VectorType n (DesugarPrimitiveExpr a)) Source #

type Vec2 a = Vec 2 a Source #

type Vec3 a = Vec 3 a Source #

type Vec4 a = Vec 4 a Source #

type Mat (n :: Nat) (m :: Nat) = Expr ('MatrixType n m) Source #

mat :: forall (n :: Nat) (m :: Nat). (KnownNat n, KnownNat m, PrintMatElements n m) => MatInit n m -> Mat n m Source #

class (SingI b, SingI a) => Cast (b :: Types) (a :: Types) where Source #

Methods

cast :: Expr a -> Expr b Source #

type family Fractional a :: Bool where ... Source #

Equations

Fractional Float = 'True 
Fractional (Expr ('VectorType n a)) = Fractional (Expr ('Primitive a)) 
Fractional a = 'False 

type family Algebric (a :: Types) :: Bool where ... Source #

Equations

Algebric ('Primitive a) = 'True 
Algebric ('VectorType n a) = 'True 
Algebric a = 'False 

type family Integral (a :: Types) :: Bool where ... Source #

Equations

Integral ('Primitive 'TInt) = 'True 
Integral ('Primitive 'TUInt) = 'True 
Integral ('VectorType n 'TInt) = 'True 
Integral ('VectorType n 'TUInt) = 'True 
Integral a = 'False 

diag :: forall (n :: Natural) (a :: PrimitiveTypes). (n <= 4, KnownNat n, SingI a) => Expr ('Primitive a) -> Expr ('VectorType n a) Source #

type family SwizzleChar (c :: Char) (n :: Natural) :: Bool where ... Source #

Equations

SwizzleChar 'x' 1 = 'True 
SwizzleChar 'r' 1 = 'True 
SwizzleChar 'y' 2 = 'True 
SwizzleChar 'g' 2 = 'True 
SwizzleChar 'z' 3 = 'True 
SwizzleChar 'b' 3 = 'True 
SwizzleChar 'w' 4 = 'True 
SwizzleChar 'a' 4 = 'True 
SwizzleChar c 1 = 'False 
SwizzleChar c n = SwizzleChar c (n - 1) 

type family Swizzle (s :: Symbol) (n :: Nat) :: Maybe Nat where ... Source #

Equations

Swizzle "" n = 'Just 0 
Swizzle s n = SwizzleRec (UnconsSymbol s) n 

type family SwizzleRec (s :: Maybe (Char, Symbol)) (n :: Nat) :: Maybe Nat where ... Source #

Equations

SwizzleRec ('Just '(c, s)) n = SwizzleRec' s n (SwizzleChar c n) 
SwizzleRec s n = 'Nothing :: Maybe Nat 

type family SwizzleRec' (s :: Symbol) (n :: Nat) (b :: Bool) :: Maybe Nat where ... Source #

Equations

SwizzleRec' s n 'True = IncMaybe (Swizzle s n) 
SwizzleRec' s n b = 'Nothing :: Maybe Nat 

type family IncMaybe (n :: Maybe Nat) :: Maybe Nat where ... Source #

Equations

IncMaybe ('Just n) = 'Just (n + 1) 
IncMaybe ('Nothing :: Maybe Nat) = 'Nothing :: Maybe Nat 

type family SwizzleOutput (a :: PrimitiveTypes) (n :: Nat) :: Types where ... Source #

Equations

SwizzleOutput a 1 = 'Primitive a 
SwizzleOutput a n = 'VectorType n a