ksys/phys: Start implementing HavokCylinderWaterShape

This commit is contained in:
Léo Lam
2022-02-03 19:16:51 +01:00
parent 3af0c57f95
commit e58c1a4a44
5 changed files with 127 additions and 8 deletions
+2
View File
@@ -63,6 +63,7 @@ add_library(hkStubs OBJECT
Havok/Common/Base/Types/hkRefPtr.h
Havok/Common/Base/Types/hkRefVariant.h
Havok/Common/Base/Types/Geometry/Aabb/hkAabb.h
Havok/Common/Base/Types/Geometry/Aabb/hkAabbUtil.h
Havok/Common/Base/Types/Geometry/Sphere/hkSphere.h
Havok/Common/Base/Types/Physics/hkStepInfo.h
Havok/Common/Base/Types/Physics/ContactPoint/hkContactPointMaterial.h
@@ -103,6 +104,7 @@ add_library(hkStubs OBJECT
Havok/Physics2012/Collide/Filter/hkpShapeCollectionFilter.h
Havok/Physics2012/Collide/Filter/Group/hkpGroupFilter.cpp
Havok/Physics2012/Collide/Filter/Group/hkpGroupFilter.h
Havok/Physics2012/Collide/Query/hkpRayHitCollector.h
Havok/Physics2012/Collide/Query/CastUtil/hkpWorldRayCastInput.h
Havok/Physics2012/Collide/Shape/hkpShape.h
Havok/Physics2012/Collide/Shape/hkpShapeBase.h
@@ -0,0 +1,36 @@
#pragma once
#include <Havok/Common/Base/Types/Geometry/Aabb/hkAabb.h>
namespace hkAabbUtil {
void calcAabb(const hkTransform& localToWorld, const hkVector4& halfExtents,
hkSimdRealParameter extraRadius, hkAabb& aabbOut);
inline void calcAabb(const hkTransform& localToWorld, const hkVector4& halfExtents,
hkSimdRealParameter extraRadius, hkAabb& aabbOut) {
hkVector4 x, y, z;
x.setMul(halfExtents.getComponent<0>(), localToWorld.getRotation().getColumn<0>());
y.setMul(halfExtents.getComponent<1>(), localToWorld.getRotation().getColumn<1>());
z.setMul(halfExtents.getComponent<2>(), localToWorld.getRotation().getColumn<2>());
x.setAbs(x);
y.setAbs(y);
z.setAbs(z);
hkVector4 max;
z.setAdd(z, extraRadius);
max.setAdd(x, y);
max.add(z);
hkVector4 min;
min.setNeg<4>(max);
max.add(localToWorld.getTranslation());
min.add(localToWorld.getTranslation());
aabbOut.m_max = max;
aabbOut.m_min = min;
}
} // namespace hkAabbUtil
@@ -0,0 +1,31 @@
#pragma once
#include <Havok/Common/Base/hkBase.h>
#include <Havok/Physics2012/Collide/Shape/hkpShapeBase.h>
class hkpCdBody;
struct hkpShapeRayCastCollectorOutput;
class hkpRayHitCollector {
public:
inline hkpRayHitCollector();
virtual void addRayHit(const hkpCdBody& cdBody,
const hkpShapeRayCastCollectorOutput& hitInfo) = 0;
inline void reset();
virtual ~hkpRayHitCollector() = default;
static int shapeKeysFromCdBody(hkpShapeKey* buf, int maxKeys, const hkpCdBody& body);
hkReal m_earlyOutHitFraction;
};
inline hkpRayHitCollector::hkpRayHitCollector() {
reset();
}
inline void hkpRayHitCollector::reset() {
m_earlyOutHitFraction = 1.f;
}