From a54dd4b52a8da13196b8e824509bf1eca86d8b10 Mon Sep 17 00:00:00 2001 From: Orange Date: Fri, 29 Aug 2025 00:11:31 +0300 Subject: [PATCH] Fixes plane triangle generation Corrects the order of vertices when constructing triangles for the plane primitive, addressing a potential winding order issue that could lead to incorrect surface normals and rendering. --- source/3d_primitives/plane.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/3d_primitives/plane.cpp b/source/3d_primitives/plane.cpp index 938393a..c541810 100644 --- a/source/3d_primitives/plane.cpp +++ b/source/3d_primitives/plane.cpp @@ -9,10 +9,11 @@ namespace omath::primitives const Vector3& vertex_b, const Vector3& direction, const float size) noexcept { + const auto second_vertex_a = vertex_a + direction * size; return std::array { - Triangle{vertex_a + direction * size, vertex_a, vertex_b}, - Triangle{vertex_b + direction * size, vertex_b, vertex_a} + Triangle{second_vertex_a, vertex_a, vertex_b}, + Triangle{second_vertex_a, vertex_b + direction * size, vertex_b} }; } } // namespace omath::primitives \ No newline at end of file