mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 00:09:18 +02:00
std::remainder instead of not optimal while loops
This commit is contained in:
@@ -152,12 +152,7 @@ void TCamera::Update()
|
|||||||
|
|
||||||
Angle.y -= m_rotationoffsets.y * rotationfactor;
|
Angle.y -= m_rotationoffsets.y * rotationfactor;
|
||||||
m_rotationoffsets.y *= ( 1.0 - rotationfactor );
|
m_rotationoffsets.y *= ( 1.0 - rotationfactor );
|
||||||
while( Angle.y > M_PI ) {
|
Angle.y = std::remainder(Angle.y, 2.0 * M_PI);
|
||||||
Angle.y -= 2 * M_PI;
|
|
||||||
}
|
|
||||||
while( Angle.y < -M_PI ) {
|
|
||||||
Angle.y += 2 * M_PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limit the camera pitch to +/- 90°.
|
// Limit the camera pitch to +/- 90°.
|
||||||
Angle.x = clamp(Angle.x - (m_rotationoffsets.x * rotationfactor), -M_PI_2, M_PI_2);
|
Angle.x = clamp(Angle.x - (m_rotationoffsets.x * rotationfactor), -M_PI_2, M_PI_2);
|
||||||
|
|||||||
Reference in New Issue
Block a user