summaryrefslogtreecommitdiff
path: root/assets/shaders/grid.vert
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-19 13:24:31 +1100
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-10-19 13:24:31 +1100
commit6182860f1b1aba4128b4f66eda7977600e60d1a0 (patch)
tree388d9aff8ca19ef324633ac1bea43f1548675150 /assets/shaders/grid.vert
parent5d1750d9adfc45b53c75310c58e31dfdbd8a6e15 (diff)
parentd6d742f8a24490f885e4a1ae3fea7ec46b01f58c (diff)
fix merge
Diffstat (limited to 'assets/shaders/grid.vert')
-rw-r--r--assets/shaders/grid.vert42
1 files changed, 0 insertions, 42 deletions
diff --git a/assets/shaders/grid.vert b/assets/shaders/grid.vert
deleted file mode 100644
index 592cbfc..0000000
--- a/assets/shaders/grid.vert
+++ /dev/null
@@ -1,42 +0,0 @@
-#version 410 core
-
-uniform Camera {
- mat4 view;
- mat4 proj;
- vec4 viewPos;
-} cam;
-
-out vec3 nearPoint;
-out vec3 farPoint;
-out float near;
-out float far;
-out mat4 fragView;
-out mat4 fragProj;
-
-// 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)
-);
-
-vec3 UnprojectPoint(float x, float y, float z, mat4 view, mat4 projection) {
- mat4 viewInv = inverse(view);
- mat4 projInv = inverse(projection);
- vec4 unprojectedPoint = viewInv * projInv * vec4(x, y, z, 1.0);
- return unprojectedPoint.xyz / unprojectedPoint.w;
-}
-
-// normal vertex projection
-void main() {
- // gl_Position = cam.proj * cam.view * vec4(gridPlane[gl_VertexID].xyz, 1.0);
- vec3 p = gridPlane[gl_VertexID].xyz;
- nearPoint = UnprojectPoint(p.x, p.y, -1.0, cam.view, cam.proj).xyz; // unprojecting on the near plane
- farPoint = UnprojectPoint(p.x, p.y, 1.0, cam.view, cam.proj).xyz; // unprojecting on the far plane
-
- fragView = cam.view;
- fragProj = cam.proj;
- near = 0.01;
- far = 100.0;
-
- gl_Position = vec4(p, 1.0); // using directly the clipped coordinates
-} \ No newline at end of file