Added camera

Moved some math types
Added some more vector types
Did the camera matrix calulations
Updated shaders to take push constants
This commit is contained in:
2025-10-05 02:40:59 +01:00
parent 2c67896cf2
commit 3b8c50a361
15 changed files with 355 additions and 70 deletions

View File

@@ -63,6 +63,7 @@
VK_FUNC(CmdSetViewport);
VK_FUNC(CmdSetScissor);
VK_FUNC(CmdPushConstants);
VK_FUNC(CmdCopyBufferToImage);
VK_FUNC(CmdPipelineBarrier2);
VK_FUNC(CmdBeginRendering);

View File

@@ -9,6 +9,11 @@ struct Vertex {
uint pad;
};
layout(push_constant, row_major)
uniform Global {
mat4 proj;
};
layout(binding = 0, scalar)
readonly buffer Vertices {
Vertex vtx[];
@@ -21,7 +26,7 @@ layout(location = 2) out flat uint idx;
void main() {
Vertex v = vtx[gl_VertexIndex];
gl_Position = v.p;
gl_Position = proj * v.p;
frag_uv = v.uv;
frag_c = vec4((v.c >> 24) & 0xFF, (v.c >> 16) & 0xFF, (v.c >> 8) & 0xFF, (v.c >> 0) & 0xFF) / 255.0f;