From 2a14abecaee073aef1f1966bb397d6086b2e4785 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Tue, 9 May 2023 10:55:50 -0500 Subject: refactor: rename transform -> node --- shaders/mesh.frag | 17 +++++++++++++++++ shaders/mesh.vert | 21 +++++++++++++++++++++ shaders/quad.vert | 21 +++++++++++++++++++++ 3 files changed, 59 insertions(+) create mode 100644 shaders/mesh.frag create mode 100644 shaders/mesh.vert create mode 100644 shaders/quad.vert (limited to 'shaders') diff --git a/shaders/mesh.frag b/shaders/mesh.frag new file mode 100644 index 0000000..532d1ac --- /dev/null +++ b/shaders/mesh.frag @@ -0,0 +1,17 @@ +#version 410 core +out vec4 FragColor; + +in vec3 position; +in vec3 normal; +in vec2 tex; + +uniform float time; +uniform sampler2D ourTexture; + +void main() +{ + //FragColor = vec4(sin(time), cos(time), -sin(time), 1.0f); + //FragColor = vec4(normal, 1.0f); + //FragColor = vec4(tex, 1.0f, 1.0f); + FragColor = texture(ourTexture, tex); +} diff --git a/shaders/mesh.vert b/shaders/mesh.vert new file mode 100644 index 0000000..cb20d1f --- /dev/null +++ b/shaders/mesh.vert @@ -0,0 +1,21 @@ +#version 410 core +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec3 in_normal; +layout (location = 2) in vec2 in_tex; + +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +out vec3 position; +out vec3 normal; +out vec2 tex; + +void main() +{ + gl_Position = projection * view * model * vec4(in_position, 1.0); + position = in_position; + //normal = vec3(model * vec4(in_normal, 1.0f)); + normal = in_normal; + tex = in_tex; +} diff --git a/shaders/quad.vert b/shaders/quad.vert new file mode 100644 index 0000000..cb20d1f --- /dev/null +++ b/shaders/quad.vert @@ -0,0 +1,21 @@ +#version 410 core +layout (location = 0) in vec3 in_position; +layout (location = 1) in vec3 in_normal; +layout (location = 2) in vec2 in_tex; + +uniform mat4 model; +uniform mat4 view; +uniform mat4 projection; + +out vec3 position; +out vec3 normal; +out vec2 tex; + +void main() +{ + gl_Position = projection * view * model * vec4(in_position, 1.0); + position = in_position; + //normal = vec3(model * vec4(in_normal, 1.0f)); + normal = in_normal; + tex = in_tex; +} -- cgit v1.2.1