mirror of https://github.com/AxioDL/metaforce.git
CWorldTransManager 2-camera instances
This commit is contained in:
parent
e91efb2313
commit
7d2370efe0
|
@ -32,7 +32,7 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
|||
SObjectTag samusCharSet = m_projManager.TagFromPath(_S("MP1/Shared/ANCS_77289A4A.blend"));
|
||||
SObjectTag platModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_6FA561D0.blend"));
|
||||
SObjectTag bgModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_BC34D54C.blend"));
|
||||
CAnimRes samusAnimRes(samusCharSet.id, 2, zeus::CVector3f{2.f, 2.f, 2.f}, 0, true);
|
||||
CAnimRes samusAnimRes(samusCharSet.id, 2, zeus::CVector3f{2.f, 2.f, 2.f}, 1, true);
|
||||
g_GameState->GetWorldTransitionManager()->EnableTransition(samusAnimRes,
|
||||
platModel.id, zeus::CVector3f::skOne,
|
||||
bgModel.id, zeus::CVector3f::skOne, true);
|
||||
|
@ -173,8 +173,13 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
|||
m_vm.m_moviePlayer->DrawFrame();
|
||||
}
|
||||
|
||||
if (m_frame == 300)
|
||||
g_GameState->GetWorldTransitionManager()->PleaseStopSoon();
|
||||
|
||||
g_GameState->GetWorldTransitionManager()->Update(1.f / 60.f);
|
||||
g_GameState->GetWorldTransitionManager()->Draw();
|
||||
|
||||
++m_frame;
|
||||
}
|
||||
|
||||
specter::View* ViewManager::BuildSpaceViews()
|
||||
|
|
|
@ -57,6 +57,7 @@ class ViewManager : public specter::IViewManager
|
|||
CCameraBlurFilter m_camBlur;
|
||||
CRandom16 m_random;
|
||||
float m_theta = 0.f;
|
||||
unsigned m_frame = 0;
|
||||
public:
|
||||
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent,
|
||||
TLockedToken<CTexture>& xrayPalette)
|
||||
|
|
|
@ -46,7 +46,8 @@ CAnimData::CAnimData(ResId id,
|
|||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
const std::shared_ptr<CAnimationManager>& animMgr,
|
||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
const TLockedToken<CCharacterFactory>& charFactory)
|
||||
const TLockedToken<CCharacterFactory>& charFactory,
|
||||
int drawInstCount)
|
||||
: x0_charFactory(charFactory),
|
||||
xc_charInfo(character),
|
||||
xcc_layoutData(layout),
|
||||
|
@ -58,7 +59,8 @@ CAnimData::CAnimData(ResId id,
|
|||
x204_charIdx(charIdx),
|
||||
x208_defaultAnim(defaultAnim),
|
||||
x224_pose(layout->GetSegIdList().GetList().size()),
|
||||
x2fc_poseBuilder(layout)
|
||||
x2fc_poseBuilder(layout),
|
||||
m_drawInstCount(drawInstCount)
|
||||
{
|
||||
x220_25_loop = loop;
|
||||
|
||||
|
@ -620,12 +622,12 @@ void CAnimData::AdvanceAnim(CCharAnimTime& time, zeus::CVector3f& offset, zeus::
|
|||
|
||||
void CAnimData::SetXRayModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules)
|
||||
{
|
||||
xf4_xrayModel = std::make_shared<CSkinnedModel>(model, skinRules, xd8_modelData->GetLayoutInfo(), 0);
|
||||
xf4_xrayModel = std::make_shared<CSkinnedModel>(model, skinRules, xd8_modelData->GetLayoutInfo(), 0, m_drawInstCount);
|
||||
}
|
||||
|
||||
void CAnimData::SetInfraModel(const TLockedToken<CModel>& model, const TLockedToken<CSkinRules>& skinRules)
|
||||
{
|
||||
xf8_infraModel = std::make_shared<CSkinnedModel>(model, skinRules, xd8_modelData->GetLayoutInfo(), 0);
|
||||
xf8_infraModel = std::make_shared<CSkinnedModel>(model, skinRules, xd8_modelData->GetLayoutInfo(), 0, m_drawInstCount);
|
||||
}
|
||||
|
||||
void CAnimData::PoseSkinnedModel(CSkinnedModel& model, const CPoseAsTransforms& pose,
|
||||
|
|
|
@ -136,6 +136,8 @@ class CAnimData
|
|||
static rstl::reserved_vector<CParticlePOINode, 20> g_ParticlePOINodes;
|
||||
static rstl::reserved_vector<CSoundPOINode, 20> g_SoundPOINodes;
|
||||
|
||||
int m_drawInstCount;
|
||||
|
||||
public:
|
||||
CAnimData(ResId,
|
||||
const CCharacterInfo& character,
|
||||
|
@ -146,7 +148,8 @@ public:
|
|||
const std::weak_ptr<CAnimSysContext>& ctx,
|
||||
const std::shared_ptr<CAnimationManager>& animMgr,
|
||||
const std::shared_ptr<CTransitionManager>& transMgr,
|
||||
const TLockedToken<CCharacterFactory>& charFactory);
|
||||
const TLockedToken<CCharacterFactory>& charFactory,
|
||||
int drawInstCount);
|
||||
|
||||
ResId GetEventResourceIdForAnimResourceId(ResId) const;
|
||||
void AddAdditiveSegData(const CSegIdList& list, CSegStatementSet& stSet);
|
||||
|
|
|
@ -25,7 +25,7 @@ CFactoryFnReturn CCharacterFactory::CDummyFactory::Build(const SObjectTag& tag,
|
|||
const CCharacterInfo& charInfo =
|
||||
*static_cast<TObjOwnerParam<const CCharacterInfo*>&>(*params.GetObj()).GetParam();
|
||||
|
||||
switch (tag.type.toUint32())
|
||||
switch (tag.type.toUint32() & 0x1)
|
||||
{
|
||||
case 0:
|
||||
return TToken<CSkinnedModel>::GetIObjObjectFor(
|
||||
|
@ -33,14 +33,14 @@ CFactoryFnReturn CCharacterFactory::CDummyFactory::Build(const SObjectTag& tag,
|
|||
charInfo.GetModelId(),
|
||||
charInfo.GetSkinRulesId(),
|
||||
charInfo.GetCharLayoutInfoId(),
|
||||
0));
|
||||
0, tag.type.toUint32() >> 16));
|
||||
case 1:
|
||||
return TToken<CSkinnedModel>::GetIObjObjectFor(
|
||||
std::make_unique<CMorphableSkinnedModel>(*g_SimplePool,
|
||||
charInfo.GetIceModelId(),
|
||||
charInfo.GetIceSkinRulesId(),
|
||||
charInfo.GetCharLayoutInfoId(),
|
||||
0));
|
||||
0, tag.type.toUint32() >> 16));
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -107,23 +107,25 @@ std::unique_ptr<u8[]> CCharacterFactory::CDummyFactory::LoadResourcePartSync(con
|
|||
std::unique_ptr<CAnimData>
|
||||
CCharacterFactory::CreateCharacter(int charIdx, bool loop,
|
||||
const TLockedToken<CCharacterFactory>& factory,
|
||||
int defaultAnim) const
|
||||
int defaultAnim, int drawInsts) const
|
||||
{
|
||||
const CCharacterInfo& charInfo = x4_charInfoDB[charIdx];
|
||||
CVParamTransfer charParm(new TObjOwnerParam<const CCharacterInfo*>(&charInfo));
|
||||
|
||||
TToken<CSkinnedModel> skinnedModel =
|
||||
const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj({FourCC(), charInfo.GetModelId()}, charParm);
|
||||
const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj
|
||||
({FourCC(drawInsts << 16), charInfo.GetModelId()}, charParm);
|
||||
|
||||
rstl::optional_object<TToken<CMorphableSkinnedModel>> iceModel;
|
||||
if (charInfo.GetIceModelId() != 0xffffffff &&
|
||||
charInfo.GetIceSkinRulesId() != 0xffffffff)
|
||||
iceModel.emplace(const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj({FourCC(1), charInfo.GetIceModelId()}, charParm));
|
||||
iceModel.emplace(const_cast<CCharacterFactory*>(this)->x70_cacheResPool.GetObj
|
||||
({FourCC((drawInsts << 16) | 1), charInfo.GetIceModelId()}, charParm));
|
||||
|
||||
return std::make_unique<CAnimData>(x68_selfId, charInfo, defaultAnim, charIdx, loop,
|
||||
x14_charLayoutInfoDB[charIdx], skinnedModel,
|
||||
iceModel, x24_sysContext, x28_animMgr, x2c_transMgr,
|
||||
factory);
|
||||
factory, drawInsts);
|
||||
}
|
||||
|
||||
ResId CCharacterFactory::GetEventResourceIdForAnimResourceId(ResId id) const
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
std::unique_ptr<CAnimData> CreateCharacter(int charIdx, bool loop,
|
||||
const TLockedToken<CCharacterFactory>& factory,
|
||||
int defaultAnim) const;
|
||||
int defaultAnim, int drawInsts) const;
|
||||
ResId GetEventResourceIdForAnimResourceId(ResId animId) const;
|
||||
|
||||
const CCharacterInfo& GetCharInfo(int charIdx) const { return x4_charInfoDB[charIdx]; }
|
||||
|
|
|
@ -22,20 +22,21 @@ CModelData::~CModelData() {}
|
|||
CModelData::CModelData() {}
|
||||
CModelData CModelData::CModelDataNull() {return CModelData();}
|
||||
|
||||
CModelData::CModelData(const CStaticRes& res)
|
||||
: x0_scale(res.GetScale())
|
||||
CModelData::CModelData(const CStaticRes& res, int instCount)
|
||||
: x0_scale(res.GetScale()), m_drawInstCount(instCount)
|
||||
{
|
||||
x1c_normalModel = g_SimplePool->GetObj({SBIG('CMDL'), res.GetId()});
|
||||
if (!x1c_normalModel)
|
||||
Log.report(logvisor::Fatal, "unable to find CMDL %08X", res.GetId());
|
||||
m_normalModelInst = x1c_normalModel->MakeNewInstance(0);
|
||||
m_normalModelInst = x1c_normalModel->MakeNewInstance(0, instCount);
|
||||
}
|
||||
|
||||
CModelData::CModelData(const CAnimRes& res)
|
||||
: x0_scale(res.GetScale())
|
||||
CModelData::CModelData(const CAnimRes& res, int instCount)
|
||||
: x0_scale(res.GetScale()), m_drawInstCount(instCount)
|
||||
{
|
||||
TToken<CCharacterFactory> factory = g_CharFactoryBuilder->GetFactory(res);
|
||||
x10_animData = factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory, res.GetDefaultAnim());
|
||||
x10_animData = factory->CreateCharacter(res.GetCharacterNodeId(), res.CanLoop(), factory,
|
||||
res.GetDefaultAnim(), instCount);
|
||||
}
|
||||
|
||||
SAdvancementDeltas CModelData::GetAdvancementDeltas(const CCharAnimTime& a,
|
||||
|
@ -115,7 +116,7 @@ void CModelData::SetXRayModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
x2c_xrayModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
if (!x2c_xrayModel)
|
||||
Log.report(logvisor::Fatal, "unable to find CMDL %08X", modelSkin.first);
|
||||
m_xrayModelInst = x2c_xrayModel->MakeNewInstance(0);
|
||||
m_xrayModelInst = x2c_xrayModel->MakeNewInstance(0, m_drawInstCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +139,7 @@ void CModelData::SetInfraModel(const std::pair<ResId, ResId>& modelSkin)
|
|||
x3c_infraModel = g_SimplePool->GetObj({SBIG('CMDL'), modelSkin.first});
|
||||
if (!x3c_infraModel)
|
||||
Log.report(logvisor::Fatal, "unable to find CMDL %08X", modelSkin.first);
|
||||
m_infraModelInst = x3c_infraModel->MakeNewInstance(0);
|
||||
m_infraModelInst = x3c_infraModel->MakeNewInstance(0, m_drawInstCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,8 @@ class CModelData
|
|||
std::unique_ptr<CBooModel> m_xrayModelInst;
|
||||
std::unique_ptr<CBooModel> m_infraModelInst;
|
||||
|
||||
int m_drawInstCount;
|
||||
|
||||
public:
|
||||
enum class EWhichModel
|
||||
{
|
||||
|
@ -98,8 +100,8 @@ public:
|
|||
void SetSortThermal(bool v) { x14_25_sortThermal = v; }
|
||||
|
||||
~CModelData();
|
||||
CModelData(const CStaticRes& res);
|
||||
CModelData(const CAnimRes& res);
|
||||
CModelData(const CStaticRes& res, int instCount=1);
|
||||
CModelData(const CAnimRes& res, int instCount=1);
|
||||
CModelData(CModelData&&) = default;
|
||||
CModelData& operator=(CModelData&&) = default;
|
||||
CModelData();
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
struct SShader
|
||||
{
|
||||
std::vector<TCachedToken<CTexture>> x0_textures;
|
||||
std::vector<std::vector<boo::IShaderPipeline*>> m_shaders;
|
||||
std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>> m_shaders;
|
||||
MaterialSet m_matSet;
|
||||
int m_matSetIdx;
|
||||
SShader(int idx) : m_matSetIdx(idx) {}
|
||||
|
@ -87,7 +87,7 @@ private:
|
|||
std::vector<CBooSurface>* x0_surfaces;
|
||||
const MaterialSet* x4_matSet;
|
||||
int m_matSetIdx = -1;
|
||||
const std::vector<std::vector<boo::IShaderPipeline*>>* m_pipelines;
|
||||
const std::vector<std::shared_ptr<hecl::Runtime::ShaderPipelines>>* m_pipelines;
|
||||
boo::IVertexFormat* m_vtxFmt;
|
||||
boo::IGraphicsBufferS* x8_vbo;
|
||||
boo::IGraphicsBufferS* xc_ibo;
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
~CBooModel();
|
||||
CBooModel(TToken<CModel>& token, std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
||||
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb);
|
||||
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb, int numInsts);
|
||||
|
||||
static void MakeTexuresFromMats(const MaterialSet& matSet,
|
||||
std::vector<TCachedToken<CTexture>>& toksOut,
|
||||
|
@ -203,7 +203,7 @@ public:
|
|||
const zeus::CAABox& GetAABB() const {return m_aabb;}
|
||||
CBooModel& GetInstance() {return *x28_modelInst;}
|
||||
const CBooModel& GetInstance() const {return *x28_modelInst;}
|
||||
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx);
|
||||
std::unique_ptr<CBooModel> MakeNewInstance(int shaderIdx, int subInsts);
|
||||
};
|
||||
|
||||
CFactoryFnReturn FModelFactory(const urde::SObjectTag& tag,
|
||||
|
|
|
@ -36,7 +36,7 @@ CBooModel::~CBooModel()
|
|||
|
||||
CBooModel::CBooModel(TToken<CModel>& token, std::vector<CBooSurface>* surfaces, SShader& shader,
|
||||
boo::IVertexFormat* vtxFmt, boo::IGraphicsBufferS* vbo, boo::IGraphicsBufferS* ibo,
|
||||
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb)
|
||||
size_t weightVecCount, size_t skinBankCount, const zeus::CAABox& aabb, int instCount)
|
||||
: m_model(token), x0_surfaces(surfaces), x4_matSet(&shader.m_matSet), m_matSetIdx(shader.m_matSetIdx),
|
||||
m_pipelines(&shader.m_shaders), m_vtxFmt(vtxFmt), x8_vbo(vbo), xc_ibo(ibo), m_weightVecCount(weightVecCount),
|
||||
m_skinBankCount(skinBankCount), x1c_textures(shader.x0_textures), x20_aabb(aabb),
|
||||
|
@ -69,6 +69,10 @@ CBooModel::CBooModel(TToken<CModel>& token, std::vector<CBooSurface>* surfaces,
|
|||
x38_firstUnsortedSurface = &*it;
|
||||
}
|
||||
}
|
||||
|
||||
m_instances.reserve(instCount);
|
||||
for (int i=0 ; i<instCount ; ++i)
|
||||
PushNewModelInstance();
|
||||
}
|
||||
|
||||
CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
||||
|
@ -185,14 +189,14 @@ CBooModel::ModelInstance* CBooModel::PushNewModelInstance()
|
|||
thisOffs[2] = lightOff;
|
||||
thisSizes[2] = lightSz;
|
||||
|
||||
const std::vector<boo::IShaderPipeline*>& pipelines = m_pipelines->at(surf.m_data.matIdx);
|
||||
const std::shared_ptr<hecl::Runtime::ShaderPipelines>& pipelines = m_pipelines->at(surf.m_data.matIdx);
|
||||
|
||||
newInst.m_shaderDataBindings.emplace_back();
|
||||
std::vector<boo::IShaderDataBinding*>& extendeds = newInst.m_shaderDataBindings.back();
|
||||
extendeds.reserve(pipelines.size());
|
||||
extendeds.reserve(pipelines->m_pipelines.size());
|
||||
|
||||
int idx = 0;
|
||||
for (boo::IShaderPipeline* pipeline : pipelines)
|
||||
for (boo::IShaderPipeline* pipeline : pipelines->m_pipelines)
|
||||
{
|
||||
extendeds.push_back(
|
||||
ctx.newShaderDataBinding(pipeline, m_vtxFmt,
|
||||
|
@ -657,12 +661,12 @@ static const u8* MemoryFromPartData(const u8*& dataCur, const s32*& secSizeCur)
|
|||
return ret;
|
||||
}
|
||||
|
||||
std::unique_ptr<CBooModel> CModel::MakeNewInstance(int shaderIdx)
|
||||
std::unique_ptr<CBooModel> CModel::MakeNewInstance(int shaderIdx, int subInsts)
|
||||
{
|
||||
if (shaderIdx >= x18_matSets.size())
|
||||
shaderIdx = 0;
|
||||
return std::make_unique<CBooModel>(m_selfToken, &x8_surfaces, x18_matSets[shaderIdx],
|
||||
m_vtxFmt, m_vbo, m_ibo, m_weightVecCount, m_skinBankCount, m_aabb);
|
||||
m_vtxFmt, m_vbo, m_ibo, m_weightVecCount, m_skinBankCount, m_aabb, subInsts);
|
||||
}
|
||||
|
||||
CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* store, CObjectReference* selfRef)
|
||||
|
@ -705,25 +709,25 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
|||
const u8* iboData = MemoryFromPartData(dataCur, secSizeCur);
|
||||
const u8* surfInfo = MemoryFromPartData(dataCur, secSizeCur);
|
||||
|
||||
for (CBooModel::SShader& matSet : x18_matSets)
|
||||
{
|
||||
matSet.m_shaders.reserve(matSet.m_matSet.materials.size());
|
||||
for (const MaterialSet::Material& mat : matSet.m_matSet.materials)
|
||||
{
|
||||
hecl::Runtime::ShaderTag tag(mat.heclIr,
|
||||
hmdlMeta.colorCount, hmdlMeta.uvCount, hmdlMeta.weightCount,
|
||||
hmdlMeta.weightCount * 4, 8, boo::Primitive(hmdlMeta.topology),
|
||||
true, true, true);
|
||||
matSet.m_shaders.push_back(CModelShaders::g_ModelShaders->buildExtendedShader
|
||||
(tag, mat.heclIr, "CMDL", *CGraphics::g_BooFactory));
|
||||
}
|
||||
}
|
||||
|
||||
m_gfxToken = CGraphics::CommitResources([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, vboData, hmdlMeta.vertStride, hmdlMeta.vertCount);
|
||||
m_ibo = ctx.newStaticBuffer(boo::BufferUse::Index, iboData, 4, hmdlMeta.indexCount);
|
||||
m_vtxFmt = hecl::Runtime::HMDLData::NewVertexFormat(ctx, hmdlMeta, m_vbo, m_ibo);
|
||||
|
||||
for (CBooModel::SShader& matSet : x18_matSets)
|
||||
{
|
||||
matSet.m_shaders.reserve(matSet.m_matSet.materials.size());
|
||||
for (const MaterialSet::Material& mat : matSet.m_matSet.materials)
|
||||
{
|
||||
hecl::Runtime::ShaderTag tag(mat.heclIr,
|
||||
hmdlMeta.colorCount, hmdlMeta.uvCount, hmdlMeta.weightCount,
|
||||
hmdlMeta.weightCount * 4, 8, boo::Primitive(hmdlMeta.topology),
|
||||
true, true, true);
|
||||
matSet.m_shaders.push_back(CModelShaders::g_ModelShaders->buildExtendedShader(tag, mat.heclIr, "CMDL", ctx));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -743,7 +747,7 @@ CModel::CModel(std::unique_ptr<u8[]>&& in, u32 /* dataLen */, IObjectStore* stor
|
|||
const float* aabbPtr = reinterpret_cast<const float*>(data.get() + 0xc);
|
||||
m_aabb = zeus::CAABox(hecl::SBig(aabbPtr[0]), hecl::SBig(aabbPtr[1]), hecl::SBig(aabbPtr[2]),
|
||||
hecl::SBig(aabbPtr[3]), hecl::SBig(aabbPtr[4]), hecl::SBig(aabbPtr[5]));
|
||||
x28_modelInst = MakeNewInstance(0);
|
||||
x28_modelInst = MakeNewInstance(0, 1);
|
||||
}
|
||||
|
||||
void CBooModel::SShader::UnlockTextures()
|
||||
|
|
|
@ -8,7 +8,7 @@ static logvisor::Module Log("urde::CSkinnedModel");
|
|||
CSkinnedModel::CSkinnedModel(TLockedToken<CModel> model,
|
||||
TLockedToken<CSkinRules> skinRules,
|
||||
TLockedToken<CCharLayoutInfo> layoutInfo,
|
||||
int shaderIdx)
|
||||
int shaderIdx, int drawInsts)
|
||||
: x4_model(model), x10_skinRules(skinRules), x1c_layoutInfo(layoutInfo)
|
||||
{
|
||||
if (!model)
|
||||
|
@ -17,16 +17,16 @@ CSkinnedModel::CSkinnedModel(TLockedToken<CModel> model,
|
|||
Log.report(logvisor::Fatal, "bad skin token provided to CSkinnedModel");
|
||||
if (!layoutInfo)
|
||||
Log.report(logvisor::Fatal, "bad character layout token provided to CSkinnedModel");
|
||||
m_modelInst = model->MakeNewInstance(shaderIdx);
|
||||
m_modelInst = model->MakeNewInstance(shaderIdx, drawInsts);
|
||||
}
|
||||
|
||||
CSkinnedModel::CSkinnedModel(IObjectStore& store, ResId model,
|
||||
ResId skinRules, ResId layoutInfo,
|
||||
int shaderIdx)
|
||||
int shaderIdx, int drawInsts)
|
||||
: CSkinnedModel(store.GetObj(SObjectTag{FOURCC('CMDL'), model}),
|
||||
store.GetObj(SObjectTag{FOURCC('CSKR'), skinRules}),
|
||||
store.GetObj(SObjectTag{FOURCC('CINF'), layoutInfo}),
|
||||
shaderIdx)
|
||||
shaderIdx, drawInsts)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,8 @@ void CSkinnedModel::Draw(const CModelFlags& drawFlags) const
|
|||
|
||||
CMorphableSkinnedModel::CMorphableSkinnedModel(IObjectStore& store, ResId model,
|
||||
ResId skinRules, ResId layoutInfo,
|
||||
int shaderIdx)
|
||||
: CSkinnedModel(store, model, skinRules, layoutInfo, shaderIdx)
|
||||
int shaderIdx, int drawInsts)
|
||||
: CSkinnedModel(store, model, skinRules, layoutInfo, shaderIdx, drawInsts)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ public:
|
|||
CSkinnedModel(TLockedToken<CModel> model,
|
||||
TLockedToken<CSkinRules> skinRules,
|
||||
TLockedToken<CCharLayoutInfo> layoutInfo,
|
||||
int shaderIdx);
|
||||
int shaderIdx, int drawInsts);
|
||||
CSkinnedModel(IObjectStore& store, ResId model, ResId skinRules,
|
||||
ResId layoutInfo, int shaderIdx);
|
||||
ResId layoutInfo, int shaderIdx, int drawInsts);
|
||||
|
||||
const TLockedToken<CModel>& GetModel() const {return x4_model;}
|
||||
const std::unique_ptr<CBooModel>& GetModelInst() const {return m_modelInst;}
|
||||
|
@ -50,7 +50,7 @@ class CMorphableSkinnedModel : public CSkinnedModel
|
|||
{
|
||||
public:
|
||||
CMorphableSkinnedModel(IObjectStore& store, ResId model, ResId skinRules,
|
||||
ResId layoutInfo, int shaderIdx);
|
||||
ResId layoutInfo, int shaderIdx, int drawInsts);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -52,32 +52,36 @@ public:
|
|||
CModelShaders(const hecl::Runtime::FileStoreManager& storeMgr,
|
||||
boo::IGraphicsDataFactory* gfxFactory);
|
||||
|
||||
boo::IShaderPipeline* buildShader(const hecl::Runtime::ShaderTag& tag, const std::string& source,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory::Context& ctx)
|
||||
std::shared_ptr<hecl::Runtime::ShaderPipelines> buildShader(const hecl::Runtime::ShaderTag& tag,
|
||||
const std::string& source,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory& factory)
|
||||
{
|
||||
return m_shaderCache.buildShader(tag, source, diagName, ctx);
|
||||
return m_shaderCache.buildShader(tag, source, diagName, factory);
|
||||
}
|
||||
|
||||
boo::IShaderPipeline* buildShader(const hecl::Runtime::ShaderTag& tag, const hecl::Frontend::IR& ir,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory::Context& ctx)
|
||||
std::shared_ptr<hecl::Runtime::ShaderPipelines> buildShader(const hecl::Runtime::ShaderTag& tag,
|
||||
const hecl::Frontend::IR& ir,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory& factory)
|
||||
{
|
||||
return m_shaderCache.buildShader(tag, ir, diagName, ctx);
|
||||
return m_shaderCache.buildShader(tag, ir, diagName, factory);
|
||||
}
|
||||
|
||||
std::vector<boo::IShaderPipeline*> buildExtendedShader(const hecl::Runtime::ShaderTag& tag, const std::string& source,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory::Context& ctx)
|
||||
std::shared_ptr<hecl::Runtime::ShaderPipelines> buildExtendedShader(const hecl::Runtime::ShaderTag& tag,
|
||||
const std::string& source,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory& factory)
|
||||
{
|
||||
return m_shaderCache.buildExtendedShader(tag, source, diagName, ctx);
|
||||
return m_shaderCache.buildExtendedShader(tag, source, diagName, factory);
|
||||
}
|
||||
|
||||
std::vector<boo::IShaderPipeline*> buildExtendedShader(const hecl::Runtime::ShaderTag& tag, const hecl::Frontend::IR& ir,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory::Context& ctx)
|
||||
std::shared_ptr<hecl::Runtime::ShaderPipelines> buildExtendedShader(const hecl::Runtime::ShaderTag& tag,
|
||||
const hecl::Frontend::IR& ir,
|
||||
const std::string& diagName,
|
||||
boo::IGraphicsDataFactory& factory)
|
||||
{
|
||||
return m_shaderCache.buildExtendedShader(tag, ir, diagName, ctx);
|
||||
return m_shaderCache.buildExtendedShader(tag, ir, diagName, factory);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -9,18 +9,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, bo
|
|||
{
|
||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
struct Vert
|
||||
{
|
||||
zeus::CVector2f m_pos;
|
||||
zeus::CVector2f m_uv;
|
||||
} verts[4] =
|
||||
{
|
||||
{{-1.0, -1.0}, {0.0, 0.0}},
|
||||
{{-1.0, 1.0}, {0.0, 1.0}},
|
||||
{{ 1.0, -1.0}, {1.0, 0.0}},
|
||||
{{ 1.0, 1.0}, {1.0, 1.0}},
|
||||
};
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, 32, 4);
|
||||
m_vbo = ctx.newDynamicBuffer(boo::BufferUse::Vertex, 32, 4);
|
||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
m_dataBind = TMultiBlendShader<CTexturedQuadFilter>::BuildShaderDataBinding(ctx, type, *this);
|
||||
return true;
|
||||
|
@ -36,6 +25,20 @@ CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type,
|
|||
|
||||
void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale)
|
||||
{
|
||||
float xFac = CGraphics::g_CroppedViewport.xc_width / float(CGraphics::g_ViewportResolution.x);
|
||||
float yFac = CGraphics::g_CroppedViewport.x10_height / float(CGraphics::g_ViewportResolution.y);
|
||||
float xBias = CGraphics::g_CroppedViewport.x4_left / float(CGraphics::g_ViewportResolution.x);
|
||||
float yBias = CGraphics::g_CroppedViewport.x8_top / float(CGraphics::g_ViewportResolution.y);
|
||||
|
||||
Vert verts[4] =
|
||||
{
|
||||
{{-1.0, -1.0}, {xBias, yBias}},
|
||||
{{-1.0, 1.0}, {xBias, yBias + yFac}},
|
||||
{{ 1.0, -1.0}, {xBias + xFac, yBias}},
|
||||
{{ 1.0, 1.0}, {xBias + xFac, yBias + yFac}},
|
||||
};
|
||||
m_vbo->load(verts, sizeof(verts));
|
||||
|
||||
m_uniform.m_color = color;
|
||||
m_uniform.m_uvScale = uvScale;
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
|
|
@ -17,6 +17,12 @@ class CTexturedQuadFilter
|
|||
friend struct CTexturedQuadFilterMetalDataBindingFactory;
|
||||
friend struct CTexturedQuadFilterD3DDataBindingFactory;
|
||||
|
||||
struct Vert
|
||||
{
|
||||
zeus::CVector2f m_pos;
|
||||
zeus::CVector2f m_uv;
|
||||
};
|
||||
|
||||
struct Uniform
|
||||
{
|
||||
zeus::CColor m_color;
|
||||
|
@ -25,7 +31,7 @@ class CTexturedQuadFilter
|
|||
TLockedToken<CTexture> m_tex;
|
||||
boo::ITexture* m_booTex;
|
||||
boo::GraphicsDataToken m_token;
|
||||
boo::IGraphicsBufferS* m_vbo;
|
||||
boo::IGraphicsBufferD* m_vbo;
|
||||
boo::IGraphicsBufferD* m_uniBuf;
|
||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
||||
Uniform m_uniform;
|
||||
|
|
|
@ -45,7 +45,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING0 uniform sampler2D tex;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" colorOut = vtf.color * texture(tex, vtf.uv);\n"
|
||||
" colorOut = vtf.color * vec4(texture(tex, vtf.uv).rgb, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace urde
|
|||
|
||||
static CModelData MakePlayerAnimRes(ResId resId, const zeus::CVector3f& scale)
|
||||
{
|
||||
return CAnimRes(resId, 0, scale, 0, true);
|
||||
return {CAnimRes(resId, 0, scale, 0, true), 1};
|
||||
}
|
||||
|
||||
CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& aabb, unsigned int resId,
|
||||
|
|
|
@ -240,8 +240,9 @@ void CWorldTransManager::DrawEnabled()
|
|||
rect.xc_width = CGraphics::g_ViewportResolution.x;
|
||||
rect.x10_height = CGraphics::g_ViewportResolution.y;
|
||||
CGraphics::ResolveSpareTexture(rect);
|
||||
CGraphics::g_BooMainCommandQueue->clearTarget(true, true);
|
||||
DrawSecondPass();
|
||||
m_dissolve.draw(zeus::CColor{1.f, 1.f, 1.f, t}, 1.f);
|
||||
m_dissolve.draw(zeus::CColor{1.f, 1.f, 1.f, 1.f - t}, 1.f);
|
||||
}
|
||||
|
||||
CWideScreenFilter::SetViewportToFull();
|
||||
|
@ -287,8 +288,8 @@ void CWorldTransManager::TouchModels()
|
|||
x4_modelData->x14c_beamModel.IsLoaded() &&
|
||||
x4_modelData->x14c_beamModel.GetObj())
|
||||
{
|
||||
x4_modelData->x68_beamModelData = CStaticRes(x4_modelData->x14c_beamModel.GetObjectTag()->id,
|
||||
x4_modelData->x0_samusRes.GetScale());
|
||||
x4_modelData->x68_beamModelData = {CStaticRes(x4_modelData->x14c_beamModel.GetObjectTag()->id,
|
||||
x4_modelData->x0_samusRes.GetScale()), 2};
|
||||
}
|
||||
|
||||
if (x4_modelData->x1c_samusModelData.IsNull() &&
|
||||
|
@ -300,7 +301,7 @@ void CWorldTransManager::TouchModels()
|
|||
CAnimRes animRes(x4_modelData->x0_samusRes.GetId(), GetSuitCharIdx(),
|
||||
x4_modelData->x0_samusRes.GetScale(), x4_modelData->x0_samusRes.GetDefaultAnim(),
|
||||
true);
|
||||
x4_modelData->x1c_samusModelData = animRes;
|
||||
x4_modelData->x1c_samusModelData = {animRes, 2};
|
||||
|
||||
CAnimPlaybackParms aData(animRes.GetDefaultAnim(), -1, 1.f, true);
|
||||
x4_modelData->x1c_samusModelData.AnimationData()->SetAnimation(aData, false);
|
||||
|
@ -347,7 +348,7 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
|
|||
|
||||
if (platRes != -1)
|
||||
{
|
||||
x4_modelData->xb4_platformModelData = CStaticRes(platRes, platScale);
|
||||
x4_modelData->xb4_platformModelData = {CStaticRes(platRes, platScale), 2};
|
||||
x4_modelData->xb4_platformModelData.Touch(CModelData::EWhichModel::Normal, 0);
|
||||
}
|
||||
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit df53b858ffc9a06f9cf833908a93587c003179f2
|
||||
Subproject commit 88fade1d0df7b34a38e9415adbb04a7eaf838f42
|
Loading…
Reference in New Issue