diff options
Diffstat (limited to 'data/shaders')
-rw-r--r-- | data/shaders/grid.frag | 19 | ||||
-rw-r--r-- | data/shaders/grid.vert | 18 | ||||
-rw-r--r-- | data/shaders/mesh.frag | 20 | ||||
-rw-r--r-- | data/shaders/mesh.vert | 17 | ||||
-rw-r--r-- | data/shaders/ui.frag | 10 | ||||
-rw-r--r-- | data/shaders/ui.vert | 10 |
6 files changed, 94 insertions, 0 deletions
diff --git a/data/shaders/grid.frag b/data/shaders/grid.frag new file mode 100644 index 0000000..2bfdd7a --- /dev/null +++ b/data/shaders/grid.frag @@ -0,0 +1,19 @@ +#version 330 core + +in VSOUT { + vec2 texcoords; +} vsout; + +out vec4 frag_color; + +uniform sampler2D texture0; + +void main(void) +{ + const float gamma = 2.2; + + vec3 color = vec3(texture(texture0, vsout.texcoords)); + color = pow(color, vec3(1.0/gamma)); + + frag_color = vec4(color, 0.5); +} diff --git a/data/shaders/grid.vert b/data/shaders/grid.vert new file mode 100644 index 0000000..4cb8948 --- /dev/null +++ b/data/shaders/grid.vert @@ -0,0 +1,18 @@ +#version 330 core + +layout(location = 0) in vec3 aposition; +layout(location = 2) in vec2 atexcoords; + +out VSOUT { + vec2 texcoords; +} vsout; + +uniform mat4 projection; +uniform mat4 view; +uniform mat4 world; + +void main(void) +{ + vsout.texcoords = atexcoords; + gl_Position = projection*view*world*vec4(aposition, 1.0); +} diff --git a/data/shaders/mesh.frag b/data/shaders/mesh.frag new file mode 100644 index 0000000..6e9365e --- /dev/null +++ b/data/shaders/mesh.frag @@ -0,0 +1,20 @@ +#version 330 core + +in VSOUT { + vec2 texcoords; +} vsout; + +out vec4 frag_color; + +uniform sampler2D texture0; +uniform vec3 color; + +void main(void) +{ + const float gamma = 2.2; + + vec3 result = vec3(texture(texture0, vsout.texcoords)); + result = pow(result, vec3(1.0/gamma)); + + frag_color = vec4(result*color, 1.0); +} diff --git a/data/shaders/mesh.vert b/data/shaders/mesh.vert new file mode 100644 index 0000000..c53f508 --- /dev/null +++ b/data/shaders/mesh.vert @@ -0,0 +1,17 @@ +#version 330 core +layout(location = 0) in vec3 aposition; +layout(location = 2) in vec2 atexcoords; + +out VSOUT { + vec2 texcoords; +} vsout; + +uniform mat4 projection; +uniform mat4 view; +uniform mat4 world; + +void main(void) +{ + vsout.texcoords = atexcoords; + gl_Position = projection*view*world*vec4(aposition, 1.0); +} diff --git a/data/shaders/ui.frag b/data/shaders/ui.frag new file mode 100644 index 0000000..03b3b62 --- /dev/null +++ b/data/shaders/ui.frag @@ -0,0 +1,10 @@ +#version 330 core + +out vec4 frag_color; + +uniform vec4 color; + +void main(void) +{ + frag_color = color; +} diff --git a/data/shaders/ui.vert b/data/shaders/ui.vert new file mode 100644 index 0000000..6f252e5 --- /dev/null +++ b/data/shaders/ui.vert @@ -0,0 +1,10 @@ +#version 330 core +layout(location = 0) in vec3 aposition; + +uniform mat4 projection; +uniform mat4 world; + +void main(void) +{ + gl_Position = projection*world*vec4(aposition, 1.0); +} |