metaforce/Runtime/Graphics/CSkinnedModel.hpp

73 lines
2.3 KiB
C++
Raw Normal View History

2016-04-13 06:07:23 +00:00
#ifndef __URDE_CSKINNEDMODEL_HPP__
#define __URDE_CSKINNEDMODEL_HPP__
#include "CToken.hpp"
#include "CModel.hpp"
#include "optional.hpp"
namespace urde
{
class CModel;
class CSkinRules;
class CCharLayoutInfo;
class CPoseAsTransforms;
class CVertexMorphEffect;
class IObjectStore;
class CSkinnedModel
{
2016-08-21 20:39:18 +00:00
friend class CBooModel;
std::unique_ptr<CBooModel> m_modelInst;
2016-04-14 21:42:47 +00:00
TLockedToken<CModel> x4_model;
TLockedToken<CSkinRules> x10_skinRules;
TLockedToken<CCharLayoutInfo> x1c_layoutInfo;
std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>> m_vertWorkspace;
public:
2016-04-15 03:02:21 +00:00
enum class EDataOwnership
{
Zero,
One
};
2016-08-21 20:39:18 +00:00
CSkinnedModel(TLockedToken<CModel> model,
TLockedToken<CSkinRules> skinRules,
TLockedToken<CCharLayoutInfo> layoutInfo,
2016-09-12 04:53:28 +00:00
int shaderIdx, int drawInsts);
2017-08-13 05:26:14 +00:00
CSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules,
CAssetId layoutInfo, int shaderIdx, int drawInsts);
2016-04-14 21:42:47 +00:00
2016-09-04 02:27:35 +00:00
const TLockedToken<CModel>& GetModel() const {return x4_model;}
const std::unique_ptr<CBooModel>& GetModelInst() const {return m_modelInst;}
const TLockedToken<CSkinRules>& GetSkinRules() const {return x10_skinRules;}
const TLockedToken<CCharLayoutInfo>& GetLayoutInfo() const {return x1c_layoutInfo;}
2016-08-21 20:39:18 +00:00
void Calculate(const CPoseAsTransforms& pose,
const CModelFlags& drawFlags,
const std::experimental::optional<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes);
void Draw(const CModelFlags& drawFlags) const;
2017-03-26 05:53:04 +00:00
typedef void(*FPointGenerator)(void* item, const std::vector<std::pair<zeus::CVector3f, zeus::CVector3f>>& vn);
2017-03-26 05:53:04 +00:00
static void SetPointGeneratorFunc(void* ctx, FPointGenerator func)
{
g_PointGenFunc = func;
g_PointGenCtx = ctx;
}
2017-09-04 02:22:46 +00:00
static void ClearPointGeneratorFunc()
{
g_PointGenFunc = nullptr;
}
2017-03-26 05:53:04 +00:00
static FPointGenerator g_PointGenFunc;
static void* g_PointGenCtx;
};
2016-04-15 03:02:21 +00:00
class CMorphableSkinnedModel : public CSkinnedModel
{
public:
2017-08-13 05:26:14 +00:00
CMorphableSkinnedModel(IObjectStore& store, CAssetId model, CAssetId skinRules,
CAssetId layoutInfo, int shaderIdx, int drawInsts);
2016-04-15 03:02:21 +00:00
};
}
2016-04-13 06:07:23 +00:00
#endif // __URDE_CSKINNEDMODEL_HPP__