summaryrefslogtreecommitdiff
path: root/assets/shaders
diff options
context:
space:
mode:
Diffstat (limited to 'assets/shaders')
-rw-r--r--assets/shaders/grid.frag2
-rw-r--r--assets/shaders/grid.vert8
2 files changed, 8 insertions, 2 deletions
diff --git a/assets/shaders/grid.frag b/assets/shaders/grid.frag
index 5bce13b..06eebc3 100644
--- a/assets/shaders/grid.frag
+++ b/assets/shaders/grid.frag
@@ -3,5 +3,5 @@
out vec4 FragColor;
void main() {
- FragColor = vec4(1.0);
+ FragColor = vec4(1.0, 0.0, 0.0, 1.0);
} \ No newline at end of file
diff --git a/assets/shaders/grid.vert b/assets/shaders/grid.vert
index a98eabe..bdfa477 100644
--- a/assets/shaders/grid.vert
+++ b/assets/shaders/grid.vert
@@ -6,6 +6,12 @@ uniform Camera {
vec4 viewPos;
} cam;
+// Grid position are in xy clipped space
+vec3 gridPlane[6] = vec3[](
+ vec3(1, 1, 0), vec3(-1, -1, 0), vec3(-1, 1, 0),
+ vec3(-1, -1, 0), vec3(1, 1, 0), vec3(1, -1, 0)
+);
+// normal vertice projection
void main() {
- gl_Position = vec4(1.0);
+ gl_Position = cam.proj * cam.view * vec4(gridPlane[gl_VertexID].xyz, 1.0);
} \ No newline at end of file