metaforce/Runtime/Collision/CJointCollisionDescription.hpp

93 lines
3.1 KiB
C++
Raw Permalink Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2017-03-01 03:42:06 +00:00
#include <string>
#include "Runtime/Character/CSegId.hpp"
#include <zeus/CAABox.hpp>
#include <zeus/CVector3f.hpp>
2017-03-01 03:42:06 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2019-06-10 08:28:33 +00:00
struct SJointInfo {
const char* from;
const char* to;
float radius;
float separation;
};
2019-12-14 23:50:29 +00:00
struct SAABoxJointInfo {
const char* name;
zeus::CVector3f extents;
};
2018-12-31 08:37:52 +00:00
struct SOBBJointInfo {
2018-12-08 05:30:43 +00:00
const char* from;
const char* to;
zeus::CVector3f bounds;
2018-12-04 02:31:15 +00:00
};
2019-11-09 23:48:46 +00:00
struct SOBBRadiiJointInfo {
const char* from;
const char* to;
float radius;
};
2018-12-31 08:37:52 +00:00
struct SSphereJointInfo {
2018-12-08 05:30:43 +00:00
const char* name;
float radius;
2018-12-04 02:31:15 +00:00
};
2018-12-08 05:30:43 +00:00
class CJointCollisionDescription {
2017-03-01 03:42:06 +00:00
public:
2018-12-08 05:30:43 +00:00
enum class ECollisionType {
Sphere,
SphereSubdivide,
AABox,
OBBAutoSize,
OBB,
};
2017-03-01 03:42:06 +00:00
2018-12-08 05:30:43 +00:00
enum class EOrientationType { Zero, One };
2017-03-01 03:42:06 +00:00
private:
2018-12-08 05:30:43 +00:00
ECollisionType x0_colType;
EOrientationType x4_orientType;
CSegId x8_pivotId;
CSegId x9_nextId;
zeus::CVector3f xc_bounds;
zeus::CVector3f x18_pivotPoint;
float x24_radius;
float x28_maxSeparation;
std::string x2c_name;
TUniqueId x3c_actorId = kInvalidUniqueId;
float x40_mass;
2017-03-26 04:12:06 +00:00
2017-03-01 03:42:06 +00:00
public:
2018-12-08 05:30:43 +00:00
CJointCollisionDescription(ECollisionType, CSegId, CSegId, const zeus::CVector3f&, const zeus::CVector3f&, float,
float, EOrientationType, std::string_view, float);
static CJointCollisionDescription SphereSubdivideCollision(CSegId pivotId, CSegId nextId, float radius,
float maxSeparation, EOrientationType orientType,
std::string_view name, float mass);
static CJointCollisionDescription SphereCollision(CSegId pivotId, float radius, std::string_view name, float mass);
static CJointCollisionDescription AABoxCollision(CSegId pivotId, const zeus::CVector3f& bounds, std::string_view name,
float mass);
static CJointCollisionDescription OBBAutoSizeCollision(CSegId pivotId, CSegId nextId, const zeus::CVector3f& bounds,
EOrientationType orientType, std::string_view, float mass);
static CJointCollisionDescription OBBCollision(CSegId pivotId, const zeus::CVector3f& bounds,
const zeus::CVector3f& pivotPoint, std::string_view name, float mass);
std::string_view GetName() const { return x2c_name; }
TUniqueId GetCollisionActorId() const { return x3c_actorId; }
void SetCollisionActorId(TUniqueId id) { x3c_actorId = id; }
const zeus::CVector3f& GetBounds() const { return xc_bounds; }
float GetRadius() const { return x24_radius; }
float GetMaxSeparation() const { return x28_maxSeparation; }
EOrientationType GetOrientationType() const { return x4_orientType; }
float GetMass() const { return x40_mass; }
const zeus::CVector3f& GetPivotPoint() const { return x18_pivotPoint; }
ECollisionType GetType() const { return x0_colType; }
CSegId GetNextId() const { return x9_nextId; }
CSegId GetPivotId() const { return x8_pivotId; }
void ScaleAllBounds(const zeus::CVector3f& scale);
2017-03-01 03:42:06 +00:00
};
2021-04-10 08:42:06 +00:00
} // namespace metaforce