General: Pass std::nullopt to CAnimData::Render instead of {}

Prevents some implementations (libstdc++ and libc++) from completely zeroing out the underlying
buffer and instead sets a single byte flag.

Eliminates unnecessary memsets.
This commit is contained in:
Lioncash 2020-04-05 08:15:45 -04:00
parent 786634e181
commit f77fb2089b
5 changed files with 11 additions and 11 deletions

View File

@ -354,7 +354,7 @@ void CModelData::Render(EWhichModel which, const zeus::CTransform& xf, const CAc
model.GetModelInst()->ActivateLights(useLights); model.GetModelInst()->ActivateLights(useLights);
} }
x10_animData->Render(model, drawFlags, {}, nullptr); x10_animData->Render(model, drawFlags, std::nullopt, nullptr);
} else { } else {
const auto& model = PickStaticModel(which); const auto& model = PickStaticModel(which);
if (lights) { if (lights) {
@ -388,18 +388,18 @@ void CModelData::InvSuitDraw(EWhichModel which, const zeus::CTransform& xf, cons
/* Z-prime */ /* Z-prime */
flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly; flags.m_extendedShader = EExtendedShader::SolidColorBackfaceCullLEqualAlphaOnly;
flags.x4_color = zeus::skWhite; flags.x4_color = zeus::skWhite;
x10_animData->Render(model, flags, {}, nullptr); x10_animData->Render(model, flags, std::nullopt, nullptr);
/* Normal Blended */ /* Normal Blended */
lights->ActivateLights(*model.GetModelInst()); lights->ActivateLights(*model.GetModelInst());
flags.m_extendedShader = EExtendedShader::ForcedAlpha; flags.m_extendedShader = EExtendedShader::ForcedAlpha;
flags.x4_color = alphaColor; flags.x4_color = alphaColor;
x10_animData->Render(model, flags, {}, nullptr); x10_animData->Render(model, flags, std::nullopt, nullptr);
/* Selection Additive */ /* Selection Additive */
flags.m_extendedShader = EExtendedShader::ForcedAdditive; flags.m_extendedShader = EExtendedShader::ForcedAdditive;
flags.x4_color = additiveColor; flags.x4_color = additiveColor;
x10_animData->Render(model, flags, {}, nullptr); x10_animData->Render(model, flags, std::nullopt, nullptr);
} else { } else {
CBooModel& model = *PickStaticModel(which); CBooModel& model = *PickStaticModel(which);
model.DisableAllLights(); model.DisableAllLights();
@ -441,7 +441,7 @@ void CModelData::DisintegrateDraw(EWhichModel which, const zeus::CTransform& xf,
if (x10_animData) { if (x10_animData) {
CSkinnedModel& sModel = PickAnimatedModel(which); CSkinnedModel& sModel = PickAnimatedModel(which);
x10_animData->Render(sModel, flags, {}, nullptr); x10_animData->Render(sModel, flags, std::nullopt, nullptr);
} else { } else {
CBooModel& model = *PickStaticModel(which); CBooModel& model = *PickStaticModel(which);
model.Draw(flags, nullptr, nullptr); model.Draw(flags, nullptr, nullptr);

View File

@ -480,7 +480,7 @@ void CGrappleArm::RenderXRayModel(const CStateManager& mgr, const zeus::CTransfo
// g_Renderer->SetAmbientColor(zeus::skWhite); // g_Renderer->SetAmbientColor(zeus::skWhite);
CSkinnedModel& model = const_cast<CSkinnedModel&>(*x50_grappleArmSkeletonModel->GetAnimationData()->GetModelData()); CSkinnedModel& model = const_cast<CSkinnedModel&>(*x50_grappleArmSkeletonModel->GetAnimationData()->GetModelData());
model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)}); model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)});
x0_grappleArmModel->GetAnimationData()->Render(model, flags, {}, nullptr); x0_grappleArmModel->GetAnimationData()->Render(model, flags, std::nullopt, nullptr);
// g_Renderer->SetAmbientColor(zeus::skWhite); // g_Renderer->SetAmbientColor(zeus::skWhite);
// CGraphics::DisableAllLights(); // CGraphics::DisableAllLights();
} }

View File

@ -512,7 +512,7 @@ void CGunWeapon::DrawHologram(const CStateManager& mgr, const zeus::CTransform&
// g_Renderer->SetAmbientColor(zeus::skWhite); // g_Renderer->SetAmbientColor(zeus::skWhite);
CSkinnedModel& model = const_cast<CSkinnedModel&>(*x60_holoModelData->GetAnimationData()->GetModelData()); CSkinnedModel& model = const_cast<CSkinnedModel&>(*x60_holoModelData->GetAnimationData()->GetModelData());
model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)}); model.GetModelInst()->ActivateLights({CLight::BuildLocalAmbient({}, zeus::skWhite)});
const_cast<CGunWeapon*>(this)->x10_solidModelData->GetAnimationData()->Render(model, flags, {}, nullptr); const_cast<CGunWeapon*>(this)->x10_solidModelData->GetAnimationData()->Render(model, flags, std::nullopt, nullptr);
// g_Renderer->SetAmbientColor(zeus::skWhite); // g_Renderer->SetAmbientColor(zeus::skWhite);
// CGraphics::DisableAllLights(); // CGraphics::DisableAllLights();
} }

View File

@ -518,7 +518,7 @@ void CFishCloud::RenderBoid(int idx, const CBoid& boid, u32& drawMask,
CModelFlags thermFlags(0, 0, 3, zeus::skWhite); CModelFlags thermFlags(0, 0, 3, zeus::skWhite);
mData.RenderThermal(zeus::skWhite, zeus::CColor(0.f, 0.25f), thermFlags); mData.RenderThermal(zeus::skWhite, zeus::CColor(0.f, 0.25f), thermFlags);
} else { } else {
mData.GetAnimationData()->Render(model, flags, {}, nullptr); mData.GetAnimationData()->Render(model, flags, std::nullopt, nullptr);
} }
} }

View File

@ -1063,7 +1063,7 @@ void CWallCrawlerSwarm::RenderBoid(const CBoid* boid, u32& drawMask, bool therma
CGraphics::SetModelMatrix(boid->GetTransform()); CGraphics::SetModelMatrix(boid->GetTransform());
if (boid->x48_timeToDie > 0.f && !thermalHot) { if (boid->x48_timeToDie > 0.f && !thermalHot) {
const CModelFlags useFlags(0, 0, 3, zeus::skWhite); const CModelFlags useFlags(0, 0, 3, zeus::skWhite);
mData.GetAnimationData()->Render(model, useFlags, {}, nullptr); mData.GetAnimationData()->Render(model, useFlags, std::nullopt, nullptr);
if (auto iceModel = mData.GetAnimationData()->GetIceModel()) { if (auto iceModel = mData.GetAnimationData()->GetIceModel()) {
if (!iceModel->GetModelInst()->TryLockTextures()) { if (!iceModel->GetModelInst()->TryLockTextures()) {
return; return;
@ -1072,13 +1072,13 @@ void CWallCrawlerSwarm::RenderBoid(const CBoid* boid, u32& drawMask, bool therma
const float alpha = 1.f - boid->x48_timeToDie; const float alpha = 1.f - boid->x48_timeToDie;
const zeus::CColor color(1.f, alpha > 0.f ? boid->x48_timeToDie : 1.f); const zeus::CColor color(1.f, alpha > 0.f ? boid->x48_timeToDie : 1.f);
const CModelFlags iceFlags(5, 0, 3, color); const CModelFlags iceFlags(5, 0, 3, color);
mData.GetAnimationData()->Render(*iceModel, iceFlags, {}, nullptr); mData.GetAnimationData()->Render(*iceModel, iceFlags, std::nullopt, nullptr);
} }
} else if (thermalHot) { } else if (thermalHot) {
const CModelFlags thermFlags(5, 0, 3, zeus::skWhite); const CModelFlags thermFlags(5, 0, 3, zeus::skWhite);
mData.RenderThermal(zeus::skWhite, zeus::CColor(0.f, 0.25f), thermFlags); mData.RenderThermal(zeus::skWhite, zeus::CColor(0.f, 0.25f), thermFlags);
} else { } else {
mData.GetAnimationData()->Render(model, flags, {}, nullptr); mData.GetAnimationData()->Render(model, flags, std::nullopt, nullptr);
} }
} }