diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-02 17:00:32 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-02 17:00:32 +0100 |
| commit | be2477c0fa161689ff02ec96b177a26594f1925b (patch) | |
| tree | d034413054a261e1e9008c996930e8fbc56484bf /src/3d/visual_debug.cc | |
| parent | ba14a37866caa0f314e5b17e3fbd525daaf1ee81 (diff) | |
chore: Apply final code formatting and cleanup
Diffstat (limited to 'src/3d/visual_debug.cc')
| -rw-r--r-- | src/3d/visual_debug.cc | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/src/3d/visual_debug.cc b/src/3d/visual_debug.cc index c6c5c51..51ccc39 100644 --- a/src/3d/visual_debug.cc +++ b/src/3d/visual_debug.cc @@ -174,25 +174,32 @@ void VisualDebug::create_pipeline(WGPUTextureFormat format) { } void VisualDebug::add_box(const mat4& transform, const vec3& local_extent, - const vec3& color) { + const vec3& color) { float lx = local_extent.x; float ly = local_extent.y; float lz = local_extent.z; // 8 corners of transformed box - vec4 p[] = {transform * vec4(-lx, -ly, -lz, 1), transform * vec4(lx, -ly, -lz, 1), - transform * vec4(lx, ly, -lz, 1), transform * vec4(-lx, ly, -lz, 1), - transform * vec4(-lx, -ly, lz, 1), transform * vec4(lx, -ly, lz, 1), - transform * vec4(lx, ly, lz, 1), transform * vec4(-lx, ly, lz, 1)}; + vec4 p[] = { + transform * vec4(-lx, -ly, -lz, 1), transform * vec4(lx, -ly, -lz, 1), + transform * vec4(lx, ly, -lz, 1), transform * vec4(-lx, ly, -lz, 1), + transform * vec4(-lx, -ly, lz, 1), transform * vec4(lx, -ly, lz, 1), + transform * vec4(lx, ly, lz, 1), transform * vec4(-lx, ly, lz, 1)}; // 12 edges (each 2 vertices) DebugLine edges[] = { - {p[0].xyz(), p[1].xyz(), color}, {p[1].xyz(), p[2].xyz(), color}, - {p[2].xyz(), p[3].xyz(), color}, {p[3].xyz(), p[0].xyz(), color}, // Front face - {p[4].xyz(), p[5].xyz(), color}, {p[5].xyz(), p[6].xyz(), color}, - {p[6].xyz(), p[7].xyz(), color}, {p[7].xyz(), p[4].xyz(), color}, // Back face - {p[0].xyz(), p[4].xyz(), color}, {p[1].xyz(), p[5].xyz(), color}, - {p[2].xyz(), p[6].xyz(), color}, {p[3].xyz(), p[7].xyz(), color} // Connecting edges + {p[0].xyz(), p[1].xyz(), color}, + {p[1].xyz(), p[2].xyz(), color}, + {p[2].xyz(), p[3].xyz(), color}, + {p[3].xyz(), p[0].xyz(), color}, // Front face + {p[4].xyz(), p[5].xyz(), color}, + {p[5].xyz(), p[6].xyz(), color}, + {p[6].xyz(), p[7].xyz(), color}, + {p[7].xyz(), p[4].xyz(), color}, // Back face + {p[0].xyz(), p[4].xyz(), color}, + {p[1].xyz(), p[5].xyz(), color}, + {p[2].xyz(), p[6].xyz(), color}, + {p[3].xyz(), p[7].xyz(), color} // Connecting edges }; for (const auto& l : edges) { |
