mirror of https://github.com/AxioDL/metaforce.git
CCollisionEdge: Make constructors constexpr
Makes the default and non-stream iterator constexpr, which allows for elimination of a runtime initializer.
This commit is contained in:
parent
af6e3b21f8
commit
a952ff1110
|
@ -8,14 +8,14 @@ class CCollisionEdge {
|
||||||
u16 x2_index2 = -1;
|
u16 x2_index2 = -1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CCollisionEdge() = default;
|
constexpr CCollisionEdge() noexcept = default;
|
||||||
explicit CCollisionEdge(CInputStream&);
|
explicit CCollisionEdge(CInputStream&);
|
||||||
CCollisionEdge(u16 v0, u16 v1) : x0_index1(v0), x2_index2(v1) {}
|
constexpr CCollisionEdge(u16 v0, u16 v1) noexcept : x0_index1(v0), x2_index2(v1) {}
|
||||||
|
|
||||||
u16 GetVertIndex1() const { return x0_index1; }
|
[[nodiscard]] constexpr u16 GetVertIndex1() const noexcept { return x0_index1; }
|
||||||
u16 GetVertIndex2() const { return x2_index2; }
|
[[nodiscard]] constexpr u16 GetVertIndex2() const noexcept { return x2_index2; }
|
||||||
|
|
||||||
void swapBig() {
|
constexpr void swapBig() noexcept {
|
||||||
x0_index1 = hecl::SBig(x0_index1);
|
x0_index1 = hecl::SBig(x0_index1);
|
||||||
x2_index2 = hecl::SBig(x2_index2);
|
x2_index2 = hecl::SBig(x2_index2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ constexpr std::array<u8, 12> DefaultSurfaceMaterials{
|
||||||
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::array<CCollisionEdge, 18> DefaultEdges{{
|
constexpr std::array<CCollisionEdge, 18> DefaultEdges{{
|
||||||
{4, 1},
|
{4, 1},
|
||||||
{1, 5},
|
{1, 5},
|
||||||
{5, 4},
|
{5, 4},
|
||||||
|
|
Loading…
Reference in New Issue