ksys/phys: Finish QueryContactPointInfo::Iterator

This commit is contained in:
Léo Lam 2022-03-18 21:18:08 +01:00
parent 10ad05ef8e
commit f709a7c612
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
4 changed files with 25 additions and 2 deletions

View File

@ -84010,8 +84010,8 @@ Address,Quality,Size,Name
0x0000007100fc3330,O,000068,_ZN4ksys4phys21QueryContactPointInfo4freeEPS1_
0x0000007100fc3374,O,000004,_ZN4ksys4phys21QueryContactPointInfoD1Ev
0x0000007100fc3378,O,000036,_ZN4ksys4phys21QueryContactPointInfoD0Ev
0x0000007100fc339c,U,000088,QueryContactPointInfo::Iterator::x_1
0x0000007100fc33f4,U,000068,QueryContactPointInfo::Iterator::x_2
0x0000007100fc339c,M,000088,_ZNK4ksys4phys21QueryContactPointInfo8Iterator14getHitPositionEPN4sead7Vector3IfEERKNS0_9ShapeCastE
0x0000007100fc33f4,M,000068,_ZNK4ksys4phys21QueryContactPointInfo8Iterator14getHitPositionERKNS0_9ShapeCastE
0x0000007100fc3438,O,000032,_ZNK4ksys4phys21QueryContactPointInfo8Iterator16getPointPositionEPN4sead7Vector3IfEENS0_16ContactPointInfo8Iterator5PointE
0x0000007100fc3458,O,000056,_ZNK4ksys4phys21QueryContactPointInfo8Iterator16getPointPositionENS0_16ContactPointInfo8Iterator5PointE
0x0000007100fc3490,M,000284,_ZN4ksys4phys7RayCastC1EPNS0_18SystemGroupHandlerENS0_9GroundHitE

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

View File

@ -1,5 +1,6 @@
#include "KingSystem/Physics/System/physQueryContactPointInfo.h"
#include "KingSystem/Physics/System/physContactMgr.h"
#include "KingSystem/Physics/System/physShapeCast.h"
namespace ksys::phys {
@ -17,6 +18,21 @@ void QueryContactPointInfo::free(QueryContactPointInfo* info) {
QueryContactPointInfo::~QueryContactPointInfo() = default;
// NON_MATCHING: reordering
void QueryContactPointInfo::Iterator::getHitPosition(sead::Vector3f* out,
const ShapeCast& shape_cast) const {
float distance = getPoint()->separating_distance;
auto start = shape_cast.getStart();
auto end = shape_cast.getEnd();
*out = start + (end - start) * distance;
}
sead::Vector3f QueryContactPointInfo::Iterator::getHitPosition(const ShapeCast& shape_cast) const {
sead::Vector3f pos;
getHitPosition(&pos, shape_cast);
return pos;
}
void QueryContactPointInfo::Iterator::getPointPosition(sead::Vector3f* out, Point point) const {
out->e = getPoint()->position.e;
}

View File

@ -4,12 +4,17 @@
namespace ksys::phys {
class ShapeCast;
class QueryContactPointInfo : public ContactPointInfo {
public:
class Iterator : public ContactPointInfo::Iterator {
public:
using ContactPointInfo::Iterator::Iterator;
void getHitPosition(sead::Vector3f* out, const ShapeCast& shape_cast) const;
sead::Vector3f getHitPosition(const ShapeCast& shape_cast) const;
void getPointPosition(sead::Vector3f* out, Point point) const override;
sead::Vector3f getPointPosition(Point point) const override;
};

View File

@ -47,6 +47,8 @@ public:
void setRotation(const sead::Matrix33f& rotation_matrix);
void setRotation(const sead::Matrix34f& transform_matrix);
const sead::Vector3f& getStart() const { return mFrom; }
const sead::Vector3f& getEnd() const { return mTo; }
void setStartAndEnd(const sead::Vector3f& start, const sead::Vector3f& end);
void setStartAndDisplacement(const sead::Vector3f& start, const sead::Vector3f& displacement);
void setStartAndDisplacementScaled(const sead::Vector3f& start,