app34 :: (Vec 3 Float -> Vec 3 Float) -> Vec 4 Float -> Vec 4 Float app34 f q = let t = f (q%xyz) in V4 (t%x) (t%y) (t%z) (q%w) p1 = app34 $ \t -> (V3 0.5 0.5 0.5 + cos( (t + V3 0.0 0.1 0.2) *! 6.28318) *! 0.5) f x = (x + sin x + sin (1.1 * x)) `mod` 4 * 2 makeFrame (time :: Float) (vertexstream :: PrimitiveStream Triangle ((Vec 4 Float))) = imageFrame (emptyDepthImage 1, emptyColorImage navy) `overlay` vertexstream & mapPrimitives (\((x)) -> ((scale 0.5 . (projmat *.)) x, x)) & rasterizePrimitives (TriangleCtx CullNone PolygonFill NoOffset LastVertex) ((Smooth)) & filterFragments (\((v)) -> v%y * v%y + v%x * v%x + v%z * v%z > 1.5) & mapFragments (\((x)) -> ((p1 (rotMatrixZ time *. rotMatrixY time *. (p1 (rotMatrixX time *. rotMatrixY time *. x) *! (1 + 0.5 * sin time))) *! f time))) & accumulateWith (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) where projmat = perspective 0.1 100.0 (30 * pi / 180) 1.0 .*. lookat (V3 3.0 1.3 0.3) (V3 0.0 0.0 0.0) (V3 0.0 1.0 0.0) .*. rotMatrixY (pi / 24.0 * time) main = renderFrame $ makeFrame (Uniform "Time") (fetch "stream4" ((Attribute "position4")))