Havok: Add hkpBoxShape

This commit is contained in:
Léo Lam 2022-01-30 19:36:08 +01:00
parent ff2e2f9ff7
commit 3a2ba7a23a
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
3 changed files with 47 additions and 0 deletions

View File

@ -109,6 +109,7 @@ add_library(hkStubs OBJECT
Havok/Physics2012/Collide/Shape/Compound/Tree/hkpBvTreeShape.h
Havok/Physics2012/Collide/Shape/Compound/Tree/Mopp/hkpMoppBvTreeShape.h
Havok/Physics2012/Collide/Shape/Convex/hkpConvexShape.h
Havok/Physics2012/Collide/Shape/Convex/Box/hkpBoxShape.h
Havok/Physics2012/Collide/Shape/Convex/Capsule/hkpCapsuleShape.h
Havok/Physics2012/Collide/Shape/HeightField/hkpSphereRepShape.h
Havok/Physics2012/Collide/Shape/Query/hkpRayShapeCollectionFilter.h

View File

@ -0,0 +1,44 @@
#pragma once
#include <Havok/Physics2012/Collide/Shape/Convex/hkpConvexShape.h>
/// A simple box shape centered around the origin.
class hkpBoxShape : public hkpConvexShape {
public:
HK_DECLARE_CLASS_ALLOCATOR(hkpBoxShape)
HK_DECLARE_REFLECTION()
HKCD_DECLARE_SHAPE_TYPE(hkcdShapeType::BOX)
public:
hkpBoxShape() {}
explicit hkpBoxShape(const hkVector4& halfExtents, hkReal radius = hkConvexShapeDefaultRadius);
explicit hkpBoxShape(hkFinishLoadedObjectFlag flag);
~hkpBoxShape() override;
void getSupportingVertex(hkVector4Parameter direction,
hkcdVertex& supportingVertexOut) const override;
void convertVertexIdsToVertices(const hkpVertexId* ids, int numIds,
hkcdVertex* verticesOut) const override;
void getCentre(hkVector4& centreOut) const override;
int getNumCollisionSpheres() const override;
const hkSphere* getCollisionSpheres(hkSphere* sphereBuffer) const override;
void getAabb(const hkTransform& localToWorld, hkReal tolerance, hkAabb& out) const override;
hkBool castRay(const hkpShapeRayCastInput& input,
hkpShapeRayCastOutput& results) const override;
void getFirstVertex(hkVector4& v) const override;
inline const hkVector4& getHalfExtents() const;
void setHalfExtents(const hkVector4& halfExtents);
protected:
hkVector4 m_halfExtents;
};
inline int hkpBoxShape::getNumCollisionSpheres() const {
return 0;
}
inline const hkVector4& hkpBoxShape::getHalfExtents() const {
return m_halfExtents;
}

View File

@ -4,6 +4,8 @@
#include <Havok/Physics2012/Collide/Shape/HeightField/hkpSphereRepShape.h>
#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
extern hkReal hkConvexShapeDefaultRadius;
class hkpConvexShape : public hkpSphereRepShape {
public:
HK_DECLARE_CLASS_ALLOCATOR(hkpConvexShape)