mischief-render
Safe HaskellNone
LanguageGHC2024

Mischief.Shader.Types

Documentation

(+:) :: 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 #

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

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

Equations

DesugarExpr (Expr a) = a 

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 #

Instances

Instances details
(SingI ('Primitive a), SingI ('Primitive b)) => Cast ('Primitive a) ('Primitive b) Source # 
Instance details

Defined in Mischief.Shader.Types

Methods

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

(SingI ('VectorType n a), SingI ('VectorType n b)) => Cast ('VectorType n a) ('VectorType n b) Source # 
Instance details

Defined in Mischief.Shader.Types

Methods

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

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

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 #

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 

Orphan instances

(KnownSymbol s, KnownNat n, SingI a, Swizzle s n ~ 'Just m, m >= 1, m <= 4, SwizzleOutput a m ~ out) => HasField (s :: Symbol) (Expr ('VectorType n a) :: Type) (Expr out :: Type) Source # 
Instance details

Methods

getField :: Expr ('VectorType n a) -> Expr out #