File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
resources/shaders/glsl330 Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -15,10 +15,10 @@ const int MAX_ITERATIONS = 255; // Max iterations to do.
1515// Square a complex number
1616vec2 complexSquare(vec2 z)
1717{
18- return vec2 (
19- z.x * z.x - z.y * z.y,
20- z.x * z.y * 2.0
21- );
18+ return vec2 (
19+ z.x * z.x - z.y * z.y,
20+ z.x * z.y * 2.0
21+ );
2222}
2323
2424// Convert Hue Saturation Value color into RGB
@@ -33,8 +33,8 @@ vec3 hsv2rgb(vec3 c)
3333void main()
3434{
3535 // The pixel coordinates scaled so they are on the mandelbrot scale.
36- vec2 z = vec2 (((gl_FragCoord .x + offset.x)/ screenDims.x) * 2.5 * zoom,
37- ((screenDims.y - gl_FragCoord .y + offset.y)/ screenDims.y) * 1.5 * zoom); // y also flipped due to opengl
36+ vec2 z = vec2 (((( gl_FragCoord .x + offset.x)/ screenDims.x) * 2.5 ) / zoom,
37+ ((( screenDims.y - gl_FragCoord .y + offset.y)/ screenDims.y) * 1.5 ) / zoom); // y also flipped due to opengl
3838 int iterations = 0 ;
3939
4040 /*
Original file line number Diff line number Diff line change @@ -40,14 +40,14 @@ int main()
4040
4141 // Load julia set shader
4242 // NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
43- Shader shader = LoadShader (0 , "resources/shaders/glsl330/ julia_shader.fs" );
43+ Shader shader = LoadShader (0 , "julia_shader.fs" );
4444
4545 // c constant to use in z^2 + c
4646 float c [2 ] = { POINTS_OF_INTEREST [0 ][0 ], POINTS_OF_INTEREST [0 ][1 ] };
4747
4848 // Offset and zoom to draw the julia set at. (centered on screen and 1.6 times smaller)
4949 float offset [2 ] = { - (float )screenWidth /2 , - (float )screenHeight /2 };
50- float zoom = 1.6f ;
50+ float zoom = 1.0f ;
5151
5252 Vector2 offsetSpeed = { 0.0f , 0.0f };
5353
@@ -111,8 +111,8 @@ int main()
111111 // Probably offset movement should be proportional to zoom level
112112 if (IsMouseButtonDown (MOUSE_LEFT_BUTTON ) || IsMouseButtonDown (MOUSE_RIGHT_BUTTON ))
113113 {
114- if (IsMouseButtonDown (MOUSE_LEFT_BUTTON )) zoom -= 0.003f ;
115- if (IsMouseButtonDown (MOUSE_RIGHT_BUTTON )) zoom += 0.003f ;
114+ if (IsMouseButtonDown (MOUSE_LEFT_BUTTON )) zoom += zoom * 0.003f ;
115+ if (IsMouseButtonDown (MOUSE_RIGHT_BUTTON )) zoom -= zoom * 0.003f ;
116116
117117 Vector2 mousePos = GetMousePosition ();
118118
You can’t perform that action at this time.
0 commit comments