Don't process an invalid window position

This is used for computing a vector index, so it can't be
negative.
This commit is contained in:
Ian McInerney 2020-09-30 23:14:10 +01:00
parent a5ed5e5675
commit 38584e55dd
1 changed files with 5 additions and 4 deletions

View File

@ -383,10 +383,11 @@ void CCAMERA::MakeRayAtCurrrentMousePosition( SFVEC3F &aOutOrigin,
const SFVEC2I windowPos = SFVEC2I( m_lastPosition.x, const SFVEC2I windowPos = SFVEC2I( m_lastPosition.x,
m_windowSize.y - m_lastPosition.y ); m_windowSize.y - m_lastPosition.y );
if( ( windowPos.x < m_windowSize.x ) && if( ( 0 < windowPos.x ) && ( windowPos.x < m_windowSize.x ) &&
( windowPos.y < m_windowSize.y ) ) ( 0 < windowPos.y ) && ( windowPos.y < m_windowSize.y ) )
MakeRay( windowPos, {
aOutOrigin, aOutDirection ); MakeRay( windowPos, aOutOrigin, aOutDirection );
}
} }