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
@@ -137,15 +137,6 @@ void DebugCamera::PostUpdate()
CCamera& camera = gEnv->pSystem->GetViewCamera();
camera.SetMatrix(Matrix34(m_view, m_position));
const float FONT_COLOR[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
gEnv->pRenderer->Draw2dLabel(0.0f, 700.0f, 1.3f, FONT_COLOR, false,
"Debug Camera: pos [ %.3f, %.3f, %.3f ] p/y [ %.1f, %.1f ] dir [ %.3f, %.3f, %.3f ] scl %.2f inv %d",
m_position.x, m_position.y, m_position.z,
m_cameraPitch, m_cameraYaw,
m_view.GetColumn1().x, m_view.GetColumn1().y, m_view.GetColumn1().z,
m_moveScale,
m_isYInverted);
}
///////////////////////////////////////////////////////////////////////////////
@@ -101,25 +101,6 @@ void CView::Update(float frameTime, bool isActive)
const float farPlane = (m_viewParams.farplane > 0.f) ? m_viewParams.farplane : DEFAULT_FAR;
float fov = (m_viewParams.fov < 0.001f) ? DEFAULT_FOV : m_viewParams.fov;
// [VR] specific
// Modify FOV based on the HMD device configuration
bool isRenderingToHMD = gEnv->pRenderer ? gEnv->pRenderer->GetIStereoRenderer()->IsRenderingToHMD() : false;
if (isRenderingToHMD)
{
const AZ::VR::HMDDeviceInfo* deviceInfo = nullptr;
EBUS_EVENT_RESULT(deviceInfo, AZ::VR::HMDDeviceRequestBus, GetDeviceInfo);
if (deviceInfo)
{
//Add 12 degrees to the FOV here used for culling.
//It won't be used for rendering, just to make sure we don't cull
//anything out incorrectly.
//This value was decided based on experimentation with the HTC Vive
//and works perfectly fine for the Oculus Rift
const float fovCorrection = 12.0f;
fov = deviceInfo->fovV + DEG2RAD(fovCorrection);
}
}
m_camera.SetFrustum(pSysCam->GetViewSurfaceX(), pSysCam->GetViewSurfaceZ(), fov, nearPlane, farPlane, pSysCam->GetPixelAspectRatio());
//apply shake & set the view matrix
@@ -140,20 +121,6 @@ void CView::Update(float frameTime, bool isActive)
Vec3 pos = m_viewParams.position;
Vec3 p = Vec3(ZERO);
if (isRenderingToHMD)
{
//This HMD tracking state is used JUST for use in the visibility system.
//RT_SetStereoCamera in D3DRendPipeline will override this info before rendering with the absolute
//latest tracking info.
const AZ::VR::TrackingState* trackingState = nullptr;
EBUS_EVENT_RESULT(trackingState, AZ::VR::HMDDeviceRequestBus, GetTrackingState);
if (trackingState && trackingState->CheckStatusFlags(AZ::VR::HMDStatus_IsUsable))
{
p = q * AZVec3ToLYVec3(trackingState->pose.position);
q = q * AZQuaternionToLYQuaternion(trackingState->pose.orientation);
}
}
Matrix34 viewMtx(q);
viewMtx.SetTranslation(pos + p);
m_camera.SetMatrix(viewMtx);
@@ -640,30 +640,6 @@ void CViewSystem::ClearAllViews()
////////////////////////////////////////////////////////////////////
void CViewSystem::DebugDraw()
{
IRenderer* pRenderer = gEnv->pRenderer;
if (pRenderer)
{
float xpos = 20;
float ypos = 15;
float fColor[4] = {1.0f, 1.0f, 1.0f, 0.7f};
float fColorRed[4] = {1.0f, 0.0f, 0.0f, 0.7f};
float fColorGreen[4] = {0.0f, 1.0f, 0.0f, 0.7f};
pRenderer->Draw2dLabel(xpos, 5, 1.35f, fColor, false, "ViewSystem Stats: %" PRISIZE_T " Views ", m_views.size());
IView* pActiveView = GetActiveView();
for (TViewMap::iterator it = m_views.begin(); it != m_views.end(); ++it)
{
IView* pView = it->second;
const CCamera& cam = pView->GetCamera();
bool isActive = (pView == pActiveView);
Vec3 pos = cam.GetPosition();
Ang3 ang = cam.GetAngles();
pRenderer->Draw2dLabel(xpos, ypos, 1.35f, isActive ? fColorGreen : fColorRed, false, "View Camera: %p . View Id: %d, pos (%f, %f, %f), ang (%f, %f, %f)", &cam, it->first, pos.x, pos.y, pos.z, ang.x, ang.y, ang.z);
ypos += 11;
}
}
}
//////////////////////////////////////////////////////////////////////////