From fa2bdd711212ba6b7a94a20971e8bfa281e73296 Mon Sep 17 00:00:00 2001 From: Uneven Prankster Date: Wed, 12 Jul 2023 13:22:29 -0300 Subject: lol --- assets/base.vs | 26 ++++++++++++++++++++++++++ assets/femme.png | Bin 0 -> 194744 bytes assets/grayscale.fs | 16 ++++++++++++++++ assets/gs_full.glsl | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 assets/base.vs create mode 100644 assets/femme.png create mode 100644 assets/grayscale.fs create mode 100644 assets/gs_full.glsl (limited to 'assets') 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 new file mode 100644 index 0000000..8ca2541 Binary files /dev/null and b/assets/femme.png differ 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 -- cgit v1.2.3