mirror of https://github.com/zeldaret/botw.git
ksys/phys: Add TeraMeshRigidBodyResource
This commit is contained in:
parent
8a9fb5d10c
commit
5ffa9564ca
|
@ -95394,15 +95394,15 @@ Address,Quality,Size,Name
|
|||
0x00000071012b1218,U,000204,
|
||||
0x00000071012b12e4,U,000092,
|
||||
0x00000071012b1340,U,000008,
|
||||
0x00000071012b1348,U,000096,
|
||||
0x00000071012b13a8,U,000096,
|
||||
0x00000071012b1408,U,000104,
|
||||
0x00000071012b1470,U,000104,
|
||||
0x00000071012b14d8,U,000140,
|
||||
0x00000071012b1564,U,000008,
|
||||
0x00000071012b156c,U,000092,
|
||||
0x00000071012b15c8,U,000008,
|
||||
0x00000071012b15d0,U,000372,
|
||||
0x00000071012b1348,O,000096,_ZN4ksys4phys25TeraMeshRigidBodyResourceD1Ev
|
||||
0x00000071012b13a8,O,000096,_ZThn32_N4ksys4phys25TeraMeshRigidBodyResourceD1Ev
|
||||
0x00000071012b1408,O,000104,_ZN4ksys4phys25TeraMeshRigidBodyResourceD0Ev
|
||||
0x00000071012b1470,O,000104,_ZThn32_N4ksys4phys25TeraMeshRigidBodyResourceD0Ev
|
||||
0x00000071012b14d8,O,000140,_ZN4ksys4phys25TeraMeshRigidBodyResource6parse_EPhmPN4sead4HeapE
|
||||
0x00000071012b1564,O,000008,_ZNK4ksys4phys25TeraMeshRigidBodyResource27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x00000071012b156c,O,000092,_ZNK4ksys4phys25TeraMeshRigidBodyResource18getRuntimeTypeInfoEv
|
||||
0x00000071012b15c8,O,000008,_ZNK4ksys4phys25TeraMeshRigidBodyResource10needsParseEv
|
||||
0x00000071012b15d0,O,000372,_ZN4ksys4phys25TeraMeshRigidBodyResource33checkDerivedRuntimeTypeInfoStaticEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x00000071012b1744,U,000048,
|
||||
0x00000071012b1774,U,000004,
|
||||
0x00000071012b1778,U,000004,
|
||||
|
|
Can't render this file because it is too large.
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
class hkpRigidBody : public hkpEntity {
|
||||
public:
|
||||
HK_DECLARE_CLASS_ALLOCATOR(hkpRigidBody)
|
||||
HK_DECLARE_REFLECTION()
|
||||
|
||||
virtual ~hkpRigidBody();
|
||||
void enableDeactivation(bool _enableDeactivation);
|
||||
};
|
||||
|
|
|
@ -35,6 +35,10 @@ target_sources(uking PRIVATE
|
|||
RigidBody/Shape/physSphereShape.h
|
||||
RigidBody/Shape/physWaterCylinderShape.cpp
|
||||
RigidBody/Shape/physWaterCylinderShape.h
|
||||
RigidBody/TeraMesh/physTeraMeshRigidBody.cpp
|
||||
RigidBody/TeraMesh/physTeraMeshRigidBody.h
|
||||
RigidBody/TeraMesh/physTeraMeshRigidBodyResource.cpp
|
||||
RigidBody/TeraMesh/physTeraMeshRigidBodyResource.h
|
||||
|
||||
StaticCompound/physStaticCompound.cpp
|
||||
StaticCompound/physStaticCompound.h
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
#include "KingSystem/Physics/RigidBody/TeraMesh/physTeraMeshRigidBody.h"
|
|
@ -0,0 +1,13 @@
|
|||
#pragma once
|
||||
|
||||
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
// FIXME
|
||||
class TeraMeshRigidBody : public RigidBody {
|
||||
public:
|
||||
TeraMeshRigidBody(hkpRigidBody* hk_body, sead::Heap* heap);
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
|
@ -0,0 +1,29 @@
|
|||
#include "KingSystem/Physics/RigidBody/TeraMesh/physTeraMeshRigidBodyResource.h"
|
||||
#include <Havok/Common/Serialize/Util/hkNativePackfileUtils.h>
|
||||
#include <Havok/Common/Serialize/Util/hkRootLevelContainer.h>
|
||||
#include <Havok/Physics2012/Dynamics/Entity/hkpRigidBody.h>
|
||||
#include "KingSystem/Physics/RigidBody/TeraMesh/physTeraMeshRigidBody.h"
|
||||
#include "KingSystem/Utils/Debug.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
TeraMeshRigidBodyResource::~TeraMeshRigidBodyResource() {
|
||||
delete mRigidBody;
|
||||
if (mHkpRigidBody)
|
||||
hkNativePackfileUtils::unloadInPlace(getRawData(), int(getRawSize()));
|
||||
}
|
||||
|
||||
bool TeraMeshRigidBodyResource::parse_(u8* data, size_t size, sead::Heap* heap) {
|
||||
const char* error = nullptr;
|
||||
auto* container = static_cast<hkRootLevelContainer*>(
|
||||
hkNativePackfileUtils::loadInPlace(getRawData(), int(getRawSize()), nullptr, &error));
|
||||
if (!container) {
|
||||
util::PrintDebugFmt("failed to load TeraMeshRigidBody resource: %s", error);
|
||||
}
|
||||
|
||||
mHkpRigidBody = container->findObject<hkpRigidBody>();
|
||||
mRigidBody = new (heap) TeraMeshRigidBody(mHkpRigidBody, heap);
|
||||
return mRigidBody != nullptr;
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include "KingSystem/Resource/resResource.h"
|
||||
|
||||
class hkpRigidBody;
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
class TeraMeshRigidBody;
|
||||
|
||||
class TeraMeshRigidBodyResource : public res::Resource {
|
||||
SEAD_RTTI_OVERRIDE(TeraMeshRigidBodyResource, res::Resource)
|
||||
|
||||
public:
|
||||
TeraMeshRigidBodyResource() = default;
|
||||
~TeraMeshRigidBodyResource() override;
|
||||
|
||||
hkpRigidBody* getHkpRigidBody() const { return mHkpRigidBody; }
|
||||
TeraMeshRigidBody* getRigidBody() const { return mRigidBody; }
|
||||
|
||||
bool needsParse() const override { return true; }
|
||||
bool parse_(u8* data, size_t size, sead::Heap* heap) override;
|
||||
|
||||
private:
|
||||
hkpRigidBody* mHkpRigidBody = nullptr;
|
||||
TeraMeshRigidBody* mRigidBody = nullptr;
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
|
@ -99,8 +99,7 @@ private:
|
|||
MotionAccessor* mMotionAccessor = nullptr;
|
||||
u16 _c0 = 0;
|
||||
void* _c8 = nullptr;
|
||||
void* _d0;
|
||||
};
|
||||
KSYS_CHECK_SIZE_NX150(RigidBody, 0xD8);
|
||||
KSYS_CHECK_SIZE_NX150(RigidBody, 0xD0);
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
Loading…
Reference in New Issue