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/physPolytopeRigidBody.h
|
||||||
RigidBody/Shape/Polytope/physPolytopeShape.cpp
|
RigidBody/Shape/Polytope/physPolytopeShape.cpp
|
||||||
RigidBody/Shape/Polytope/physPolytopeShape.h
|
RigidBody/Shape/Polytope/physPolytopeShape.h
|
||||||
|
RigidBody/Shape/Sphere/physSphereRigidBody.cpp
|
||||||
|
RigidBody/Shape/Sphere/physSphereRigidBody.h
|
||||||
RigidBody/Shape/Sphere/physSphereShape.cpp
|
RigidBody/Shape/Sphere/physSphereShape.cpp
|
||||||
RigidBody/Shape/Sphere/physSphereShape.h
|
RigidBody/Shape/Sphere/physSphereShape.h
|
||||||
RigidBody/Shape/physShape.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;
|
class SphereParam;
|
||||||
|
|
||||||
struct SphereShape {
|
|
||||||
virtual ~SphereShape();
|
|
||||||
|
|
||||||
RigidBody* createBody(bool flag, const RigidBodyInstanceParam& params, sead::Heap* heap);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SphereShapeParam {
|
struct SphereShapeParam {
|
||||||
SphereShape* createShape(sead::Heap* heap);
|
|
||||||
|
|
||||||
sead::Vector3f translate;
|
sead::Vector3f translate;
|
||||||
float radius;
|
float radius;
|
||||||
CommonShapeParam common;
|
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 {
|
class SphereParam : public RigidBodyInstanceParam {
|
||||||
SEAD_RTTI_OVERRIDE(SphereParam, RigidBodyInstanceParam)
|
SEAD_RTTI_OVERRIDE(SphereParam, RigidBodyInstanceParam)
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -23,13 +23,8 @@ static RigidBodyType* createRigidBody(RigidBodyInstanceParam* param, sead::Heap*
|
||||||
return RigidBodyFromShape::make<RigidBodyType, ShapeType>(*shape, true, *param, heap);
|
return RigidBodyFromShape::make<RigidBodyType, ShapeType>(*shape, true, *param, heap);
|
||||||
}
|
}
|
||||||
|
|
||||||
RigidBody* RigidBodyFactory::createSphere(RigidBodyInstanceParam* params, sead::Heap* heap) {
|
SphereRigidBody* RigidBodyFactory::createSphere(RigidBodyInstanceParam* params, sead::Heap* heap) {
|
||||||
if (params->isDynamicSensor())
|
return createRigidBody<SphereRigidBody, SphereShape, SphereParam>(params, heap);
|
||||||
params->motion_type = MotionType::Keyframed;
|
|
||||||
|
|
||||||
auto* v = sead::DynamicCast<SphereParam>(params);
|
|
||||||
auto* shape = v->shape.createShape(heap);
|
|
||||||
return shape->createBody(true, *params, heap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CapsuleRigidBody* RigidBodyFactory::createCapsule(RigidBodyInstanceParam* params,
|
CapsuleRigidBody* RigidBodyFactory::createCapsule(RigidBodyInstanceParam* params,
|
||||||
|
|
|
@ -16,10 +16,11 @@ class CylinderWaterRigidBody;
|
||||||
class PolytopeRigidBody;
|
class PolytopeRigidBody;
|
||||||
class RigidBody;
|
class RigidBody;
|
||||||
struct RigidBodyInstanceParam;
|
struct RigidBodyInstanceParam;
|
||||||
|
class SphereRigidBody;
|
||||||
|
|
||||||
class RigidBodyFactory {
|
class RigidBodyFactory {
|
||||||
public:
|
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 CapsuleRigidBody* createCapsule(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||||
static CylinderRigidBody* createCylinder(RigidBodyInstanceParam* params, sead::Heap* heap);
|
static CylinderRigidBody* createCylinder(RigidBodyInstanceParam* params, sead::Heap* heap);
|
||||||
static CylinderWaterRigidBody* createCylinderWater(RigidBodyInstanceParam* params,
|
static CylinderWaterRigidBody* createCylinderWater(RigidBodyInstanceParam* params,
|
||||||
|
|
Loading…
Reference in New Issue