metaforce/Runtime/Collision/CJointCollisionDescription.cpp

62 lines
3.5 KiB
C++
Raw Normal View History

2017-03-01 03:42:06 +00:00
#include "Collision/CJointCollisionDescription.hpp"
2018-12-08 05:30:43 +00:00
namespace urde {
2017-03-01 03:42:06 +00:00
2018-11-13 09:20:11 +00:00
CJointCollisionDescription::CJointCollisionDescription(ECollisionType colType, CSegId pivotId, CSegId nextId,
const zeus::CVector3f& bounds, const zeus::CVector3f& pivotPoint,
float radius, float maxSeparation, EOrientationType orientType,
std::string_view name, float mass)
: x0_colType(colType)
, x4_orientType(orientType)
2018-11-13 09:20:11 +00:00
, x8_pivotId(pivotId)
, x9_nextId(nextId)
, xc_bounds(bounds)
, x18_pivotPoint(pivotPoint)
, x24_radius(radius)
, x28_maxSeparation(maxSeparation)
, x2c_name(name)
2018-12-08 05:30:43 +00:00
, x40_mass(mass) {}
2017-03-26 04:12:06 +00:00
2018-12-08 05:30:43 +00:00
CJointCollisionDescription CJointCollisionDescription::SphereSubdivideCollision(CSegId pivotId, CSegId nextId,
float radius, float maxSeparation,
EOrientationType orientType,
std::string_view name, float mass) {
return CJointCollisionDescription(ECollisionType::SphereSubdivide, pivotId, nextId, zeus::CVector3f::skZero,
zeus::CVector3f::skZero, radius, maxSeparation, orientType, name, mass);
}
2018-12-08 05:30:43 +00:00
CJointCollisionDescription CJointCollisionDescription::SphereCollision(CSegId pivotId, float radius,
std::string_view name, float mass) {
return CJointCollisionDescription(ECollisionType::Sphere, pivotId, {}, zeus::CVector3f::skZero,
zeus::CVector3f::skZero, radius, 0.f, EOrientationType::Zero, name, mass);
}
2017-03-26 04:12:06 +00:00
2018-12-08 05:30:43 +00:00
CJointCollisionDescription CJointCollisionDescription::AABoxCollision(CSegId pivotId, const zeus::CVector3f& bounds,
std::string_view name, float mass) {
return CJointCollisionDescription(ECollisionType::AABox, pivotId, {}, bounds, zeus::CVector3f::skZero, 0.f, 0.f,
EOrientationType::Zero, name, mass);
}
2018-12-08 05:30:43 +00:00
CJointCollisionDescription CJointCollisionDescription::OBBAutoSizeCollision(CSegId pivotId, CSegId nextId,
const zeus::CVector3f& bounds,
EOrientationType orientType,
std::string_view name, float mass) {
return CJointCollisionDescription(ECollisionType::OBBAutoSize, pivotId, nextId, bounds, zeus::CVector3f::skZero, 0.f,
0.f, orientType, name, mass);
2018-11-13 09:20:11 +00:00
}
2018-12-08 05:30:43 +00:00
CJointCollisionDescription CJointCollisionDescription::OBBCollision(CSegId pivotId, const zeus::CVector3f& bounds,
const zeus::CVector3f& pivotPoint,
std::string_view name, float mass) {
return CJointCollisionDescription(ECollisionType::OBB, pivotId, {}, bounds, pivotPoint, 0.f, 0.f,
EOrientationType::Zero, name, mass);
}
2017-05-07 06:55:01 +00:00
2018-12-08 05:30:43 +00:00
void CJointCollisionDescription::ScaleAllBounds(const zeus::CVector3f& scale) {
xc_bounds *= scale;
x24_radius *= scale.x();
x28_maxSeparation *= scale.x();
x18_pivotPoint *= scale;
2017-03-01 03:42:06 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace urde