2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-18 05:25:24 +00:00

Start wiring up wgpu+winit

This commit is contained in:
2022-01-31 19:06:54 -05:00
parent 5491fd75cf
commit e48435f11e
209 changed files with 24234 additions and 8085 deletions

View File

@@ -3,10 +3,9 @@
#include <vector>
#include "Runtime/CFactoryMgr.hpp"
#include "Runtime/RetroTypes.hpp"
#include "Runtime/Character/CSkinBank.hpp"
#include "Runtime/RetroTypes.hpp"
#include <boo/graphicsdev/IGraphicsDataFactory.hpp>
#include <zeus/CVector3f.hpp>
namespace metaforce {
@@ -14,46 +13,42 @@ class CPoseAsTransforms;
class CModel;
struct SSkinWeighting {
CSegId m_id;
float m_weight;
explicit SSkinWeighting(CInputStream& in) : m_id(in), m_weight(in.readFloatBig()) {}
CSegId x0_id;
float x4_weight;
explicit SSkinWeighting(CInputStream& in) : x0_id(in), x4_weight(in.readFloatBig()) {}
};
class CVirtualBone {
std::vector<SSkinWeighting> m_weights;
rstl::reserved_vector<SSkinWeighting, 3> x0_weights;
u32 x1c_vertexCount;
zeus::CTransform x20_xf;
zeus::CMatrix3f x50_mtx;
public:
explicit CVirtualBone(CInputStream& in) {
u32 weightCount = in.readUint32Big();
m_weights.reserve(weightCount);
for (u32 i = 0; i < weightCount; ++i)
m_weights.emplace_back(in);
}
explicit CVirtualBone(CInputStream& in);
const std::vector<SSkinWeighting>& GetWeights() const { return m_weights; }
[[nodiscard]] const rstl::reserved_vector<SSkinWeighting, 3>& GetWeights() const { return x0_weights; }
};
class CSkinRules {
std::vector<CSkinBank> x0_skinBanks;
// u32 x10_vertexCount;
// u32 x14_normalCount;
std::vector<CVirtualBone> m_virtualBones;
std::vector<u32> m_poolToSkinIdx;
std::vector<CVirtualBone> x0_bones;
u32 x10_vertexCount;
u32 x14_normalCount;
public:
explicit CSkinRules(CInputStream& in);
void GetBankTransforms(std::vector<const zeus::CTransform*>& out, const CPoseAsTransforms& pose,
int skinBankIdx) const {
// FIXME: This is definitely not proper behavior, this is here to fix the phazon suit crashing
if (x0_skinBanks.size() <= skinBankIdx) {
return;
}
x0_skinBanks[skinBankIdx].GetBankTransforms(out, pose);
}
// void GetBankTransforms(std::vector<const zeus::CTransform*>& out, const CPoseAsTransforms& pose,
// int skinBankIdx) const {
// // FIXME: This is definitely not proper behavior, this is here to fix the phazon suit crashing
// if (x0_skinBanks.size() <= skinBankIdx) {
// return;
// }
// x0_skinBanks[skinBankIdx].GetBankTransforms(out, pose);
// }
void TransformVerticesCPU(std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vnOut,
const CPoseAsTransforms& pose, const CModel& model) const;
// void TransformVerticesCPU(std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vnOut,
// const CPoseAsTransforms& pose, const CModel& model) const;
};
CFactoryFnReturn FSkinRulesFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& params,