std::remainder instead of not optimal while loops

This commit is contained in:
docentYT
2026-02-03 00:11:03 +01:00
parent af98ec6c89
commit 0fdbc5cc42

View File

@@ -152,12 +152,7 @@ void TCamera::Update()
Angle.y -= m_rotationoffsets.y * rotationfactor;
m_rotationoffsets.y *= ( 1.0 - rotationfactor );
while( Angle.y > M_PI ) {
Angle.y -= 2 * M_PI;
}
while( Angle.y < -M_PI ) {
Angle.y += 2 * M_PI;
}
Angle.y = std::remainder(Angle.y, 2.0 * M_PI);
// Limit the camera pitch to +/- 90°.
Angle.x = clamp(Angle.x - (m_rotationoffsets.x * rotationfactor), -M_PI_2, M_PI_2);