ksys/phys: Rename RigidContactPointsEx::Point to ContactPoint

It's not just used in RigidContactPointsEx::Point.
This commit is contained in:
Léo Lam 2022-01-04 18:23:10 +01:00
parent 6511ecd711
commit 8cf2def97c
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
4 changed files with 39 additions and 34 deletions

View File

@ -84310,8 +84310,8 @@ Address,Quality,Size,Name
0x0000007100fcfc0c,O,000168,_ZN4ksys4phys20RigidContactPointsEx10freePointsEv 0x0000007100fcfc0c,O,000168,_ZN4ksys4phys20RigidContactPointsEx10freePointsEv
0x0000007100fcfcb4,O,000260,_ZNK4ksys4phys20RigidContactPointsEx8Iterator7getDataEPN4sead7Vector3IfEENS2_4ModeE 0x0000007100fcfcb4,O,000260,_ZNK4ksys4phys20RigidContactPointsEx8Iterator7getDataEPN4sead7Vector3IfEENS2_4ModeE
0x0000007100fcfdb8,O,000048,_ZNK4ksys4phys20RigidContactPointsEx8Iterator7getDataENS2_4ModeE 0x0000007100fcfdb8,O,000048,_ZNK4ksys4phys20RigidContactPointsEx8Iterator7getDataENS2_4ModeE
0x0000007100fcfde8,O,000068,_ZN4ksys4phys20RigidContactPointsEx8IteratorC1ERKN4sead6BufferIPNS1_5PointEEEi 0x0000007100fcfde8,O,000068,_ZN4ksys4phys20RigidContactPointsEx8IteratorC1ERKN4sead6BufferIPNS0_12ContactPointEEEi
0x0000007100fcfe2c,O,000028,_ZN4ksys4phys20RigidContactPointsEx11IteratorEndC1ERKN4sead6BufferIPNS1_5PointEEEi 0x0000007100fcfe2c,O,000028,_ZN4ksys4phys20RigidContactPointsEx11IteratorEndC1ERKN4sead6BufferIPNS0_12ContactPointEEEi
0x0000007100fcfe48,U,000112, 0x0000007100fcfe48,U,000112,
0x0000007100fcfeb8,U,000072, 0x0000007100fcfeb8,U,000072,
0x0000007100fcff00,U,000692, 0x0000007100fcff00,U,000692,

Can't render this file because it is too large.

View File

@ -13,6 +13,7 @@
#include <thread/seadAtomic.h> #include <thread/seadAtomic.h>
#include <thread/seadMutex.h> #include <thread/seadMutex.h>
#include "KingSystem/Physics/System/physDefines.h" #include "KingSystem/Physics/System/physDefines.h"
#include "KingSystem/Utils/Types.h"
namespace sead { namespace sead {
class Heap; class Heap;
@ -42,6 +43,29 @@ struct ContactInfoTable {
sead::Buffer<Receiver> receivers; sead::Buffer<Receiver> receivers;
}; };
// XXX: what exactly is this? Is this really a contact point?
struct ContactPoint {
enum class Flag {
_1 = 1 << 0,
_2 = 1 << 1,
};
void* _0;
void* _8;
sead::Vector3f _10;
sead::Vector3f _1c;
float scale;
void* _30;
void* _38;
void* _40;
void* _48;
void* _50;
void* _58;
void* _60;
sead::TypedBitFlag<Flag, u8> flags;
};
KSYS_CHECK_SIZE_NX150(ContactPoint, 0x70);
class ContactMgr : public sead::hostio::Node { class ContactMgr : public sead::hostio::Node {
public: public:
ContactMgr(); ContactMgr();

View File

@ -1,4 +1,5 @@
#include "KingSystem/Physics/System/physRigidContactPointsEx.h" #include "KingSystem/Physics/System/physRigidContactPointsEx.h"
#include "KingSystem/Physics/System/physContactMgr.h"
#include "KingSystem/Physics/System/physMemSystem.h" #include "KingSystem/Physics/System/physMemSystem.h"
namespace ksys::phys { namespace ksys::phys {
@ -66,14 +67,14 @@ void RigidContactPointsEx::Iterator::getData(sead::Vector3f* out,
switch (mode) { switch (mode) {
case Mode::_0: { case Mode::_0: {
if (getPoint()->flags.isOn(Point::Flag::_2)) if (getPoint()->flags.isOn(ContactPoint::Flag::_2))
return; return;
*out += getPoint()->_1c * -scale; *out += getPoint()->_1c * -scale;
break; break;
} }
case Mode::_1: { case Mode::_1: {
if (!getPoint()->flags.isOn(Point::Flag::_2)) if (!getPoint()->flags.isOn(ContactPoint::Flag::_2))
return; return;
*out += getPoint()->_1c * scale; *out += getPoint()->_1c * scale;
break; break;
@ -97,7 +98,7 @@ RigidContactPointsEx::Iterator::getData(RigidContactPointsEx::Iterator::Mode mod
RigidContactPointsEx::Iterator::Iterator(const RigidContactPointsEx::Points& points, int count) RigidContactPointsEx::Iterator::Iterator(const RigidContactPointsEx::Points& points, int count)
: mPoints(points.getBufferPtr()), mPointsNum(count), mPointsStart(points.getBufferPtr()) { : mPoints(points.getBufferPtr()), mPointsNum(count), mPointsStart(points.getBufferPtr()) {
for (int i = 0; i != count; ++i) { for (int i = 0; i != count; ++i) {
if (!mPoints[i]->flags.isOn(Point::Flag::_1)) if (!mPoints[i]->flags.isOn(ContactPoint::Flag::_1))
break; break;
++mIdx; ++mIdx;
} }

View File

@ -9,32 +9,12 @@
namespace ksys::phys { namespace ksys::phys {
struct ContactPoint;
// FIXME: rename. This should be below SensorGroupFilter and StaticCompound stuff // FIXME: rename. This should be below SensorGroupFilter and StaticCompound stuff
class RigidContactPointsEx : public IRigidContactPoints { class RigidContactPointsEx : public IRigidContactPoints {
public: public:
struct Point { using Points = sead::Buffer<ContactPoint*>;
enum class Flag {
_1 = 1 << 0,
_2 = 1 << 1,
};
void* _0;
void* _8;
sead::Vector3f _10;
sead::Vector3f _1c;
float scale;
void* _30;
void* _38;
void* _40;
void* _48;
void* _50;
void* _58;
void* _60;
sead::TypedBitFlag<Flag, u8> flags;
};
KSYS_CHECK_SIZE_NX150(Point, 0x70);
using Points = sead::Buffer<Point*>;
class IteratorEnd; class IteratorEnd;
@ -57,8 +37,8 @@ public:
void getData(sead::Vector3f* out, Mode mode) const; void getData(sead::Vector3f* out, Mode mode) const;
sead::Vector3f getData(Mode mode) const; sead::Vector3f getData(Mode mode) const;
const Point* getPoint() const { return mPoints[mIdx]; } const ContactPoint* getPoint() const { return mPoints[mIdx]; }
const Point* operator*() const { return getPoint(); } const ContactPoint* operator*() const { return getPoint(); }
friend bool operator==(const Iterator& lhs, const Iterator& rhs) { friend bool operator==(const Iterator& lhs, const Iterator& rhs) {
return lhs.mIdx == rhs.mIdx; return lhs.mIdx == rhs.mIdx;
@ -71,9 +51,9 @@ public:
friend class IteratorEnd; friend class IteratorEnd;
int mIdx = 0; int mIdx = 0;
const Point* const* mPoints = nullptr; const ContactPoint* const* mPoints = nullptr;
int mPointsNum = 0; int mPointsNum = 0;
const Point* const* mPointsStart = nullptr; const ContactPoint* const* mPointsStart = nullptr;
}; };
class IteratorEnd { class IteratorEnd {
@ -95,9 +75,9 @@ public:
private: private:
int mIdx = 0; int mIdx = 0;
const Point* const* mPoints = nullptr; const ContactPoint* const* mPoints = nullptr;
int mPointsNum = 0; int mPointsNum = 0;
const Point* const* mPointsStart = nullptr; const ContactPoint* const* mPointsStart = nullptr;
}; };
static RigidContactPointsEx* make(sead::Heap* heap, int num, int num2, static RigidContactPointsEx* make(sead::Heap* heap, int num, int num2,