diff options
| author | raysan5 <raysan5@gmail.com> | 2016-01-13 17:13:28 +0100 |
|---|---|---|
| committer | raysan5 <raysan5@gmail.com> | 2016-01-13 17:13:28 +0100 |
| commit | fb6ef2c2f4fe22552908d339cda541453e43faec (patch) | |
| tree | 53d86522f6f1a5256e097a2e7bc82ce3e0101526 /shaders/gl330 | |
| parent | bb49102a4b5ae7bf6a34b437b133e8c5e3557f8d (diff) | |
| download | raylib-fb6ef2c2f4fe22552908d339cda541453e43faec.tar.gz raylib-fb6ef2c2f4fe22552908d339cda541453e43faec.zip | |
Vertex shaders optimization
Diffstat (limited to 'shaders/gl330')
| -rw-r--r-- | shaders/gl330/base.vs | 5 | ||||
| -rw-r--r-- | shaders/gl330/bloom.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/blur.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/cross_hatching.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/cross_stitching.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/dream_vision.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/fisheye.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/grayscale.fs | 6 | ||||
| -rw-r--r-- | shaders/gl330/phong.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/phong.vs | 7 | ||||
| -rw-r--r-- | shaders/gl330/pixel.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/posterization.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/predator.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/scanlines.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/swirl.fs | 2 | ||||
| -rw-r--r-- | shaders/gl330/template.fs | 4 |
16 files changed, 22 insertions, 24 deletions
diff --git a/shaders/gl330/base.vs b/shaders/gl330/base.vs index 59eae0a0..b0f930b7 100644 --- a/shaders/gl330/base.vs +++ b/shaders/gl330/base.vs @@ -6,8 +6,7 @@ in vec3 vertexNormal; out vec2 fragTexCoord; -uniform mat4 projectionMatrix; -uniform mat4 modelviewMatrix; +uniform mat4 mvpMatrix; // NOTE: Add here your custom variables @@ -15,5 +14,5 @@ void main() { fragTexCoord = vertexTexCoord; - gl_Position = projectionMatrix*modelviewMatrix*vec4(vertexPosition, 1.0); + 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 index f9cebe18..2833ce33 100644 --- a/shaders/gl330/bloom.fs +++ b/shaders/gl330/bloom.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/blur.fs b/shaders/gl330/blur.fs index b4e5bd2b..bd2b521f 100644 --- a/shaders/gl330/blur.fs +++ b/shaders/gl330/blur.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/cross_hatching.fs b/shaders/gl330/cross_hatching.fs index e2362212..7e25b25b 100644 --- a/shaders/gl330/cross_hatching.fs +++ b/shaders/gl330/cross_hatching.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/cross_stitching.fs b/shaders/gl330/cross_stitching.fs index 041bf1dc..73f867b6 100644 --- a/shaders/gl330/cross_stitching.fs +++ b/shaders/gl330/cross_stitching.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/dream_vision.fs b/shaders/gl330/dream_vision.fs index de9c04eb..f9316342 100644 --- a/shaders/gl330/dream_vision.fs +++ b/shaders/gl330/dream_vision.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/fisheye.fs b/shaders/gl330/fisheye.fs index d0e42cca..bbbff65c 100644 --- a/shaders/gl330/fisheye.fs +++ b/shaders/gl330/fisheye.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/grayscale.fs b/shaders/gl330/grayscale.fs index 38337e00..af50b8c1 100644 --- a/shaders/gl330/grayscale.fs +++ b/shaders/gl330/grayscale.fs @@ -5,16 +5,16 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables void main() { - vec4 base = texture2D(texture0, fragTexCoord)*tintColor; + vec4 base = texture2D(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, tintColor.a); + 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 index bb8826f4..75b7e6d7 100644 --- a/shaders/gl330/phong.fs +++ b/shaders/gl330/phong.fs @@ -6,7 +6,7 @@ in vec3 fragNormal; // Diffuse data uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // Light attributes uniform vec3 light_ambientColor = vec3(0.6, 0.3, 0); diff --git a/shaders/gl330/phong.vs b/shaders/gl330/phong.vs index 25163902..ee6d34bf 100644 --- a/shaders/gl330/phong.vs +++ b/shaders/gl330/phong.vs @@ -6,8 +6,7 @@ in vec2 vertexTexCoord; in vec3 vertexNormal; // Projection and model data -uniform mat4 projectionMatrix; -uniform mat4 modelviewMatrix; +uniform mat4 mvpMatrix; uniform mat4 modelMatrix; // Attributes to fragment shader @@ -21,8 +20,8 @@ void main() // Calculate view vector normal from model mat3 normalMatrix = transpose(inverse(mat3(modelMatrix))); - fragNormal = normalize(normalMatrix * vertexNormal); + fragNormal = normalize(normalMatrix*vertexNormal); // Calculate final vertex position - gl_Position = projectionMatrix * modelviewMatrix * vec4(vertexPosition, 1.0); + 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 index ec9e13d7..feee1423 100644 --- a/shaders/gl330/pixel.fs +++ b/shaders/gl330/pixel.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/posterization.fs b/shaders/gl330/posterization.fs index 652cf609..a4e49466 100644 --- a/shaders/gl330/posterization.fs +++ b/shaders/gl330/posterization.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/predator.fs b/shaders/gl330/predator.fs index 77882917..2295d01b 100644 --- a/shaders/gl330/predator.fs +++ b/shaders/gl330/predator.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/scanlines.fs b/shaders/gl330/scanlines.fs index 7f33f882..57297299 100644 --- a/shaders/gl330/scanlines.fs +++ b/shaders/gl330/scanlines.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/swirl.fs b/shaders/gl330/swirl.fs index 18a47cec..e88b59c9 100644 --- a/shaders/gl330/swirl.fs +++ b/shaders/gl330/swirl.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables diff --git a/shaders/gl330/template.fs b/shaders/gl330/template.fs index 92221959..660e8484 100644 --- a/shaders/gl330/template.fs +++ b/shaders/gl330/template.fs @@ -5,7 +5,7 @@ in vec2 fragTexCoord; out vec4 fragColor; uniform sampler2D texture0; -uniform vec4 tintColor; +uniform vec4 fragTintColor; // NOTE: Add here your custom variables @@ -15,5 +15,5 @@ void main() // NOTE: Implement here your fragment shader code - fragColor = texelColor*tintColor; + fragColor = texelColor*fragTintColor; } |
