diff options
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/base.vs | 26 | ||||
| -rw-r--r-- | assets/femme.png | bin | 0 -> 194744 bytes | |||
| -rw-r--r-- | assets/grayscale.fs | 16 | ||||
| -rw-r--r-- | assets/gs_full.glsl | 36 |
4 files changed, 78 insertions, 0 deletions
diff --git a/assets/base.vs b/assets/base.vs new file mode 100644 index 0000000..8cc2abb --- /dev/null +++ b/assets/base.vs @@ -0,0 +1,26 @@ +#version 330 + +// Input vertex attributes +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexColor; + +// Input uniform values +uniform mat4 mvp; + +// Output vertex attributes (to fragment shader) +out vec2 fragTexCoord; +out vec4 fragColor; + +// 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); +}
\ No newline at end of file diff --git a/assets/femme.png b/assets/femme.png Binary files differnew file mode 100644 index 0000000..8ca2541 --- /dev/null +++ b/assets/femme.png diff --git a/assets/grayscale.fs b/assets/grayscale.fs new file mode 100644 index 0000000..979a81c --- /dev/null +++ b/assets/grayscale.fs @@ -0,0 +1,16 @@ +#version 330 + +in vec2 fragTexCoord; +in vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +out vec4 finalColor; + +void main() +{ + vec4 texelColor = texture(texture0, fragTexCoord) * colDiffuse * fragColor; + float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); + finalColor = vec4(gray, gray, gray, texelColor.a); +}
\ No newline at end of file diff --git a/assets/gs_full.glsl b/assets/gs_full.glsl new file mode 100644 index 0000000..4b3e3f3 --- /dev/null +++ b/assets/gs_full.glsl @@ -0,0 +1,36 @@ +@vertex +in vec3 vertexPosition; +in vec2 vertexTexCoord; +in vec3 vertexNormal; +in vec4 vertexColor; + +uniform mat4 mvp; + +out vec2 fragTexCoord; +out vec4 fragColor; + +void main() +{ + fragTexCoord = vertexTexCoord; + fragColor = vertexColor; + + gl_Position = mvp*vec4(vertexPosition, 1.0); +} +@vs_end + +@fragment +in vec2 fragTexCoord; +in vec4 fragColor; + +uniform sampler2D texture0; +uniform vec4 colDiffuse; + +out vec4 finalColor; + +void main() +{ + vec4 texelColor = texture(texture0, fragTexCoord) * colDiffuse * fragColor; + float gray = dot(texelColor.rgb, vec3(0.299, 0.587, 0.114)); + finalColor = vec4(gray, gray, gray, texelColor.a); +} +@fs_end
\ No newline at end of file |
