summaryrefslogtreecommitdiff
path: root/lc
diff options
context:
space:
mode:
authorPéter Diviánszky <divipp@gmail.com>2016-02-16 07:15:29 +0100
committerPéter Diviánszky <divipp@gmail.com>2016-02-16 07:29:03 +0100
commit6700a057f30e8ca6c8aa2dde71d03516fd7ae6cd (patch)
tree5cafa9969ae9eb0884abd4b1ece21916d1680b91 /lc
parent2c1c5a8ae057c4e3a93ccf2a6f796af87188c0d1 (diff)
generate functions in shaders
Diffstat (limited to 'lc')
-rw-r--r--lc/Builtins.lc12
1 files changed, 4 insertions, 8 deletions
diff --git a/lc/Builtins.lc b/lc/Builtins.lc
index d4226f25..5eead277 100644
--- a/lc/Builtins.lc
+++ b/lc/Builtins.lc
@@ -53,14 +53,10 @@ type family MatVecScalarElem a where
53 53
54data Swizz = Sx | Sy | Sz | Sw 54data Swizz = Sx | Sy | Sz | Sw
55 55
56-- todo: use pattern matching 56mapVec :: (a -> b) -> VecS a n -> VecS b n
57mapVec :: forall a b m . (a -> b) -> Vec m a -> Vec m b 57mapVec f (V2 x y) = V2 (f x) (f y)
58mapVec @a @b @m f v = 'VecSCase (\m _ -> 'Vec m b) 58mapVec f (V3 x y z) = V3 (f x) (f y) (f z)
59 (\x y -> V2 (f x) (f y)) 59mapVec f (V4 x y z w) = V4 (f x) (f y) (f z) (f w)
60 (\x y z -> V3 (f x) (f y) (f z))
61 (\x y z w -> V4 (f x) (f y) (f z) (f w))
62 @m
63 v
64 60
65-- todo: make it more type safe 61-- todo: make it more type safe
66swizzscalar :: forall n . Vec n a -> Swizz -> a 62swizzscalar :: forall n . Vec n a -> Swizz -> a