diff --git a/examples/shaders/resources/shaders/glsl100/julia_set.fs b/examples/shaders/resources/shaders/glsl100/julia_set.fs index d246001f5..0ef190d01 100644 --- a/examples/shaders/resources/shaders/glsl100/julia_set.fs +++ b/examples/shaders/resources/shaders/glsl100/julia_set.fs @@ -13,24 +13,23 @@ uniform float zoom; // Zoom of the scale. // NOTE: Maximum number of shader for-loop iterations depend on GPU, // for example, on RasperryPi for this examply only supports up to 60 const int MAX_ITERATIONS = 48; // Max iterations to do. - -const float COLOR_CYCLES = 1; // Number of times the palette repeats. +const float COLOR_CYCLES = 1; // Number of times the color palette repeats. // Square a complex number vec2 ComplexSquare(vec2 z) { return vec2( - z.x * z.x - z.y * z.y, - z.x * z.y * 2.0 + z.x*z.x - z.y*z.y, + z.x*z.y*2.0 ); } // Convert Hue Saturation Value (HSV) color into RGB vec3 Hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); + vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz)*6.0 - K.www); + return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main() @@ -56,7 +55,7 @@ void main() // The pixel coordinates are scaled so they are on the mandelbrot scale // NOTE: fragTexCoord already comes as normalized screen coordinates but offset must be normalized before scaling and zoom - vec2 z = vec2((fragTexCoord.x - 0.5) * 2.5, (fragTexCoord.y - 0.5) * 1.5) / zoom; + vec2 z = vec2((fragTexCoord.x - 0.5)*2.5, (fragTexCoord.y - 0.5)*1.5)/zoom; z.x += offset.x; z.y += offset.y; @@ -82,5 +81,5 @@ void main() // If in set, color black. 0.999 allows for some float accuracy error. if (norm > 0.999) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0); - else gl_FragColor = vec4(Hsv2rgb(vec3(norm * COLOR_CYCLES, 1.0, 1.0)), 1.0); + else gl_FragColor = vec4(Hsv2rgb(vec3(norm*COLOR_CYCLES, 1.0, 1.0)), 1.0); } diff --git a/examples/shaders/resources/shaders/glsl330/julia_set.fs b/examples/shaders/resources/shaders/glsl330/julia_set.fs index 5b4986980..afdc75e5e 100644 --- a/examples/shaders/resources/shaders/glsl330/julia_set.fs +++ b/examples/shaders/resources/shaders/glsl330/julia_set.fs @@ -12,23 +12,23 @@ uniform vec2 offset; // Offset of the scale. uniform float zoom; // Zoom of the scale. const int MAX_ITERATIONS = 255; // Max iterations to do. -const float COLOR_CYCLES = 2; // Number of times the palette repeats. Can show higher detail for higher iteration numbers. +const float COLOR_CYCLES = 2; // Number of times the color palette repeats. Can show higher detail for higher iteration numbers. // Square a complex number vec2 ComplexSquare(vec2 z) { return vec2( - z.x * z.x - z.y * z.y, - z.x * z.y * 2.0 + z.x*z.x - z.y*z.y, + z.x*z.y*2.0 ); } // Convert Hue Saturation Value (HSV) color into RGB vec3 Hsv2rgb(vec3 c) { - vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); - vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); - return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); + vec4 K = vec4(1.0, 2.0/3.0, 1.0/3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz)*6.0 - K.www); + return c.z*mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } void main() @@ -54,7 +54,7 @@ void main() // The pixel coordinates are scaled so they are on the mandelbrot scale // NOTE: fragTexCoord already comes as normalized screen coordinates but offset must be normalized before scaling and zoom - vec2 z = vec2((fragTexCoord.x - 0.5) * 2.5, (fragTexCoord.y - 0.5) * 1.5) / zoom; + vec2 z = vec2((fragTexCoord.x - 0.5)*2.5, (fragTexCoord.y - 0.5)*1.5)/zoom; z.x += offset.x; z.y += offset.y; @@ -79,5 +79,5 @@ void main() // If in set, color black. 0.999 allows for some float accuracy error. if (norm > 0.999) finalColor = vec4(0.0, 0.0, 0.0, 1.0); - else finalColor = vec4(Hsv2rgb(vec3(norm * COLOR_CYCLES, 1.0, 1.0)), 1.0); + else finalColor = vec4(Hsv2rgb(vec3(norm*COLOR_CYCLES, 1.0, 1.0)), 1.0); } diff --git a/examples/shaders/shaders_julia_set.c b/examples/shaders/shaders_julia_set.c index a4fed0012..32c209e57 100644 --- a/examples/shaders/shaders_julia_set.c +++ b/examples/shaders/shaders_julia_set.c @@ -134,12 +134,12 @@ int main(void) // Find the velocity at which to change the camera. Take the distance of the mouse // from the center of the screen as the direction, and adjust magnitude based on // the current zoom. - offsetVelocity.x = (mousePos.x/(float)screenWidth - 0.5) * offsetSpeedMul / zoom; - offsetVelocity.y = (mousePos.y/(float)screenHeight - 0.5) * offsetSpeedMul / zoom; + offsetVelocity.x = (mousePos.x/(float)screenWidth - 0.5)*offsetSpeedMul/zoom; + offsetVelocity.y = (mousePos.y/(float)screenHeight - 0.5)*offsetSpeedMul/zoom; // Apply move velocity to camera - offset[0] += GetFrameTime() * offsetVelocity.x; - offset[1] += GetFrameTime() * offsetVelocity.y; + offset[0] += GetFrameTime()*offsetVelocity.x; + offset[1] += GetFrameTime()*offsetVelocity.y; // Update the shader uniform values! SetShaderValue(shader, zoomLoc, &zoom, SHADER_UNIFORM_FLOAT); @@ -147,7 +147,7 @@ int main(void) } // Increment c value with time - const float dc = GetFrameTime() * (float)incrementSpeed * 0.0005f; + const float dc = GetFrameTime()*(float)incrementSpeed*0.0005f; c[0] += dc; c[1] += dc; SetShaderValue(shader, cLoc, c, SHADER_UNIFORM_VEC2);