Don't render to texture when in wireframe mode, re #43
This commit is contained in:
parent
fc663f210f
commit
a0140fd551
3 changed files with 114 additions and 79 deletions
|
@ -257,20 +257,41 @@ 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()
|
||||||
{
|
{
|
||||||
switch (m_Stage)
|
if (m_Driver->getPolygonMode() == UDriver::Filled)
|
||||||
{
|
{
|
||||||
case 0:
|
switch (m_Stage)
|
||||||
++m_Stage;
|
{
|
||||||
m_SubStage = 0;
|
case 0:
|
||||||
return true;
|
++m_Stage;
|
||||||
case 1:
|
m_SubStage = 0;
|
||||||
++m_Stage;
|
return true;
|
||||||
m_SubStage = 0;
|
case 1:
|
||||||
return true;
|
++m_Stage;
|
||||||
case 2:
|
m_SubStage = 0;
|
||||||
m_Stage = 0;
|
return true;
|
||||||
m_SubStage = 0;
|
case 2:
|
||||||
return false;
|
++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()
|
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);
|
||||||
|
|
|
@ -359,54 +359,71 @@ 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);
|
||||||
|
|
||||||
switch (m_Stage)
|
if (m_Driver->getPolygonMode() == UDriver::Filled)
|
||||||
{
|
{
|
||||||
case 0:
|
switch (m_Stage)
|
||||||
++m_Stage;
|
{
|
||||||
m_SubStage = 0;
|
case 0:
|
||||||
// stage 1:
|
++m_Stage;
|
||||||
// (initBloom)
|
m_SubStage = 0;
|
||||||
// clear buffer
|
// stage 1:
|
||||||
// draw scene left
|
// (initBloom)
|
||||||
return true;
|
// clear buffer
|
||||||
case 1:
|
// draw scene left
|
||||||
++m_Stage;
|
return true;
|
||||||
m_SubStage = 0;
|
case 1:
|
||||||
// stage 2:
|
++m_Stage;
|
||||||
// draw scene right
|
m_SubStage = 0;
|
||||||
return true;
|
// stage 2:
|
||||||
case 2:
|
// draw scene right
|
||||||
++m_Stage;
|
return true;
|
||||||
m_SubStage = 0;
|
case 2:
|
||||||
// stage 3:
|
++m_Stage;
|
||||||
// (endBloom)
|
m_SubStage = 0;
|
||||||
// draw interface 3d left
|
// stage 3:
|
||||||
return true;
|
// (endBloom)
|
||||||
case 3:
|
// draw interface 3d left
|
||||||
++m_Stage;
|
return true;
|
||||||
m_SubStage = 0;
|
case 3:
|
||||||
// stage 4:
|
++m_Stage;
|
||||||
// draw interface 3d right
|
m_SubStage = 0;
|
||||||
return true;
|
// stage 4:
|
||||||
case 4:
|
// draw interface 3d right
|
||||||
++m_Stage;
|
return true;
|
||||||
m_SubStage = 0;
|
case 4:
|
||||||
// stage 5:
|
++m_Stage;
|
||||||
// (endInterfacesDisplayBloom)
|
m_SubStage = 0;
|
||||||
// draw interface 2d left
|
// stage 5:
|
||||||
return true;
|
// (endInterfacesDisplayBloom)
|
||||||
case 5:
|
// draw interface 2d left
|
||||||
++m_Stage;
|
return true;
|
||||||
m_SubStage = 0;
|
case 5:
|
||||||
// stage 6:
|
++m_Stage;
|
||||||
// draw interface 2d right
|
m_SubStage = 0;
|
||||||
return true;
|
// stage 6:
|
||||||
case 6:
|
// draw interface 2d right
|
||||||
m_Stage = 0;
|
return true;
|
||||||
m_SubStage = 0;
|
case 6:
|
||||||
// present
|
m_Stage = 0;
|
||||||
m_OrientationCached = false;
|
m_SubStage = 0;
|
||||||
return false;
|
// 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");
|
nlerror("Invalid stage");
|
||||||
m_Stage = 0;
|
m_Stage = 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);
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue