mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
switched to polygons
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user