2022-10-14 14:06:06 +00:00
|
|
|
#include "MetroidPrime/CAABoxFilter.hpp"
|
|
|
|
|
|
|
|
#include "Collision/CCollisionInfoList.hpp"
|
|
|
|
#include "Collision/CollisionUtil.hpp"
|
|
|
|
|
|
|
|
void CAABoxFilter::FilterBoxFloorCollisions(const CCollisionInfoList& in, CCollisionInfoList& out) {
|
|
|
|
float minZ = 10000.f;
|
|
|
|
|
2022-10-19 04:11:57 +00:00
|
|
|
for (CCollisionInfoList::const_iterator it = in.Begin(); it != in.End(); ++it) {
|
2022-10-14 14:06:06 +00:00
|
|
|
if (it->GetMaterialLeft().HasMaterial(kMT_Wall) && it->GetPoint().GetZ() < minZ) {
|
|
|
|
minZ = it->GetPoint().GetZ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CCollisionInfoList temp;
|
2022-10-19 04:11:57 +00:00
|
|
|
for (CCollisionInfoList::const_iterator it = in.Begin(); it != in.End(); ++it) {
|
2022-10-14 14:06:06 +00:00
|
|
|
if (it->GetMaterialLeft().HasMaterial(kMT_Floor)) {
|
|
|
|
if (it->GetPoint().GetZ() < minZ) {
|
|
|
|
temp.Add(*it, false);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
temp.Add(*it, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
CollisionUtil::AddAverageToFront(temp, out);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CAABoxFilter::Filter(const CCollisionInfoList& in, CCollisionInfoList& out) const {
|
|
|
|
FilterBoxFloorCollisions(in, out);
|
|
|
|
}
|