From fec0ce34c5da82fcd36446abddd235e36bc0f5be Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Oct 2021 14:57:12 +0200 Subject: [PATCH] Remove trailing spaces --- .../resources/shaders/glsl100/cubemap.fs | 2 +- .../resources/shaders/glsl100/skybox.fs | 4 +- .../resources/shaders/glsl330/cubemap.fs | 2 +- .../resources/shaders/glsl330/skybox.fs | 2 +- .../shaders/glsl100/point_particle.vs | 6 +-- .../shaders/glsl330/point_particle.vs | 6 +-- .../shaders/resources/shaders/glsl100/base.fs | 4 +- .../shaders/resources/shaders/glsl100/base.vs | 4 +- .../shaders/resources/shaders/glsl100/blur.fs | 8 ++-- .../resources/shaders/glsl100/color_mix.fs | 4 +- .../shaders/glsl100/cross_hatching.fs | 16 +++---- .../shaders/glsl100/cross_stitching.fs | 8 ++-- .../shaders/glsl100/cubes_panning.fs | 12 ++--- .../resources/shaders/glsl100/depth.fs | 2 +- .../resources/shaders/glsl100/distortion.fs | 4 +- .../resources/shaders/glsl100/eratosthenes.fs | 8 ++-- .../resources/shaders/glsl100/fisheye.fs | 2 +- .../shaders/resources/shaders/glsl100/fog.fs | 6 +-- .../resources/shaders/glsl100/grayscale.fs | 4 +- .../resources/shaders/glsl100/julia_set.fs | 6 +-- .../resources/shaders/glsl100/lighting.fs | 12 ++--- .../resources/shaders/glsl100/outline.fs | 27 +++++------- .../shaders/glsl100/palette_switch.fs | 4 +- .../resources/shaders/glsl100/pixelizer.fs | 10 ++--- .../shaders/glsl100/posterization.fs | 8 ++-- .../resources/shaders/glsl100/predator.fs | 6 +-- .../resources/shaders/glsl100/raymarching.fs | 44 ++++++++++--------- .../resources/shaders/glsl100/reload.fs | 26 +++++------ .../resources/shaders/glsl100/scanlines.fs | 2 +- .../resources/shaders/glsl100/sobel.fs | 10 ++--- .../resources/shaders/glsl100/spotlight.fs | 20 ++++----- .../resources/shaders/glsl100/swirl.fs | 6 +-- .../shaders/resources/shaders/glsl120/base.fs | 4 +- .../shaders/resources/shaders/glsl120/base.vs | 4 +- .../shaders/glsl120/base_lighting.vs | 2 +- .../resources/shaders/glsl120/bloom.fs | 6 +-- .../shaders/resources/shaders/glsl120/blur.fs | 8 ++-- .../shaders/glsl120/cross_hatching.fs | 16 +++---- .../shaders/glsl120/cross_stitching.fs | 8 ++-- .../resources/shaders/glsl120/distortion.fs | 4 +- .../resources/shaders/glsl120/fisheye.fs | 2 +- .../shaders/resources/shaders/glsl120/fog.fs | 6 +-- .../resources/shaders/glsl120/grayscale.fs | 4 +- .../resources/shaders/glsl120/pixelizer.fs | 10 ++--- .../shaders/glsl120/posterization.fs | 8 ++-- .../resources/shaders/glsl120/predator.fs | 6 +-- .../resources/shaders/glsl120/scanlines.fs | 2 +- .../resources/shaders/glsl120/sobel.fs | 10 ++--- .../resources/shaders/glsl120/swirl.fs | 6 +-- .../shaders/resources/shaders/glsl330/base.fs | 4 +- .../shaders/resources/shaders/glsl330/base.vs | 4 +- .../glsl330/base_lighting_instanced.vs | 2 +- .../resources/shaders/glsl330/bloom.fs | 6 +-- .../shaders/resources/shaders/glsl330/blur.fs | 4 +- .../resources/shaders/glsl330/color_mix.fs | 2 +- .../shaders/glsl330/cross_hatching.fs | 8 ++-- .../shaders/glsl330/cross_stitching.fs | 2 +- .../shaders/glsl330/cubes_panning.fs | 12 ++--- .../resources/shaders/glsl330/depth.fs | 2 +- .../resources/shaders/glsl330/distortion.fs | 4 +- .../resources/shaders/glsl330/eratosthenes.fs | 8 ++-- .../resources/shaders/glsl330/fisheye.fs | 2 +- .../shaders/resources/shaders/glsl330/fog.fs | 6 +-- .../resources/shaders/glsl330/grayscale.fs | 4 +- .../resources/shaders/glsl330/julia_set.fs | 10 ++--- .../resources/shaders/glsl330/lighting.fs | 12 ++--- .../resources/shaders/glsl330/outline.fs | 24 +++++----- .../resources/shaders/glsl330/overdraw.fs | 8 ++-- .../shaders/glsl330/posterization.fs | 4 +- .../resources/shaders/glsl330/predator.fs | 8 ++-- .../resources/shaders/glsl330/raymarching.fs | 42 +++++++++--------- .../resources/shaders/glsl330/reload.fs | 2 +- .../resources/shaders/glsl330/scanlines.fs | 2 +- .../resources/shaders/glsl330/sobel.fs | 10 ++--- .../resources/shaders/glsl330/spotlight.fs | 14 +++--- .../resources/shaders/glsl330/swirl.fs | 6 +-- .../shaders/glsl100/alpha_discard.fs | 4 +- .../text/resources/shaders/glsl100/sdf.fs | 2 +- .../text/resources/shaders/glsl330/sdf.fs | 2 +- src/rlgl.h | 8 ++-- 80 files changed, 309 insertions(+), 310 deletions(-) diff --git a/examples/models/resources/shaders/glsl100/cubemap.fs b/examples/models/resources/shaders/glsl100/cubemap.fs index 402cdea00..7d1bde0a7 100644 --- a/examples/models/resources/shaders/glsl100/cubemap.fs +++ b/examples/models/resources/shaders/glsl100/cubemap.fs @@ -18,7 +18,7 @@ vec2 SampleSphericalMap(vec3 v) void main() { - // Normalize local position + // Normalize local position vec2 uv = SampleSphericalMap(normalize(fragPosition)); // Fetch color from texture map diff --git a/examples/models/resources/shaders/glsl100/skybox.fs b/examples/models/resources/shaders/glsl100/skybox.fs index 4aa4ec9c0..0ea6876cb 100644 --- a/examples/models/resources/shaders/glsl100/skybox.fs +++ b/examples/models/resources/shaders/glsl100/skybox.fs @@ -19,8 +19,8 @@ void main() else texelColor = textureCube(environmentMap, fragPosition); vec3 color = vec3(texelColor.x, texelColor.y, texelColor.z); - - if (doGamma)// Apply gamma correction + + if (doGamma) // Apply gamma correction { color = color/(color + vec3(1.0)); color = pow(color, vec3(1.0/2.2)); diff --git a/examples/models/resources/shaders/glsl330/cubemap.fs b/examples/models/resources/shaders/glsl330/cubemap.fs index e4d4ddd40..f59003f92 100644 --- a/examples/models/resources/shaders/glsl330/cubemap.fs +++ b/examples/models/resources/shaders/glsl330/cubemap.fs @@ -19,7 +19,7 @@ vec2 SampleSphericalMap(vec3 v) void main() { - // Normalize local position + // Normalize local position vec2 uv = SampleSphericalMap(normalize(fragPosition)); // Fetch color from texture map diff --git a/examples/models/resources/shaders/glsl330/skybox.fs b/examples/models/resources/shaders/glsl330/skybox.fs index bb96fc3c3..d71fef0c1 100644 --- a/examples/models/resources/shaders/glsl330/skybox.fs +++ b/examples/models/resources/shaders/glsl330/skybox.fs @@ -20,7 +20,7 @@ void main() else color = texture(environmentMap, fragPosition).rgb; if (doGamma)// Apply gamma correction - { + { color = color/(color + vec3(1.0)); color = pow(color, vec3(1.0/2.2)); } diff --git a/examples/others/resources/shaders/glsl100/point_particle.vs b/examples/others/resources/shaders/glsl100/point_particle.vs index 890834c49..f3b700748 100644 --- a/examples/others/resources/shaders/glsl100/point_particle.vs +++ b/examples/others/resources/shaders/glsl100/point_particle.vs @@ -7,18 +7,18 @@ attribute vec3 vertexPosition; uniform mat4 mvp; uniform float currentTime; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables void main() { // Unpack data from vertexPosition vec2 pos = vertexPosition.xy; float period = vertexPosition.z; - + // Calculate final vertex position (jiggle it around a bit horizontally) pos += vec2(100.0, 0.0) * sin(period * currentTime); gl_Position = mvp * vec4(pos.x, pos.y, 0.0, 1.0); - + // Calculate the screen space size of this particle (also vary it over time) gl_PointSize = 10.0 - 5.0 * abs(sin(period * currentTime)); } \ No newline at end of file diff --git a/examples/others/resources/shaders/glsl330/point_particle.vs b/examples/others/resources/shaders/glsl330/point_particle.vs index e43b91de3..e38c8b5a6 100644 --- a/examples/others/resources/shaders/glsl330/point_particle.vs +++ b/examples/others/resources/shaders/glsl330/point_particle.vs @@ -7,18 +7,18 @@ in vec3 vertexPosition; uniform mat4 mvp; uniform float currentTime; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables void main() { // Unpack data from vertexPosition vec2 pos = vertexPosition.xy; float period = vertexPosition.z; - + // Calculate final vertex position (jiggle it around a bit horizontally) pos += vec2(100, 0) * sin(period * currentTime); gl_Position = mvp * vec4(pos, 0.0, 1.0); - + // Calculate the screen space size of this particle (also vary it over time) gl_PointSize = 10 - 5 * abs(sin(period * currentTime)); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/base.fs b/examples/shaders/resources/shaders/glsl100/base.fs index c1126423a..6a8d44e65 100644 --- a/examples/shaders/resources/shaders/glsl100/base.fs +++ b/examples/shaders/resources/shaders/glsl100/base.fs @@ -16,8 +16,8 @@ void main() { // Texel color fetching from texture sampler vec4 texelColor = texture2D(texture0, fragTexCoord); - + // NOTE: Implement here your fragment shader code - + gl_FragColor = texelColor*colDiffuse; } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/base.vs b/examples/shaders/resources/shaders/glsl100/base.vs index 4be76b9e5..32e83999a 100644 --- a/examples/shaders/resources/shaders/glsl100/base.vs +++ b/examples/shaders/resources/shaders/glsl100/base.vs @@ -13,14 +13,14 @@ uniform mat4 mvp; varying vec2 fragTexCoord; varying vec4 fragColor; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables void main() { // Send vertex attributes to fragment shader fragTexCoord = vertexTexCoord; fragColor = vertexColor; - + // Calculate final vertex position gl_Position = mvp*vec4(vertexPosition, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/blur.fs b/examples/shaders/resources/shaders/glsl100/blur.fs index 96f780e1e..2fef57160 100644 --- a/examples/shaders/resources/shaders/glsl100/blur.fs +++ b/examples/shaders/resources/shaders/glsl100/blur.fs @@ -19,14 +19,14 @@ const float renderHeight = 450.0; vec3 offset = vec3(0.0, 1.3846153846, 3.2307692308); vec3 weight = vec3(0.2270270270, 0.3162162162, 0.0702702703); -void main() -{ +void main() +{ // Texel color fetching from texture sampler vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight.x; - + tc += texture2D(texture0, fragTexCoord + vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; tc += texture2D(texture0, fragTexCoord - vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; - + tc += texture2D(texture0, fragTexCoord + vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; diff --git a/examples/shaders/resources/shaders/glsl100/color_mix.fs b/examples/shaders/resources/shaders/glsl100/color_mix.fs index c5c0cb70c..a163a8a0e 100644 --- a/examples/shaders/resources/shaders/glsl100/color_mix.fs +++ b/examples/shaders/resources/shaders/glsl100/color_mix.fs @@ -18,9 +18,9 @@ void main() // Texel color fetching from texture sampler vec4 texelColor0 = texture2D(texture0, fragTexCoord); vec4 texelColor1 = texture2D(texture1, fragTexCoord); - + float x = fract(fragTexCoord.s); float final = smoothstep(divider - 0.1, divider + 0.1, x); - + gl_FragColor = mix(texelColor0, texelColor1, final); } diff --git a/examples/shaders/resources/shaders/glsl100/cross_hatching.fs b/examples/shaders/resources/shaders/glsl100/cross_hatching.fs index 7d63b0a50..d978de85e 100644 --- a/examples/shaders/resources/shaders/glsl100/cross_hatching.fs +++ b/examples/shaders/resources/shaders/glsl100/cross_hatching.fs @@ -18,27 +18,27 @@ float lumThreshold02 = 0.7; float lumThreshold03 = 0.5; float lumThreshold04 = 0.3; -void main() +void main() { vec3 tc = vec3(1.0, 1.0, 1.0); float lum = length(texture2D(texture0, fragTexCoord).rgb); - if (lum < lumThreshold01) + if (lum < lumThreshold01) { if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } + } - if (lum < lumThreshold02) + if (lum < lumThreshold02) { if (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } + } - if (lum < lumThreshold03) + if (lum < lumThreshold03) { if (mod(gl_FragCoord .x + gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } + } - if (lum < lumThreshold04) + if (lum < lumThreshold04) { if (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); } diff --git a/examples/shaders/resources/shaders/glsl100/cross_stitching.fs b/examples/shaders/resources/shaders/glsl100/cross_stitching.fs index de6d4f400..a7a348d7b 100644 --- a/examples/shaders/resources/shaders/glsl100/cross_stitching.fs +++ b/examples/shaders/resources/shaders/glsl100/cross_stitching.fs @@ -29,12 +29,12 @@ vec4 PostFX(sampler2D tex, vec2 uv) int remX = int(mod(cPos.x, size)); int remY = int(mod(cPos.y, size)); - + if (remX == 0 && remY == 0) tlPos = cPos; - + vec2 blPos = tlPos; blPos.y += (size - 1.0); - + if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) { if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0); @@ -45,7 +45,7 @@ vec4 PostFX(sampler2D tex, vec2 uv) if (invert == 1) c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; else c = vec4(0.0, 0.0, 0.0, 1.0); } - + return c; } diff --git a/examples/shaders/resources/shaders/glsl100/cubes_panning.fs b/examples/shaders/resources/shaders/glsl100/cubes_panning.fs index 108f05792..9e5eab0fe 100644 --- a/examples/shaders/resources/shaders/glsl100/cubes_panning.fs +++ b/examples/shaders/resources/shaders/glsl100/cubes_panning.fs @@ -17,21 +17,21 @@ vec2 VectorRotateTime(vec2 v, float speed) { float time = uTime*speed; float localTime = fract(time); // The time domain this works on is 1 sec. - + if ((localTime >= 0.0) && (localTime < 0.25)) angle = 0.0; else if ((localTime >= 0.25) && (localTime < 0.50)) angle = PI/4.0*sin(2.0*PI*localTime - PI/2.0); else if ((localTime >= 0.50) && (localTime < 0.75)) angle = PI*0.25; else if ((localTime >= 0.75) && (localTime < 1.00)) angle = PI/4.0*sin(2.0*PI*localTime); - + // Rotate vector by angle v -= 0.5; v = mat2(cos(angle), -sin(angle), sin(angle), cos(angle))*v; v += 0.5; - + return v; } -float Rectangle(in vec2 st, in float size, in float fill) +float Rectangle(in vec2 st, in float size, in float fill) { float roundSize = 0.5 - size/2.0; float left = step(roundSize, st.x); @@ -43,7 +43,7 @@ float Rectangle(in vec2 st, in float size, in float fill) } void main() -{ +{ vec2 fragPos = fragTexCoord; fragPos.xy += uTime/9.0; @@ -52,7 +52,7 @@ void main() vec2 fpos = fract(fragPos); // Get the fractional coords fpos = VectorRotateTime(fpos, 0.2); - + float alpha = Rectangle(fpos, 0.216, 1.0); vec3 color = vec3(0.3, 0.3, 0.3); diff --git a/examples/shaders/resources/shaders/glsl100/depth.fs b/examples/shaders/resources/shaders/glsl100/depth.fs index f6a14eb2f..780992784 100644 --- a/examples/shaders/resources/shaders/glsl100/depth.fs +++ b/examples/shaders/resources/shaders/glsl100/depth.fs @@ -20,7 +20,7 @@ void main() // Linearize depth value float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear)); - + // Calculate final fragment color gl_FragColor = vec4(depth, depth, depth, 1.0f); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/distortion.fs b/examples/shaders/resources/shaders/glsl100/distortion.fs index 50116ce0b..c232be2c0 100644 --- a/examples/shaders/resources/shaders/glsl100/distortion.fs +++ b/examples/shaders/resources/shaders/glsl100/distortion.fs @@ -23,13 +23,13 @@ void main() // The following two variables need to be set per eye vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter; vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter; - + // Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter) vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1] float rSq = theta.x*theta.x + theta.y*theta.y; vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq); //vec2 tc = LensCenter + Scale*theta1; - + // Detect whether blue texture coordinates are out of range since these will scaled out the furthest vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq); vec2 tcBlue = LensCenter + Scale*thetaBlue; diff --git a/examples/shaders/resources/shaders/glsl100/eratosthenes.fs b/examples/shaders/resources/shaders/glsl100/eratosthenes.fs index ba6de891f..0d5fcc5a4 100644 --- a/examples/shaders/resources/shaders/glsl100/eratosthenes.fs +++ b/examples/shaders/resources/shaders/glsl100/eratosthenes.fs @@ -11,7 +11,7 @@ precision mediump float; Each integer is tested to see if it is a prime number. Primes are colored white. Non-primes are colored with a color that indicates the smallest factor which evenly divdes our integer. - You can change the scale variable to make a larger or smaller grid. + You can change the scale variable to make a larger or smaller grid. Total number of integers displayed = scale squared, so scale = 100 tests the first 10,000 integers. WARNING: If you make scale too large, your GPU may bog down! @@ -27,11 +27,11 @@ vec4 Colorizer(float counter, float maxSize) { float red = 0.0, green = 0.0, blue = 0.0; float normsize = counter/maxSize; - + red = smoothstep(0.3, 0.7, normsize); green = sin(3.14159*normsize); blue = 1.0 - smoothstep(0.0, 0.4, normsize); - + return vec4(0.8*red, 0.8*green, 0.8*blue, 1.0); } @@ -41,7 +41,7 @@ void main() float scale = 1000.0; // Makes 100x100 square grid. Change this variable to make a smaller or larger grid. float value = scale*floor(fragTexCoord.y*scale) + floor(fragTexCoord.x*scale); // Group pixels into boxes representing integer values int valuei = int(value); - + //if ((valuei == 0) || (valuei == 1) || (valuei == 2)) gl_FragColor = vec4(1.0); //else { diff --git a/examples/shaders/resources/shaders/glsl100/fisheye.fs b/examples/shaders/resources/shaders/glsl100/fisheye.fs index 8beb3d4a8..c8ca0bb06 100644 --- a/examples/shaders/resources/shaders/glsl100/fisheye.fs +++ b/examples/shaders/resources/shaders/glsl100/fisheye.fs @@ -23,7 +23,7 @@ void main() vec2 uv = vec2(0.0); vec2 xy = 2.0 * fragTexCoord.xy - 1.0; float d = length(xy); - + if (d < (2.0 - maxFactor)) { d = length(xy * maxFactor); diff --git a/examples/shaders/resources/shaders/glsl100/fog.fs b/examples/shaders/resources/shaders/glsl100/fog.fs index eeb2150f9..c3d0e1765 100644 --- a/examples/shaders/resources/shaders/glsl100/fog.fs +++ b/examples/shaders/resources/shaders/glsl100/fog.fs @@ -54,7 +54,7 @@ void main() if (lights[i].enabled == 1) { vec3 light = vec3(0.0); - + if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position); if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition); @@ -69,10 +69,10 @@ void main() vec4 finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0))); finalColor += texelColor*(ambient/10.0); - + // Gamma correction finalColor = pow(finalColor, vec4(1.0/2.2)); - + // Fog calculation float dist = length(viewPos - fragPosition); diff --git a/examples/shaders/resources/shaders/glsl100/grayscale.fs b/examples/shaders/resources/shaders/glsl100/grayscale.fs index 15174ea57..0c01fc5fe 100644 --- a/examples/shaders/resources/shaders/glsl100/grayscale.fs +++ b/examples/shaders/resources/shaders/glsl100/grayscale.fs @@ -16,10 +16,10 @@ void main() { // Texel color fetching from texture sampler vec4 texelColor = texture2D(texture0, fragTexCoord)*colDiffuse*fragColor; - + // Convert texel color to grayscale using NTSC conversion weights float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); - + // Calculate final fragment color gl_FragColor = vec4(gray, gray, gray, texelColor.a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/julia_set.fs b/examples/shaders/resources/shaders/glsl100/julia_set.fs index bce25db1f..44d083459 100644 --- a/examples/shaders/resources/shaders/glsl100/julia_set.fs +++ b/examples/shaders/resources/shaders/glsl100/julia_set.fs @@ -52,7 +52,7 @@ void main() We use dot product (z.x * z.x + z.y * z.y) to determine the magnitude (length) squared. And once the magnitude squared is > 4, then magnitude > 2 is also true (saves computational power). *************************************************************************************************/ - + // 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 + offset.x/screenDims.x)*2.5/zoom, (fragTexCoord.y + offset.y/screenDims.y)*1.5/zoom); @@ -70,10 +70,10 @@ void main() // See http://linas.org/art-gallery/escape/escape.html for more information. z = ComplexSquare(z) + c; z = ComplexSquare(z) + c; - + // This last part smooths the color (again see link above). float smoothVal = float(iter) + 1.0 - (log(log(length(z)))/log(2.0)); - + // Normalize the value so it is between 0 and 1. float norm = smoothVal/float(MAX_ITERATIONS); diff --git a/examples/shaders/resources/shaders/glsl100/lighting.fs b/examples/shaders/resources/shaders/glsl100/lighting.fs index 5e4ff64cb..736716198 100644 --- a/examples/shaders/resources/shaders/glsl100/lighting.fs +++ b/examples/shaders/resources/shaders/glsl100/lighting.fs @@ -53,17 +53,17 @@ void main() if (lights[i].enabled == 1) { vec3 light = vec3(0.0); - - if (lights[i].type == LIGHT_DIRECTIONAL) + + if (lights[i].type == LIGHT_DIRECTIONAL) { light = -normalize(lights[i].target - lights[i].position); } - - if (lights[i].type == LIGHT_POINT) + + if (lights[i].type == LIGHT_POINT) { light = normalize(lights[i].position - fragPosition); } - + float NdotL = max(dot(normal, light), 0.0); lightDot += lights[i].color.rgb*NdotL; @@ -75,7 +75,7 @@ void main() vec4 finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0))); finalColor += texelColor*(ambient/10.0); - + // Gamma correction gl_FragColor = pow(finalColor, vec4(1.0/2.2)); } diff --git a/examples/shaders/resources/shaders/glsl100/outline.fs b/examples/shaders/resources/shaders/glsl100/outline.fs index 51b1f322a..c64409e94 100644 --- a/examples/shaders/resources/shaders/glsl100/outline.fs +++ b/examples/shaders/resources/shaders/glsl100/outline.fs @@ -14,24 +14,21 @@ uniform vec2 textureSize; uniform float outlineSize; uniform vec4 outlineColor; -// Output fragment color -out vec4 finalColor; - void main() { - vec4 texel = texture2D(texture0, fragTexCoord); // Get texel color - vec2 texelScale = vec2(0.0); + vec4 texel = texture2D(texture0, fragTexCoord); // Get texel color + vec2 texelScale = vec2(0.0); texelScale.x = outlineSize/textureSize.x; texelScale.y = outlineSize/textureSize.y; - // We sample four corner texels, but only for the alpha channel (this is for the outline) - vec4 corners = vec4(0.0); - corners.x = texture2D(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a; - corners.y = texture2D(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a; - corners.z = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a; - corners.w = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a; - - float outline = min(dot(corners, vec4(1.0)), 1.0); - vec4 color = mix(vec4(0.0), outlineColor, outline); - gl_FragColor = mix(color, texel, texel.a); + // We sample four corner texels, but only for the alpha channel (this is for the outline) + vec4 corners = vec4(0.0); + corners.x = texture2D(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a; + corners.y = texture2D(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a; + corners.z = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a; + corners.w = texture2D(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a; + + float outline = min(dot(corners, vec4(1.0)), 1.0); + vec4 color = mix(vec4(0.0), outlineColor, outline); + gl_FragColor = mix(color, texel, texel.a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/palette_switch.fs b/examples/shaders/resources/shaders/glsl100/palette_switch.fs index e5b038d6e..25b496321 100644 --- a/examples/shaders/resources/shaders/glsl100/palette_switch.fs +++ b/examples/shaders/resources/shaders/glsl100/palette_switch.fs @@ -20,9 +20,9 @@ void main() // Convert the (normalized) texel color RED component (GB would work, too) // to the palette index by scaling up from [0, 1] to [0, 255]. int index = int(texelColor.r*255.0); - + ivec3 color = ivec3(0); - + // NOTE: On GLSL 100 we are not allowed to index a uniform array by a variable value, // a constantmust be used, so this logic... if (index == 0) color = palette[0]; diff --git a/examples/shaders/resources/shaders/glsl100/pixelizer.fs b/examples/shaders/resources/shaders/glsl100/pixelizer.fs index 44fb0ca20..dae63df24 100644 --- a/examples/shaders/resources/shaders/glsl100/pixelizer.fs +++ b/examples/shaders/resources/shaders/glsl100/pixelizer.fs @@ -10,7 +10,7 @@ varying vec4 fragColor; uniform sampler2D texture0; uniform vec4 colDiffuse; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables // NOTE: Render size values must be passed from code const float renderWidth = 800.0; @@ -19,13 +19,13 @@ const float renderHeight = 450.0; float pixelWidth = 5.0; float pixelHeight = 5.0; -void main() -{ +void main() +{ float dx = pixelWidth*(1.0/renderWidth); float dy = pixelHeight*(1.0/renderHeight); - + vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy)); - + vec3 tc = texture2D(texture0, coord).rgb; gl_FragColor = vec4(tc, 1.0); diff --git a/examples/shaders/resources/shaders/glsl100/posterization.fs b/examples/shaders/resources/shaders/glsl100/posterization.fs index a7942c82e..f7060e54b 100644 --- a/examples/shaders/resources/shaders/glsl100/posterization.fs +++ b/examples/shaders/resources/shaders/glsl100/posterization.fs @@ -15,15 +15,15 @@ uniform vec4 colDiffuse; float gamma = 0.6; float numColors = 8.0; -void main() -{ +void main() +{ vec3 color = texture2D(texture0, fragTexCoord.xy).rgb; - + color = pow(color, vec3(gamma, gamma, gamma)); color = color*numColors; color = floor(color); color = color/numColors; color = pow(color, vec3(1.0/gamma)); - + gl_FragColor = vec4(color, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/predator.fs b/examples/shaders/resources/shaders/glsl100/predator.fs index 37dc0bdf7..e0c0a9d26 100644 --- a/examples/shaders/resources/shaders/glsl100/predator.fs +++ b/examples/shaders/resources/shaders/glsl100/predator.fs @@ -12,18 +12,18 @@ uniform vec4 colDiffuse; // NOTE: Add here your custom variables -void main() +void main() { vec3 color = texture2D(texture0, fragTexCoord).rgb; vec3 colors[3]; colors[0] = vec3(0.0, 0.0, 1.0); colors[1] = vec3(1.0, 1.0, 0.0); colors[2] = vec3(1.0, 0.0, 0.0); - + float lum = (color.r + color.g + color.b)/3.0; vec3 tc = vec3(0.0, 0.0, 0.0); - + if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5); else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5); diff --git a/examples/shaders/resources/shaders/glsl100/raymarching.fs b/examples/shaders/resources/shaders/glsl100/raymarching.fs index 7535086b5..d58d9d331 100644 --- a/examples/shaders/resources/shaders/glsl100/raymarching.fs +++ b/examples/shaders/resources/shaders/glsl100/raymarching.fs @@ -2,12 +2,14 @@ precision mediump float; +#extension GL_OES_standard_derivatives : enable + // Input vertex attributes (from vertex shader) varying vec2 fragTexCoord; varying vec4 fragColor; uniform vec3 viewEye; -uniform vec3 viewCenter; +uniform vec3 viewCenter; uniform float runTime; uniform vec2 resolution; @@ -31,7 +33,7 @@ uniform vec2 resolution; // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -// A list of useful distance function to simple primitives, and an example on how to +// A list of useful distance function to simple primitives, and an example on how to // do some interesting boolean operations, repetition and displacement. // // More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm @@ -142,7 +144,7 @@ float sdPryamid4(vec3 p, vec3 h ) // h = { cos a, sin a, height } { // Tetrahedron = Octahedron - Cube float box = sdBox( p - vec3(0,-2.0*h.z,0), vec3(2.0*h.z) ); - + float d = 0.0; d = max( d, abs( dot(p, vec3( -h.x, h.y, 0 )) )); d = max( d, abs( dot(p, vec3( h.x, h.y, 0 )) )); @@ -237,7 +239,7 @@ vec2 map( in vec3 pos ) res = opU( res, vec2( 0.5*sdTorus( opTwist(pos-vec3(-2.0,0.25, 2.0)),vec2(0.20,0.05)), 46.7 ) ); res = opU( res, vec2( sdConeSection( pos-vec3( 0.0,0.35,-2.0), 0.15, 0.2, 0.1 ), 13.67 ) ); res = opU( res, vec2( sdEllipsoid( pos-vec3( 1.0,0.35,-2.0), vec3(0.15, 0.2, 0.05) ), 43.17 ) ); - + return res; } @@ -245,14 +247,14 @@ vec2 castRay( in vec3 ro, in vec3 rd ) { float tmin = 0.2; float tmax = 30.0; - + #if 1 // bounding volume float tp1 = (0.0-ro.y)/rd.y; if( tp1>0.0 ) tmax = min( tmax, tp1 ); float tp2 = (1.6-ro.y)/rd.y; if( tp2>0.0 ) { if( ro.y>1.6 ) tmin = max( tmin, tp2 ); else tmax = min( tmax, tp2 ); } #endif - + float t = tmin; float m = -1.0; for( int i=0; i<64; i++ ) @@ -286,9 +288,9 @@ float calcSoftshadow( in vec3 ro, in vec3 rd, in float mint, in float tmax ) vec3 calcNormal( in vec3 pos ) { vec2 e = vec2(1.0,-1.0)*0.5773*0.0005; - return normalize( e.xyy*map( pos + e.xyy ).x + - e.yyx*map( pos + e.yyx ).x + - e.yxy*map( pos + e.yxy ).x + + return normalize( e.xyy*map( pos + e.xyy ).x + + e.yyx*map( pos + e.yyx ).x + + e.yxy*map( pos + e.yxy ).x + e.xxx*map( pos + e.xxx ).x ); /* vec3 eps = vec3( 0.0005, 0.0, 0.0 ); @@ -312,7 +314,7 @@ float calcAO( in vec3 pos, in vec3 nor ) occ += -(dd-hr)*sca; sca *= 0.95; } - return clamp( 1.0 - 3.0*occ, 0.0, 1.0 ); + return clamp( 1.0 - 3.0*occ, 0.0, 1.0 ); } // http://iquilezles.org/www/articles/checkerfiltering/checkerfiltering.htm @@ -323,11 +325,11 @@ float checkersGradBox( in vec2 p ) // analytical integral (box filter) vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w; // xor pattern - return 0.5 - 0.5*i.x*i.y; + return 0.5 - 0.5*i.x*i.y; } vec3 render( in vec3 ro, in vec3 rd ) -{ +{ vec3 col = vec3(0.7, 0.9, 1.0) +rd.y*0.8; vec2 res = castRay(ro,rd); float t = res.x; @@ -337,17 +339,17 @@ vec3 render( in vec3 ro, in vec3 rd ) vec3 pos = ro + t*rd; vec3 nor = calcNormal( pos ); vec3 ref = reflect( rd, nor ); - - // material + + // material col = 0.45 + 0.35*sin( vec3(0.05,0.08,0.10)*(m-1.0) ); if( m<1.5 ) { - + float f = checkersGradBox( 5.0*pos.xz ); col = 0.3 + f*vec3(0.1); } - // lighting + // lighting float occ = calcAO( pos, nor ); vec3 lig = normalize( vec3(cos(-0.4 * runTime), sin(0.7 * runTime), -0.6) ); vec3 hal = normalize( lig-rd ); @@ -356,7 +358,7 @@ vec3 render( in vec3 ro, in vec3 rd ) float bac = clamp( dot( nor, normalize(vec3(-lig.x,0.0,-lig.z))), 0.0, 1.0 )*clamp( 1.0-pos.y,0.0,1.0); float dom = smoothstep( -0.1, 0.1, ref.y ); float fre = pow( clamp(1.0+dot(nor,rd),0.0,1.0), 2.0 ); - + dif *= calcSoftshadow( pos, lig, 0.02, 2.5 ); dom *= calcSoftshadow( pos, ref, 0.02, 2.5 ); @@ -398,22 +400,22 @@ void main() // pixel coordinates vec2 o = vec2(float(m),float(n)) / float(AA) - 0.5; vec2 p = (-resolution.xy + 2.0*(gl_FragCoord.xy+o))/resolution.y; -#else +#else vec2 p = (-resolution.xy + 2.0*gl_FragCoord.xy)/resolution.y; #endif // RAY: Camera is provided from raylib //vec3 ro = vec3( -0.5+3.5*cos(0.1*time + 6.0*mo.x), 1.0 + 2.0*mo.y, 0.5 + 4.0*sin(0.1*time + 6.0*mo.x) ); - + vec3 ro = viewEye; vec3 ta = viewCenter; - + // camera-to-world transformation mat3 ca = setCamera( ro, ta, 0.0 ); // ray direction vec3 rd = ca * normalize( vec3(p.xy,2.0) ); - // render + // render vec3 col = render( ro, rd ); // gamma diff --git a/examples/shaders/resources/shaders/glsl100/reload.fs b/examples/shaders/resources/shaders/glsl100/reload.fs index eda00ae3a..d8e441607 100644 --- a/examples/shaders/resources/shaders/glsl100/reload.fs +++ b/examples/shaders/resources/shaders/glsl100/reload.fs @@ -14,26 +14,26 @@ uniform float time; // Total run time (in secods) // Draw circle vec4 DrawCircle(vec2 fragCoord, vec2 position, float radius, vec3 color) { - float d = length(position - fragCoord) - radius; - float t = clamp(d, 0.0, 1.0); - return vec4(color, 1.0 - t); + float d = length(position - fragCoord) - radius; + float t = clamp(d, 0.0, 1.0); + return vec4(color, 1.0 - t); } void main() { - vec2 fragCoord = gl_FragCoord.xy; - vec2 position = vec2(mouse.x, resolution.y - mouse.y); - float radius = 40.0; + vec2 fragCoord = gl_FragCoord.xy; + vec2 position = vec2(mouse.x, resolution.y - mouse.y); + float radius = 40.0; // Draw background layer vec4 colorA = vec4(0.2,0.2,0.8, 1.0); vec4 colorB = vec4(1.0,0.7,0.2, 1.0); - vec4 layer1 = mix(colorA, colorB, abs(sin(time*0.1))); + vec4 layer1 = mix(colorA, colorB, abs(sin(time*0.1))); - // Draw circle layer - vec3 color = vec3(0.9, 0.16, 0.21); - vec4 layer2 = DrawCircle(fragCoord, position, radius, color); - - // Blend the two layers - gl_FragColor = mix(layer1, layer2, layer2.a); + // Draw circle layer + vec3 color = vec3(0.9, 0.16, 0.21); + vec4 layer2 = DrawCircle(fragCoord, position, radius, color); + + // Blend the two layers + gl_FragColor = mix(layer1, layer2, layer2.a); } diff --git a/examples/shaders/resources/shaders/glsl100/scanlines.fs b/examples/shaders/resources/shaders/glsl100/scanlines.fs index ce649e1a0..74c9c312f 100644 --- a/examples/shaders/resources/shaders/glsl100/scanlines.fs +++ b/examples/shaders/resources/shaders/glsl100/scanlines.fs @@ -37,7 +37,7 @@ void main() // Scanlines method 2 float globalPos = (fragTexCoord.y + offset) * frequency; float wavePos = cos((fract(globalPos) - 0.5)*3.14); - + vec4 color = texture2D(texture0, fragTexCoord); gl_FragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos); diff --git a/examples/shaders/resources/shaders/glsl100/sobel.fs b/examples/shaders/resources/shaders/glsl100/sobel.fs index 3e5c22dda..6468b0977 100644 --- a/examples/shaders/resources/shaders/glsl100/sobel.fs +++ b/examples/shaders/resources/shaders/glsl100/sobel.fs @@ -13,11 +13,11 @@ uniform vec4 colDiffuse; // NOTE: Add here your custom variables vec2 resolution = vec2(800.0, 450.0); -void main() +void main() { float x = 1.0/resolution.x; float y = 1.0/resolution.y; - + vec4 horizEdge = vec4(0.0); horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0; @@ -25,7 +25,7 @@ void main() horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0; horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; - + vec4 vertEdge = vec4(0.0); vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0; @@ -33,8 +33,8 @@ void main() vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0; vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; - + vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb)); - + gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl100/spotlight.fs b/examples/shaders/resources/shaders/glsl100/spotlight.fs index c8d830381..a563421ae 100644 --- a/examples/shaders/resources/shaders/glsl100/spotlight.fs +++ b/examples/shaders/resources/shaders/glsl100/spotlight.fs @@ -16,10 +16,10 @@ uniform float screenWidth; // Width of the screen void main() { float alpha = 1.0; - + // Get the position of the current fragment (screen coordinates!) vec2 pos = vec2(gl_FragCoord.x, gl_FragCoord.y); - + // Find out which spotlight is nearest float d = 65000.0; // some high value int fi = -1; // found index @@ -29,18 +29,18 @@ void main() for (int j = 0; j < MAX_SPOTS; j++) { float dj = distance(pos, spots[j].pos) - spots[j].radius + spots[i].radius; - - if (d > dj) + + if (d > dj) { d = dj; fi = i; } } } - + // d now equals distance to nearest spot... // allowing for the different radii of all spotlights - if (fi == 0) + if (fi == 0) { if (d > spots[0].radius) alpha = 1.0; else @@ -49,7 +49,7 @@ void main() else alpha = (d - spots[0].inner)/(spots[0].radius - spots[0].inner); } } - else if (fi == 1) + else if (fi == 1) { if (d > spots[1].radius) alpha = 1.0; else @@ -58,7 +58,7 @@ void main() else alpha = (d - spots[1].inner)/(spots[1].radius - spots[1].inner); } } - else if (fi == 2) + else if (fi == 2) { if (d > spots[2].radius) alpha = 1.0; else @@ -67,8 +67,8 @@ void main() else alpha = (d - spots[2].inner)/(spots[2].radius - spots[2].inner); } } - - // Right hand side of screen is dimly lit, + + // Right hand side of screen is dimly lit, // could make the threshold value user definable if ((pos.x > screenWidth/2.0) && (alpha > 0.9)) alpha = 0.9; diff --git a/examples/shaders/resources/shaders/glsl100/swirl.fs b/examples/shaders/resources/shaders/glsl100/swirl.fs index 7807b807d..ec6c6648f 100644 --- a/examples/shaders/resources/shaders/glsl100/swirl.fs +++ b/examples/shaders/resources/shaders/glsl100/swirl.fs @@ -26,16 +26,16 @@ void main() vec2 texSize = vec2(renderWidth, renderHeight); vec2 tc = fragTexCoord*texSize; tc -= center; - + float dist = length(tc); - if (dist < radius) + if (dist < radius) { float percent = (radius - dist)/radius; float theta = percent*percent*angle*8.0; float s = sin(theta); float c = cos(theta); - + tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); } diff --git a/examples/shaders/resources/shaders/glsl120/base.fs b/examples/shaders/resources/shaders/glsl120/base.fs index 18799f957..50781ad18 100644 --- a/examples/shaders/resources/shaders/glsl120/base.fs +++ b/examples/shaders/resources/shaders/glsl120/base.fs @@ -15,8 +15,8 @@ void main() { // Texel color fetching from texture sampler vec4 texelColor = texture2D(texture0, fragTexCoord); - + // NOTE: Implement here your fragment shader code - + gl_FragColor = texelColor*colDiffuse; } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/base.vs b/examples/shaders/resources/shaders/glsl120/base.vs index 674153d8c..08a61e38b 100644 --- a/examples/shaders/resources/shaders/glsl120/base.vs +++ b/examples/shaders/resources/shaders/glsl120/base.vs @@ -13,14 +13,14 @@ uniform mat4 mvp; varying vec2 fragTexCoord; varying vec4 fragColor; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables void main() { // Send vertex attributes to fragment shader fragTexCoord = vertexTexCoord; fragColor = vertexColor; - + // Calculate final vertex position gl_Position = mvp*vec4(vertexPosition, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/base_lighting.vs b/examples/shaders/resources/shaders/glsl120/base_lighting.vs index 678c60e9d..b11409399 100644 --- a/examples/shaders/resources/shaders/glsl120/base_lighting.vs +++ b/examples/shaders/resources/shaders/glsl120/base_lighting.vs @@ -50,7 +50,7 @@ void main() fragPosition = vec3(matModel*vec4(vertexPosition, 1.0)); fragTexCoord = vertexTexCoord; fragColor = vertexColor; - + mat3 normalMatrix = transpose(inverse(mat3(matModel))); fragNormal = normalize(normalMatrix*vertexNormal); diff --git a/examples/shaders/resources/shaders/glsl120/bloom.fs b/examples/shaders/resources/shaders/glsl120/bloom.fs index f97c18ed7..b8c44959b 100644 --- a/examples/shaders/resources/shaders/glsl120/bloom.fs +++ b/examples/shaders/resources/shaders/glsl120/bloom.fs @@ -10,9 +10,9 @@ uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const vec2 size = vec2(800, 450); // render size -const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance -const float quality = 2.5; // lower = smaller glow, better quality +const vec2 size = vec2(800, 450); // Framebuffer size +const float samples = 5.0; // Pixels per axis; higher = bigger glow, worse performance +const float quality = 2.5; // Defines size factor: Lower = smaller glow, better quality void main() { diff --git a/examples/shaders/resources/shaders/glsl120/blur.fs b/examples/shaders/resources/shaders/glsl120/blur.fs index 99cddfc97..cf66d8776 100644 --- a/examples/shaders/resources/shaders/glsl120/blur.fs +++ b/examples/shaders/resources/shaders/glsl120/blur.fs @@ -17,14 +17,14 @@ const float renderHeight = 450.0; vec3 offset = vec3(0.0, 1.3846153846, 3.2307692308); vec3 weight = vec3(0.2270270270, 0.3162162162, 0.0702702703); -void main() -{ +void main() +{ // Texel color fetching from texture sampler vec3 tc = texture2D(texture0, fragTexCoord).rgb*weight.x; - + tc += texture2D(texture0, fragTexCoord + vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; tc += texture2D(texture0, fragTexCoord - vec2(offset.y)/renderWidth, 0.0).rgb*weight.y; - + tc += texture2D(texture0, fragTexCoord + vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z; diff --git a/examples/shaders/resources/shaders/glsl120/cross_hatching.fs b/examples/shaders/resources/shaders/glsl120/cross_hatching.fs index 46514120f..14b7e2e19 100644 --- a/examples/shaders/resources/shaders/glsl120/cross_hatching.fs +++ b/examples/shaders/resources/shaders/glsl120/cross_hatching.fs @@ -16,27 +16,27 @@ float lumThreshold02 = 0.7; float lumThreshold03 = 0.5; float lumThreshold04 = 0.3; -void main() +void main() { vec3 tc = vec3(1.0, 1.0, 1.0); float lum = length(texture2D(texture0, fragTexCoord).rgb); - if (lum < lumThreshold01) + if (lum < lumThreshold01) { if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } + } - if (lum < lumThreshold02) + if (lum < lumThreshold02) { if (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } + } - if (lum < lumThreshold03) + if (lum < lumThreshold03) { if (mod(gl_FragCoord .x + gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } + } - if (lum < lumThreshold04) + if (lum < lumThreshold04) { if (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); } diff --git a/examples/shaders/resources/shaders/glsl120/cross_stitching.fs b/examples/shaders/resources/shaders/glsl120/cross_stitching.fs index dee4617e2..0e0cb7cbd 100644 --- a/examples/shaders/resources/shaders/glsl120/cross_stitching.fs +++ b/examples/shaders/resources/shaders/glsl120/cross_stitching.fs @@ -27,12 +27,12 @@ vec4 PostFX(sampler2D tex, vec2 uv) int remX = int(mod(cPos.x, size)); int remY = int(mod(cPos.y, size)); - + if (remX == 0 && remY == 0) tlPos = cPos; - + vec2 blPos = tlPos; blPos.y += (size - 1.0); - + if ((remX == remY) || (((int(cPos.x) - int(blPos.x)) == (int(blPos.y) - int(cPos.y))))) { if (invert == 1) c = vec4(0.2, 0.15, 0.05, 1.0); @@ -43,7 +43,7 @@ vec4 PostFX(sampler2D tex, vec2 uv) if (invert == 1) c = texture2D(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; else c = vec4(0.0, 0.0, 0.0, 1.0); } - + return c; } diff --git a/examples/shaders/resources/shaders/glsl120/distortion.fs b/examples/shaders/resources/shaders/glsl120/distortion.fs index f9d7f1e5a..cf739814b 100644 --- a/examples/shaders/resources/shaders/glsl120/distortion.fs +++ b/examples/shaders/resources/shaders/glsl120/distortion.fs @@ -21,13 +21,13 @@ void main() // The following two variables need to be set per eye vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter; vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter; - + // Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter) vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1] float rSq = theta.x*theta.x + theta.y*theta.y; vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq); //vec2 tc = LensCenter + Scale*theta1; - + // Detect whether blue texture coordinates are out of range since these will scaled out the furthest vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq); vec2 tcBlue = LensCenter + Scale*thetaBlue; diff --git a/examples/shaders/resources/shaders/glsl120/fisheye.fs b/examples/shaders/resources/shaders/glsl120/fisheye.fs index 6f376ba39..5cc57f0e7 100644 --- a/examples/shaders/resources/shaders/glsl120/fisheye.fs +++ b/examples/shaders/resources/shaders/glsl120/fisheye.fs @@ -21,7 +21,7 @@ void main() vec2 uv = vec2(0.0); vec2 xy = 2.0 * fragTexCoord.xy - 1.0; float d = length(xy); - + if (d < (2.0 - maxFactor)) { d = length(xy * maxFactor); diff --git a/examples/shaders/resources/shaders/glsl120/fog.fs b/examples/shaders/resources/shaders/glsl120/fog.fs index fcd6ef954..63af6c494 100644 --- a/examples/shaders/resources/shaders/glsl120/fog.fs +++ b/examples/shaders/resources/shaders/glsl120/fog.fs @@ -52,7 +52,7 @@ void main() if (lights[i].enabled == 1) { vec3 light = vec3(0.0); - + if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position); if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition); @@ -67,10 +67,10 @@ void main() vec4 finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0))); finalColor += texelColor*(ambient/10.0); - + // Gamma correction finalColor = pow(finalColor, vec4(1.0/2.2)); - + // Fog calculation float dist = length(viewPos - fragPosition); diff --git a/examples/shaders/resources/shaders/glsl120/grayscale.fs b/examples/shaders/resources/shaders/glsl120/grayscale.fs index 4de60d224..de48f6bb6 100644 --- a/examples/shaders/resources/shaders/glsl120/grayscale.fs +++ b/examples/shaders/resources/shaders/glsl120/grayscale.fs @@ -14,10 +14,10 @@ void main() { // Texel color fetching from texture sampler vec4 texelColor = texture2D(texture0, fragTexCoord)*colDiffuse*fragColor; - + // Convert texel color to grayscale using NTSC conversion weights float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); - + // Calculate final fragment color gl_FragColor = vec4(gray, gray, gray, texelColor.a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/pixelizer.fs b/examples/shaders/resources/shaders/glsl120/pixelizer.fs index 6f741fafc..8f5e4f1af 100644 --- a/examples/shaders/resources/shaders/glsl120/pixelizer.fs +++ b/examples/shaders/resources/shaders/glsl120/pixelizer.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; uniform sampler2D texture0; uniform vec4 colDiffuse; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables // NOTE: Render size values must be passed from code const float renderWidth = 800.0; @@ -17,13 +17,13 @@ const float renderHeight = 450.0; float pixelWidth = 5.0; float pixelHeight = 5.0; -void main() -{ +void main() +{ float dx = pixelWidth*(1.0/renderWidth); float dy = pixelHeight*(1.0/renderHeight); - + vec2 coord = vec2(dx*floor(fragTexCoord.x/dx), dy*floor(fragTexCoord.y/dy)); - + vec3 tc = texture2D(texture0, coord).rgb; gl_FragColor = vec4(tc, 1.0); diff --git a/examples/shaders/resources/shaders/glsl120/posterization.fs b/examples/shaders/resources/shaders/glsl120/posterization.fs index 475b93a16..445c925fc 100644 --- a/examples/shaders/resources/shaders/glsl120/posterization.fs +++ b/examples/shaders/resources/shaders/glsl120/posterization.fs @@ -13,15 +13,15 @@ uniform vec4 colDiffuse; float gamma = 0.6; float numColors = 8.0; -void main() -{ +void main() +{ vec3 color = texture2D(texture0, fragTexCoord.xy).rgb; - + color = pow(color, vec3(gamma, gamma, gamma)); color = color*numColors; color = floor(color); color = color/numColors; color = pow(color, vec3(1.0/gamma)); - + gl_FragColor = vec4(color, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/predator.fs b/examples/shaders/resources/shaders/glsl120/predator.fs index 2999cc8dd..219869658 100644 --- a/examples/shaders/resources/shaders/glsl120/predator.fs +++ b/examples/shaders/resources/shaders/glsl120/predator.fs @@ -10,18 +10,18 @@ uniform vec4 colDiffuse; // NOTE: Add here your custom variables -void main() +void main() { vec3 color = texture2D(texture0, fragTexCoord).rgb; vec3 colors[3]; colors[0] = vec3(0.0, 0.0, 1.0); colors[1] = vec3(1.0, 1.0, 0.0); colors[2] = vec3(1.0, 0.0, 0.0); - + float lum = (color.r + color.g + color.b)/3.0; vec3 tc = vec3(0.0, 0.0, 0.0); - + if (lum < 0.5) tc = mix(colors[0], colors[1], lum/0.5); else tc = mix(colors[1], colors[2], (lum - 0.5)/0.5); diff --git a/examples/shaders/resources/shaders/glsl120/scanlines.fs b/examples/shaders/resources/shaders/glsl120/scanlines.fs index 929c79eba..520daa584 100644 --- a/examples/shaders/resources/shaders/glsl120/scanlines.fs +++ b/examples/shaders/resources/shaders/glsl120/scanlines.fs @@ -35,7 +35,7 @@ void main() // Scanlines method 2 float globalPos = (fragTexCoord.y + offset) * frequency; float wavePos = cos((fract(globalPos) - 0.5)*3.14); - + vec4 color = texture2D(texture0, fragTexCoord); gl_FragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos); diff --git a/examples/shaders/resources/shaders/glsl120/sobel.fs b/examples/shaders/resources/shaders/glsl120/sobel.fs index 73e72703a..8c74a6ade 100644 --- a/examples/shaders/resources/shaders/glsl120/sobel.fs +++ b/examples/shaders/resources/shaders/glsl120/sobel.fs @@ -11,11 +11,11 @@ uniform vec4 colDiffuse; // NOTE: Add here your custom variables vec2 resolution = vec2(800.0, 450.0); -void main() +void main() { float x = 1.0/resolution.x; float y = 1.0/resolution.y; - + vec4 horizEdge = vec4(0.0); horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0; @@ -23,7 +23,7 @@ void main() horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0; horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; - + vec4 vertEdge = vec4(0.0); vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0; @@ -31,8 +31,8 @@ void main() vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0; vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; - + vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb)); - + gl_FragColor = vec4(edge, texture2D(texture0, fragTexCoord).a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl120/swirl.fs b/examples/shaders/resources/shaders/glsl120/swirl.fs index 0618e013f..7b3dd2f9d 100644 --- a/examples/shaders/resources/shaders/glsl120/swirl.fs +++ b/examples/shaders/resources/shaders/glsl120/swirl.fs @@ -24,16 +24,16 @@ void main() vec2 texSize = vec2(renderWidth, renderHeight); vec2 tc = fragTexCoord*texSize; tc -= center; - + float dist = length(tc); - if (dist < radius) + if (dist < radius) { float percent = (radius - dist)/radius; float theta = percent*percent*angle*8.0; float s = sin(theta); float c = cos(theta); - + tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); } diff --git a/examples/shaders/resources/shaders/glsl330/base.fs b/examples/shaders/resources/shaders/glsl330/base.fs index f1418df18..6b5006224 100644 --- a/examples/shaders/resources/shaders/glsl330/base.fs +++ b/examples/shaders/resources/shaders/glsl330/base.fs @@ -17,9 +17,9 @@ void main() { // Texel color fetching from texture sampler vec4 texelColor = texture(texture0, fragTexCoord); - + // NOTE: Implement here your fragment shader code - + finalColor = texelColor*colDiffuse; } diff --git a/examples/shaders/resources/shaders/glsl330/base.vs b/examples/shaders/resources/shaders/glsl330/base.vs index f3099e826..8cc2abb27 100644 --- a/examples/shaders/resources/shaders/glsl330/base.vs +++ b/examples/shaders/resources/shaders/glsl330/base.vs @@ -13,14 +13,14 @@ uniform mat4 mvp; out vec2 fragTexCoord; out vec4 fragColor; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables void main() { // Send vertex attributes to fragment shader fragTexCoord = vertexTexCoord; fragColor = vertexColor; - + // Calculate final vertex position gl_Position = mvp*vec4(vertexPosition, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/base_lighting_instanced.vs b/examples/shaders/resources/shaders/glsl330/base_lighting_instanced.vs index d198efe1f..7f16dc62f 100644 --- a/examples/shaders/resources/shaders/glsl330/base_lighting_instanced.vs +++ b/examples/shaders/resources/shaders/glsl330/base_lighting_instanced.vs @@ -24,7 +24,7 @@ void main() { // Compute MVP for current instance mat4 mvpi = mvp*instanceTransform; - + // Send vertex attributes to fragment shader fragPosition = vec3(mvpi*vec4(vertexPosition, 1.0)); fragTexCoord = vertexTexCoord; diff --git a/examples/shaders/resources/shaders/glsl330/bloom.fs b/examples/shaders/resources/shaders/glsl330/bloom.fs index 549cde8f8..56eadb502 100644 --- a/examples/shaders/resources/shaders/glsl330/bloom.fs +++ b/examples/shaders/resources/shaders/glsl330/bloom.fs @@ -13,9 +13,9 @@ out vec4 finalColor; // NOTE: Add here your custom variables -const vec2 size = vec2(800, 450); // render size -const float samples = 5.0; // pixels per axis; higher = bigger glow, worse performance -const float quality = 2.5; // lower = smaller glow, better quality +const vec2 size = vec2(800, 450); // Framebuffer size +const float samples = 5.0; // Pixels per axis; higher = bigger glow, worse performance +const float quality = 2.5; // Defines size factor: Lower = smaller glow, better quality void main() { diff --git a/examples/shaders/resources/shaders/glsl330/blur.fs b/examples/shaders/resources/shaders/glsl330/blur.fs index e4df406d7..8809f7118 100644 --- a/examples/shaders/resources/shaders/glsl330/blur.fs +++ b/examples/shaders/resources/shaders/glsl330/blur.fs @@ -24,8 +24,8 @@ void main() { // Texel color fetching from texture sampler vec3 texelColor = texture(texture0, fragTexCoord).rgb*weight[0]; - - for (int i = 1; i < 3; i++) + + for (int i = 1; i < 3; i++) { texelColor += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; texelColor += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; diff --git a/examples/shaders/resources/shaders/glsl330/color_mix.fs b/examples/shaders/resources/shaders/glsl330/color_mix.fs index 761b3464a..e794d32fd 100644 --- a/examples/shaders/resources/shaders/glsl330/color_mix.fs +++ b/examples/shaders/resources/shaders/glsl330/color_mix.fs @@ -22,6 +22,6 @@ void main() float x = fract(fragTexCoord.s); float final = smoothstep(divider - 0.1, divider + 0.1, x); - + finalColor = mix(texelColor0, texelColor1, final); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/cross_hatching.fs b/examples/shaders/resources/shaders/glsl330/cross_hatching.fs index f95ad0755..276eabd83 100644 --- a/examples/shaders/resources/shaders/glsl330/cross_hatching.fs +++ b/examples/shaders/resources/shaders/glsl330/cross_hatching.fs @@ -24,22 +24,22 @@ void main() vec3 tc = vec3(1.0, 1.0, 1.0); float lum = length(texture(texture0, fragTexCoord).rgb); - if (lum < lumThreshold01) + if (lum < lumThreshold01) { if (mod(gl_FragCoord.x + gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); } - if (lum < lumThreshold02) + if (lum < lumThreshold02) { if (mod(gl_FragCoord.x - gl_FragCoord.y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); } - if (lum < lumThreshold03) + if (lum < lumThreshold03) { if (mod(gl_FragCoord.x + gl_FragCoord.y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); } - if (lum < lumThreshold04) + if (lum < lumThreshold04) { if (mod(gl_FragCoord.x - gl_FragCoord.y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); } diff --git a/examples/shaders/resources/shaders/glsl330/cross_stitching.fs b/examples/shaders/resources/shaders/glsl330/cross_stitching.fs index 9cdd36cad..02be86182 100644 --- a/examples/shaders/resources/shaders/glsl330/cross_stitching.fs +++ b/examples/shaders/resources/shaders/glsl330/cross_stitching.fs @@ -47,7 +47,7 @@ vec4 PostFX(sampler2D tex, vec2 uv) if (invert == 1) c = texture(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; else c = vec4(0.0, 0.0, 0.0, 1.0); } - + return c; } diff --git a/examples/shaders/resources/shaders/glsl330/cubes_panning.fs b/examples/shaders/resources/shaders/glsl330/cubes_panning.fs index c92418a48..1d75e4e8c 100644 --- a/examples/shaders/resources/shaders/glsl330/cubes_panning.fs +++ b/examples/shaders/resources/shaders/glsl330/cubes_panning.fs @@ -18,21 +18,21 @@ vec2 VectorRotateTime(vec2 v, float speed) { float time = uTime*speed; float localTime = fract(time); // The time domain this works on is 1 sec. - + if ((localTime >= 0.0) && (localTime < 0.25)) angle = 0.0; else if ((localTime >= 0.25) && (localTime < 0.50)) angle = PI/4*sin(2*PI*localTime - PI/2); else if ((localTime >= 0.50) && (localTime < 0.75)) angle = PI*0.25; else if ((localTime >= 0.75) && (localTime < 1.00)) angle = PI/4*sin(2*PI*localTime); - + // Rotate vector by angle v -= 0.5; v = mat2(cos(angle), -sin(angle), sin(angle), cos(angle))*v; v += 0.5; - + return v; } -float Rectangle(in vec2 st, in float size, in float fill) +float Rectangle(in vec2 st, in float size, in float fill) { float roundSize = 0.5 - size/2.0; float left = step(roundSize, st.x); @@ -44,7 +44,7 @@ float Rectangle(in vec2 st, in float size, in float fill) } void main() -{ +{ vec2 fragPos = fragTexCoord; fragPos.xy += uTime/9.0; @@ -53,7 +53,7 @@ void main() vec2 fpos = fract(fragPos); // Get the fractional coords fpos = VectorRotateTime(fpos, 0.2); - + float alpha = Rectangle(fpos, 0.216, 1.0); vec3 color = vec3(0.3, 0.3, 0.3); diff --git a/examples/shaders/resources/shaders/glsl330/depth.fs b/examples/shaders/resources/shaders/glsl330/depth.fs index 2422f3906..f7546bbb8 100644 --- a/examples/shaders/resources/shaders/glsl330/depth.fs +++ b/examples/shaders/resources/shaders/glsl330/depth.fs @@ -21,7 +21,7 @@ void main() // Linearize depth value float depth = (2.0*zNear)/(zFar + zNear - z*(zFar - zNear)); - + // Calculate final fragment color finalColor = vec4(depth, depth, depth, 1.0f); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/distortion.fs b/examples/shaders/resources/shaders/glsl330/distortion.fs index cb4be8fc3..43d540db9 100644 --- a/examples/shaders/resources/shaders/glsl330/distortion.fs +++ b/examples/shaders/resources/shaders/glsl330/distortion.fs @@ -24,13 +24,13 @@ void main() // The following two variables need to be set per eye vec2 LensCenter = fragTexCoord.x < 0.5 ? LeftLensCenter : RightLensCenter; vec2 ScreenCenter = fragTexCoord.x < 0.5 ? LeftScreenCenter : RightScreenCenter; - + // Scales input texture coordinates for distortion: vec2 HmdWarp(vec2 fragTexCoord, vec2 LensCenter) vec2 theta = (fragTexCoord - LensCenter)*ScaleIn; // Scales to [-1, 1] float rSq = theta.x*theta.x + theta.y*theta.y; vec2 theta1 = theta*(HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z*rSq*rSq + HmdWarpParam.w*rSq*rSq*rSq); //vec2 tc = LensCenter + Scale*theta1; - + // Detect whether blue texture coordinates are out of range since these will scaled out the furthest vec2 thetaBlue = theta1*(ChromaAbParam.z + ChromaAbParam.w*rSq); vec2 tcBlue = LensCenter + Scale*thetaBlue; diff --git a/examples/shaders/resources/shaders/glsl330/eratosthenes.fs b/examples/shaders/resources/shaders/glsl330/eratosthenes.fs index 14711222b..644e38d8c 100644 --- a/examples/shaders/resources/shaders/glsl330/eratosthenes.fs +++ b/examples/shaders/resources/shaders/glsl330/eratosthenes.fs @@ -9,7 +9,7 @@ Each integer is tested to see if it is a prime number. Primes are colored white. Non-primes are colored with a color that indicates the smallest factor which evenly divdes our integer. - You can change the scale variable to make a larger or smaller grid. + You can change the scale variable to make a larger or smaller grid. Total number of integers displayed = scale squared, so scale = 100 tests the first 10,000 integers. WARNING: If you make scale too large, your GPU may bog down! @@ -28,11 +28,11 @@ vec4 Colorizer(float counter, float maxSize) { float red = 0.0, green = 0.0, blue = 0.0; float normsize = counter/maxSize; - + red = smoothstep(0.3, 0.7, normsize); green = sin(3.14159*normsize); blue = 1.0 - smoothstep(0.0, 0.4, normsize); - + return vec4(0.8*red, 0.8*green, 0.8*blue, 1.0); } @@ -45,7 +45,7 @@ void main() if ((value == 0) || (value == 1) || (value == 2)) finalColor = vec4(1.0); else { - for (int i = 2; (i < max(2, sqrt(value) + 1)); i++) + for (int i = 2; (i < max(2, sqrt(value) + 1)); i++) { if ((value - i*floor(float(value)/float(i))) == 0) { diff --git a/examples/shaders/resources/shaders/glsl330/fisheye.fs b/examples/shaders/resources/shaders/glsl330/fisheye.fs index e85d7c9da..bb03a6156 100644 --- a/examples/shaders/resources/shaders/glsl330/fisheye.fs +++ b/examples/shaders/resources/shaders/glsl330/fisheye.fs @@ -7,7 +7,7 @@ out vec4 fragColor; uniform sampler2D texture0; uniform vec4 colDiffuse; -// NOTE: Add here your custom variables +// NOTE: Add here your custom variables const float PI = 3.1415926535; diff --git a/examples/shaders/resources/shaders/glsl330/fog.fs b/examples/shaders/resources/shaders/glsl330/fog.fs index 2160f31bb..445cca317 100644 --- a/examples/shaders/resources/shaders/glsl330/fog.fs +++ b/examples/shaders/resources/shaders/glsl330/fog.fs @@ -55,7 +55,7 @@ void main() if (lights[i].enabled == 1) { vec3 light = vec3(0.0); - + if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position); if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition); @@ -70,10 +70,10 @@ void main() finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0))); finalColor += texelColor*(ambient/10.0); - + // Gamma correction finalColor = pow(finalColor, vec4(1.0/2.2)); - + // Fog calculation float dist = length(viewPos - fragPosition); diff --git a/examples/shaders/resources/shaders/glsl330/grayscale.fs b/examples/shaders/resources/shaders/glsl330/grayscale.fs index 5b3e11be6..dead6ec5a 100644 --- a/examples/shaders/resources/shaders/glsl330/grayscale.fs +++ b/examples/shaders/resources/shaders/glsl330/grayscale.fs @@ -17,10 +17,10 @@ void main() { // Texel color fetching from texture sampler vec4 texelColor = texture(texture0, fragTexCoord)*colDiffuse*fragColor; - + // Convert texel color to grayscale using NTSC conversion weights float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); - + // Calculate final fragment color finalColor = vec4(gray, gray, gray, texelColor.a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/julia_set.fs b/examples/shaders/resources/shaders/glsl330/julia_set.fs index f68367ea6..c5ee0da60 100644 --- a/examples/shaders/resources/shaders/glsl330/julia_set.fs +++ b/examples/shaders/resources/shaders/glsl330/julia_set.fs @@ -51,7 +51,7 @@ void main() We use dot product (z.x * z.x + z.y * z.y) to determine the magnitude (length) squared. And once the magnitude squared is > 4, then magnitude > 2 is also true (saves computational power). *************************************************************************************************/ - + // 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 + offset.x/screenDims.x)*2.5/zoom, (fragTexCoord.y + offset.y/screenDims.y)*1.5/zoom); @@ -60,18 +60,18 @@ void main() for (iterations = 0; iterations < MAX_ITERATIONS; iterations++) { z = ComplexSquare(z) + c; // Iterate function - + if (dot(z, z) > 4.0) break; } - + // Another few iterations decreases errors in the smoothing calculation. // See http://linas.org/art-gallery/escape/escape.html for more information. z = ComplexSquare(z) + c; z = ComplexSquare(z) + c; - + // This last part smooths the color (again see link above). float smoothVal = float(iterations) + 1.0 - (log(log(length(z)))/log(2.0)); - + // Normalize the value so it is between 0 and 1. float norm = smoothVal/float(MAX_ITERATIONS); diff --git a/examples/shaders/resources/shaders/glsl330/lighting.fs b/examples/shaders/resources/shaders/glsl330/lighting.fs index 6877c1c74..93be20edd 100644 --- a/examples/shaders/resources/shaders/glsl330/lighting.fs +++ b/examples/shaders/resources/shaders/glsl330/lighting.fs @@ -54,17 +54,17 @@ void main() if (lights[i].enabled == 1) { vec3 light = vec3(0.0); - - if (lights[i].type == LIGHT_DIRECTIONAL) + + if (lights[i].type == LIGHT_DIRECTIONAL) { light = -normalize(lights[i].target - lights[i].position); } - - if (lights[i].type == LIGHT_POINT) + + if (lights[i].type == LIGHT_POINT) { light = normalize(lights[i].position - fragPosition); } - + float NdotL = max(dot(normal, light), 0.0); lightDot += lights[i].color.rgb*NdotL; @@ -76,7 +76,7 @@ void main() finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0))); finalColor += texelColor*(ambient/10.0)*colDiffuse; - + // Gamma correction finalColor = pow(finalColor, vec4(1.0/2.2)); } diff --git a/examples/shaders/resources/shaders/glsl330/outline.fs b/examples/shaders/resources/shaders/glsl330/outline.fs index 804a1a597..2584a21c0 100644 --- a/examples/shaders/resources/shaders/glsl330/outline.fs +++ b/examples/shaders/resources/shaders/glsl330/outline.fs @@ -17,19 +17,19 @@ out vec4 finalColor; void main() { - vec4 texel = texture(texture0, fragTexCoord); // Get texel color - vec2 texelScale = vec2(0.0); + vec4 texel = texture(texture0, fragTexCoord); // Get texel color + vec2 texelScale = vec2(0.0); texelScale.x = outlineSize/textureSize.x; texelScale.y = outlineSize/textureSize.y; - // We sample four corner texels, but only for the alpha channel (this is for the outline) - vec4 corners = vec4(0.0); - corners.x = texture(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a; - corners.y = texture(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a; - corners.z = texture(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a; - corners.w = texture(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a; - - float outline = min(dot(corners, vec4(1.0)), 1.0); - vec4 color = mix(vec4(0.0), outlineColor, outline); - finalColor = mix(color, texel, texel.a); + // We sample four corner texels, but only for the alpha channel (this is for the outline) + vec4 corners = vec4(0.0); + corners.x = texture(texture0, fragTexCoord + vec2(texelScale.x, texelScale.y)).a; + corners.y = texture(texture0, fragTexCoord + vec2(texelScale.x, -texelScale.y)).a; + corners.z = texture(texture0, fragTexCoord + vec2(-texelScale.x, texelScale.y)).a; + corners.w = texture(texture0, fragTexCoord + vec2(-texelScale.x, -texelScale.y)).a; + + float outline = min(dot(corners, vec4(1.0)), 1.0); + vec4 color = mix(vec4(0.0), outlineColor, outline); + finalColor = mix(color, texel, texel.a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/overdraw.fs b/examples/shaders/resources/shaders/glsl330/overdraw.fs index 435217c37..d1a4b6aa5 100644 --- a/examples/shaders/resources/shaders/glsl330/overdraw.fs +++ b/examples/shaders/resources/shaders/glsl330/overdraw.fs @@ -15,12 +15,12 @@ out vec4 finalColor; void main() { - // To show overdraw, we just render all the fragments + // To show overdraw, we just render all the fragments // with a solid color and some transparency - - // NOTE: This is not a postpro render, + + // NOTE: This is not a postpro render, // it will only render all screen texture in a plain color - + finalColor = vec4(1.0, 0.0, 0.0, 0.2); } diff --git a/examples/shaders/resources/shaders/glsl330/posterization.fs b/examples/shaders/resources/shaders/glsl330/posterization.fs index be2b5dd65..cf8458525 100644 --- a/examples/shaders/resources/shaders/glsl330/posterization.fs +++ b/examples/shaders/resources/shaders/glsl330/posterization.fs @@ -20,12 +20,12 @@ void main() { // Texel color fetching from texture sampler vec3 texelColor = texture(texture0, fragTexCoord.xy).rgb; - + texelColor = pow(texelColor, vec3(gamma, gamma, gamma)); texelColor = texelColor*numColors; texelColor = floor(texelColor); texelColor = texelColor/numColors; texelColor = pow(texelColor, vec3(1.0/gamma)); - + finalColor = vec4(texelColor, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/predator.fs b/examples/shaders/resources/shaders/glsl330/predator.fs index 6a55c7626..c0db7b37c 100644 --- a/examples/shaders/resources/shaders/glsl330/predator.fs +++ b/examples/shaders/resources/shaders/glsl330/predator.fs @@ -21,12 +21,12 @@ void main() colors[0] = vec3(0.0, 0.0, 1.0); colors[1] = vec3(1.0, 1.0, 0.0); colors[2] = vec3(1.0, 0.0, 0.0); - + float lum = (texelColor.r + texelColor.g + texelColor.b)/3.0; - + int ix = (lum < 0.5)? 0:1; - + vec3 tc = mix(colors[ix], colors[ix + 1], (lum - float(ix)*0.5)/0.5); - + finalColor = vec4(tc, 1.0); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/raymarching.fs b/examples/shaders/resources/shaders/glsl330/raymarching.fs index 5b0caa652..6a9eb4516 100644 --- a/examples/shaders/resources/shaders/glsl330/raymarching.fs +++ b/examples/shaders/resources/shaders/glsl330/raymarching.fs @@ -8,7 +8,7 @@ in vec4 fragColor; out vec4 finalColor; uniform vec3 viewEye; -uniform vec3 viewCenter; +uniform vec3 viewCenter; uniform float runTime; uniform vec2 resolution; @@ -32,7 +32,7 @@ uniform vec2 resolution; // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. -// A list of useful distance function to simple primitives, and an example on how to +// A list of useful distance function to simple primitives, and an example on how to // do some interesting boolean operations, repetition and displacement. // // More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm @@ -143,7 +143,7 @@ float sdPryamid4(vec3 p, vec3 h ) // h = { cos a, sin a, height } { // Tetrahedron = Octahedron - Cube float box = sdBox( p - vec3(0,-2.0*h.z,0), vec3(2.0*h.z) ); - + float d = 0.0; d = max( d, abs( dot(p, vec3( -h.x, h.y, 0 )) )); d = max( d, abs( dot(p, vec3( h.x, h.y, 0 )) )); @@ -238,7 +238,7 @@ vec2 map( in vec3 pos ) res = opU( res, vec2( 0.5*sdTorus( opTwist(pos-vec3(-2.0,0.25, 2.0)),vec2(0.20,0.05)), 46.7 ) ); res = opU( res, vec2( sdConeSection( pos-vec3( 0.0,0.35,-2.0), 0.15, 0.2, 0.1 ), 13.67 ) ); res = opU( res, vec2( sdEllipsoid( pos-vec3( 1.0,0.35,-2.0), vec3(0.15, 0.2, 0.05) ), 43.17 ) ); - + return res; } @@ -246,14 +246,14 @@ vec2 castRay( in vec3 ro, in vec3 rd ) { float tmin = 0.2; float tmax = 30.0; - + #if 1 // bounding volume float tp1 = (0.0-ro.y)/rd.y; if( tp1>0.0 ) tmax = min( tmax, tp1 ); float tp2 = (1.6-ro.y)/rd.y; if( tp2>0.0 ) { if( ro.y>1.6 ) tmin = max( tmin, tp2 ); else tmax = min( tmax, tp2 ); } #endif - + float t = tmin; float m = -1.0; for( int i=0; i<64; i++ ) @@ -287,9 +287,9 @@ float calcSoftshadow( in vec3 ro, in vec3 rd, in float mint, in float tmax ) vec3 calcNormal( in vec3 pos ) { vec2 e = vec2(1.0,-1.0)*0.5773*0.0005; - return normalize( e.xyy*map( pos + e.xyy ).x + - e.yyx*map( pos + e.yyx ).x + - e.yxy*map( pos + e.yxy ).x + + return normalize( e.xyy*map( pos + e.xyy ).x + + e.yyx*map( pos + e.yyx ).x + + e.yxy*map( pos + e.yxy ).x + e.xxx*map( pos + e.xxx ).x ); /* vec3 eps = vec3( 0.0005, 0.0, 0.0 ); @@ -313,7 +313,7 @@ float calcAO( in vec3 pos, in vec3 nor ) occ += -(dd-hr)*sca; sca *= 0.95; } - return clamp( 1.0 - 3.0*occ, 0.0, 1.0 ); + return clamp( 1.0 - 3.0*occ, 0.0, 1.0 ); } // http://iquilezles.org/www/articles/checkerfiltering/checkerfiltering.htm @@ -324,11 +324,11 @@ float checkersGradBox( in vec2 p ) // analytical integral (box filter) vec2 i = 2.0*(abs(fract((p-0.5*w)*0.5)-0.5)-abs(fract((p+0.5*w)*0.5)-0.5))/w; // xor pattern - return 0.5 - 0.5*i.x*i.y; + return 0.5 - 0.5*i.x*i.y; } vec3 render( in vec3 ro, in vec3 rd ) -{ +{ vec3 col = vec3(0.7, 0.9, 1.0) +rd.y*0.8; vec2 res = castRay(ro,rd); float t = res.x; @@ -338,17 +338,17 @@ vec3 render( in vec3 ro, in vec3 rd ) vec3 pos = ro + t*rd; vec3 nor = calcNormal( pos ); vec3 ref = reflect( rd, nor ); - - // material + + // material col = 0.45 + 0.35*sin( vec3(0.05,0.08,0.10)*(m-1.0) ); if( m<1.5 ) { - + float f = checkersGradBox( 5.0*pos.xz ); col = 0.3 + f*vec3(0.1); } - // lighting + // lighting float occ = calcAO( pos, nor ); vec3 lig = normalize( vec3(cos(-0.4 * runTime), sin(0.7 * runTime), -0.6) ); vec3 hal = normalize( lig-rd ); @@ -357,7 +357,7 @@ vec3 render( in vec3 ro, in vec3 rd ) float bac = clamp( dot( nor, normalize(vec3(-lig.x,0.0,-lig.z))), 0.0, 1.0 )*clamp( 1.0-pos.y,0.0,1.0); float dom = smoothstep( -0.1, 0.1, ref.y ); float fre = pow( clamp(1.0+dot(nor,rd),0.0,1.0), 2.0 ); - + dif *= calcSoftshadow( pos, lig, 0.02, 2.5 ); dom *= calcSoftshadow( pos, ref, 0.02, 2.5 ); @@ -399,22 +399,22 @@ void main() // pixel coordinates vec2 o = vec2(float(m),float(n)) / float(AA) - 0.5; vec2 p = (-resolution.xy + 2.0*(gl_FragCoord.xy+o))/resolution.y; -#else +#else vec2 p = (-resolution.xy + 2.0*gl_FragCoord.xy)/resolution.y; #endif // RAY: Camera is provided from raylib //vec3 ro = vec3( -0.5+3.5*cos(0.1*time + 6.0*mo.x), 1.0 + 2.0*mo.y, 0.5 + 4.0*sin(0.1*time + 6.0*mo.x) ); - + vec3 ro = viewEye; vec3 ta = viewCenter; - + // camera-to-world transformation mat3 ca = setCamera( ro, ta, 0.0 ); // ray direction vec3 rd = ca * normalize( vec3(p.xy,2.0) ); - // render + // render vec3 col = render( ro, rd ); // gamma diff --git a/examples/shaders/resources/shaders/glsl330/reload.fs b/examples/shaders/resources/shaders/glsl330/reload.fs index 21ce18e02..59fdcbae1 100644 --- a/examples/shaders/resources/shaders/glsl330/reload.fs +++ b/examples/shaders/resources/shaders/glsl330/reload.fs @@ -34,7 +34,7 @@ void main() // Draw circle layer vec3 color = vec3(0.9, 0.16, 0.21); vec4 layer2 = DrawCircle(fragCoord, position, radius, color); - + // Blend the two layers finalColor = mix(layer1, layer2, layer2.a); } diff --git a/examples/shaders/resources/shaders/glsl330/scanlines.fs b/examples/shaders/resources/shaders/glsl330/scanlines.fs index 22dc9cd53..2c4c6fdfc 100644 --- a/examples/shaders/resources/shaders/glsl330/scanlines.fs +++ b/examples/shaders/resources/shaders/glsl330/scanlines.fs @@ -41,7 +41,7 @@ void main() // Scanlines method 2 float globalPos = (fragTexCoord.y + offset) * frequency; float wavePos = cos((fract(globalPos) - 0.5)*3.14); - + // Texel color fetching from texture sampler vec4 texelColor = texture(texture0, fragTexCoord); diff --git a/examples/shaders/resources/shaders/glsl330/sobel.fs b/examples/shaders/resources/shaders/glsl330/sobel.fs index f317ae328..f76e9cab9 100644 --- a/examples/shaders/resources/shaders/glsl330/sobel.fs +++ b/examples/shaders/resources/shaders/glsl330/sobel.fs @@ -14,11 +14,11 @@ out vec4 finalColor; // NOTE: Add here your custom variables uniform vec2 resolution = vec2(800, 450); -void main() +void main() { float x = 1.0/resolution.x; float y = 1.0/resolution.y; - + vec4 horizEdge = vec4(0.0); horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; horizEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y ))*2.0; @@ -26,7 +26,7 @@ void main() horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y - y))*1.0; horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y ))*2.0; horizEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; - + vec4 vertEdge = vec4(0.0); vertEdge -= texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y - y))*1.0; vertEdge -= texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y - y))*2.0; @@ -34,8 +34,8 @@ void main() vertEdge += texture2D(texture0, vec2(fragTexCoord.x - x, fragTexCoord.y + y))*1.0; vertEdge += texture2D(texture0, vec2(fragTexCoord.x , fragTexCoord.y + y))*2.0; vertEdge += texture2D(texture0, vec2(fragTexCoord.x + x, fragTexCoord.y + y))*1.0; - + vec3 edge = sqrt((horizEdge.rgb*horizEdge.rgb) + (vertEdge.rgb*vertEdge.rgb)); - + finalColor = vec4(edge, texture2D(texture0, fragTexCoord).a); } \ No newline at end of file diff --git a/examples/shaders/resources/shaders/glsl330/spotlight.fs b/examples/shaders/resources/shaders/glsl330/spotlight.fs index c573be8f3..02cddf42c 100644 --- a/examples/shaders/resources/shaders/glsl330/spotlight.fs +++ b/examples/shaders/resources/shaders/glsl330/spotlight.fs @@ -23,10 +23,10 @@ uniform float screenWidth; // Width of the screen void main() { float alpha = 1.0; - + // Get the position of the current fragment (screen coordinates!) vec2 pos = vec2(gl_FragCoord.x, gl_FragCoord.y); - + // Find out which spotlight is nearest float d = 65000; // some high value int fi = -1; // found index @@ -36,15 +36,15 @@ void main() for (int j = 0; j < MAX_SPOTS; j++) { float dj = distance(pos, spots[j].pos) - spots[j].radius + spots[i].radius; - - if (d > dj) + + if (d > dj) { d = dj; fi = i; } } } - + // d now equals distance to nearest spot... // allowing for the different radii of all spotlights if (fi != -1) @@ -56,8 +56,8 @@ void main() else alpha = (d - spots[fi].inner) / (spots[fi].radius - spots[fi].inner); } } - - // Right hand side of screen is dimly lit, + + // Right hand side of screen is dimly lit, // could make the threshold value user definable if ((pos.x > screenWidth/2.0) && (alpha > 0.9)) alpha = 0.9; diff --git a/examples/shaders/resources/shaders/glsl330/swirl.fs b/examples/shaders/resources/shaders/glsl330/swirl.fs index 4741e597e..bb0732c55 100644 --- a/examples/shaders/resources/shaders/glsl330/swirl.fs +++ b/examples/shaders/resources/shaders/glsl330/swirl.fs @@ -27,16 +27,16 @@ void main() vec2 texSize = vec2(renderWidth, renderHeight); vec2 tc = fragTexCoord*texSize; tc -= center; - + float dist = length(tc); - if (dist < radius) + if (dist < radius) { float percent = (radius - dist)/radius; float theta = percent*percent*angle*8.0; float s = sin(theta); float c = cos(theta); - + tc = vec2(dot(tc, vec2(c, -s)), dot(tc, vec2(s, c))); } diff --git a/examples/text/resources/shaders/glsl100/alpha_discard.fs b/examples/text/resources/shaders/glsl100/alpha_discard.fs index a6b1e20cf..15aacf5f0 100644 --- a/examples/text/resources/shaders/glsl100/alpha_discard.fs +++ b/examples/text/resources/shaders/glsl100/alpha_discard.fs @@ -13,8 +13,8 @@ uniform vec4 colDiffuse; void main() { vec4 texelColor = texture2D(texture0, fragTexCoord); - + if (texelColor.a == 0.0) discard; - + gl_FragColor = texelColor*fragColor*colDiffuse; } diff --git a/examples/text/resources/shaders/glsl100/sdf.fs b/examples/text/resources/shaders/glsl100/sdf.fs index 31323d96b..d4878cf4e 100644 --- a/examples/text/resources/shaders/glsl100/sdf.fs +++ b/examples/text/resources/shaders/glsl100/sdf.fs @@ -19,7 +19,7 @@ void main() // NOTE: Calculate alpha using signed distance field (SDF) float distance = texture2D(texture0, fragTexCoord).a; float alpha = smoothstep(0.5 - smoothing, 0.5 + smoothing, distance); - + // Calculate final fragment color gl_FragColor = vec4(fragColor.rgb, fragColor.a*alpha); } diff --git a/examples/text/resources/shaders/glsl330/sdf.fs b/examples/text/resources/shaders/glsl330/sdf.fs index 45e1cabea..545f45073 100644 --- a/examples/text/resources/shaders/glsl330/sdf.fs +++ b/examples/text/resources/shaders/glsl330/sdf.fs @@ -20,7 +20,7 @@ void main() float distanceFromOutline = texture(texture0, fragTexCoord).a - 0.5; float distanceChangePerFragment = length(vec2(dFdx(distanceFromOutline), dFdy(distanceFromOutline))); float alpha = smoothstep(-distanceChangePerFragment, distanceChangePerFragment, distanceFromOutline); - + // Calculate final fragment color finalColor = vec4(fragColor.rgb, fragColor.a*alpha); } diff --git a/src/rlgl.h b/src/rlgl.h index cd486a266..0d8258c13 100644 --- a/src/rlgl.h +++ b/src/rlgl.h @@ -1808,10 +1808,10 @@ static void GLAPIENTRY rlDebugMessageCallback(GLenum source, GLenum type, GLuint // Ignore non-significant error/warning codes (NVidia drivers) // NOTE: Here there are the details with a sample output: // - #131169 - Framebuffer detailed info: The driver allocated storage for renderbuffer 2. (severity: low) - // - #131185 - Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_ENUM_88e4) + // - #131185 - Buffer detailed info: Buffer object 1 (bound to GL_ELEMENT_ARRAY_BUFFER_ARB, usage hint is GL_ENUM_88e4) // will use VIDEO memory as the source for buffer object operations. (severity: low) // - #131218 - Program/shader state performance warning: Vertex shader in program 7 is being recompiled based on GL state. (severity: medium) - // - #131204 - Texture state usage warning: The texture object (0) bound to texture image unit 0 does not have + // - #131204 - Texture state usage warning: The texture object (0) bound to texture image unit 0 does not have // a defined base level and cannot be used for texture mapping. (severity: low) if ((id == 131169) || (id == 131185) || (id == 131218) || (id == 131204)) return; @@ -2404,7 +2404,7 @@ void rlUnloadRenderBatch(rlRenderBatch batch) for (int i = 0; i < batch.bufferCount; i++) { // Unbind VAO attribs data - if (RLGL.ExtSupported.vao) + if (RLGL.ExtSupported.vao) { glBindVertexArray(batch.vertexBuffer[i].vaoId); glDisableVertexAttribArray(0); @@ -2413,7 +2413,7 @@ void rlUnloadRenderBatch(rlRenderBatch batch) glDisableVertexAttribArray(3); glBindVertexArray(0); } - + // Delete VBOs from GPU (VRAM) glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[0]); glDeleteBuffers(1, &batch.vertexBuffer[i].vboId[1]);