SWA API mappings

This commit is contained in:
RadiantDerg 2025-01-12 20:45:50 -06:00 committed by Hyper
parent 4ab26a1696
commit eb3225c2f7
12 changed files with 121 additions and 3 deletions

View file

@ -0,0 +1,19 @@
#pragma once
#include <SWA.inl>
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"

View file

@ -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;
}
}

View file

@ -0,0 +1,21 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Math
{
class CMatrix
{
public:
be<float> data[16]; // Eigen::Affine3f
};
class CMatrix44
{
public:
be<float> data[16]; // Eigen::Matrix4f
};
SWA_ASSERT_SIZEOF(CMatrix, 0x40);
SWA_ASSERT_SIZEOF(CMatrix44, 0x40);
}

View file

@ -0,0 +1,17 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Math
{
class CQuaternion //Eigen::Quaternionf;
{
public:
be<float> X;
be<float> Y;
be<float> Z;
be<float> W;
};
SWA_ASSERT_SIZEOF(CQuaternion, 0x10);
}

View file

@ -28,3 +28,5 @@ namespace Hedgehog::Math
be<float> W;
};
}
#include "Vector.inl"

View file

@ -0,0 +1,4 @@
namespace Hedgehog::Math
{
}

View file

@ -0,0 +1,18 @@
#pragma once
#include <SWA.inl>
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<float> m_AspectRatio;
be<float> m_Near;
be<float> m_Far;
};
}

View file

@ -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"

View file

@ -9,7 +9,8 @@ namespace SWA
{
public:
xpointer<void> m_pVftable;
SWA_INSERT_PADDING(0xC4);
// SWA::CCamera::MyCamera
SWA_INSERT_PADDING(0xC4);
be<float> m_VertAspectRatio;
SWA_INSERT_PADDING(0x48);
be<float> m_HorzAspectRatio;

View file

@ -29,7 +29,8 @@ namespace SWA
SWA_INSERT_PADDING(0x10);
};
SWA_INSERT_PADDING(0x1C);
SWA_INSERT_PADDING(0x10);
hh::map<Hedgehog::Base::CSharedString, boost::shared_ptr<SWA::CWorld>> m_Worlds;
boost::shared_ptr<Hedgehog::Database::CDatabase> m_spDatabase;
SWA_INSERT_PADDING(0x88);
Hedgehog::Base::CSharedString m_StageName;

View file

@ -12,9 +12,21 @@ namespace SWA
class CMember
{
public:
SWA_INSERT_PADDING(0x80);
//boost::shared_ptr<Hedgehog::Mirage::CRenderScene> m_spRenderScene;
//Hedgehog::Base::CSharedString m_Name;
SWA_INSERT_PADDING(0xC);
boost::shared_ptr<CCamera> m_spCamera;
boost::shared_ptr<CCamera> m_spOverrideCamera;
SWA_INSERT_PADDING(0x64);
};
xpointer<CMember> m_pMember;
boost::shared_ptr<CCamera> GetCamera() const;
};
//SWA_ASSERT_OFFSETOF(CWorld::CMember, m_spCamera, 0xC);
//SWA_ASSERT_SIZEOF(CWorld::CMember, 0x80);
}
#include "World.inl"

View file

@ -0,0 +1,7 @@
namespace SWA
{
inline boost::shared_ptr<CCamera> CWorld::GetCamera() const
{
return m_pMember->m_spOverrideCamera ? m_pMember->m_spOverrideCamera : m_pMember->m_spCamera;
}
}