diff --git a/colourful b/colourful new file mode 100644 index 0000000..a872e54 --- /dev/null +++ b/colourful @@ -0,0 +1,5 @@ +const one 1.0; +fun main() Unit { + outColor := Vec4(get !fragColor.X, get !fragColor.Y, get !fragColor.Z, one); + return +} diff --git a/colourful.png b/colourful.png new file mode 100644 index 0000000..cb1db8e Binary files /dev/null and b/colourful.png differ diff --git a/function b/function new file mode 100644 index 0000000..fda538d --- /dev/null +++ b/function @@ -0,0 +1,15 @@ +const one 1.0; + +fun cmult(a | Vec2, b | Vec2) Vec2 { + return(Vec2( + -(*(get a.X, get b.X), *(get a.Y, get b.Y)), + +(*(get a.X, get b.Y), *(get a.Y, get b.X)) + )) +}; + +fun main() Unit { + coord | Vec2 = Vec2(get !fragColor.X, get !fragColor.Y); + l | Float = length(cmult(coord, coord)); + outColor := Vec4(l, l, l, one); + return +} diff --git a/function.png b/function.png new file mode 100644 index 0000000..a9c203d Binary files /dev/null and b/function.png differ diff --git a/mandelbrot b/mandelbrot new file mode 100644 index 0000000..8336c3e --- /dev/null +++ b/mandelbrot @@ -0,0 +1,28 @@ +const zero 0.0; +const two 2.0; +const one 1.0; +const d 10.0; + +fun cmult(a | Vec2, b | Vec2) Vec2 { + return(Vec2( + -(*(get a.X, get b.X), *(get a.Y, get b.Y)), + +(*(get a.X, get b.Y), *(get a.Y, get b.X)) + )) +}; + +fun mandelbrot(depth | Float, z | Vec2, c | Vec2) Vec2 + when lt(depth, zero) is z + else mandelbrot(-(depth, one), +(cmult(z, z), c), c); + +fun sign(x | Float) Float { + return(-(x, length(x))) +}; + +fun main() Unit { + coord | Vec2 = Vec2(get !fragColor.X, get !fragColor.Y); + l | Vec2 = mandelbrot(d, coord, coord); + color | Float = /(length(l), two); + outColor := Vec4(color, color, color, one); + return +} + diff --git a/mult b/mult new file mode 100644 index 0000000..8a43885 --- /dev/null +++ b/mult @@ -0,0 +1,7 @@ +const one 1.0; + +fun main() Unit { + shade | Float = *(get !fragColor.X, get !fragColor.Y); + outColor := Vec4(shade, shade, shade, one); + return +} diff --git a/mult.png b/mult.png new file mode 100644 index 0000000..9edb5ad Binary files /dev/null and b/mult.png differ diff --git a/recursive b/recursive new file mode 100644 index 0000000..70bd170 --- /dev/null +++ b/recursive @@ -0,0 +1,12 @@ +const zero 0.0; +const pointone 0.1; +const one 1.0; +const ten 10.0; + +fun loop(i | Float, x | Float) Float when lt(i, pointone) is x else loop(-(i, one), +(x, pointone)); + +fun main() Unit { + color | Float = loop(ten, zero); + outColor := Vec4(color, color, color, one); + return +} diff --git a/recursive.png b/recursive.png new file mode 100644 index 0000000..890b00a Binary files /dev/null and b/recursive.png differ diff --git a/unrolled b/unrolled new file mode 100644 index 0000000..76291ab --- /dev/null +++ b/unrolled @@ -0,0 +1,24 @@ +const zero 0.0; +const pointone 0.1; +const one 1.0; +const ten 10.0; + +fun loop(i | Float, x | Float) Float when lt(i, pointone) is x else loop(-(i, one), +(x, pointone)); + +fun main() Unit { + var color | Float; + color := zero; + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + color := +(!color, pointone); + c | Float = !color; + outColor := Vec4(c, c, c, one); + return +} diff --git a/unrolled.png b/unrolled.png new file mode 100644 index 0000000..8f098ad Binary files /dev/null and b/unrolled.png differ diff --git a/white b/white new file mode 100644 index 0000000..de9b104 --- /dev/null +++ b/white @@ -0,0 +1,2 @@ +const one 1.0; +fun main() Unit {outColor := Vec4(one, one, one, one); return}