mirror of https://github.com/AxioDL/metaforce.git
More collision imps
This commit is contained in:
parent
a8021d4d88
commit
6e0fad8489
|
@ -22,11 +22,12 @@ CRayCastResult CCollidableOBBTree::CastRayInternal(const CInternalRayCastStructu
|
|||
|
||||
zeus::CAABox CCollidableOBBTree::CalculateAABox(const zeus::CTransform&) const
|
||||
{
|
||||
|
||||
return x10_tree->CalculateLocalAABox();
|
||||
}
|
||||
|
||||
zeus::CAABox CCollidableOBBTree::CalculateLocalAABox() const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,18 @@ COBBTree::COBBTree(CInputStream& in)
|
|||
{
|
||||
}
|
||||
|
||||
zeus::CAABox COBBTree::CalculateLocalAABox() const
|
||||
{
|
||||
return CalculateAABox(zeus::CTransform::Identity());
|
||||
}
|
||||
|
||||
zeus::CAABox COBBTree::CalculateAABox(const zeus::CTransform& xf) const
|
||||
{
|
||||
if (x88_root)
|
||||
return x88_root->GetOBB().calculateAABox(xf);
|
||||
return zeus::CAABox::skInvertedBox;
|
||||
}
|
||||
|
||||
COBBTree::SIndexData::SIndexData(CInputStream& in)
|
||||
{
|
||||
u32 count = in.readUint32Big();
|
||||
|
|
|
@ -62,11 +62,14 @@ private:
|
|||
u32 x8_memsize = 0;
|
||||
/* CSimpleAllocator xc_ We're not using this but lets keep track*/
|
||||
SIndexData x18_indexData;
|
||||
std::unique_ptr<const CNode> x88_root;
|
||||
std::unique_ptr<CNode> x88_root;
|
||||
public:
|
||||
COBBTree()=default;
|
||||
COBBTree(const COBBTree::SIndexData&, const CNode*);
|
||||
COBBTree(CInputStream&);
|
||||
|
||||
zeus::CAABox CalculateLocalAABox() const;
|
||||
zeus::CAABox CalculateAABox(const zeus::CTransform&) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,8 +3,50 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
const CMaterialList& CRayCastResult::GetMaterial() const
|
||||
|
||||
void CRayCastResult::MakeInvalid()
|
||||
{
|
||||
/* NOTE: CRayCastResult: Enable this if it's required, this is a total guess - Phil */
|
||||
#if 0
|
||||
x0_time = 0.f;
|
||||
x4_point.zeroOut();
|
||||
x10_plane.vec.zeroOut();;
|
||||
x10_plane.d = 0.f;
|
||||
x28_material = CMaterialList();
|
||||
#endif
|
||||
x20_invalid = EInvalid::Invalid;
|
||||
}
|
||||
|
||||
bool CRayCastResult::IsInvalid() const
|
||||
{
|
||||
return x20_invalid == EInvalid::Invalid;
|
||||
}
|
||||
|
||||
float CRayCastResult::GetTime() const
|
||||
{
|
||||
return x0_time;
|
||||
}
|
||||
|
||||
const zeus::CVector3f&CRayCastResult::GetPoint() const
|
||||
{
|
||||
return x4_point;
|
||||
}
|
||||
|
||||
const zeus::CPlane&CRayCastResult::GetPlane() const
|
||||
{
|
||||
return x10_plane;
|
||||
}
|
||||
|
||||
const CMaterialList&CRayCastResult::GetMaterial() const
|
||||
{
|
||||
return x28_material;
|
||||
}
|
||||
|
||||
void CRayCastResult::Transform(const zeus::CTransform& xf)
|
||||
{
|
||||
x4_point = xf * x4_point;
|
||||
x10_plane.vec = xf.rotate(x10_plane.vec);
|
||||
x10_plane.d = x10_plane.vec.dot(x4_point);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,25 +9,37 @@ namespace urde
|
|||
class CRayCastResult
|
||||
{
|
||||
public:
|
||||
enum class EInvalid
|
||||
enum class EInvalid : u8
|
||||
{
|
||||
Zero,
|
||||
One
|
||||
Invalid,
|
||||
Valid
|
||||
};
|
||||
private:
|
||||
EInvalid invalid = EInvalid::Zero;
|
||||
zeus::CVector3f x4_;
|
||||
zeus::CVector3f x10_;
|
||||
float x0_time;
|
||||
zeus::CVector3f x4_point;
|
||||
zeus::CPlane x10_plane;
|
||||
EInvalid x20_invalid = EInvalid::Invalid;
|
||||
/*u32 x24_; */
|
||||
CMaterialList x28_material;
|
||||
public:
|
||||
CRayCastResult();
|
||||
CRayCastResult(const CRayCastResult& other, EInvalid) {}
|
||||
CRayCastResult(const CRayCastResult& other, EInvalid invalid)
|
||||
: x0_time(other.x0_time),
|
||||
x4_point(other.x4_point),
|
||||
x10_plane(other.x10_plane),
|
||||
x20_invalid(invalid),
|
||||
x28_material(other.x28_material)
|
||||
{
|
||||
}
|
||||
|
||||
CRayCastResult(float, const zeus::CVector3f&, const zeus::CPlane& plane, const CMaterialList& matList)
|
||||
: x28_material(matList)
|
||||
{}
|
||||
|
||||
void MakeInvalid();
|
||||
|
||||
bool IsInvalid() const;
|
||||
|
||||
float GetTime() const;
|
||||
const zeus::CVector3f& GetPoint() const;
|
||||
const zeus::CPlane& GetPlane() const;
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit d14a7aed7bd256191ed5bfbbb9a0f9cf4a141796
|
||||
Subproject commit 5352a5842ac0b2b6ba075f2c885fa172a93a54c0
|
Loading…
Reference in New Issue