mirror of https://github.com/AxioDL/metaforce.git
CToken usage fixes in CWorldTransManager; better model instances
This commit is contained in:
parent
f4ea728a61
commit
0d08d4a40e
|
@ -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::skOne, 0, true);
|
||||
CAnimRes samusAnimRes(samusCharSet.id, 2, zeus::CVector3f{2.f, 2.f, 2.f}, 0, true);
|
||||
g_GameState->GetWorldTransitionManager()->EnableTransition(samusAnimRes,
|
||||
platModel.id, zeus::CVector3f::skOne,
|
||||
bgModel.id, zeus::CVector3f::skOne, false);
|
||||
|
|
|
@ -254,16 +254,18 @@ bool CBooModel::TryLockTextures() const
|
|||
allLoad = false;
|
||||
}
|
||||
|
||||
if (allLoad)
|
||||
const_cast<CBooModel*>(this)->BuildGfxToken();
|
||||
|
||||
const_cast<CBooModel*>(this)->x40_24_texturesLoaded = allLoad;
|
||||
}
|
||||
|
||||
if (!m_gfxToken && x40_24_texturesLoaded)
|
||||
const_cast<CBooModel*>(this)->BuildGfxToken();
|
||||
|
||||
return x40_24_texturesLoaded;
|
||||
}
|
||||
|
||||
void CBooModel::UnlockTextures() const
|
||||
{
|
||||
const_cast<boo::GraphicsDataToken&>(m_gfxToken).doDestroy();
|
||||
for (TCachedToken<CTexture>& tex : const_cast<std::vector<TCachedToken<CTexture>>&>(x1c_textures))
|
||||
tex.Unlock();
|
||||
const_cast<CBooModel*>(this)->x40_24_texturesLoaded = false;
|
||||
|
|
|
@ -49,24 +49,16 @@ void CTweaks::RegisterTweaks()
|
|||
|
||||
void CTweaks::RegisterResourceTweaks()
|
||||
{
|
||||
#if 0
|
||||
CResFactory& factory = *dynamic_cast<CResFactory*>(g_ResFactory);
|
||||
CResLoader& loader = factory.GetLoader();
|
||||
std::unique_ptr<CInputStream> strm;
|
||||
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "GunRes")));
|
||||
g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm);
|
||||
strm.reset(loader.LoadNewResourceSync(IDFromFactory(factory, "PlayerRes"), nullptr));
|
||||
g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm);
|
||||
#else
|
||||
ProjectResourceFactoryMP1& factory = ProjectManager::g_SharedManager->resourceFactoryMP1();
|
||||
std::unique_ptr<CInputStream> strm;
|
||||
std::experimental::optional<CMemoryInStream> strm;
|
||||
|
||||
SObjectTag tag = factory.ProjectResourceFactoryBase::TagFromPath(_S("MP1/Tweaks/GunRes.yaml"));
|
||||
strm.reset(new CMemoryInStream(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag)));
|
||||
strm.emplace(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag));
|
||||
g_tweakGunRes = new DataSpec::DNAMP1::CTweakGunRes(*strm);
|
||||
|
||||
tag = factory.ProjectResourceFactoryBase::TagFromPath(_S("MP1/Tweaks/PlayerRes.yaml"));
|
||||
strm.reset(new CMemoryInStream(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag)));
|
||||
strm.emplace(factory.LoadResourceSync(tag).release(), factory.ResourceSize(tag));
|
||||
g_tweakPlayerRes = new DataSpec::DNAMP1::CTweakPlayerRes(*strm);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -157,16 +157,20 @@ void CWorldTransManager::DrawAllModels()
|
|||
CModelFlags flags = {};
|
||||
flags.m_extendedShaderIdx = 1;
|
||||
|
||||
if (!x4_modelData->x100_bgModelData.IsNull())
|
||||
if (!x4_modelData->x100_bgModelData[0].IsNull())
|
||||
{
|
||||
zeus::CTransform xf0 = zeus::CTransform::Translate(0.f, 0.f, -(2.f * x1c_bgHeight - x18_bgOffset));
|
||||
x4_modelData->x100_bgModelData.Render(CModelData::EWhichModel::Normal, xf0, &lights, flags);
|
||||
|
||||
x4_modelData->x100_bgModelData[0].Render(CModelData::EWhichModel::Normal, xf0, &lights, flags);
|
||||
}
|
||||
if (!x4_modelData->x100_bgModelData[1].IsNull())
|
||||
{
|
||||
zeus::CTransform xf1 = zeus::CTransform::Translate(0.f, 0.f, x18_bgOffset - x1c_bgHeight);
|
||||
x4_modelData->x100_bgModelData.Render(CModelData::EWhichModel::Normal, xf1, &lights, flags);
|
||||
|
||||
x4_modelData->x100_bgModelData[1].Render(CModelData::EWhichModel::Normal, xf1, &lights, flags);
|
||||
}
|
||||
if (!x4_modelData->x100_bgModelData[2].IsNull())
|
||||
{
|
||||
zeus::CTransform xf2 = zeus::CTransform::Translate(0.f, 0.f, x18_bgOffset);
|
||||
x4_modelData->x100_bgModelData.Render(CModelData::EWhichModel::Normal, xf2, &lights, flags);
|
||||
x4_modelData->x100_bgModelData[2].Render(CModelData::EWhichModel::Normal, xf2, &lights, flags);
|
||||
}
|
||||
|
||||
if (!x4_modelData->xb4_platformModelData.IsNull())
|
||||
|
@ -277,14 +281,16 @@ void CWorldTransManager::TouchModels()
|
|||
if (!x4_modelData)
|
||||
return;
|
||||
|
||||
if (x4_modelData->x14c_beamModel.IsLoaded() &&
|
||||
if (x4_modelData->x68_beamModelData.IsNull() &&
|
||||
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());
|
||||
}
|
||||
|
||||
if (x4_modelData->x158_suitModel.IsLoaded() &&
|
||||
if (x4_modelData->x1c_samusModelData.IsNull() &&
|
||||
x4_modelData->x158_suitModel.IsLoaded() &&
|
||||
x4_modelData->x158_suitModel.GetObj() &&
|
||||
x4_modelData->x164_suitSkin.IsLoaded() &&
|
||||
x4_modelData->x164_suitSkin.GetObj())
|
||||
|
@ -304,9 +310,13 @@ void CWorldTransManager::TouchModels()
|
|||
if (!x4_modelData->xb4_platformModelData.IsNull())
|
||||
x4_modelData->xb4_platformModelData.Touch(CModelData::EWhichModel::Normal, 0);
|
||||
|
||||
if (!x4_modelData->x100_bgModelData.IsNull())
|
||||
x4_modelData->x100_bgModelData.Touch(CModelData::EWhichModel::Normal, 0);
|
||||
|
||||
if (!x4_modelData->x100_bgModelData[0].IsNull())
|
||||
x4_modelData->x100_bgModelData[0].Touch(CModelData::EWhichModel::Normal, 0);
|
||||
if (!x4_modelData->x100_bgModelData[1].IsNull())
|
||||
x4_modelData->x100_bgModelData[1].Touch(CModelData::EWhichModel::Normal, 0);
|
||||
if (!x4_modelData->x100_bgModelData[2].IsNull())
|
||||
x4_modelData->x100_bgModelData[2].Touch(CModelData::EWhichModel::Normal, 0);
|
||||
|
||||
if (!x4_modelData->x68_beamModelData.IsNull())
|
||||
x4_modelData->x68_beamModelData.Touch(CModelData::EWhichModel::Normal, 0);
|
||||
}
|
||||
|
@ -323,11 +333,6 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
|
|||
x8_textData.reset();
|
||||
x20_random.SetSeed(99);
|
||||
|
||||
//x4_modelData->x1c_samusModelData = CModelData(samusRes);
|
||||
|
||||
//CAnimPlaybackParms aData(samusRes.GetDefaultAnim(), -1, 1.f, true);
|
||||
//x4_modelData->x1c_samusModelData.AnimationData()->SetAnimation(aData, false);
|
||||
|
||||
const std::string& modelName = g_tweakPlayerRes->GetBeamCineModel(
|
||||
DataSpec::ITweakPlayerRes::EBeamId(g_GameState->GetPlayerState()->GetCurrentBeam()));
|
||||
|
||||
|
@ -346,9 +351,9 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
|
|||
|
||||
if (bgRes != -1)
|
||||
{
|
||||
x4_modelData->x100_bgModelData = CStaticRes(bgRes, bgScale);
|
||||
x4_modelData->x100_bgModelData.Touch(CModelData::EWhichModel::Normal, 0);
|
||||
zeus::CAABox bounds = x4_modelData->x100_bgModelData.GetBounds();
|
||||
x4_modelData->x100_bgModelData[0] = CStaticRes(bgRes, bgScale);
|
||||
x4_modelData->x100_bgModelData[0].Touch(CModelData::EWhichModel::Normal, 0);
|
||||
zeus::CAABox bounds = x4_modelData->x100_bgModelData[0].GetBounds();
|
||||
x1c_bgHeight = (bounds.max.z - bounds.min.z) * bgScale.z;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
CModelData x1c_samusModelData;
|
||||
CModelData x68_beamModelData;
|
||||
CModelData xb4_platformModelData;
|
||||
CModelData x100_bgModelData;
|
||||
CModelData x100_bgModelData[3];
|
||||
TLockedToken<CModel> x14c_beamModel;
|
||||
TLockedToken<CModel> x158_suitModel;
|
||||
TLockedToken<CSkinRules> x164_suitSkin;
|
||||
|
|
Loading…
Reference in New Issue