fix(Physics & Matrices): Updated physics and matrix structures. (#55)

This commit is contained in:
Reece Watson 2022-11-06 16:38:41 -05:00 committed by GitHub
parent 6799e1eed9
commit 1d5916827c
10 changed files with 130 additions and 75 deletions

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "../rage/vector.hpp" #include "../rage/vector.hpp"
#include "phArchetypeDamp.hpp" #include "phArchetype.hpp"
#pragma pack(push, 1) #pragma pack(push, 1)
class CNavigation class CNavigation
@ -10,13 +10,7 @@ public:
char pad_0000[16]; //0x0000 char pad_0000[16]; //0x0000
class rage::phArchetypeDamp* m_damp; //0x0010 class rage::phArchetypeDamp* m_damp; //0x0010
char pad_0018[8]; //0x0018 char pad_0018[8]; //0x0018
rage::fvector3 m_right; //0x0020 rage::fmatrix44 m_transformation_matrix;
char pad_002C[4]; //0x002C
rage::fvector3 m_forward; //0x0030
char pad_003C[4]; //0x003C
rage::fvector3 m_up; //0x0040
char pad_004C[4]; //0x004C
rage::fvector3 m_position; //0x0050
}; //Size: 0x0060 }; //Size: 0x0060
static_assert(sizeof(CNavigation) == 0x5C); static_assert(sizeof(CNavigation) == 0x60);
#pragma pack(pop) #pragma pack(pop)

View File

@ -7,6 +7,8 @@ namespace rage
{ {
public: public:
virtual ~pgBase() = default; virtual ~pgBase() = default;
virtual int return_zero() = 0;
virtual void error() = 0;
void *unk_0000; // 0x0000 void *unk_0000; // 0x0000
}; //Size: 0x0008 }; //Size: 0x0008

29
base/phArchetype.hpp Normal file
View File

@ -0,0 +1,29 @@
#pragma once
#include "phBound.hpp"
namespace rage
{
class phArchetype
{
char pad_0000[32]; //0x0000
class phBound* m_bound; //0x0020
char pad_0028[16]; //0x0028
}; //Size: 0x0038
static_assert(sizeof(phArchetype) == 0x38);
class phArchetypePhys : public phArchetype
{
char pad_0038[28]; //0x0028
float m_water_collision; //0x0054
char pad_0058[40]; //0x0058
}; //Size: 0x0080
static_assert(sizeof(phArchetypePhys) == 0x80);
class phArchetypeDamp : public phArchetypePhys
{
public:
char pad_0080[96]; //0x0080
}; //Size: 0x00E0
static_assert(sizeof(phArchetypeDamp) == 0xE0);
}

View File

@ -1,18 +0,0 @@
#pragma once
#include "phBoundComposite.hpp"
namespace rage
{
class phArchetypeDamp
{
public:
char pad_0000[32]; //0x0000
class phBoundComposite* m_bound_composite; //0x0020
char pad_0028[44]; //0x0028
float m_water_collision; //0x0054
}; //Size: 0x0058
static_assert(sizeof(phArchetypeDamp) == 0x58);
}

41
base/phBound.hpp Normal file
View File

@ -0,0 +1,41 @@
#pragma once
#include <cstdint>
#include "pgBase.hpp"
#include "../rage/vector.hpp"
namespace rage {
class phBoundBase : public pgBase
{
};
enum class eBoundType : uint8_t
{
SPHERE,
CAPSULE,
BOX = 3,
GEOMETRY,
BVH = 8,
COMPOSITE = 10,
DISC = 12,
CYLINDER,
PLANE = 15
};
#pragma pack(push,4)
class phBound : public phBoundBase {
public:
eBoundType m_type; //0x0010
uint8_t m_flags; //0x0011
uint16_t m_part_index; //0x0012
float m_radius_around_centroid; //0x0014
char pad_0018[8]; //0x0018
fvector4 m_bounding_box_max_xyz_margin_w; //0x0020
fvector4 m_bounding_box_min_xyz_ref_count_w; //0x0030
fvector4 m_centroid_offset_xyz_material_id_0_w; //0x0040
fvector4 m_cg_offset_xyz_material_id_1_w; //0x0050
fvector4 m_volume_distribution; //0x0060
}; //Size: 0x0070
static_assert(sizeof(phBound) == 0x70);
#pragma pack(pop)
}

View File

@ -1,14 +1,17 @@
#pragma once #pragma once
#include "phBound.hpp"
namespace rage namespace rage
{ {
#pragma pack(push,1)
class phBoundCapsule class phBoundCapsule : public phBound
{ {
public: public:
char pad_0000[44]; //0x0000 float m_capsule_half_height;
float m_collision; //0x002C uint64_t unk_0074;
}; //Size: 0x0030 uint32_t unk_007C;
static_assert(sizeof(phBoundCapsule) == 0x30); }; //Size: 0x0080
static_assert(sizeof(phBoundCapsule) == 0x80);
#pragma pack(pop)
} }

View File

@ -1,15 +0,0 @@
#pragma once
#include "phBoundCapsule.hpp"
namespace rage
{
class phBoundCapsuleList
{
public:
class phBoundCapsule* m_bound_capsule; //0x0000
}; //Size: 0x0008
static_assert(sizeof(phBoundCapsuleList) == 0x08);
}

View File

@ -1,16 +1,26 @@
#pragma once #pragma once
#include "phBoundCapsuleList.hpp" #include <cstdint>
#include "phBound.hpp"
#include "../rage/vector.hpp"
namespace rage namespace rage
{ {
#pragma pack(push,8)
class phBoundComposite class phBoundComposite : public phBound
{ {
public: public:
char pad_0000[112]; //0x0000 class phBound** m_bounds; //0x0070
class phBoundCapsuleList* m_bound_capsule_list; //0x0070 fmatrix34* m_current_matrices; //0x0078
}; //Size: 0x0078 fmatrix34* m_last_matrices; //0x0080
static_assert(sizeof(phBoundComposite) == 0x78); fvector3* unk_0088; //0x0088
uint32_t* m_type_and_include_flags; //0x0090
uint32_t* m_owned_type_and_include_flags; //0x0098
uint16_t m_max_num_bounds; //0x00A0
uint16_t m_num_bounds; //0x00A2
char pad_00A4[4]; //0x00A4
void* unk_00A8; //0x00A8
}; //Size: 0x00B0
static_assert(sizeof(phBoundComposite) == 0xB0);
#pragma pack(pop)
} }

View File

@ -14,30 +14,23 @@ namespace rage
class fwEntity : public fwExtensibleBase class fwEntity : public fwExtensibleBase
{ {
public: public:
class CBaseModelInfo *m_model_info; class CBaseModelInfo *m_model_info; //0x0020
char gap28; char gap28; //0x0028
uint8_t m_entity_type; uint8_t m_entity_type; //0x0029
char gap2A[2]; char gap2A[2]; //0x002A
uint8_t m_invisible; //0x002C uint8_t m_invisible; //0x002C
char gap2D[3]; //0x002D char gap2D[3]; //0x002D
class CNavigation *m_navigation; //0x0030 class CNavigation *m_navigation; //0x0030
char gap38[16]; //0x0038 char gap38[16]; //0x0038
class rage::fwDrawData *m_draw_data; //0x0048 class rage::fwDrawData *m_draw_data; //0x0048
char gap50[16]; //0x0050 char gap50[16]; //0x0050
rage::fvector3 m_right; //0x0060 fmatrix44 m_transformation_matrix; //0x0060
char gap6C[4]; //0x006C uint64_t qwordA0; //0x00A0
rage::fvector3 m_forward; //0x0070 uint32_t dwordA8; //0x00A8
char gap7C[4]; //0x007C uint32_t dwordAC; //0x00AC
rage::fvector3 m_up; //0x0080 uint32_t dwordB0; //0x00B0
char gap8C[4]; //0x008C char gapB4[4]; //0x00B4
rage::fvector3 m_position; //0x0090 std::uint8_t byteB8; //0x00B8
char gap9C[4]; // 0x009C
uint64_t qwordA0;
uint32_t dwordA8;
uint32_t dwordAC;
uint32_t dwordB0;
char gapB4[4];
std::uint8_t byteB8;
}; };
static_assert(sizeof(fwEntity) == 0xB9); static_assert(sizeof(fwEntity) == 0xB9);
#pragma pack(pop) #pragma pack(pop)

View File

@ -23,7 +23,23 @@ namespace rage
struct { T x, y, z, w; }; struct { T x, y, z, w; };
}; };
template<typename T>
union matrix34
{
T data[3][4];
struct { struct {T x, y, z, w; } rows[3];};
};
template<typename T>
union matrix44
{
T data[3][4];
struct { struct {T x, y, z, w; } rows[4];};
};
typedef vector2<float> fvector2; typedef vector2<float> fvector2;
typedef vector3<float> fvector3; typedef vector3<float> fvector3;
typedef vector4<float> fvector4; typedef vector4<float> fvector4;
typedef matrix34<float> fmatrix34;
typedef matrix44<float> fmatrix44;
} }