From 12829892b262a0c7fcccba9198e5b6b31b2a8015 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Thu, 9 Jul 2020 13:02:31 +0200 Subject: Cleaning code --- resources/shaders/julia.frag | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 resources/shaders/julia.frag (limited to 'resources/shaders/julia.frag') diff --git a/resources/shaders/julia.frag b/resources/shaders/julia.frag new file mode 100644 index 0000000..12d923b --- /dev/null +++ b/resources/shaders/julia.frag @@ -0,0 +1,48 @@ +// ----- Vertex Shader ----- +#version 410 core + +layout(location = 0) in vec3 position; +uniform mat4 projection; +uniform mat4 model; + +void main(){ + gl_Position = projection * model * vec4(position,1); +} + +// ----- Fragment Shader ----- + +#version 410 core + +uniform vec2 resolution; +uniform float time; + +out vec3 color; + +#define ACCURACY 1000 +#define LIMIT 1000 + +vec2 cmult(vec2 z1,vec2 z2){ + return(vec2(z1.x*z2.x-z1.y*z2.y,z1.x*z2.y+z1.y*z2.x)); +} + +vec2 IsDiverging(vec2 coord){ + vec2 z=vec2(coord.x,coord.y); + int i; + for(i=0;i LIMIT) + break; + + } + return(z); +} + + +void main() +{ + vec2 coord=gl_FragCoord.xy/resolution.xy; + coord-=0.5; + coord/=(time/10); + float d=length(IsDiverging(coord)); + color=vec3(LIMIT/(d*2),0,0); +} -- cgit v1.2.3