diff options
| author | vimene <vincent.menegaux@gmail.com> | 2025-12-26 00:50:56 +0100 |
|---|---|---|
| committer | vimene <vincent.menegaux@gmail.com> | 2025-12-26 00:50:56 +0100 |
| commit | b21d32a0dd906404b0cdf7d6edf395ba63adba8b (patch) | |
| tree | 8937a36f4038b5f4dd8ac1aa55f83cb4161be9ac /src/engine.cpp | |
| parent | 00370c21f107ff2a320fbdef170e24a8b5cda92a (diff) | |
| download | engine-b21d32a0dd906404b0cdf7d6edf395ba63adba8b.tar.gz | |
transpose matrix representation
map values[i * 4 + j] to values[i + j * 4], meaning that values[1] is
now the second line, first column, instead of first line, second column
Diffstat (limited to 'src/engine.cpp')
| -rw-r--r-- | src/engine.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index 142a8e1..792b99f 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -1700,13 +1700,10 @@ static int main_graphical() { // update uniform buffer { // TODO: should use push constants - // TODO: we shouldn't have to transpose, we could change the Matrix4 implementation to - // make all operation on transpose, which wouldn't change anything for the software - // renderer engine::vk::UniformBufferObject ubo { - .model = Matrix4::rot_z(time * PI / 2.f).transpose(), - .view = Matrix4::look_at(Vector3(2.f, 2.f, 2.f), Vector3(0.f, 0.f, 0.f), Vector3(0.f, 0.f, 1.f)).transpose(), - .proj = Matrix4::perspective(PI / 4.f, static_cast<float>(swapchain_extent.width) / static_cast<float>(swapchain_extent.height), .1f, 10.f).transpose(), + .model = Matrix4::rot_z(time * PI / 2.f), + .view = Matrix4::look_at(Vector3(2.f, 2.f, 2.f), Vector3(0.f, 0.f, 0.f), Vector3(0.f, 0.f, 1.f)), + .proj = Matrix4::perspective(PI / 4.f, static_cast<float>(swapchain_extent.width) / static_cast<float>(swapchain_extent.height), .1f, 10.f), }; memcpy(uniform_buf_mems[frame_idx], &ubo, sizeof(engine::vk::UniformBufferObject)); } |
