Skip to content

Commit

Permalink
Merge pull request mapbase-source#184 from Petercov/mapbase-feature/p…
Browse files Browse the repository at this point in the history
…rojtex-aspect-fix

Compute aspect ratios on shadow depth textures
  • Loading branch information
Blixibon committed Apr 26, 2022
2 parents 857b83a + aad6101 commit 9c1ed5c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sp/src/game/client/clientshadowmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4484,20 +4484,29 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
}

CViewSetup shadowView;
#ifndef MAPBASE
shadowView.m_flAspectRatio = 1.0f;
#endif
shadowView.x = shadowView.y = 0;
shadowView.width = shadowDepthTexture->GetActualWidth();
shadowView.height = shadowDepthTexture->GetActualHeight();
#ifndef ASW_PROJECTED_TEXTURES
shadowView.m_bOrtho = false;
shadowView.m_bDoBloomAndToneMapping = false;
#ifdef MAPBASE
shadowView.m_flAspectRatio = (flashlightState.m_fHorizontalFOVDegrees / flashlightState.m_fVerticalFOVDegrees);
#endif // MAPBASE
#endif

// Copy flashlight parameters
#ifdef ASW_PROJECTED_TEXTURES
if ( !flashlightState.m_bOrtho )
{
shadowView.m_bOrtho = false;

#ifdef MAPBASE
shadowView.m_flAspectRatio = (flashlightState.m_fHorizontalFOVDegrees / flashlightState.m_fVerticalFOVDegrees);
#endif // MAPBASE
}
else
{
Expand All @@ -4506,6 +4515,10 @@ void CClientShadowMgr::ComputeShadowDepthTextures( const CViewSetup &viewSetup )
shadowView.m_OrthoTop = flashlightState.m_fOrthoTop;
shadowView.m_OrthoRight = flashlightState.m_fOrthoRight;
shadowView.m_OrthoBottom = flashlightState.m_fOrthoBottom;

#ifdef MAPBASE
shadowView.m_flAspectRatio = 1.0f;
#endif
}

shadowView.m_bDoBloomAndToneMapping = false;
Expand Down

0 comments on commit 9c1ed5c

Please sign in to comment.