switched to polygons

This commit is contained in:
2025-04-18 12:34:24 +03:00
parent 254674a62e
commit a340766348
2 changed files with 13 additions and 5 deletions

View File

@@ -4,12 +4,14 @@
#pragma once #pragma once
#include <array> #include <array>
#include "omath/triangle.hpp"
#include "omath/vector3.hpp" #include "omath/vector3.hpp"
namespace omath::primitives namespace omath::primitives
{ {
[[nodiscard]] [[nodiscard]]
std::array<Vector3<float>, 8> CreateBox(const Vector3<float>& top, const Vector3<float>& bottom, std::array<Triangle<Vector3<float>>, 8> CreateBox(const Vector3<float>& top, const Vector3<float>& bottom,
const Vector3<float>& dirForward, const Vector3<float>& dirRight, const Vector3<float>& dirForward, const Vector3<float>& dirRight,
float ratio = 4.f); float ratio = 4.f);
} }

View File

@@ -3,10 +3,12 @@
// //
#include "omath/3d_primitives/box.hpp" #include "omath/3d_primitives/box.hpp"
namespace omath::primitives namespace omath::primitives
{ {
std::array<Vector3<float>, 8> CreateBox(const Vector3<float>& top, const Vector3<float>& bottom, std::array<Triangle<Vector3<float>>, 8> CreateBox(const Vector3<float>& top, const Vector3<float>& bottom,
const Vector3<float>& dirForward, const Vector3<float>& dirForward,
const Vector3<float>& dirRight, const Vector3<float>& dirRight,
const float ratio) const float ratio)
@@ -28,6 +30,10 @@ namespace omath::primitives
points[6] = top + (-dirForward + dirRight) * sideSize; points[6] = top + (-dirForward + dirRight) * sideSize;
points[7] = top + (-dirForward - dirRight) * sideSize; points[7] = top + (-dirForward - dirRight) * sideSize;
return points;
std::array<Triangle<Vector3<float>>, 8> polygons;
polygons[0] = {points[0], points[2], points[3]};
return polygons;
} }
} }