diff options
| author | Léo Lam <leo@leolam.fr> | 2022-01-06 02:25:15 +0100 |
|---|---|---|
| committer | Léo Lam <leo@leolam.fr> | 2022-01-06 12:13:25 +0100 |
| commit | 2d1ffdf6d25b9e2cefac4e271fd95d01c0b9a3b7 (patch) | |
| tree | 1f01cbb9e8883926393105ed47ac1da97e00bfd9 /src | |
| parent | a859b356e694c73c034fcd467781a9a9491aa88b (diff) | |
ksys/phys: Add StaticCompoundInfo
Diffstat (limited to 'src')
3 files changed, 147 insertions, 0 deletions
diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index c8c96c9f..e46286fd 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -34,6 +34,8 @@ target_sources(uking PRIVATE StaticCompound/physStaticCompound.h StaticCompound/physStaticCompoundFieldBodyGroup.cpp StaticCompound/physStaticCompoundFieldBodyGroup.h + StaticCompound/physStaticCompoundInfo.cpp + StaticCompound/physStaticCompoundInfo.h SupportBone/physSupportBoneParam.cpp SupportBone/physSupportBoneParam.h diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundInfo.cpp b/src/KingSystem/Physics/StaticCompound/physStaticCompoundInfo.cpp new file mode 100644 index 00000000..e2dd888e --- /dev/null +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundInfo.cpp @@ -0,0 +1,104 @@ +#include "KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h" +#include <Havok/Common/Base/Reflection/hkClass.h> +#include <Havok/Common/Base/Reflection/hkClassMember.h> +#include <Havok/Common/Base/Reflection/hkTypeInfo.h> +#include <array> + +namespace ksys::phys { + +// Reflection data is normally autogenerated with a Havok script and type parser, +// but considering we only have 3 classes it's easier to just write the data manually. + +// ShapeInfo + +static constexpr hkClassMember ShapeInfo_Members[] = { + {"ActorInfoIndex", nullptr, nullptr, hkClassMember::Type::TYPE_INT32, + hkClassMember::Type::TYPE_VOID, 0, 0, 0, nullptr}, + {"InstanceId", nullptr, nullptr, hkClassMember::Type::TYPE_INT32, + hkClassMember::Type::TYPE_VOID, 0, 0, 4, nullptr}, + {"BodyGroup", nullptr, nullptr, hkClassMember::Type::TYPE_INT8, hkClassMember::Type::TYPE_VOID, + 0, 0, 8, nullptr}, + {"BodyLayerType", nullptr, nullptr, hkClassMember::Type::TYPE_UINT8, + hkClassMember::Type::TYPE_VOID, 0, 0, 9, nullptr}, +}; + +const hkClass ShapeInfo_Class{ + "ShapeInfo", + nullptr, + sizeof(ShapeInfo), + nullptr, + 0, + nullptr, + 0, + ShapeInfo_Members, + std::size(ShapeInfo_Members), +}; + +const hkClass& ShapeInfo::staticClass() { + return ShapeInfo_Class; +} + +const hkTypeInfo ShapeInfo_TypeInfo = hkTypeInfo::make<ShapeInfo>("ShapeInfo", "!ShapeInfo"); + +// ActorInfo + +static constexpr hkClassMember ActorInfo_Members[] = { + {"HashId", nullptr, nullptr, hkClassMember::Type::TYPE_UINT32, hkClassMember::Type::TYPE_VOID, + 0, 0, 0, nullptr}, + {"SRTHash", nullptr, nullptr, hkClassMember::Type::TYPE_INT32, hkClassMember::Type::TYPE_VOID, + 0, 0, 4, nullptr}, + {"ShapeInfoStart", nullptr, nullptr, hkClassMember::Type::TYPE_INT32, + hkClassMember::Type::TYPE_VOID, 0, 0, 8, nullptr}, + {"ShapeInfoEnd", nullptr, nullptr, hkClassMember::Type::TYPE_INT32, + hkClassMember::Type::TYPE_VOID, 0, 0, 0xc, nullptr}, +}; + +const hkClass ActorInfo_Class{ + "ActorInfo", + nullptr, + sizeof(ActorInfo), + nullptr, + 0, + nullptr, + 0, + ActorInfo_Members, + std::size(ActorInfo_Members), +}; + +const hkClass& ActorInfo::staticClass() { + return ActorInfo_Class; +} + +const hkTypeInfo ActorInfo_TypeInfo = hkTypeInfo::make<ActorInfo>("ActorInfo", "!ActorInfo"); + +// StaticCompoundInfo + +static constexpr hkClassMember StaticCompoundInfo_Members[] = { + {"Offset", nullptr, nullptr, hkClassMember::Type::TYPE_UINT32, hkClassMember::Type::TYPE_VOID, + 0, 0, 0, nullptr}, + {"ActorInfo", &ActorInfo_Class, nullptr, hkClassMember::Type::TYPE_ARRAY, + hkClassMember::Type::TYPE_STRUCT, 0, 0, 8, nullptr}, + {"ShapeInfo", &ShapeInfo_Class, nullptr, hkClassMember::Type::TYPE_ARRAY, + hkClassMember::Type::TYPE_STRUCT, 0, 0, 0x18, nullptr}, +}; + +const hkClass StaticCompoundInfo_Class{ + "StaticCompoundInfo", + nullptr, + sizeof(StaticCompoundInfo), + nullptr, + 0, + nullptr, + 0, + StaticCompoundInfo_Members, + std::size(StaticCompoundInfo_Members), +}; + +const hkClass& StaticCompoundInfo::staticClass() { + return StaticCompoundInfo_Class; +} + +const hkTypeInfo StaticCompoundInfo_TypeInfo = + hkTypeInfo::make<StaticCompoundInfo>("StaticCompoundInfo", "!StaticCompoundInfo"); + +} // namespace ksys::phys diff --git a/src/KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h b/src/KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h new file mode 100644 index 00000000..5f10a41c --- /dev/null +++ b/src/KingSystem/Physics/StaticCompound/physStaticCompoundInfo.h @@ -0,0 +1,41 @@ +#pragma once + +#include <Havok/Common/Base/hkBase.h> + +class hkTypeInfo; + +namespace ksys::phys { + +struct ShapeInfo { + HK_DECLARE_REFLECTION() + + hkInt32 m_ActorInfoIndex; + hkInt32 m_InstanceId; + hkInt8 m_BodyGroup; + hkUint8 m_BodyLayerType; +}; +extern const hkClass ShapeInfo_Class; +extern const hkTypeInfo ShapeInfo_TypeInfo; + +struct ActorInfo { + HK_DECLARE_REFLECTION() + + hkUint32 m_HashId; + hkInt32 m_SRTHash; + hkInt32 m_ShapeInfoStart; + hkInt32 m_ShapeInfoEnd; +}; +extern const hkClass ActorInfo_Class; +extern const hkTypeInfo ActorInfo_TypeInfo; + +struct StaticCompoundInfo { + HK_DECLARE_REFLECTION() + + hkUint32 m_Offset; + hkArray<ActorInfo> m_ActorInfo; + hkArray<ShapeInfo> m_ShapeInfo; +}; +extern const hkClass StaticCompoundInfo_Class; +extern const hkTypeInfo StaticCompoundInfo_TypeInfo; + +} // namespace ksys::phys |
