diff --git a/UnleashedRecomp/api/Hedgehog/Math/Aabb.h b/UnleashedRecomp/api/Hedgehog/Math/Aabb.h new file mode 100644 index 0000000..b13873f --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Math/Aabb.h @@ -0,0 +1,19 @@ +#pragma once + +#include + +namespace Hedgehog::Math +{ + class CAabb // Eigen::AlignedBox3f + { + public: + Hedgehog::Math::CVector min; + Hedgehog::Math::CVector max; + + CVector Center() const; + }; + + SWA_ASSERT_SIZEOF(CAabb, 0x18); +} + +#include "Aabb.inl" diff --git a/UnleashedRecomp/api/Hedgehog/Math/Aabb.inl b/UnleashedRecomp/api/Hedgehog/Math/Aabb.inl new file mode 100644 index 0000000..c24ab01 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Math/Aabb.inl @@ -0,0 +1,12 @@ +namespace Hedgehog::Math +{ + inline CVector Hedgehog::Math::CAabb::Center() const + { + // return (min + max) / 2; + Hedgehog::Math::CVector result; + result.X = (max.X + min.X) * 0.5f; + result.Y = (max.Y + min.Y) * 0.5f; + result.Z = 0.5f * (max.Z + min.Z); + return result; + } +} diff --git a/UnleashedRecomp/api/Hedgehog/Math/Matrix.h b/UnleashedRecomp/api/Hedgehog/Math/Matrix.h new file mode 100644 index 0000000..941c5f4 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Math/Matrix.h @@ -0,0 +1,21 @@ +#pragma once + +#include + +namespace Hedgehog::Math +{ + class CMatrix + { + public: + be data[16]; // Eigen::Affine3f + }; + + class CMatrix44 + { + public: + be data[16]; // Eigen::Matrix4f + }; + + SWA_ASSERT_SIZEOF(CMatrix, 0x40); + SWA_ASSERT_SIZEOF(CMatrix44, 0x40); +} diff --git a/UnleashedRecomp/api/Hedgehog/Math/Quaternion.h b/UnleashedRecomp/api/Hedgehog/Math/Quaternion.h new file mode 100644 index 0000000..555d207 --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Math/Quaternion.h @@ -0,0 +1,17 @@ +#pragma once + +#include + +namespace Hedgehog::Math +{ + class CQuaternion //Eigen::Quaternionf; + { + public: + be X; + be Y; + be Z; + be W; + }; + + SWA_ASSERT_SIZEOF(CQuaternion, 0x10); +} diff --git a/UnleashedRecomp/api/Hedgehog/Math/Vector.h b/UnleashedRecomp/api/Hedgehog/Math/Vector.h index b1c0f3d..4e5c6b5 100644 --- a/UnleashedRecomp/api/Hedgehog/Math/Vector.h +++ b/UnleashedRecomp/api/Hedgehog/Math/Vector.h @@ -28,3 +28,5 @@ namespace Hedgehog::Math be W; }; } + +#include "Vector.inl" diff --git a/UnleashedRecomp/api/Hedgehog/Math/Vector.inl b/UnleashedRecomp/api/Hedgehog/Math/Vector.inl new file mode 100644 index 0000000..e236c7d --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/Math/Vector.inl @@ -0,0 +1,4 @@ +namespace Hedgehog::Math +{ + +} diff --git a/UnleashedRecomp/api/Hedgehog/MirageCore/Camera/hhCamera.h b/UnleashedRecomp/api/Hedgehog/MirageCore/Camera/hhCamera.h new file mode 100644 index 0000000..ec01e8c --- /dev/null +++ b/UnleashedRecomp/api/Hedgehog/MirageCore/Camera/hhCamera.h @@ -0,0 +1,18 @@ +#pragma once + +#include + +namespace Hedgehog::Mirage +{ + class CCamera : Base::CObject + { + public: + Math::CMatrix m_View; + Math::CMatrix44 m_Projection; + Math::CVector m_Position; + Math::CVector m_Direction; + be m_AspectRatio; + be m_Near; + be m_Far; + }; +} diff --git a/UnleashedRecomp/api/SWA.h b/UnleashedRecomp/api/SWA.h index d85d9a3..dc28c27 100644 --- a/UnleashedRecomp/api/SWA.h +++ b/UnleashedRecomp/api/SWA.h @@ -27,7 +27,11 @@ #include "Hedgehog/Base/Type/hhSharedString.h" #include "Hedgehog/Base/hhObject.h" #include "Hedgehog/Database/System/hhDatabaseData.h" +#include "Hedgehog/Math/Aabb.h" +#include "Hedgehog/Math/Matrix.h" +#include "Hedgehog/Math/Quaternion.h" #include "Hedgehog/Math/Vector.h" +#include "Hedgehog/MirageCore/Camera/hhCamera.h" #include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h" #include "Hedgehog/MirageCore/RenderData/hhMaterialData.h" #include "Hedgehog/MirageCore/RenderData/hhMeshData.h" diff --git a/UnleashedRecomp/api/SWA/Camera/Camera.h b/UnleashedRecomp/api/SWA/Camera/Camera.h index 1d3db6c..8651c88 100644 --- a/UnleashedRecomp/api/SWA/Camera/Camera.h +++ b/UnleashedRecomp/api/SWA/Camera/Camera.h @@ -9,7 +9,8 @@ namespace SWA { public: xpointer m_pVftable; - SWA_INSERT_PADDING(0xC4); + // SWA::CCamera::MyCamera + SWA_INSERT_PADDING(0xC4); be m_VertAspectRatio; SWA_INSERT_PADDING(0x48); be m_HorzAspectRatio; diff --git a/UnleashedRecomp/api/SWA/System/GameDocument.h b/UnleashedRecomp/api/SWA/System/GameDocument.h index 150ebd9..5d25927 100644 --- a/UnleashedRecomp/api/SWA/System/GameDocument.h +++ b/UnleashedRecomp/api/SWA/System/GameDocument.h @@ -29,7 +29,8 @@ namespace SWA SWA_INSERT_PADDING(0x10); }; - SWA_INSERT_PADDING(0x1C); + SWA_INSERT_PADDING(0x10); + hh::map> m_Worlds; boost::shared_ptr m_spDatabase; SWA_INSERT_PADDING(0x88); Hedgehog::Base::CSharedString m_StageName; diff --git a/UnleashedRecomp/api/SWA/System/World.h b/UnleashedRecomp/api/SWA/System/World.h index aafbcd2..31160a4 100644 --- a/UnleashedRecomp/api/SWA/System/World.h +++ b/UnleashedRecomp/api/SWA/System/World.h @@ -12,9 +12,21 @@ namespace SWA class CMember { public: - SWA_INSERT_PADDING(0x80); + //boost::shared_ptr m_spRenderScene; + //Hedgehog::Base::CSharedString m_Name; + SWA_INSERT_PADDING(0xC); + boost::shared_ptr m_spCamera; + boost::shared_ptr m_spOverrideCamera; + SWA_INSERT_PADDING(0x64); }; xpointer m_pMember; + + boost::shared_ptr GetCamera() const; }; + + //SWA_ASSERT_OFFSETOF(CWorld::CMember, m_spCamera, 0xC); + //SWA_ASSERT_SIZEOF(CWorld::CMember, 0x80); } + +#include "World.inl" diff --git a/UnleashedRecomp/api/SWA/System/World.inl b/UnleashedRecomp/api/SWA/System/World.inl new file mode 100644 index 0000000..6006e29 --- /dev/null +++ b/UnleashedRecomp/api/SWA/System/World.inl @@ -0,0 +1,7 @@ +namespace SWA +{ + inline boost::shared_ptr CWorld::GetCamera() const + { + return m_pMember->m_spOverrideCamera ? m_pMember->m_spOverrideCamera : m_pMember->m_spCamera; + } +}