mirror of https://github.com/zeldaret/botw.git
ksys/phys: Declare factory functions for SphereShape/SphereRigidBody
This commit is contained in:
parent
cc3d3ad03d
commit
4a1bb88bd5
|
@ -68,6 +68,8 @@ target_sources(uking PRIVATE
|
|||
RigidBody/Shape/Polytope/physPolytopeRigidBody.h
|
||||
RigidBody/Shape/Polytope/physPolytopeShape.cpp
|
||||
RigidBody/Shape/Polytope/physPolytopeShape.h
|
||||
RigidBody/Shape/Sphere/physSphereRigidBody.cpp
|
||||
RigidBody/Shape/Sphere/physSphereRigidBody.h
|
||||
RigidBody/Shape/Sphere/physSphereShape.cpp
|
||||
RigidBody/Shape/Sphere/physSphereShape.h
|
||||
RigidBody/Shape/physShape.h
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Physics/RigidBody/Shape/Sphere/physSphereRigidBody.h"
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBodyFromShape.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
class SphereRigidBody : public RigidBodyFromShape {
|
||||
SEAD_RTTI_OVERRIDE(SphereRigidBody, RigidBodyFromShape)
|
||||
public:
|
||||
static SphereRigidBody* make(RigidBodyInstanceParam* param, sead::Heap* heap);
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Physics/RigidBody/Shape/Sphere/physSphereShape.h"
|
|
@ -9,20 +9,18 @@ namespace ksys::phys {
|
|||
|
||||
class SphereParam;
|
||||
|
||||
struct SphereShape {
|
||||
virtual ~SphereShape();
|
||||
|
||||
RigidBody* createBody(bool flag, const RigidBodyInstanceParam& params, sead::Heap* heap);
|
||||
};
|
||||
|
||||
struct SphereShapeParam {
|
||||
SphereShape* createShape(sead::Heap* heap);
|
||||
|
||||
sead::Vector3f translate;
|
||||
float radius;
|
||||
CommonShapeParam common;
|
||||
};
|
||||
|
||||
class SphereShape : public Shape {
|
||||
SEAD_RTTI_OVERRIDE(SphereShape, Shape)
|
||||
public:
|
||||
static SphereShape* make(const SphereShapeParam& param, sead::Heap* heap);
|
||||
};
|
||||
|
||||
class SphereParam : public RigidBodyInstanceParam {
|
||||
SEAD_RTTI_OVERRIDE(SphereParam, RigidBodyInstanceParam)
|
||||
public:
|
||||
|
|
|
@ -23,13 +23,8 @@ static RigidBodyType* createRigidBody(RigidBodyInstanceParam* param, sead::Heap*
|
|||
return RigidBodyFromShape::make<RigidBodyType, ShapeType>(*shape, true, *param, heap);
|
||||
}
|
||||
|
||||
RigidBody* RigidBodyFactory::createSphere(RigidBodyInstanceParam* params, sead::Heap* heap) {
|
||||
if (params->isDynamicSensor())
|
||||
params->motion_type = MotionType::Keyframed;
|
||||
|
||||
auto* v = sead::DynamicCast<SphereParam>(params);
|
||||
auto* shape = v->shape.createShape(heap);
|
||||
return shape->createBody(true, *params, heap);
|
||||
SphereRigidBody* RigidBodyFactory::createSphere(RigidBodyInstanceParam* params, sead::Heap* heap) {
|
||||
return createRigidBody<SphereRigidBody, SphereShape, SphereParam>(params, heap);
|
||||
}
|
||||
|
||||
CapsuleRigidBody* RigidBodyFactory::createCapsule(RigidBodyInstanceParam* params,
|
||||
|
|
|
@ -16,10 +16,11 @@ class CylinderWaterRigidBody;
|
|||
class PolytopeRigidBody;
|
||||
class RigidBody;
|
||||
struct RigidBodyInstanceParam;
|
||||
class SphereRigidBody;
|
||||
|
||||
class RigidBodyFactory {
|
||||
public:
|
||||
static RigidBody* createSphere(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static SphereRigidBody* createSphere(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static CapsuleRigidBody* createCapsule(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static CylinderRigidBody* createCylinder(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||
static CylinderWaterRigidBody* createCylinderWater(RigidBodyInstanceParam* params,
|
||||
|
|
Loading…
Reference in New Issue