summary refs log tree commit diff
path: root/shader
diff options
context:
space:
mode:
Diffstat (limited to 'shader')
-rw-r--r--shader/tri.frag5
-rw-r--r--shader/tri.vert11
2 files changed, 11 insertions, 5 deletions
diff --git a/shader/tri.frag b/shader/tri.frag
index 5599421..dea0868 100644
--- a/shader/tri.frag
+++ b/shader/tri.frag
@@ -1,8 +1,9 @@
 #version 450
 
-layout(location = 0) in vec4 in_pos;
+layout(location = 0) in vec2 uv;
 layout(location = 0) out vec4 out_color;
 
 void main(void) {
-	out_color = vec4(in_pos.xy + vec2(0.5,0.5), 0, 1.0);
+	float n = 2 * length(uv - 0.5);
+	out_color = vec4(vec3(uv, 1) * (1.75 - n), float(n<1));
 }
diff --git a/shader/tri.vert b/shader/tri.vert
index 701d7c6..750b2a3 100644
--- a/shader/tri.vert
+++ b/shader/tri.vert
@@ -1,9 +1,14 @@
 #version 450
 
+layout(set = 1, binding = 0) uniform UBO {
+	mat4 camera;
+};
+
 layout(location = 0) in vec2 in_pos;
-layout(location = 0) out vec4 out_pos;
+layout(location = 1) in vec2 in_uv;
+layout(location = 0) out vec2 out_uv;
 
 void main() {
-	gl_Position = vec4(in_pos.x, in_pos.y, 0.0, 1.0);
-	out_pos = gl_Position;
+	gl_Position = camera * vec4(in_pos, 0.0, 1.0);
+	out_uv = in_uv;
 }