From 6f34ba5df72e0f57a9eb241b3804dc632dee2ada Mon Sep 17 00:00:00 2001 From: itycodes Date: Fri, 7 Mar 2025 19:11:31 +0100 Subject: [PATCH] Slight cleanup of the vertex shader --- vert.vert | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/vert.vert b/vert.vert index ece17a1..962366f 100644 --- a/vert.vert +++ b/vert.vert @@ -29,22 +29,29 @@ void main() { // assign the transformee gl_Position = pos.posnrm[gl_VertexIndex][0]; + // this needs a refactor; + // the push constant format doesn't really match + // what it's being used for. + vec3 cam_orig = offst.xyz; + vec2 cam_rot = vec2(data[3].w, offst.w); + + mat4 view_orig = mat4( - 1.0, 0.0, 0.0, offst.x, - 0.0, 1.0, 0.0, offst.y, - 0.0, 0.0, 1.0, offst.z, + 1.0, 0.0, 0.0, cam_orig.x, + 0.0, 1.0, 0.0, cam_orig.y, + 0.0, 0.0, 1.0, cam_orig.z, 0.0, 0.0, 0.0, 1.0 ); mat4 view_rot_xz = mat4( - cos(offst.w), 0.0, sin(offst.w), 0.0, + cos(cam_rot.y), 0.0, sin(cam_rot.y), 0.0, 0.0, 1.0, 0.0, 0.0, - -sin(offst.w), 0.0, cos(offst.w), 0.0, + -sin(cam_rot.y), 0.0, cos(cam_rot.y), 0.0, 0.0, 0.0, 0.0, 1.0 ); mat4 view_rot_yz = mat4( 1.0, 0.0, 0.0, 0.0, - 0.0, cos(data[3].w), sin(data[3].w), 0.0, - 0.0, -sin(data[3].w), cos(data[3].w), 0.0, + 0.0, cos(cam_rot.x), sin(cam_rot.x), 0.0, + 0.0, -sin(cam_rot.x), cos(cam_rot.x), 0.0, 0.0, 0.0, 0.0, 1.0 ); mat4 project_aspect = mat4(