Remove I3DEngine CryCommon Interface (#567)
Delete: - I3DEngine - Missions - Time of day - GameEffectsSystem Gem - ImageProcessing Gem - SVOGI Gem - Various other things that don't do anything now that the legacy renderer has been removed.
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include <IProcess.h>
|
||||
#include "Log.h"
|
||||
#include "XConsole.h"
|
||||
#include <I3DEngine.h>
|
||||
#include <CryLibrary.h>
|
||||
#include "PhysRenderer.h"
|
||||
#include <IMovieSystem.h>
|
||||
@@ -222,92 +221,6 @@ void CSystem::CreateRendererVars(const SSystemInitParams& startupParams)
|
||||
"Usage: r_OverscanBordersDrawDebugView [0=off/1=show]");
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderBegin()
|
||||
{
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
|
||||
if (m_bIgnoreUpdates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool rndAvail = m_env.pRenderer != 0;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//start the rendering pipeline
|
||||
if (rndAvail)
|
||||
{
|
||||
m_env.pRenderer->BeginFrame();
|
||||
}
|
||||
|
||||
gEnv->nMainFrameID = (rndAvail) ? m_env.pRenderer->GetFrameID(false) : 0;
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderEnd([[maybe_unused]] bool bRenderStats, bool bMainWindow)
|
||||
{
|
||||
{
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
|
||||
if (m_bIgnoreUpdates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_env.pRenderer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (bMainWindow) // we don't do this in UI Editor window for example
|
||||
{
|
||||
#if !defined (_RELEASE)
|
||||
// Flush render data and swap buffers.
|
||||
m_env.pRenderer->RenderDebug(bRenderStats);
|
||||
#endif
|
||||
|
||||
#if defined(USE_PERFHUD)
|
||||
if (m_pPerfHUD)
|
||||
{
|
||||
m_pPerfHUD->Draw();
|
||||
}
|
||||
if (m_pMiniGUI)
|
||||
{
|
||||
m_pMiniGUI->Draw();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!gEnv->pSystem->GetILevelSystem() || !gEnv->pSystem->GetILevelSystem()->IsLevelLoaded())
|
||||
{
|
||||
IConsole* console = GetIConsole();
|
||||
|
||||
//Same goes for the console. When no level is loaded, it's okay to render it outside of the renderer
|
||||
//so that users can load maps or change settings.
|
||||
if (console != nullptr)
|
||||
{
|
||||
console->Draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_env.pRenderer->ForceGC(); // XXX Rename this
|
||||
m_env.pRenderer->EndFrame();
|
||||
|
||||
|
||||
if (IConsole* pConsole = GetIConsole())
|
||||
{
|
||||
// if we have pending cvar calculation, execute it here
|
||||
// since we know cvars will be correct here after ->EndFrame().
|
||||
if (!pConsole->IsHashCalculated())
|
||||
{
|
||||
pConsole->CalcCheatVarHash();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::OnScene3DEnd()
|
||||
{
|
||||
//Render Console
|
||||
@@ -391,231 +304,3 @@ void CSystem::DisplayErrorMessage(const char* acMessage,
|
||||
#endif
|
||||
m_ErrorMessages.push_back(message);
|
||||
}
|
||||
|
||||
//! Renders the statistics; this is called from RenderEnd, but if the
|
||||
//! Host application (Editor) doesn't employ the Render cycle in ISystem,
|
||||
//! it may call this method to render the essential statistics
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderStatistics()
|
||||
{
|
||||
RenderStats();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
void CSystem::Render()
|
||||
{
|
||||
if (m_bIgnoreUpdates)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//check what is the current process
|
||||
if (!m_pProcess)
|
||||
{
|
||||
return; //should never happen
|
||||
}
|
||||
//check if the game is in pause or
|
||||
//in menu mode
|
||||
//bool bPause=false;
|
||||
//if (m_pProcess->GetFlags() & PROC_MENU)
|
||||
// bPause=true;
|
||||
|
||||
FUNCTION_PROFILER_FAST(GetISystem(), PROFILE_SYSTEM, g_bProfilerEnabled);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
//draw
|
||||
m_env.p3DEngine->PreWorldStreamUpdate(m_ViewCamera);
|
||||
|
||||
if (m_pProcess)
|
||||
{
|
||||
if (m_pProcess->GetFlags() & PROC_3DENGINE)
|
||||
{
|
||||
if (!gEnv->IsEditing()) // Editor calls it's own rendering update
|
||||
{
|
||||
if (m_env.p3DEngine && !m_env.IsFMVPlaying())
|
||||
{
|
||||
if (!IsEquivalent(m_ViewCamera.GetPosition(), Vec3(0, 0, 0), VEC_EPSILON) || // never pass undefined camera to p3DEngine->RenderWorld()
|
||||
gEnv->IsDedicated() || (gEnv->pRenderer && gEnv->pRenderer->IsPost3DRendererEnabled()))
|
||||
{
|
||||
GetIRenderer()->SetViewport(0, 0, GetIRenderer()->GetWidth(), GetIRenderer()->GetHeight());
|
||||
m_env.p3DEngine->RenderWorld(SHDF_ALLOW_WATER | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOWHDR | SHDF_ZPASS | SHDF_ALLOW_AO, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_ViewCamera), __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gEnv->pRenderer)
|
||||
{
|
||||
// force rendering of black screen to be sure we don't only render the clear color (which is the fog color by default)
|
||||
gEnv->pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
|
||||
gEnv->pRenderer->Draw2dImage(0, 0, 800, 600, -1, 0.0f, 0.0f, 1.0f, 1.0f, 0.f,
|
||||
0.0f, 0.0f, 0.0f, 1.0f, 0.f);
|
||||
}
|
||||
}
|
||||
}
|
||||
#if !defined(_RELEASE)
|
||||
if (m_pVisRegTest)
|
||||
{
|
||||
m_pVisRegTest->AfterRender();
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_env.pMovieSystem)
|
||||
{
|
||||
m_env.pMovieSystem->Render();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GetIRenderer()->SetViewport(0, 0, GetIRenderer()->GetWidth(), GetIRenderer()->GetHeight());
|
||||
m_pProcess->RenderWorld(SHDF_ALLOW_WATER | SHDF_ALLOWPOSTPROCESS | SHDF_ALLOWHDR | SHDF_ZPASS | SHDF_ALLOW_AO, SRenderingPassInfo::CreateGeneralPassRenderingInfo(m_ViewCamera), __FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
m_env.p3DEngine->WorldStreamUpdate();
|
||||
|
||||
gEnv->pRenderer->SwitchToNativeResolutionBackbuffer();
|
||||
}
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CSystem::RenderStats()
|
||||
{
|
||||
#if defined(ENABLE_PROFILING_CODE)
|
||||
#ifndef _RELEASE
|
||||
// if we rendered an error message on screen during the last frame, then sleep now
|
||||
// to force hard stall for 3sec
|
||||
if (m_bHasRenderedErrorMessage && !gEnv->IsEditor() && !IsLoading())
|
||||
{
|
||||
// DO NOT REMOVE OR COMMENT THIS OUT!
|
||||
// If you hit this, then you most likely have invalid (synchronous) file accesses
|
||||
// which must be fixed in order to not stall the entire game.
|
||||
Sleep(3000);
|
||||
m_bHasRenderedErrorMessage = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// render info messages on screen
|
||||
float fTextPosX = 5.0f;
|
||||
float fTextPosY = -10;
|
||||
float fTextStepY = 13;
|
||||
|
||||
float fFrameTime = gEnv->pTimer->GetRealFrameTime();
|
||||
TErrorMessages::iterator itnext;
|
||||
for (TErrorMessages::iterator it = m_ErrorMessages.begin(); it != m_ErrorMessages.end(); it = itnext)
|
||||
{
|
||||
itnext = it;
|
||||
++itnext;
|
||||
SErrorMessage& message = *it;
|
||||
|
||||
SDrawTextInfo ti;
|
||||
ti.flags = eDrawText_FixedSize | eDrawText_2D | eDrawText_Monospace;
|
||||
memcpy(ti.color, message.m_Color, 4 * sizeof(float));
|
||||
ti.xscale = ti.yscale = 1.4f;
|
||||
m_env.pRenderer->DrawTextQueued(Vec3(fTextPosX, fTextPosY += fTextStepY, 1.0f), ti, message.m_Message.c_str());
|
||||
|
||||
if (!IsLoading())
|
||||
{
|
||||
message.m_fTimeToShow -= fFrameTime;
|
||||
}
|
||||
|
||||
if (message.m_HardFailure)
|
||||
{
|
||||
m_bHasRenderedErrorMessage = true;
|
||||
}
|
||||
|
||||
if (message.m_fTimeToShow < 0.0f)
|
||||
{
|
||||
m_ErrorMessages.erase(it);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!m_env.pConsole)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef _RELEASE
|
||||
if (m_rOverscanBordersDrawDebugView)
|
||||
{
|
||||
RenderOverscanBorders();
|
||||
}
|
||||
#endif
|
||||
|
||||
int iDisplayInfo = m_rDisplayInfo->GetIVal();
|
||||
if (iDisplayInfo == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Draw engine stats
|
||||
if (m_env.p3DEngine)
|
||||
{
|
||||
// Draw 3dengine stats and get last text cursor position
|
||||
float nTextPosX = 101 - 20, nTextPosY = -2, nTextStepY = 3;
|
||||
m_env.p3DEngine->DisplayInfo(nTextPosX, nTextPosY, nTextStepY, iDisplayInfo != 1);
|
||||
|
||||
// Dump Open 3D Engine CPU and GPU memory statistics to screen
|
||||
m_env.p3DEngine->DisplayMemoryStatistics();
|
||||
|
||||
#if defined(ENABLE_LW_PROFILERS)
|
||||
if (m_rDisplayInfo->GetIVal() == 2)
|
||||
{
|
||||
m_env.pRenderer->TextToScreen(nTextPosX, nTextPosY += nTextStepY, "SysMem %.1f mb",
|
||||
float(DumpMMStats(false)) / 1024.f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
for (int i = 0; i < NUM_POOLS; ++i)
|
||||
{
|
||||
int used = (g_pPakHeap->m_iBigPoolUsed[i] ? (int)g_pPakHeap->m_iBigPoolSize[i] : 0);
|
||||
int size = (int)g_pPakHeap->m_iBigPoolSize[i];
|
||||
float fC1[4] = {1, 1, 0, 1};
|
||||
m_env.pRenderer->Draw2dLabel(10, 100.0f + i * 16, 2.1f, fC1, false, "BigPool %d: %d bytes of %d bytes used", i, used, size);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CSystem::RenderOverscanBorders()
|
||||
{
|
||||
#ifndef _RELEASE
|
||||
|
||||
if (m_env.pRenderer && m_rOverscanBordersDrawDebugView)
|
||||
{
|
||||
int iOverscanBordersDrawDebugView = m_rOverscanBordersDrawDebugView->GetIVal();
|
||||
if (iOverscanBordersDrawDebugView)
|
||||
{
|
||||
const int texId = -1;
|
||||
const float uv = 0.0f;
|
||||
const float rot = 0.0f;
|
||||
const int whiteTextureId = m_env.pRenderer->GetWhiteTextureId();
|
||||
|
||||
const float r = 1.0f;
|
||||
const float g = 1.0f;
|
||||
const float b = 1.0f;
|
||||
const float a = 0.2f;
|
||||
|
||||
Vec2 overscanBorders = Vec2(0.0f, 0.0f);
|
||||
m_env.pRenderer->EF_Query(EFQ_OverscanBorders, overscanBorders);
|
||||
|
||||
const float overscanBorderWidth = overscanBorders.x * VIRTUAL_SCREEN_WIDTH;
|
||||
const float overscanBorderHeight = overscanBorders.y * VIRTUAL_SCREEN_HEIGHT;
|
||||
|
||||
const float xPos = overscanBorderWidth;
|
||||
const float yPos = overscanBorderHeight;
|
||||
const float width = VIRTUAL_SCREEN_WIDTH - (2.0f * overscanBorderWidth);
|
||||
const float height = VIRTUAL_SCREEN_HEIGHT - (2.0f * overscanBorderHeight);
|
||||
|
||||
m_env.pRenderer->SetState(GS_BLSRC_SRCALPHA | GS_BLDST_ONEMINUSSRCALPHA | GS_NODEPTHTEST);
|
||||
m_env.pRenderer->Draw2dImage(xPos, yPos,
|
||||
width, height,
|
||||
whiteTextureId,
|
||||
uv, uv, uv, uv,
|
||||
rot,
|
||||
r, g, b, a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user