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

This commit is contained in:
kaetemi 2013-07-05 03:42:38 +02:00
parent c3f6f5b8ff
commit cb9e5762db
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 /// Is there a next pass
bool CStereoDebugger::nextPass() bool CStereoDebugger::nextPass()
{ {
if (m_Driver->getPolygonMode() == UDriver::Filled)
{
switch (m_Stage) switch (m_Stage)
{ {
case 0: case 0:
@ -268,10 +270,29 @@ bool CStereoDebugger::nextPass()
m_SubStage = 0; m_SubStage = 0;
return true; return true;
case 2: case 2:
++m_Stage;
m_SubStage = 0;
return true;
case 3:
m_Stage = 0; m_Stage = 0;
m_SubStage = 0; m_SubStage = 0;
return 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;
}
}
} }
/// Gets the current viewport /// Gets the current viewport
@ -303,34 +324,34 @@ void CStereoDebugger::getCurrentMatrix(uint cid, NL3D::UCamera *camera) const
bool CStereoDebugger::wantClear() bool CStereoDebugger::wantClear()
{ {
m_SubStage = 1; m_SubStage = 1;
return true; return m_Stage != 3;
} }
/// The 3D scene /// The 3D scene
bool CStereoDebugger::wantScene() bool CStereoDebugger::wantScene()
{ {
m_SubStage = 2; m_SubStage = 2;
return true; return m_Stage != 3;
} }
/// Interface within the 3D scene /// Interface within the 3D scene
bool CStereoDebugger::wantInterface3D() bool CStereoDebugger::wantInterface3D()
{ {
m_SubStage = 3; m_SubStage = 3;
return true; return m_Stage == 3;
} }
/// 2D Interface /// 2D Interface
bool CStereoDebugger::wantInterface2D() bool CStereoDebugger::wantInterface2D()
{ {
m_SubStage = 4; 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 /// Returns true if a new render target was set, always fase if not using render targets
bool CStereoDebugger::beginRenderTarget() 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); 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); 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 /// Returns true if a render target was fully drawn, always false if not using render targets
bool CStereoDebugger::endRenderTarget() bool CStereoDebugger::endRenderTarget()
{ {
if (m_Driver) if (m_Stage != 3 && m_Driver && (m_Driver->getPolygonMode() == UDriver::Filled))
{ {
CTextureUser cu; CTextureUser cu;
(static_cast<CDriverUser *>(m_Driver))->setRenderTarget(cu); (static_cast<CDriverUser *>(m_Driver))->setRenderTarget(cu);

View file

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

View file

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