Remove (almost) all references to pRenderer (#651)

Remove all references to pRenderer, except from the DebugDraw and LyShine Gems that are still being updated.
This commit is contained in:
bosnichd
2021-05-10 10:05:15 -06:00
committed by GitHub
parent 4a2e6a77b5
commit 440c40e490
191 changed files with 118 additions and 23548 deletions
@@ -915,14 +915,6 @@ void CComponentEntityObject::Display(DisplayContext& dc)
m_entityId, &AzFramework::EntityDebugDisplayEvents::DisplayEntityViewport,
AzFramework::ViewportInfo{ dc.GetView()->asCViewport()->GetViewportId() },
*debugDisplay);
if (showIcons)
{
if (!displaySelectionHelper && !IsSelected())
{
m_entityIconVisible = DisplayEntityIcon(dc, *debugDisplay);
}
}
}
}
}
@@ -984,38 +976,6 @@ void CComponentEntityObject::OnContextMenu(QMenu* /*pMenu*/)
// Deliberately bypass the base class implementation (CEntityObject::OnContextMenu()).
}
bool CComponentEntityObject::DisplayEntityIcon(
DisplayContext& displayContext, AzFramework::DebugDisplayRequests& debugDisplay)
{
if (!m_hasIcon)
{
return false;
}
const QPoint entityScreenPos = displayContext.GetView()->WorldToView(GetWorldPos());
const Vec3 worldPos = GetWorldPos();
const CCamera& camera = gEnv->pRenderer->GetCamera();
const Vec3 cameraToEntity = (worldPos - camera.GetMatrix().GetTranslation());
const float distSq = cameraToEntity.GetLengthSquared();
if (distSq > square(s_kIconMaxWorldDist))
{
return false;
}
// Draw component icons on top of meshes (no depth testing)
int iconFlags = (int) DisplayContext::ETextureIconFlags::TEXICON_ON_TOP;
SetDrawTextureIconProperties(displayContext, worldPos, 1.0f, iconFlags);
const float iconScale = s_kIconMinScale + (s_kIconMaxScale - s_kIconMinScale) * (1.0f - clamp_tpl(max(0.0f, sqrt_tpl(distSq) - s_kIconCloseDist) / s_kIconFarDist, 0.0f, 1.0f));
const float worldDistToScreenScaleFraction = 0.045f;
const float screenScale = displayContext.GetView()->GetScreenScaleFactor(GetWorldPos()) * worldDistToScreenScaleFraction;
debugDisplay.DrawTextureLabel(m_iconTexture, LYVec3ToAZVec3(worldPos), s_kIconSize * iconScale, s_kIconSize * iconScale, GetTextureIconFlags());
return true;
}
void CComponentEntityObject::SetupEntityIcon()
{
bool hideIconInViewport = false;
@@ -1031,8 +991,9 @@ void CComponentEntityObject::SetupEntityIcon()
{
m_hasIcon = true;
int textureId = GetIEditor()->GetIconManager()->GetIconTexture(m_icon.c_str());
m_iconTexture = GetIEditor()->GetRenderer() ? GetIEditor()->GetRenderer()->EF_GetTextureByID(textureId) : nullptr;
// ToDo: Get from Atom?
// int textureId = GetIEditor()->GetIconManager()->GetIconTexture(m_icon.c_str());
m_iconTexture = nullptr;
}
}
}