diff options
Diffstat (limited to 'shaders/glsl100')
| -rw-r--r-- | shaders/glsl100/bloom.fs | 30 | ||||
| -rw-r--r-- | shaders/glsl100/blur.fs | 7 | ||||
| -rw-r--r-- | shaders/glsl100/cross_hatching.fs | 2 | ||||
| -rw-r--r-- | shaders/glsl100/cross_stitching.fs | 7 | ||||
| -rw-r--r-- | shaders/glsl100/dream_vision.fs | 2 | ||||
| -rw-r--r-- | shaders/glsl100/fisheye.fs | 2 | ||||
| -rw-r--r-- | shaders/glsl100/pixel.fs | 7 | ||||
| -rw-r--r-- | shaders/glsl100/posterization.fs | 2 | ||||
| -rw-r--r-- | shaders/glsl100/predator.fs | 2 | ||||
| -rw-r--r-- | shaders/glsl100/scanlines.fs | 2 | ||||
| -rw-r--r-- | shaders/glsl100/standard.fs | 13 | ||||
| -rw-r--r-- | shaders/glsl100/swirl.fs | 7 |
12 files changed, 42 insertions, 41 deletions
diff --git a/shaders/glsl100/bloom.fs b/shaders/glsl100/bloom.fs index 128736f2..a8e1d20f 100644 --- a/shaders/glsl100/bloom.fs +++ b/shaders/glsl100/bloom.fs @@ -8,30 +8,32 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +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 + void main() { vec4 sum = vec4(0); - vec4 tc = vec4(0); + vec2 sizeFactor = vec2(1)/size*quality; + + // Texel color fetching from texture sampler + vec4 source = texture2D(texture0, fragTexCoord); - for (int i = -4; i < 4; i++) + const int range = 2; // should be = (samples - 1)/2; + + for (int x = -range; x <= range; x++) { - for (int j = -3; j < 3; j++) + for (int y = -range; y <= range; y++) { - sum += texture2D(texture0, fragTexCoord + vec2(j, i)*0.004) * 0.25; + sum += texture2D(texture0, fragTexCoord + vec2(x, y)*sizeFactor); } } - - // Texel color fetching from texture sampler - vec4 texelColor = texture2D(texture0, fragTexCoord); - + // Calculate final fragment color - if (texelColor.r < 0.3) tc = sum*sum*0.012 + texelColor; - else if (texelColor.r < 0.5) tc = sum*sum*0.009 + texelColor; - else tc = sum*sum*0.0075 + texelColor; - - gl_FragColor = tc; + gl_FragColor = ((sum/(samples*samples)) + source)*colDiffuse; }
\ No newline at end of file diff --git a/shaders/glsl100/blur.fs b/shaders/glsl100/blur.fs index 80d40834..1935f080 100644 --- a/shaders/glsl100/blur.fs +++ b/shaders/glsl100/blur.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 1280; -const float renderHeight = 720; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); diff --git a/shaders/glsl100/cross_hatching.fs b/shaders/glsl100/cross_hatching.fs index 1f7dab08..ced0fd63 100644 --- a/shaders/glsl100/cross_hatching.fs +++ b/shaders/glsl100/cross_hatching.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/cross_stitching.fs b/shaders/glsl100/cross_stitching.fs index 6fabc027..67639a55 100644 --- a/shaders/glsl100/cross_stitching.fs +++ b/shaders/glsl100/cross_stitching.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 1280; -const float renderHeight = 720; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float stitchingSize = 6.0f; diff --git a/shaders/glsl100/dream_vision.fs b/shaders/glsl100/dream_vision.fs index d0cdc687..fa9c5b77 100644 --- a/shaders/glsl100/dream_vision.fs +++ b/shaders/glsl100/dream_vision.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/fisheye.fs b/shaders/glsl100/fisheye.fs index 9dba297b..461e1405 100644 --- a/shaders/glsl100/fisheye.fs +++ b/shaders/glsl100/fisheye.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/pixel.fs b/shaders/glsl100/pixel.fs index c532f219..41ba3ed6 100644 --- a/shaders/glsl100/pixel.fs +++ b/shaders/glsl100/pixel.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 1280; -const float renderHeight = 720; +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; uniform float pixelWidth = 5.0f; uniform float pixelHeight = 5.0f; diff --git a/shaders/glsl100/posterization.fs b/shaders/glsl100/posterization.fs index 801ca89c..a7942c82 100644 --- a/shaders/glsl100/posterization.fs +++ b/shaders/glsl100/posterization.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/predator.fs b/shaders/glsl100/predator.fs index 1f0e2ce5..efa7fe79 100644 --- a/shaders/glsl100/predator.fs +++ b/shaders/glsl100/predator.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/scanlines.fs b/shaders/glsl100/scanlines.fs index d885e10b..529120d0 100644 --- a/shaders/glsl100/scanlines.fs +++ b/shaders/glsl100/scanlines.fs @@ -8,7 +8,7 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables diff --git a/shaders/glsl100/standard.fs b/shaders/glsl100/standard.fs index d5daa445..3e78022d 100644 --- a/shaders/glsl100/standard.fs +++ b/shaders/glsl100/standard.fs @@ -34,7 +34,6 @@ struct Light { }; const int maxLights = 8; -uniform int lightsCount; uniform Light lights[maxLights]; vec3 CalcPointLight(Light l, vec3 n, vec3 v, float s) @@ -134,19 +133,15 @@ void main() float spec = 1.0; if (useSpecular == 1) spec *= normalize(texture2D(texture2, fragTexCoord).r); - for (int i = 0; i < lightsCount; i++) + for (int i = 0; i < maxLights; i++) { // Check if light is enabled if (lights[i].enabled == 1) { // Calculate lighting based on light type - switch (lights[i].type) - { - case 0: lighting += CalcPointLight(lights[i], n, v, spec); break; - case 1: lighting += CalcDirectionalLight(lights[i], n, v, spec); break; - case 2: lighting += CalcSpotLight(lights[i], n, v, spec); break; - default: break; - } + if(lights[i].type == 0) lighting += CalcPointLight(lights[i], n, v, spec); + else if(lights[i].type == 1) lighting += CalcDirectionalLight(lights[i], n, v, spec); + else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec); } } diff --git a/shaders/glsl100/swirl.fs b/shaders/glsl100/swirl.fs index 0d6d24f2..6b17874c 100644 --- a/shaders/glsl100/swirl.fs +++ b/shaders/glsl100/swirl.fs @@ -8,12 +8,13 @@ varying vec4 fragColor; // Input uniform values uniform sampler2D texture0; -uniform vec4 fragTintColor; +uniform vec4 colDiffuse; // NOTE: Add here your custom variables -const float renderWidth = 800.0; // HARDCODED for example! -const float renderHeight = 480.0; // Use uniforms instead... +// NOTE: Render size values must be passed from code +const float renderWidth = 800; +const float renderHeight = 450; float radius = 250.0; float angle = 0.8; |
