2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-05 01:51:25 +00:00
|
|
|
|
2017-08-21 05:46:59 +00:00
|
|
|
#include "boo/graphicsdev/IGraphicsDataFactory.hpp"
|
2016-04-09 23:19:17 +00:00
|
|
|
#include "RetroTypes.hpp"
|
2016-04-12 22:28:08 +00:00
|
|
|
#include "CSkinBank.hpp"
|
|
|
|
#include "CFactoryMgr.hpp"
|
2016-04-09 23:19:17 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-08-21 20:39:18 +00:00
|
|
|
class CPoseAsTransforms;
|
2017-08-21 05:46:59 +00:00
|
|
|
class CModel;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
struct SSkinWeighting {
|
|
|
|
CSegId m_id;
|
|
|
|
float m_weight;
|
|
|
|
explicit SSkinWeighting(CInputStream& in) : m_id(in), m_weight(in.readFloatBig()) {}
|
2017-08-21 05:46:59 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CVirtualBone {
|
|
|
|
std::vector<SSkinWeighting> m_weights;
|
|
|
|
|
2017-08-21 05:46:59 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
explicit CVirtualBone(CInputStream& in) {
|
|
|
|
u32 weightCount = in.readUint32Big();
|
|
|
|
m_weights.reserve(weightCount);
|
|
|
|
for (u32 i = 0; i < weightCount; ++i)
|
|
|
|
m_weights.emplace_back(in);
|
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector<SSkinWeighting>& GetWeights() const { return m_weights; }
|
2017-08-21 05:46:59 +00:00
|
|
|
};
|
2016-04-05 01:51:25 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CSkinRules {
|
|
|
|
std::vector<CSkinBank> x0_skinBanks;
|
|
|
|
// u32 x10_vertexCount;
|
|
|
|
// u32 x14_normalCount;
|
|
|
|
std::vector<CVirtualBone> m_virtualBones;
|
|
|
|
std::vector<u32> m_poolToSkinIdx;
|
2017-08-21 05:46:59 +00:00
|
|
|
|
2016-04-09 23:19:17 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
explicit CSkinRules(CInputStream& in);
|
2017-08-21 05:46:59 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void GetBankTransforms(std::vector<const zeus::CTransform*>& out, const CPoseAsTransforms& pose,
|
|
|
|
int skinBankIdx) const {
|
|
|
|
x0_skinBanks[skinBankIdx].GetBankTransforms(out, pose);
|
|
|
|
}
|
2017-08-21 05:46:59 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void TransformVerticesCPU(std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vnOut,
|
|
|
|
const CPoseAsTransforms& pose, const CModel& model) const;
|
2016-04-05 01:51:25 +00:00
|
|
|
};
|
|
|
|
|
2016-09-02 19:32:57 +00:00
|
|
|
CFactoryFnReturn FSkinRulesFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& params,
|
|
|
|
CObjectReference* selfRef);
|
2016-04-12 22:28:08 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|