diff options
| author | eggmund <joshuacolclough2@googlemail.com> | 2019-05-15 17:55:19 +0100 |
|---|---|---|
| committer | eggmund <joshuacolclough2@googlemail.com> | 2019-05-15 17:55:19 +0100 |
| commit | a7c5e3cab70e00a287c561d06cef9fbb7b7e49ce (patch) | |
| tree | 35be10d7e7d0ddfaa1ed079111b32b3b6783c959 /examples/shaders/resources | |
| parent | 998b4180e1d3a9b6188699fd811c9b3abe537eac (diff) | |
| download | raylib-a7c5e3cab70e00a287c561d06cef9fbb7b7e49ce.tar.gz raylib-a7c5e3cab70e00a287c561d06cef9fbb7b7e49ce.zip | |
Updating julia set example.
Now dividing by the zoom instead of multiplying (in the shader), so zoom works as expected. Also zoom increase/decrease is now scaled depending on the current zoom.
Diffstat (limited to 'examples/shaders/resources')
| -rw-r--r-- | examples/shaders/resources/shaders/glsl330/julia_shader.fs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/shaders/resources/shaders/glsl330/julia_shader.fs b/examples/shaders/resources/shaders/glsl330/julia_shader.fs index b1331d84..8e6815a5 100644 --- a/examples/shaders/resources/shaders/glsl330/julia_shader.fs +++ b/examples/shaders/resources/shaders/glsl330/julia_shader.fs @@ -15,10 +15,10 @@ const int MAX_ITERATIONS = 255; // Max iterations to do. // Square a complex number vec2 complexSquare(vec2 z) { - return vec2( - z.x * z.x - z.y * z.y, - z.x * z.y * 2.0 - ); + return vec2( + z.x * z.x - z.y * z.y, + z.x * z.y * 2.0 + ); } // Convert Hue Saturation Value color into RGB @@ -33,8 +33,8 @@ vec3 hsv2rgb(vec3 c) void main() { // The pixel coordinates scaled so they are on the mandelbrot scale. - vec2 z = vec2(((gl_FragCoord.x + offset.x)/screenDims.x) * 2.5 * zoom, - ((screenDims.y - gl_FragCoord.y + offset.y)/screenDims.y) * 1.5 * zoom); // y also flipped due to opengl + vec2 z = vec2((((gl_FragCoord.x + offset.x)/screenDims.x) * 2.5)/zoom, + (((screenDims.y - gl_FragCoord.y + offset.y)/screenDims.y) * 1.5)/zoom); // y also flipped due to opengl int iterations = 0; /* |
