mirror of https://github.com/AxioDL/metaforce.git
CPVSVisOctree: Make use of std::array where applicable
Makes the arrays strongly typed.
This commit is contained in:
parent
969bcdba35
commit
4034e3b31f
|
@ -1,5 +1,7 @@
|
||||||
#include "Runtime/Graphics/CPVSVisOctree.hpp"
|
#include "Runtime/Graphics/CPVSVisOctree.hpp"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
|
||||||
namespace urde {
|
namespace urde {
|
||||||
|
|
||||||
CPVSVisOctree CPVSVisOctree::MakePVSVisOctree(const u8* data) {
|
CPVSVisOctree CPVSVisOctree::MakePVSVisOctree(const u8* data) {
|
||||||
|
@ -17,9 +19,10 @@ CPVSVisOctree::CPVSVisOctree(const zeus::CAABox& aabb, u32 numObjects, u32 numLi
|
||||||
x20_bufferFlag = 0;
|
x20_bufferFlag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u32 NumChildTable[] = {0, 2, 2, 4, 2, 4, 4, 8};
|
u32 CPVSVisOctree::GetNumChildren(u8 byte) const {
|
||||||
|
static constexpr std::array<u32, 8> numChildTable{0, 2, 2, 4, 2, 4, 4, 8};
|
||||||
u32 CPVSVisOctree::GetNumChildren(u8 byte) const { return NumChildTable[byte & 0x7]; }
|
return numChildTable[byte & 0x7];
|
||||||
|
}
|
||||||
|
|
||||||
u32 CPVSVisOctree::GetChildIndex(const u8*, const zeus::CVector3f&) const { return 0; }
|
u32 CPVSVisOctree::GetChildIndex(const u8*, const zeus::CVector3f&) const { return 0; }
|
||||||
|
|
||||||
|
@ -29,7 +32,7 @@ s32 CPVSVisOctree::IterateSearch(u8 nodeData, const zeus::CVector3f& tp) const {
|
||||||
|
|
||||||
zeus::CVector3f newMin = x2c_searchAabb.center();
|
zeus::CVector3f newMin = x2c_searchAabb.center();
|
||||||
zeus::CVector3f newMax;
|
zeus::CVector3f newMax;
|
||||||
bool highFlags[3];
|
std::array<bool, 3> highFlags{};
|
||||||
|
|
||||||
if (tp.x() > newMin.x()) {
|
if (tp.x() > newMin.x()) {
|
||||||
newMax.x() = x2c_searchAabb.max.x();
|
newMax.x() = x2c_searchAabb.max.x();
|
||||||
|
@ -58,7 +61,7 @@ s32 CPVSVisOctree::IterateSearch(u8 nodeData, const zeus::CVector3f& tp) const {
|
||||||
highFlags[2] = false;
|
highFlags[2] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 axisCounts[2] = {1, 1};
|
std::array<u8, 2> axisCounts{1, 1};
|
||||||
if (nodeData & 0x1)
|
if (nodeData & 0x1)
|
||||||
axisCounts[0] = 2;
|
axisCounts[0] = 2;
|
||||||
if (nodeData & 0x2)
|
if (nodeData & 0x2)
|
||||||
|
|
Loading…
Reference in New Issue