2
0
raysan5 4 жил өмнө
parent
commit
fec0ce34c5
80 өөрчлөгдсөн 310 нэмэгдсэн , 311 устгасан
  1. 1 1
      examples/models/resources/shaders/glsl100/cubemap.fs
  2. 2 2
      examples/models/resources/shaders/glsl100/skybox.fs
  3. 1 1
      examples/models/resources/shaders/glsl330/cubemap.fs
  4. 1 1
      examples/models/resources/shaders/glsl330/skybox.fs
  5. 3 3
      examples/others/resources/shaders/glsl100/point_particle.vs
  6. 3 3
      examples/others/resources/shaders/glsl330/point_particle.vs
  7. 2 2
      examples/shaders/resources/shaders/glsl100/base.fs
  8. 2 2
      examples/shaders/resources/shaders/glsl100/base.vs
  9. 4 4
      examples/shaders/resources/shaders/glsl100/blur.fs
  10. 2 2
      examples/shaders/resources/shaders/glsl100/color_mix.fs
  11. 8 8
      examples/shaders/resources/shaders/glsl100/cross_hatching.fs
  12. 4 4
      examples/shaders/resources/shaders/glsl100/cross_stitching.fs
  13. 6 6
      examples/shaders/resources/shaders/glsl100/cubes_panning.fs
  14. 1 1
      examples/shaders/resources/shaders/glsl100/depth.fs
  15. 2 2
      examples/shaders/resources/shaders/glsl100/distortion.fs
  16. 4 4
      examples/shaders/resources/shaders/glsl100/eratosthenes.fs
  17. 1 1
      examples/shaders/resources/shaders/glsl100/fisheye.fs
  18. 3 3
      examples/shaders/resources/shaders/glsl100/fog.fs
  19. 2 2
      examples/shaders/resources/shaders/glsl100/grayscale.fs
  20. 3 3
      examples/shaders/resources/shaders/glsl100/julia_set.fs
  21. 6 6
      examples/shaders/resources/shaders/glsl100/lighting.fs
  22. 12 15
      examples/shaders/resources/shaders/glsl100/outline.fs
  23. 2 2
      examples/shaders/resources/shaders/glsl100/palette_switch.fs
  24. 5 5
      examples/shaders/resources/shaders/glsl100/pixelizer.fs
  25. 4 4
      examples/shaders/resources/shaders/glsl100/posterization.fs
  26. 3 3
      examples/shaders/resources/shaders/glsl100/predator.fs
  27. 23 21
      examples/shaders/resources/shaders/glsl100/raymarching.fs
  28. 14 14
      examples/shaders/resources/shaders/glsl100/reload.fs
  29. 1 1
      examples/shaders/resources/shaders/glsl100/scanlines.fs
  30. 5 5
      examples/shaders/resources/shaders/glsl100/sobel.fs
  31. 10 10
      examples/shaders/resources/shaders/glsl100/spotlight.fs
  32. 3 3
      examples/shaders/resources/shaders/glsl100/swirl.fs
  33. 2 2
      examples/shaders/resources/shaders/glsl120/base.fs
  34. 2 2
      examples/shaders/resources/shaders/glsl120/base.vs
  35. 1 1
      examples/shaders/resources/shaders/glsl120/base_lighting.vs
  36. 3 3
      examples/shaders/resources/shaders/glsl120/bloom.fs
  37. 4 4
      examples/shaders/resources/shaders/glsl120/blur.fs
  38. 8 8
      examples/shaders/resources/shaders/glsl120/cross_hatching.fs
  39. 4 4
      examples/shaders/resources/shaders/glsl120/cross_stitching.fs
  40. 2 2
      examples/shaders/resources/shaders/glsl120/distortion.fs
  41. 1 1
      examples/shaders/resources/shaders/glsl120/fisheye.fs
  42. 3 3
      examples/shaders/resources/shaders/glsl120/fog.fs
  43. 2 2
      examples/shaders/resources/shaders/glsl120/grayscale.fs
  44. 5 5
      examples/shaders/resources/shaders/glsl120/pixelizer.fs
  45. 4 4
      examples/shaders/resources/shaders/glsl120/posterization.fs
  46. 3 3
      examples/shaders/resources/shaders/glsl120/predator.fs
  47. 1 1
      examples/shaders/resources/shaders/glsl120/scanlines.fs
  48. 5 5
      examples/shaders/resources/shaders/glsl120/sobel.fs
  49. 3 3
      examples/shaders/resources/shaders/glsl120/swirl.fs
  50. 2 2
      examples/shaders/resources/shaders/glsl330/base.fs
  51. 2 2
      examples/shaders/resources/shaders/glsl330/base.vs
  52. 1 1
      examples/shaders/resources/shaders/glsl330/base_lighting_instanced.vs
  53. 3 3
      examples/shaders/resources/shaders/glsl330/bloom.fs
  54. 2 2
      examples/shaders/resources/shaders/glsl330/blur.fs
  55. 1 1
      examples/shaders/resources/shaders/glsl330/color_mix.fs
  56. 4 4
      examples/shaders/resources/shaders/glsl330/cross_hatching.fs
  57. 1 1
      examples/shaders/resources/shaders/glsl330/cross_stitching.fs
  58. 6 6
      examples/shaders/resources/shaders/glsl330/cubes_panning.fs
  59. 1 1
      examples/shaders/resources/shaders/glsl330/depth.fs
  60. 2 2
      examples/shaders/resources/shaders/glsl330/distortion.fs
  61. 4 4
      examples/shaders/resources/shaders/glsl330/eratosthenes.fs
  62. 1 1
      examples/shaders/resources/shaders/glsl330/fisheye.fs
  63. 3 3
      examples/shaders/resources/shaders/glsl330/fog.fs
  64. 2 2
      examples/shaders/resources/shaders/glsl330/grayscale.fs
  65. 5 5
      examples/shaders/resources/shaders/glsl330/julia_set.fs
  66. 6 6
      examples/shaders/resources/shaders/glsl330/lighting.fs
  67. 12 12
      examples/shaders/resources/shaders/glsl330/outline.fs
  68. 4 4
      examples/shaders/resources/shaders/glsl330/overdraw.fs
  69. 2 2
      examples/shaders/resources/shaders/glsl330/posterization.fs
  70. 4 4
      examples/shaders/resources/shaders/glsl330/predator.fs
  71. 21 21
      examples/shaders/resources/shaders/glsl330/raymarching.fs
  72. 1 1
      examples/shaders/resources/shaders/glsl330/reload.fs
  73. 1 1
      examples/shaders/resources/shaders/glsl330/scanlines.fs
  74. 5 5
      examples/shaders/resources/shaders/glsl330/sobel.fs
  75. 7 7
      examples/shaders/resources/shaders/glsl330/spotlight.fs
  76. 3 3
      examples/shaders/resources/shaders/glsl330/swirl.fs
  77. 2 2
      examples/text/resources/shaders/glsl100/alpha_discard.fs
  78. 1 1
      examples/text/resources/shaders/glsl100/sdf.fs
  79. 1 1
      examples/text/resources/shaders/glsl330/sdf.fs
  80. 4 4
      src/rlgl.h

+ 1 - 1
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

+ 2 - 2
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));

+ 1 - 1
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

+ 1 - 1
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));
     }

+ 3 - 3
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));
 }

+ 3 - 3
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));
 }

+ 2 - 2
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;
 }

+ 2 - 2
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);
 }

+ 4 - 4
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;
 

+ 2 - 2
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);
 }

+ 8 - 8
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);
     }

+ 4 - 4
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;
 }
 

+ 6 - 6
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);
 

+ 1 - 1
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);
 }

+ 2 - 2
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;

+ 4 - 4
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
     {

+ 1 - 1
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);

+ 3 - 3
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);
 

+ 2 - 2
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);
 }

+ 3 - 3
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);
 

+ 6 - 6
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));
 }

+ 12 - 15
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);
 }

+ 2 - 2
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];

+ 5 - 5
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);

+ 4 - 4
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);
 }

+ 3 - 3
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);
 

+ 23 - 21
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

+ 14 - 14
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)));
-
-	// 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);
+    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);
 }

+ 1 - 1
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);

+ 5 - 5
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);
 }

+ 10 - 10
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;
 

+ 3 - 3
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)));
     }
 

+ 2 - 2
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;
 }

+ 2 - 2
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);
 }

+ 1 - 1
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);
 

+ 3 - 3
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()
 {

+ 4 - 4
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;
 

+ 8 - 8
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);
     }

+ 4 - 4
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;
 }
 

+ 2 - 2
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;

+ 1 - 1
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);

+ 3 - 3
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);
 

+ 2 - 2
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);
 }

+ 5 - 5
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);

+ 4 - 4
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);
 }

+ 3 - 3
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);
 

+ 1 - 1
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);

+ 5 - 5
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);
 }

+ 3 - 3
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)));
     }
 

+ 2 - 2
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;
 }
 

+ 2 - 2
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);
 }

+ 1 - 1
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;

+ 3 - 3
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()
 {

+ 2 - 2
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];

+ 1 - 1
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);
 }

+ 4 - 4
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);
     }

+ 1 - 1
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;
 }
 

+ 6 - 6
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);
 

+ 1 - 1
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);
 }

+ 2 - 2
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;

+ 4 - 4
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)
             {

+ 1 - 1
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;
 

+ 3 - 3
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);
 

+ 2 - 2
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);
 }

+ 5 - 5
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);
 

+ 6 - 6
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));
 }

+ 12 - 12
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);
 }

+ 4 - 4
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);
 }
 

+ 2 - 2
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);
 }

+ 4 - 4
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);
 }

+ 21 - 21
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

+ 1 - 1
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);
 }

+ 1 - 1
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);
 

+ 5 - 5
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);
 }

+ 7 - 7
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;
 

+ 3 - 3
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)));
     }
 

+ 2 - 2
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;
 }

+ 1 - 1
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);
 }

+ 1 - 1
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);
 }

+ 4 - 4
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]);