summaryrefslogtreecommitdiff
path: root/src/3d/visual_debug.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-08 10:38:19 +0100
committerskal <pascal.massimino@gmail.com>2026-03-08 10:38:19 +0100
commit21b061b951ec3a65bc479fabeb2d9565e08a807e (patch)
tree24755d905463c8a507a34624ab3edf7295c8e0c5 /src/3d/visual_debug.cc
parent5f64a20daa81a6182d4898dcd6f86870ad0bf9d5 (diff)
fix: transpose matrices on GPU upload (row-major → column-major)
mini_math mat4 is row-major; WGSL mat4x4f is column-major. Matrices uploaded without transposing were interpreted as their own transpose on the GPU, causing RotatingCube and Renderer3D to render upside-down. - Add gpu_upload_mat4() to post_process_helper for standalone uploads - Add Uniforms::make() to RotatingCube::Uniforms (handles transpose) - Add GlobalUniforms::make() and ObjectData::make() to renderer.h - Update renderer_draw.cc and visual_debug.cc to use make() handoff(Gemini): matrix layout bug fixed across all rasterized effects. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src/3d/visual_debug.cc')
-rw-r--r--src/3d/visual_debug.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/3d/visual_debug.cc b/src/3d/visual_debug.cc
index cd4ccce..f6796d5 100644
--- a/src/3d/visual_debug.cc
+++ b/src/3d/visual_debug.cc
@@ -340,10 +340,9 @@ void VisualDebug::add_trajectory(const std::vector<vec3>& points,
}
void VisualDebug::update_buffers(const mat4& view_proj) {
- // Update Uniforms - fill entire GlobalUniforms structure
- GlobalUniforms uniforms = {};
- uniforms.view_proj = view_proj;
- // Other fields zeroed (not used by visual debug shader)
+ // Update Uniforms - only view_proj used by visual debug shader
+ const GlobalUniforms uniforms = GlobalUniforms::make(
+ view_proj, vec4(0, 0, 0, 0), vec4(0, 0, 0, 0), vec2(0, 0));
wgpuQueueWriteBuffer(wgpuDeviceGetQueue(device_), uniform_buffer_, 0,
&uniforms, sizeof(GlobalUniforms));