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.
This commit is contained in:
2025-08-29 00:11:31 +03:00
parent d7e497b617
commit a54dd4b52a

View File

@@ -9,10 +9,11 @@ namespace omath::primitives
const Vector3<float>& vertex_b, const Vector3<float>& vertex_b,
const Vector3<float>& direction, const float size) noexcept const Vector3<float>& direction, const float size) noexcept
{ {
const auto second_vertex_a = vertex_a + direction * size;
return std::array return std::array
{ {
Triangle{vertex_a + direction * size, vertex_a, vertex_b}, Triangle{second_vertex_a, vertex_a, vertex_b},
Triangle{vertex_b + direction * size, vertex_b, vertex_a} Triangle{second_vertex_a, vertex_b + direction * size, vertex_b}
}; };
} }
} // namespace omath::primitives } // namespace omath::primitives