From e3de98c8ee8a5ace29b8c3673358e9abfbdbdd1f Mon Sep 17 00:00:00 2001 From: omniscient <17525998+omnisci3nce@users.noreply.github.com> Date: Wed, 31 Jul 2024 10:48:51 +1000 Subject: feat: grid: use hardcoded indices --- assets/shaders/grid.frag | 2 +- assets/shaders/grid.vert | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'assets/shaders') 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 -- cgit v1.2.3-70-g09d2