metaforce/Runtime/Graphics/CSkinnedModel.cpp

47 lines
1.6 KiB
C++
Raw Normal View History

#include "CSkinnedModel.hpp"
namespace urde
{
2016-08-21 20:39:18 +00:00
CSkinnedModel::CSkinnedModel(TLockedToken<CModel> model,
TLockedToken<CSkinRules> skinRules,
TLockedToken<CCharLayoutInfo> layoutInfo,
int shaderIdx)
2016-04-14 21:42:47 +00:00
: x4_model(model), x10_skinRules(skinRules), x1c_layoutInfo(layoutInfo)
{
2016-08-21 20:39:18 +00:00
m_modelInst = model->MakeNewInstance(shaderIdx);
}
2016-04-15 03:02:21 +00:00
CSkinnedModel::CSkinnedModel(IObjectStore& store, ResId model,
ResId skinRules, ResId layoutInfo,
2016-08-21 20:39:18 +00:00
int shaderIdx)
: CSkinnedModel(store.GetObj(SObjectTag{FOURCC('CMDL'), model}),
store.GetObj(SObjectTag{FOURCC('CSKR'), skinRules}),
store.GetObj(SObjectTag{FOURCC('CINF'), layoutInfo}),
shaderIdx)
2016-04-15 03:02:21 +00:00
{
}
void CSkinnedModel::Calculate(const CPoseAsTransforms& pose,
2016-08-21 20:39:18 +00:00
const CModelFlags& drawFlags,
const rstl::optional_object<CVertexMorphEffect>& morphEffect,
const float* morphMagnitudes)
{
m_modelInst->UpdateUniformData(drawFlags, x10_skinRules.GetObj(), &pose);
}
void CSkinnedModel::Draw(const CModelFlags& drawFlags) const
{
2016-08-21 20:39:18 +00:00
if (m_modelInst->TryLockTextures())
m_modelInst->DrawSurfaces(drawFlags);
}
2016-04-15 03:02:21 +00:00
CMorphableSkinnedModel::CMorphableSkinnedModel(IObjectStore& store, ResId model,
ResId skinRules, ResId layoutInfo,
2016-08-21 20:39:18 +00:00
int shaderIdx)
: CSkinnedModel(store, model, skinRules, layoutInfo, shaderIdx)
2016-04-15 03:02:21 +00:00
{
}
}