Skip to content

Commit 4c3c581

Browse files
committed
Frustum construction build fix
1 parent 7d97700 commit 4c3c581

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

source/Primitives/TFrustum.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ namespace Langulus::Math
6969
using MatrixType = TMatrix<ScalarType, MemberCount + 1>;
7070
static_assert(MemberCount > 1, "Can't have one-dimensional frustum");
7171

72-
TPlane<T> mPlanes[MemberCount * 2];
72+
::std::array<TPlane<T>, MemberCount * 2> mPlanes;
7373

7474
enum {Left = 0, Right, Top, Bottom, Near, Far};
7575

7676
public:
77-
TFrustum() noexcept;
78-
TFrustum(const MatrixType&) noexcept;
77+
constexpr TFrustum() noexcept;
78+
template<template<class> class S> requires CT::Semantic<S<TFrustum<T>>>
79+
constexpr TFrustum(S<TFrustum>&&) noexcept;
80+
constexpr TFrustum(const MatrixType&) noexcept;
7981

8082
NOD() constexpr bool IsDegenerate() const noexcept;
8183
NOD() constexpr bool IsHollow() const noexcept;

source/Primitives/TFrustum.inl

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ namespace Langulus::Math
1818

1919
/// Default unit frustum construction
2020
TEMPLATE() LANGULUS(INLINED)
21-
TFrustum<T>::TFrustum() noexcept {
21+
constexpr TFrustum<T>::TFrustum() noexcept {
2222
const T right {0.5, 0, 0};
2323
const T top {0, 0.5, 0};
2424

@@ -34,10 +34,16 @@ namespace Langulus::Math
3434
}
3535
}
3636

37+
/// Copy/move construction
38+
TEMPLATE() template<template<class> class S>
39+
requires CT::Semantic<S<TFrustum<T>>> LANGULUS(INLINED)
40+
constexpr TFrustum<T>::TFrustum(S<TFrustum<T>>&& s) noexcept
41+
: mPlanes {s->mPlanes} {}
42+
3743
/// Create a frustum by deconstructing a view*projection matrix
3844
/// @param pv - projected view matrix
3945
TEMPLATE() LANGULUS(INLINED)
40-
TFrustum<T>::TFrustum(const MatrixType& pv) noexcept {
46+
constexpr TFrustum<T>::TFrustum(const MatrixType& pv) noexcept {
4147
const auto right = pv.template GetRow<0>();
4248
const auto top = pv.template GetRow<1>();
4349
const auto eye = pv.template GetRow<(MemberCount > 2 ? 3 : 2)>() * (-1);

0 commit comments

Comments
 (0)