diff options
| author | raysan5 <raysan5@gmail.com> | 2016-04-07 11:48:09 +0200 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-04-07 11:48:09 +0200 |
| commit | 78b502b0bf1ee796d86837c611150ed5f8d58fd2 (patch) | |
| tree | f0efc476e32c3141e7a3395f32ac971caa478649 /shaders/gl330 | |
| parent | 3b67a4cfba7d3b5dca805b1d1718fd2c9db64e99 (diff) | |
| download | raylib-78b502b0bf1ee796d86837c611150ed5f8d58fd2.tar.gz raylib-78b502b0bf1ee796d86837c611150ed5f8d58fd2.zip | |
Folders rename for consistency on shaders version
Diffstat (limited to 'shaders/gl330')
| -rw-r--r-- | shaders/gl330/base.vs | 18 | ||||
| -rw-r--r-- | shaders/gl330/bloom.fs | 42 | ||||
| -rw-r--r-- | shaders/gl330/blur.fs | 29 | ||||
| -rw-r--r-- | shaders/gl330/cross_hatching.fs | 44 | ||||
| -rw-r--r-- | shaders/gl330/cross_stitching.fs | 54 | ||||
| -rw-r--r-- | shaders/gl330/dream_vision.fs | 34 | ||||
| -rw-r--r-- | shaders/gl330/fisheye.fs | 40 | ||||
| -rw-r--r-- | shaders/gl330/grayscale.fs | 20 | ||||
| -rw-r--r-- | shaders/gl330/phong.fs | 76 | ||||
| -rw-r--r-- | shaders/gl330/phong.vs | 27 | ||||
| -rw-r--r-- | shaders/gl330/pixel.fs | 28 | ||||
| -rw-r--r-- | shaders/gl330/posterization.fs | 26 | ||||
| -rw-r--r-- | shaders/gl330/predator.fs | 27 | ||||
| -rw-r--r-- | shaders/gl330/scanlines.fs | 41 | ||||
| -rw-r--r-- | shaders/gl330/swirl.fs | 41 | ||||
| -rw-r--r-- | shaders/gl330/template.fs | 19 |
16 files changed, 0 insertions, 566 deletions
diff --git a/shaders/gl330/base.vs b/shaders/gl330/base.vs deleted file mode 100644 index b0f930b7..00000000 --- a/shaders/gl330/base.vs +++ /dev/null @@ -1,18 +0,0 @@ -#version 330 - -in vec3 vertexPosition; -in vec2 vertexTexCoord; -in vec3 vertexNormal; - -out vec2 fragTexCoord; - -uniform mat4 mvpMatrix; - -// NOTE: Add here your custom variables - -void main() -{ - fragTexCoord = vertexTexCoord; - - gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/bloom.fs b/shaders/gl330/bloom.fs deleted file mode 100644 index 34b6295c..00000000 --- a/shaders/gl330/bloom.fs +++ /dev/null @@ -1,42 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -void main() -{ - vec4 sum = vec4(0); - vec4 tc = vec4(0); - - for (int i = -4; i < 4; i++) - { - for (int j = -3; j < 3; j++) - { - sum += texture(texture0, fragTexCoord + vec2(j, i)*0.004) * 0.25; - } - } - - if (texture(texture0, fragTexCoord).r < 0.3) - { - tc = sum*sum*0.012 + texture(texture0, fragTexCoord); - } - else - { - if (texture(texture0, fragTexCoord).r < 0.5) - { - tc = sum*sum*0.009 + texture(texture0, fragTexCoord); - } - else - { - tc = sum*sum*0.0075 + texture(texture0, fragTexCoord); - } - } - - fragColor = tc; -}
\ No newline at end of file diff --git a/shaders/gl330/blur.fs b/shaders/gl330/blur.fs deleted file mode 100644 index 44ea42b1..00000000 --- a/shaders/gl330/blur.fs +++ /dev/null @@ -1,29 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -const float renderWidth = 1280.0; -const float renderHeight = 720.0; - -float offset[3] = float[](0.0, 1.3846153846, 3.2307692308); -float weight[3] = float[](0.2270270270, 0.3162162162, 0.0702702703); - -void main() -{ - vec3 tc = texture(texture0, fragTexCoord).rgb*weight[0]; - - for (int i = 1; i < 3; i++) - { - tc += texture(texture0, fragTexCoord + vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; - tc += texture(texture0, fragTexCoord - vec2(offset[i])/renderWidth, 0.0).rgb*weight[i]; - } - - fragColor = vec4(tc, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/cross_hatching.fs b/shaders/gl330/cross_hatching.fs deleted file mode 100644 index 6f5df964..00000000 --- a/shaders/gl330/cross_hatching.fs +++ /dev/null @@ -1,44 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -float hatchOffsetY = 5.0; -float lumThreshold01 = 0.9; -float lumThreshold02 = 0.7; -float lumThreshold03 = 0.5; -float lumThreshold04 = 0.3; - -void main() -{ - vec3 tc = vec3(1.0, 1.0, 1.0); - float lum = length(texture(texture0, fragTexCoord).rgb); - - 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 (mod(gl_FragCoord .x - gl_FragCoord .y, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } - - 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 (mod(gl_FragCoord .x - gl_FragCoord .y - hatchOffsetY, 10.0) == 0.0) tc = vec3(0.0, 0.0, 0.0); - } - - fragColor = vec4(tc, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/cross_stitching.fs b/shaders/gl330/cross_stitching.fs deleted file mode 100644 index dcb26e79..00000000 --- a/shaders/gl330/cross_stitching.fs +++ /dev/null @@ -1,54 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -const float renderWidth = 1280.0; -const float renderHeight = 720.0; - -float stitchingSize = 6.0; - -uniform int invert = 0; - -vec4 PostFX(sampler2D tex, vec2 uv) -{ - vec4 c = vec4(0.0); - float size = stitchingSize; - vec2 cPos = uv * vec2(renderWidth, renderHeight); - vec2 tlPos = floor(cPos / vec2(size, size)); - tlPos *= size; - - 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); - else c = texture(tex, tlPos * vec2(1.0/renderWidth, 1.0/renderHeight)) * 1.4; - } - else - { - 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; -} - -void main(void) -{ - vec3 tc = PostFX(texture0, fragTexCoord).rgb; - - fragColor = vec4(tc, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/dream_vision.fs b/shaders/gl330/dream_vision.fs deleted file mode 100644 index 0ea4ce20..00000000 --- a/shaders/gl330/dream_vision.fs +++ /dev/null @@ -1,34 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -void main() -{ - vec4 color = texture(texture0, fragTexCoord); - - color += texture(texture0, fragTexCoord + 0.001); - color += texture(texture0, fragTexCoord + 0.003); - color += texture(texture0, fragTexCoord + 0.005); - color += texture(texture0, fragTexCoord + 0.007); - color += texture(texture0, fragTexCoord + 0.009); - color += texture(texture0, fragTexCoord + 0.011); - - color += texture(texture0, fragTexCoord - 0.001); - color += texture(texture0, fragTexCoord - 0.003); - color += texture(texture0, fragTexCoord - 0.005); - color += texture(texture0, fragTexCoord - 0.007); - color += texture(texture0, fragTexCoord - 0.009); - color += texture(texture0, fragTexCoord - 0.011); - - color.rgb = vec3((color.r + color.g + color.b)/3.0); - color = color/9.5; - - fragColor = color; -}
\ No newline at end of file diff --git a/shaders/gl330/fisheye.fs b/shaders/gl330/fisheye.fs deleted file mode 100644 index 5bd9abf4..00000000 --- a/shaders/gl330/fisheye.fs +++ /dev/null @@ -1,40 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -const float PI = 3.1415926535; - -void main() -{ - float aperture = 178.0; - float apertureHalf = 0.5 * aperture * (PI / 180.0); - float maxFactor = sin(apertureHalf); - - vec2 uv = vec2(0); - vec2 xy = 2.0 * fragTexCoord.xy - 1.0; - float d = length(xy); - - if (d < (2.0 - maxFactor)) - { - d = length(xy * maxFactor); - float z = sqrt(1.0 - d * d); - float r = atan(d, z) / PI; - float phi = atan(xy.y, xy.x); - - uv.x = r * cos(phi) + 0.5; - uv.y = r * sin(phi) + 0.5; - } - else - { - uv = fragTexCoord.xy; - } - - fragColor = texture(texture0, uv); -}
\ No newline at end of file diff --git a/shaders/gl330/grayscale.fs b/shaders/gl330/grayscale.fs deleted file mode 100644 index b3a695bf..00000000 --- a/shaders/gl330/grayscale.fs +++ /dev/null @@ -1,20 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -void main() -{ - vec4 base = texture(texture0, fragTexCoord)*fragTintColor; - - // Convert to grayscale using NTSC conversion weights - float gray = dot(base.rgb, vec3(0.299, 0.587, 0.114)); - - fragColor = vec4(gray, gray, gray, fragTintColor.a); -}
\ No newline at end of file diff --git a/shaders/gl330/phong.fs b/shaders/gl330/phong.fs deleted file mode 100644 index 75b7e6d7..00000000 --- a/shaders/gl330/phong.fs +++ /dev/null @@ -1,76 +0,0 @@ -#version 330 - -// Vertex shader input data -in vec2 fragTexCoord; -in vec3 fragNormal; - -// Diffuse data -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// Light attributes -uniform vec3 light_ambientColor = vec3(0.6, 0.3, 0); -uniform vec3 light_diffuseColor = vec3(1, 0.5, 0); -uniform vec3 light_specularColor = vec3(0, 1, 0); -uniform float light_intensity = 1; -uniform float light_specIntensity = 1; - -// Material attributes -uniform vec3 mat_ambientColor = vec3(1, 1, 1); -uniform vec3 mat_specularColor = vec3(1, 1, 1); -uniform float mat_glossiness = 50; - -// World attributes -uniform vec3 lightPos; -uniform vec3 cameraPos; - -// Fragment shader output data -out vec4 fragColor; - -vec3 AmbientLighting() -{ - return mat_ambientColor * light_ambientColor; -} - -vec3 DiffuseLighting(in vec3 N, in vec3 L) -{ - // Lambertian reflection calculation - float diffuse = clamp(dot(N, L), 0, 1); - - return tintColor.xyz * light_diffuseColor * light_intensity * diffuse; -} - -vec3 SpecularLighting(in vec3 N, in vec3 L, in vec3 V) -{ - float specular = 0; - - // Calculate specular reflection only if the surface is oriented to the light source - if(dot(N, L) > 0) - { - // Calculate half vector - vec3 H = normalize(L + V); - - // Calculate specular intensity - specular = pow(dot(N, H), 3 + mat_glossiness); - } - - return mat_specularColor * light_specularColor * light_specIntensity * specular; -} - -void main() -{ - // Normalize input vectors - vec3 L = normalize(lightPos); - vec3 V = normalize(cameraPos); - vec3 N = normalize(fragNormal); - - vec3 ambient = AmbientLighting(); - vec3 diffuse = DiffuseLighting(N, L); - vec3 specular = SpecularLighting(N, L, V); - - // Get base color from texture - vec4 textureColor = texture(texture0, fragTexCoord); - vec3 finalColor = textureColor.rgb; - - fragColor = vec4(finalColor * (ambient + diffuse + specular), textureColor.a); -}
\ No newline at end of file diff --git a/shaders/gl330/phong.vs b/shaders/gl330/phong.vs deleted file mode 100644 index ee6d34bf..00000000 --- a/shaders/gl330/phong.vs +++ /dev/null @@ -1,27 +0,0 @@ -#version 330 - -// Vertex input data -in vec3 vertexPosition; -in vec2 vertexTexCoord; -in vec3 vertexNormal; - -// Projection and model data -uniform mat4 mvpMatrix; -uniform mat4 modelMatrix; - -// Attributes to fragment shader -out vec2 fragTexCoord; -out vec3 fragNormal; - -void main() -{ - // Send texture coord to fragment shader - fragTexCoord = vertexTexCoord; - - // Calculate view vector normal from model - mat3 normalMatrix = transpose(inverse(mat3(modelMatrix))); - fragNormal = normalize(normalMatrix*vertexNormal); - - // Calculate final vertex position - gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/pixel.fs b/shaders/gl330/pixel.fs deleted file mode 100644 index aa5a22fe..00000000 --- a/shaders/gl330/pixel.fs +++ /dev/null @@ -1,28 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -const float renderWidth = 1280.0; -const float renderHeight = 720.0; - -uniform float pixelWidth = 5.0; -uniform float pixelHeight = 5.0; - -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 = texture(texture0, coord).rgb; - - fragColor = vec4(tc, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/posterization.fs b/shaders/gl330/posterization.fs deleted file mode 100644 index 5215bd8b..00000000 --- a/shaders/gl330/posterization.fs +++ /dev/null @@ -1,26 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -float gamma = 0.6; -float numColors = 8.0; - -void main() -{ - vec3 color = texture(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)); - - fragColor = vec4(color, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/predator.fs b/shaders/gl330/predator.fs deleted file mode 100644 index 85c93d0c..00000000 --- a/shaders/gl330/predator.fs +++ /dev/null @@ -1,27 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -void main() -{ - vec3 color = texture(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; - - int ix = (lum < 0.5)? 0:1; - - vec3 tc = mix(colors[ix], colors[ix + 1], (lum - float(ix)*0.5)/0.5); - - fragColor = vec4(tc, 1.0); -}
\ No newline at end of file diff --git a/shaders/gl330/scanlines.fs b/shaders/gl330/scanlines.fs deleted file mode 100644 index 0c89e610..00000000 --- a/shaders/gl330/scanlines.fs +++ /dev/null @@ -1,41 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -float offset = 0.0; -float frequency = 720.0/3.0; - -uniform float time; - -void main (void) -{ -/* - // Scanlines method 1 - float tval = 0; //time - vec2 uv = 0.5 + (fragTexCoord - 0.5)*(0.9 + 0.01*sin(0.5*tval)); - - vec4 color = texture(texture0, fragTexCoord); - - color = clamp(color*0.5 + 0.5*color*color*1.2, 0.0, 1.0); - color *= 0.5 + 0.5*16.0*uv.x*uv.y*(1.0 - uv.x)*(1.0 - uv.y); - color *= vec4(0.8, 1.0, 0.7, 1); - color *= 0.9 + 0.1*sin(10.0*tval + uv.y*1000.0); - color *= 0.97 + 0.03*sin(110.0*tval); - - fragColor = color; -*/ - // Scanlines method 2 - float globalPos = (fragTexCoord.y + offset) * frequency; - float wavePos = cos((fract(globalPos) - 0.5)*3.14); - - vec4 color = texture(texture0, fragTexCoord); - - fragColor = mix(vec4(0.0, 0.3, 0.0, 0.0), color, wavePos); -}
\ No newline at end of file diff --git a/shaders/gl330/swirl.fs b/shaders/gl330/swirl.fs deleted file mode 100644 index 19d7468b..00000000 --- a/shaders/gl330/swirl.fs +++ /dev/null @@ -1,41 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -const float renderWidth = 1280.0; -const float renderHeight = 720.0; - -float radius = 250.0; -float angle = 0.8; - -uniform vec2 center = vec2(200.0, 200.0); - -void main (void) -{ - vec2 texSize = vec2(renderWidth, renderHeight); - vec2 tc = fragTexCoord*texSize; - tc -= center; - float dist = length(tc); - - 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))); - } - - tc += center; - vec3 color = texture(texture0, tc/texSize).rgb; - - fragColor = vec4(color, 1.0);; -}
\ No newline at end of file diff --git a/shaders/gl330/template.fs b/shaders/gl330/template.fs deleted file mode 100644 index ad7210a4..00000000 --- a/shaders/gl330/template.fs +++ /dev/null @@ -1,19 +0,0 @@ -#version 330 - -in vec2 fragTexCoord; - -out vec4 fragColor; - -uniform sampler2D texture0; -uniform vec4 fragTintColor; - -// NOTE: Add here your custom variables - -void main() -{ - vec4 texelColor = texture(texture0, fragTexCoord); - - // NOTE: Implement here your fragment shader code - - fragColor = texelColor*fragTintColor; -} |
