#version 450 // This file contains the raw math performed by the matrices in vert.vert // Matrices are still used for rotation, though. layout(std430, set = 0, binding = 0) buffer positions_buffer { mat2x4 posnrm[]; } pos; layout(push_constant, std430) uniform pc { layout(offset=0) mat4 data; layout(offset=64) vec4 offst; }; layout (location = 0) out vec4 normal; layout (location = 1) out vec4 pos_pre; layout (location = 2) out vec4 pos_post; const float PI = 3.14159; const float TAU = PI*2.0; void main() { normal = pos.posnrm[gl_VertexIndex][1]; pos_pre = pos.posnrm[gl_VertexIndex][0]; float zFar = 100.0; float zNear = 0.1; gl_Position = pos.posnrm[gl_VertexIndex][0]; gl_Position.xyz += offst.xyz; pos_post = gl_Position; mat2 xz_rot; xz_rot[0] = vec2(cos(offst.w), -sin(offst.w)); xz_rot[1] = vec2(sin(offst.w), cos(offst.w)); gl_Position.xz *= inverse(xz_rot); mat2 yz_rot; yz_rot[0] = vec2(cos(data[3].w), -sin(data[3].w)); yz_rot[1] = vec2(sin(data[3].w), cos(data[3].w)); gl_Position.yz *= inverse(yz_rot); gl_Position.x *= (1080.0/1920.0); gl_Position.w = (gl_Position.z*sin(140.0/360.0*TAU)); gl_Position.z -= zNear; gl_Position.z /= zFar; }