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 /examples/resources | |
| parent | bb49102a4b5ae7bf6a34b437b133e8c5e3557f8d (diff) | |
| download | raylib-fb6ef2c2f4fe22552908d339cda541453e43faec.tar.gz raylib-fb6ef2c2f4fe22552908d339cda541453e43faec.zip | |
Vertex shaders optimization
Diffstat (limited to 'examples/resources')
| -rw-r--r-- | examples/resources/shaders/base.vs | 5 | ||||
| -rw-r--r-- | examples/resources/shaders/bloom.fs | 2 | ||||
| -rw-r--r-- | examples/resources/shaders/grayscale.fs | 6 | ||||
| -rw-r--r-- | examples/resources/shaders/phong.fs | 2 | ||||
| -rw-r--r-- | examples/resources/shaders/phong.vs | 4 | ||||
| -rw-r--r-- | examples/resources/shaders/shapes_base.vs | 9 | ||||
| -rw-r--r-- | examples/resources/shaders/shapes_grayscale.fs | 4 | ||||
| -rw-r--r-- | examples/resources/shaders/swirl.fs | 2 |
8 files changed, 16 insertions, 18 deletions
diff --git a/examples/resources/shaders/base.vs b/examples/resources/shaders/base.vs index 59eae0a0..b0f930b7 100644 --- a/examples/resources/shaders/base.vs +++ b/examples/resources/shaders/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/examples/resources/shaders/bloom.fs b/examples/resources/shaders/bloom.fs index f9cebe18..2833ce33 100644 --- a/examples/resources/shaders/bloom.fs +++ b/examples/resources/shaders/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/examples/resources/shaders/grayscale.fs b/examples/resources/shaders/grayscale.fs index 38337e00..af50b8c1 100644 --- a/examples/resources/shaders/grayscale.fs +++ b/examples/resources/shaders/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/examples/resources/shaders/phong.fs b/examples/resources/shaders/phong.fs index bb8826f4..75b7e6d7 100644 --- a/examples/resources/shaders/phong.fs +++ b/examples/resources/shaders/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/examples/resources/shaders/phong.vs b/examples/resources/shaders/phong.vs index 25163902..c6ef77de 100644 --- a/examples/resources/shaders/phong.vs +++ b/examples/resources/shaders/phong.vs @@ -6,8 +6,8 @@ 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 diff --git a/examples/resources/shaders/shapes_base.vs b/examples/resources/shaders/shapes_base.vs index 78e543b7..1fd686be 100644 --- a/examples/resources/shaders/shapes_base.vs +++ b/examples/resources/shaders/shapes_base.vs @@ -4,16 +4,15 @@ attribute vec3 vertexPosition; attribute vec2 vertexTexCoord; attribute vec4 vertexColor; -uniform mat4 projectionMatrix; -uniform mat4 modelviewMatrix; +uniform mat4 mvpMatrix; varying vec2 fragTexCoord; -varying vec4 fragColor; +varying vec4 fragTintColor; void main() { fragTexCoord = vertexTexCoord; - fragColor = vertexColor; + fragTintColor = vertexColor; - gl_Position = projectionMatrix*modelviewMatrix*vec4(vertexPosition, 1.0); + gl_Position = mvpMatrix*vec4(vertexPosition, 1.0); }
\ No newline at end of file diff --git a/examples/resources/shaders/shapes_grayscale.fs b/examples/resources/shaders/shapes_grayscale.fs index 1b778871..23ba9153 100644 --- a/examples/resources/shaders/shapes_grayscale.fs +++ b/examples/resources/shaders/shapes_grayscale.fs @@ -2,11 +2,11 @@ uniform sampler2D texture0; varying vec2 fragTexCoord; -varying vec4 fragColor; +varying vec4 fragTintColor; void main() { - vec4 base = texture2D(texture0, fragTexCoord)*fragColor; + 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)); diff --git a/examples/resources/shaders/swirl.fs b/examples/resources/shaders/swirl.fs index ba26cc05..ace6e79d 100644 --- a/examples/resources/shaders/swirl.fs +++ b/examples/resources/shaders/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 |
