Skip to content

Commit

Permalink
create VR textures once rendering begins
Browse files Browse the repository at this point in the history
  • Loading branch information
sd805 committed Nov 27, 2022
1 parent 3f526b9 commit c5fbd77
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
5 changes: 1 addition & 4 deletions L4D2VR/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,7 @@ ITexture *__fastcall Hooks::dGetRenderTarget(void *ecx, void *edx)
void __fastcall Hooks::dRenderView(void *ecx, void *edx, CViewSetup &setup, CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw)
{
if (!m_VR->m_CreatedVRTextures)
{
hkRenderView.fOriginal(ecx, setup, hudViewSetup, nClearFlags, whatToDraw);
return;
}
m_VR->CreateVRTextures();

IMatRenderContext *rndrContext = m_Game->m_MaterialSystem->GetRenderContext();

Expand Down
10 changes: 1 addition & 9 deletions L4D2VR/vr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,6 @@ void VR::Update()

if (m_IsVREnabled && g_D3DVR9)
{
if (!m_CreatedVRTextures && m_Game->m_EngineClient->IsInGame())
{
CreateVRTextures();
}

// Prevents crashing at menu
if (!m_Game->m_EngineClient->IsInGame())
{
Expand All @@ -158,9 +153,7 @@ void VR::Update()
UpdateTracking();

if (m_Game->m_VguiSurface->IsCursorVisible())
{
ProcessMenuInput();
}
else
ProcessInput();
}
Expand Down Expand Up @@ -669,7 +662,7 @@ void VR::ProcessInput()
m_Game->ClientCmd_Unrestricted("impulse 201");
}

bool isControllerVertical = m_RightControllerAngAbs.x > 45;
bool isControllerVertical = m_RightControllerAngAbs.x > 60 || m_RightControllerAngAbs.x < -45;
if ((PressedDigitalAction(m_ShowHUD) || PressedDigitalAction(m_Scoreboard) || isControllerVertical || m_HudAlwaysVisible)
&& m_RenderedHud)
{
Expand All @@ -694,7 +687,6 @@ void VR::ProcessInput()
m_Game->ClientCmd_Unrestricted("gameui_activate");
RepositionOverlays();
}

}

QAngle VR::GetRightControllerAbsAngle()
Expand Down

0 comments on commit c5fbd77

Please sign in to comment.