From 0abc047c844878cc7171331a6d0c0d9bce958068 Mon Sep 17 00:00:00 2001 From: Jordi Santonja Blanes Date: Sat, 18 Oct 2025 14:48:49 +0200 Subject: [PATCH] Comments starting with a capital letter, and some minor fixes to adhere to the convention --- .../resources/shaders/glsl100/mandelbrot_set.fs | 6 +++--- .../resources/shaders/glsl120/mandelbrot_set.fs | 6 +++--- .../resources/shaders/glsl330/mandelbrot_set.fs | 4 ++-- examples/shaders/shaders_mandelbrot_set.c | 12 ++++++------ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/examples/shaders/resources/shaders/glsl100/mandelbrot_set.fs b/examples/shaders/resources/shaders/glsl100/mandelbrot_set.fs index 6867870c1..aab8514e8 100644 --- a/examples/shaders/resources/shaders/glsl100/mandelbrot_set.fs +++ b/examples/shaders/resources/shaders/glsl100/mandelbrot_set.fs @@ -11,11 +11,11 @@ varying vec4 fragColor; uniform vec2 offset; // Offset of the scale 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 +// For example, on RasperryPi for this examply only supports up to 60 uniform int maxIterations; // Max iterations per pixel const float max = 4.0; // We consider infinite as 4.0: if a point reaches a distance of 4.0 it will escape to infinity -const float max2 = max * max; // Square of max to avoid computing square root +const float max2 = max*max; // Square of max to avoid computing square root void main() { @@ -28,7 +28,7 @@ void main() float b = 0.0; // The Mandelbrot set is a two-dimensional set defined in the complex plane on which the iteration of the function - // fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0 + // Fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0 // Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i int iter = 0; diff --git a/examples/shaders/resources/shaders/glsl120/mandelbrot_set.fs b/examples/shaders/resources/shaders/glsl120/mandelbrot_set.fs index 8465befb3..5da3ef437 100644 --- a/examples/shaders/resources/shaders/glsl120/mandelbrot_set.fs +++ b/examples/shaders/resources/shaders/glsl120/mandelbrot_set.fs @@ -9,11 +9,11 @@ varying vec4 fragColor; uniform vec2 offset; // Offset of the scale 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 +// For example, on RasperryPi for this examply only supports up to 60 uniform int maxIterations; // Max iterations per pixel const float max = 4.0; // We consider infinite as 4.0: if a point reaches a distance of 4.0 it will escape to infinity -const float max2 = max * max; // Square of max to avoid computing square root +const float max2 = max*max; // Square of max to avoid computing square root void main() { @@ -26,7 +26,7 @@ void main() float b = 0.0; // The Mandelbrot set is a two-dimensional set defined in the complex plane on which the iteration of the function - // fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0 + // Fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0 // Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i int iter = 0; diff --git a/examples/shaders/resources/shaders/glsl330/mandelbrot_set.fs b/examples/shaders/resources/shaders/glsl330/mandelbrot_set.fs index 3bbec8701..bde74565f 100644 --- a/examples/shaders/resources/shaders/glsl330/mandelbrot_set.fs +++ b/examples/shaders/resources/shaders/glsl330/mandelbrot_set.fs @@ -14,7 +14,7 @@ uniform float zoom; // Zoom of the scale uniform int maxIterations; // Max iterations per pixel const float max = 4.0; // We consider infinite as 4.0: if a point reaches a distance of 4.0 it will escape to infinity -const float max2 = max * max; // Square of max to avoid computing square root +const float max2 = max*max; // Square of max to avoid computing square root void main() { @@ -27,7 +27,7 @@ void main() float b = 0.0; // The Mandelbrot set is a two-dimensional set defined in the complex plane on which the iteration of the function - // fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0 + // Fc(z) = z^2 + c on the complex numbers c from the plane does not diverge to infinity starting at z = 0 // Here: z = a + bi. Iterations: z -> z^2 + c = (a + bi)^2 + (c.x + c.yi) = (a^2 - b^2 + c.x) + (2ab + c.y)i int iter = 0; diff --git a/examples/shaders/shaders_mandelbrot_set.c b/examples/shaders/shaders_mandelbrot_set.c index 39f09101f..c8d0ce8d3 100644 --- a/examples/shaders/shaders_mandelbrot_set.c +++ b/examples/shaders/shaders_mandelbrot_set.c @@ -12,7 +12,7 @@ * Example originally created with raylib 5.6, last time updated with raylib 5.6 * * Example contributed by Jordi Santonja (@JordSant) -* based on previous work by Josh Colclough (@joshcol9232) +* Based on previous work by Josh Colclough (@joshcol9232) * * Example licensed under an unmodified zlib/libpng license, which is an OSI-certified, * BSD-like license that allows static linking with closed source software @@ -146,12 +146,12 @@ int main(void) if (IsMouseButtonDown(MOUSE_BUTTON_LEFT) || IsMouseButtonDown(MOUSE_BUTTON_RIGHT)) { // Change zoom. If Mouse left -> zoom in. Mouse right -> zoom out - zoom *= IsMouseButtonDown(MOUSE_BUTTON_LEFT)? zoomSpeed : 1.0f/zoomSpeed; + zoom *= IsMouseButtonDown(MOUSE_BUTTON_LEFT)? zoomSpeed : (1.0f/zoomSpeed); const Vector2 mousePos = GetMousePosition(); Vector2 offsetVelocity; // 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 + // From the center of the screen as the direction, and adjust magnitude based on the current zoom offsetVelocity.x = (mousePos.x/(float)screenWidth - 0.5f)*offsetSpeedMul/zoom; offsetVelocity.y = (mousePos.y/(float)screenHeight - 0.5f)*offsetSpeedMul/zoom; @@ -184,8 +184,8 @@ int main(void) // Draw a rectangle in shader mode to be used as shader canvas // NOTE: Rectangle uses font white character texture coordinates, - // so shader can not be applied here directly because input vertexTexCoord - // do not represent full screen coordinates (space where want to apply shader) + // So shader can not be applied here directly because input vertexTexCoord + // Do not represent full screen coordinates (space where want to apply shader) DrawRectangle(0, 0, GetScreenWidth(), GetScreenHeight(), BLACK); EndTextureMode(); @@ -196,7 +196,7 @@ int main(void) // NOTE: We do not invert texture on Y, already considered inside shader BeginShaderMode(shader); // WARNING: If FLAG_WINDOW_HIGHDPI is enabled, HighDPI monitor scaling should be considered - // when rendering the RenderTexture2D to fit in the HighDPI scaled Window + // When rendering the RenderTexture2D to fit in the HighDPI scaled Window DrawTextureEx(target.texture, (Vector2){ 0.0f, 0.0f }, 0.0f, 1.0f, WHITE); EndShaderMode();