Don't render to texture when in wireframe mode, re #43

--HG--
branch : multipass-stereo
This commit is contained in:
kaetemi 2013-07-05 03:42:38 +02:00
parent 248f07ad9e
commit eab2386ff6
3 changed files with 114 additions and 79 deletions

View file

@ -257,6 +257,8 @@ void CStereoDebugger::getClippingFrustum(uint cid, NL3D::UCamera *camera) const
/// Is there a next pass
bool CStereoDebugger::nextPass()
{
if (m_Driver->getPolygonMode() == UDriver::Filled)
{
switch (m_Stage)
{
case 0:
@ -268,10 +270,29 @@ bool CStereoDebugger::nextPass()
m_SubStage = 0;
return true;
case 2:
++m_Stage;
m_SubStage = 0;
return true;
case 3:
m_Stage = 0;
m_SubStage = 0;
return false;
}
}
else
{
switch (m_Stage)
{
case 0:
++m_Stage;
m_SubStage = 0;
return true;
case 1:
m_Stage = 0;
m_SubStage = 0;
return false;
}
}
}
/// Gets the current viewport
@ -303,34 +324,34 @@ void CStereoDebugger::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const
bool CStereoDebugger::wantClear()
{
m_SubStage = 1;
return true;
return m_Stage != 3;
}
/// The 3D scene
bool CStereoDebugger::wantScene()
{
m_SubStage = 2;
return true;
return m_Stage != 3;
}
/// Interface within the 3D scene
bool CStereoDebugger::wantInterface3D()
{
m_SubStage = 3;
return true;
return m_Stage == 3;
}
/// 2D Interface
bool CStereoDebugger::wantInterface2D()
{
m_SubStage = 4;
return true;
return m_Stage == 3;
}
/// Returns true if a new render target was set, always fase if not using render targets
bool CStereoDebugger::beginRenderTarget()
{
if (m_Driver)
if (m_Stage != 3 && m_Driver && (m_Driver->getPolygonMode() == UDriver::Filled))
{
if (m_Stage % 2) static_cast<CDriverUser *>(m_Driver)->setRenderTarget(*m_RightTexU, 0, 0, 0, 0);
else static_cast<CDriverUser *>(m_Driver)->setRenderTarget(*m_LeftTexU, 0, 0, 0, 0);
@ -342,7 +363,7 @@ bool CStereoDebugger::beginRenderTarget()
/// Returns true if a render target was fully drawn, always false if not using render targets
bool CStereoDebugger::endRenderTarget()
{
if (m_Driver)
if (m_Stage != 3 && m_Driver && (m_Driver->getPolygonMode() == UDriver::Filled))
{
CTextureUser cu;
(static_cast<CDriverUser *>(m_Driver))->setRenderTarget(cu);

View file

@ -359,6 +359,8 @@ bool CStereoOVR::nextPass()
nlassert(width == m_DevicePtr->HMDInfo.HResolution);
nlassert(height == m_DevicePtr->HMDInfo.VResolution);
if (m_Driver->getPolygonMode() == UDriver::Filled)
{
switch (m_Stage)
{
case 0:
@ -408,6 +410,21 @@ bool CStereoOVR::nextPass()
m_OrientationCached = false;
return false;
}
}
else
{
switch (m_Stage)
{
case 0:
++m_Stage;
m_SubStage = 0;
return true;
case 1:
m_Stage = 0;
m_SubStage = 0;
return false;
}
}
nlerror("Invalid stage");
m_Stage = 0;
m_SubStage = 0;
@ -459,7 +476,7 @@ bool CStereoOVR::wantClear()
m_SubStage = 1;
return true;
}
return false;
return m_Driver->getPolygonMode() != UDriver::Filled;
}
bool CStereoOVR::wantScene()
@ -471,7 +488,7 @@ bool CStereoOVR::wantScene()
m_SubStage = 2;
return true;
}
return false;
return m_Driver->getPolygonMode() != UDriver::Filled;
}
bool CStereoOVR::wantInterface3D()
@ -483,7 +500,7 @@ bool CStereoOVR::wantInterface3D()
m_SubStage = 3;
return true;
}
return false;
return m_Driver->getPolygonMode() != UDriver::Filled;
}
bool CStereoOVR::wantInterface2D()
@ -495,7 +512,7 @@ bool CStereoOVR::wantInterface2D()
m_SubStage = 4;
return true;
}
return false;
return m_Driver->getPolygonMode() != UDriver::Filled;
}
@ -504,7 +521,7 @@ bool CStereoOVR::beginRenderTarget()
{
// render target always set before driver clear
// nlassert(m_SubStage <= 1);
if (m_Driver && m_Stage == 1)
if (m_Driver && m_Stage == 1 && (m_Driver->getPolygonMode() == UDriver::Filled))
{
static_cast<CDriverUser *>(m_Driver)->setRenderTarget(*m_BarrelTexU, 0, 0, 0, 0);
return true;
@ -517,7 +534,7 @@ bool CStereoOVR::endRenderTarget()
{
// after rendering of course
// nlassert(m_SubStage > 1);
if (m_Driver && m_Stage == 6) // set to 4 to turn off distortion of 2d gui
if (m_Driver && m_Stage == 6 && (m_Driver->getPolygonMode() == UDriver::Filled)) // set to 4 to turn off distortion of 2d gui
{
CTextureUser cu;
(static_cast<CDriverUser *>(m_Driver))->setRenderTarget(cu);

View file

@ -1627,14 +1627,11 @@ bool mainLoop()
// RENDER THE FRAME 3D //
//////////////////////////
if (StereoDisplay)
{
StereoDisplay->beginRenderTarget();
}
bool stereoRenderTarget = (StereoDisplay != NULL) && StereoDisplay->beginRenderTarget();
if (!StereoDisplay || StereoDisplay->wantClear())
{
if(Render)
if (Render)
{
if (ClientCfg.Bloom)
{
@ -1777,14 +1774,14 @@ bool mainLoop()
Driver->setMatrixMode2D11();
// draw a big quad to represent thunder strokes
if (Render && WeatherManager.getThunderLevel() != 0.f)
/*if (Render && WeatherManager.getThunderLevel() != 0.f)
{
H_AUTO_USE ( RZ_Client_Main_Loop_Render_Thunder )
Driver->drawQuad(0, 0, 1, 1, ThunderColor);
// TODO : boris : add sound here !
// Needs more explosions
}
}*/
// Update the contextual menu
{