From 749410713b5c1dce369c57d74fafd504ae068960 Mon Sep 17 00:00:00 2001 From: Csaba Hruska Date: Fri, 5 Feb 2016 17:51:27 +0100 Subject: add editor examples as tests --- testdata/editor-examples/RecursiveTexture.lc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 testdata/editor-examples/RecursiveTexture.lc (limited to 'testdata/editor-examples/RecursiveTexture.lc') diff --git a/testdata/editor-examples/RecursiveTexture.lc b/testdata/editor-examples/RecursiveTexture.lc new file mode 100644 index 00000000..10938f56 --- /dev/null +++ b/testdata/editor-examples/RecursiveTexture.lc @@ -0,0 +1,24 @@ +clear = imageFrame (emptyDepthImage 1, emptyColorImage teal) + +triangleRasterCtx = TriangleCtx CullNone PolygonFill NoOffset LastVertex +colorFragmentCtx = (DepthOp Less True, ColorOp NoBlending (V4 True True True True)) + +cubeVertexStream = fetch "stream4" Triangle (Attribute "position4" :: Vec 4 Float, Attribute "vertexUV" :: Vec 2 Float) +rotMatrix = Uniform "MVP" :: Mat 4 4 Float + +setAlpha v = v * V4 1.0 1 1 0 + V4 0 0 0 1 + +cube' res (n :: Float) fb = + clear + `overlay` + cubeVertexStream + & mapPrimitives (\(v, u) -> (rotMatrix *. scale 0.4 (rotMatrixX (n/10) *. v), u)) + & rasterizePrimitives triangleRasterCtx Smooth + & mapFragments (\a -> setAlpha $ (a%yyyx *! 0.5 + texture2D sampler a) *! 0.7) + & accumulateWith colorFragmentCtx + where + sampler = Sampler LinearFilter MirroredRepeat $ Texture2D (V2 res res) (PrjImageColor fb) + +main :: Output +main = ScreenOut $ snd $ iterate (\(n, f) -> (n+1, cube' 256 n f)) (0, clear) !! 15 + -- cgit v1.2.3