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,20 +257,41 @@ void CStereoDebugger::getClippingFrustum(uint cid, NL3D::UCamera *camera) const
/// Is there a next pass
bool CStereoDebugger::nextPass()
{
switch (m_Stage)
if (m_Driver->getPolygonMode() == UDriver::Filled)
{
case 0:
++m_Stage;
m_SubStage = 0;
return true;
case 1:
++m_Stage;
m_SubStage = 0;
return true;
case 2:
m_Stage = 0;
m_SubStage = 0;
return false;
switch (m_Stage)
{
case 0:
++m_Stage;
m_SubStage = 0;
return true;
case 1:
++m_Stage;
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;
}
}
}
@ -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,54 +359,71 @@ bool CStereoOVR::nextPass()
nlassert(width == m_DevicePtr->HMDInfo.HResolution);
nlassert(height == m_DevicePtr->HMDInfo.VResolution);
switch (m_Stage)
if (m_Driver->getPolygonMode() == UDriver::Filled)
{
case 0:
++m_Stage;
m_SubStage = 0;
// stage 1:
// (initBloom)
// clear buffer
// draw scene left
return true;
case 1:
++m_Stage;
m_SubStage = 0;
// stage 2:
// draw scene right
return true;
case 2:
++m_Stage;
m_SubStage = 0;
// stage 3:
// (endBloom)
// draw interface 3d left
return true;
case 3:
++m_Stage;
m_SubStage = 0;
// stage 4:
// draw interface 3d right
return true;
case 4:
++m_Stage;
m_SubStage = 0;
// stage 5:
// (endInterfacesDisplayBloom)
// draw interface 2d left
return true;
case 5:
++m_Stage;
m_SubStage = 0;
// stage 6:
// draw interface 2d right
return true;
case 6:
m_Stage = 0;
m_SubStage = 0;
// present
m_OrientationCached = false;
return false;
switch (m_Stage)
{
case 0:
++m_Stage;
m_SubStage = 0;
// stage 1:
// (initBloom)
// clear buffer
// draw scene left
return true;
case 1:
++m_Stage;
m_SubStage = 0;
// stage 2:
// draw scene right
return true;
case 2:
++m_Stage;
m_SubStage = 0;
// stage 3:
// (endBloom)
// draw interface 3d left
return true;
case 3:
++m_Stage;
m_SubStage = 0;
// stage 4:
// draw interface 3d right
return true;
case 4:
++m_Stage;
m_SubStage = 0;
// stage 5:
// (endInterfacesDisplayBloom)
// draw interface 2d left
return true;
case 5:
++m_Stage;
m_SubStage = 0;
// stage 6:
// draw interface 2d right
return true;
case 6:
m_Stage = 0;
m_SubStage = 0;
// present
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;
@ -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
{