diff options
| author | Joe Ludwig <[email protected]> | 2013-12-03 08:54:16 -0800 |
|---|---|---|
| committer | Joe Ludwig <[email protected]> | 2013-12-03 08:54:16 -0800 |
| commit | beaae8ac45a2f322a792404092d4482065bef7ef (patch) | |
| tree | 747f35193ba235f0f0b070c05b53468a54559c8e /mp/src/game/client/view.cpp | |
| parent | Make .xcconfigs text files too. (diff) | |
| download | source-sdk-2013-beaae8ac45a2f322a792404092d4482065bef7ef.tar.xz source-sdk-2013-beaae8ac45a2f322a792404092d4482065bef7ef.zip | |
Updated the SDK with the latest code from the TF and HL2 branches
* Adds support for Visual Studio 2012 and 2013
* VR Mode:
. Switches from headtrack.dll to sourcevr.dll
. Improved readability of the UI in VR
. Removed the IPD calibration tool. TF2 will now obey the Oculus
configuration file. Use the Oculus calibration tool in your SDK or
install and run "OpenVR" under Tools in Steam to calibrate your IPD.
. Added dropdown to enable VR mode in the Video options. Removed the -vr
command line option.
. Added the ability to switch in and out of VR mode without quitting the
game
. By default VR mode will run full screen. To switch back to a
borderless window set the vr_force_windowed convar.
. Added support for VR mode on Linux
* Many assorted bug fixes and other changes from Team Fortress in
various shared files
Diffstat (limited to 'mp/src/game/client/view.cpp')
| -rw-r--r-- | mp/src/game/client/view.cpp | 116 |
1 files changed, 40 insertions, 76 deletions
diff --git a/mp/src/game/client/view.cpp b/mp/src/game/client/view.cpp index b282b5c3..333a2756 100644 --- a/mp/src/game/client/view.cpp +++ b/mp/src/game/client/view.cpp @@ -36,13 +36,14 @@ #include "materialsystem/itexture.h" #include "materialsystem/imaterialsystem.h" #include "materialsystem/materialsystem_config.h" +#include "VGuiMatSurface/IMatSystemSurface.h" #include "toolframework_client.h" #include "tier0/icommandline.h" #include "ienginevgui.h" #include <vgui_controls/Controls.h> #include <vgui/ISurface.h> #include "ScreenSpaceEffects.h" -#include "headtrack/isourcevirtualreality.h" +#include "sourcevr/isourcevirtualreality.h" #include "client_virtualreality.h" #if defined( REPLAY_ENABLED ) @@ -84,10 +85,6 @@ extern ConVar sensitivity; ConVar zoom_sensitivity_ratio( "zoom_sensitivity_ratio", "1.0", 0, "Additional mouse sensitivity scale factor applied when FOV is zoomed in." ); -#ifdef STAGING_ONLY -ConVar vr_stereo_debug_viewport( "vr_stereo_debug_viewport", "0" ); -#endif - CViewRender g_DefaultViewRender; IViewRender *view = NULL; // set in cldll_client_init.cpp if no mod creates their own @@ -301,16 +298,6 @@ void CViewRender::Init( void ) m_pDrawEntities = cvar->FindVar( "r_drawentities" ); m_pDrawBrushModels = cvar->FindVar( "r_drawbrushmodels" ); - if( UseVR() ) - { - m_eStartEye = STEREO_EYE_LEFT; - m_eLastEye = STEREO_EYE_RIGHT; - } - else - { - m_eStartEye = m_eLastEye = STEREO_EYE_MONO; - } - beams->InitBeams(); tempents->Init(); @@ -500,12 +487,18 @@ void CViewRender::DriftPitch (void) StereoEye_t CViewRender::GetFirstEye() const { - return m_eStartEye; + if( UseVR() ) + return STEREO_EYE_LEFT; + else + return STEREO_EYE_MONO; } StereoEye_t CViewRender::GetLastEye() const { - return m_eLastEye; + if( UseVR() ) + return STEREO_EYE_RIGHT; + else + return STEREO_EYE_MONO; } @@ -1177,57 +1170,14 @@ void CViewRender::Render( vrect_t *rect ) } break; - case STEREO_EYE_LEFT: - { -#ifdef STAGING_ONLY - if ( vr_stereo_debug_viewport.GetBool() ) - { - // Stress-test for crazy viewports. - view.width = vr.width * flViewportScale * 0.25f; - view.height = vr.height * flViewportScale * 0.75f; - view.x = vr.x * flViewportScale; - view.y = (vr.y + vr.height * 0.20f) * flViewportScale; - - view.m_nUnscaledWidth = vr.width / 2; - } - else -#endif - { - view.width = vr.width * flViewportScale * 0.5f; - view.height = vr.height * flViewportScale; - view.x = vr.x * flViewportScale ; - view.y = vr.y * flViewportScale; - - view.m_nUnscaledWidth = vr.width / 2; - } - } - break; - case STEREO_EYE_RIGHT: + case STEREO_EYE_LEFT: { -#ifdef STAGING_ONLY - if ( vr_stereo_debug_viewport.GetBool() ) - { - // Stress-test for crazy viewports. - view.width = vr.width * flViewportScale * 0.75f; - view.height = vr.height * flViewportScale * 0.75f; - view.x = vr.x + vr.width * 0.25f; - view.y = vr.y + vr.height * 0.1f; - - view.m_nUnscaledWidth = vr.width / 2; - view.m_nUnscaledX = vr.x + view.m_nUnscaledWidth; - } - else -#endif - { - view.width = vr.width * flViewportScale * 0.5f; - view.height = vr.height * flViewportScale; - view.x = (vr.x + view.width) * flViewportScale; - view.y = vr.y * flViewportScale; - - view.m_nUnscaledWidth = vr.width / 2; - view.m_nUnscaledX = vr.x + view.m_nUnscaledWidth; - } + g_pSourceVR->GetViewportBounds( (ISourceVirtualReality::VREye)(eEye - 1 ), &view.x, &view.y, &view.width, &view.height ); + view.m_nUnscaledWidth = view.width; + view.m_nUnscaledHeight = view.height; + view.m_nUnscaledX = view.x; + view.m_nUnscaledY = view.y; } break; @@ -1302,9 +1252,32 @@ void CViewRender::Render( vrect_t *rect ) // we should use the monitor view from the left eye for both eyes flags |= RENDERVIEW_SUPPRESSMONITORRENDERING; } + RenderView( view, nClearFlags, flags ); - } + if ( UseVR() ) + { + bool bDoUndistort = ! engine->IsTakingScreenshot(); + + if ( bDoUndistort ) + { + g_ClientVirtualReality.PostProcessFrame( eEye ); + } + + // logic here all cloned from code in viewrender.cpp around RenderHUDQuad: + + // figure out if we really want to draw the HUD based on freeze cam + bool bInFreezeCam = ( pPlayer && pPlayer->GetObserverMode() == OBS_MODE_FREEZECAM ); + + // draw the HUD after the view model so its "I'm closer" depth queues work right. + if( !bInFreezeCam && g_ClientVirtualReality.ShouldRenderHUDInWorld() ) + { + // TODO - a bit of a shonky test - basically trying to catch the main menu, the briefing screen, the loadout screen, etc. + bool bTranslucent = !g_pMatSystemSurface->IsCursorVisible(); + g_ClientVirtualReality.OverlayHUDQuadWithUndistort( view, bDoUndistort, g_pClientMode->ShouldBlackoutAroundHUD(), bTranslucent ); + } + } + } // TODO: should these be inside or outside the stereo eye stuff? @@ -1334,15 +1307,6 @@ void CViewRender::Render( vrect_t *rect ) } - if ( UseVR() ) - { - if ( !engine->IsTakingScreenshot() ) - { - // Deal with the distortion on the display. - g_ClientVirtualReality.PostProcessFrame( rect ); - } - } - } |