checks within appyRoll: routines to avoid excess math (OSX r759)

git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@65 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
Giles Williams 2005-05-23 15:14:55 +00:00
parent dab6b51154
commit e0bc521e0f
2 changed files with 23 additions and 7 deletions

View File

@ -347,8 +347,13 @@ static Universe *data_store_universe;
- (void) applyRoll:(GLfloat) roll andClimb:(GLfloat) climb
{
quaternion_rotate_about_z( &q_rotation, -roll);
quaternion_rotate_about_x( &q_rotation, -climb);
if ((roll == 0.0)&&(climb == 0.0)&&(!has_rotated))
return;
if (roll)
quaternion_rotate_about_z( &q_rotation, -roll);
if (climb)
quaternion_rotate_about_x( &q_rotation, -climb);
quaternion_normalise(&q_rotation);
quaternion_into_gl_matrix(q_rotation, rotMatrix);
@ -356,9 +361,15 @@ static Universe *data_store_universe;
- (void) applyRoll:(GLfloat) roll climb:(GLfloat) climb andYaw:(GLfloat) yaw
{
quaternion_rotate_about_z( &q_rotation, -roll);
quaternion_rotate_about_x( &q_rotation, -climb);
quaternion_rotate_about_y( &q_rotation, -yaw);
if ((roll == 0.0)&&(climb == 0.0)&&(yaw == 0.0)&&(!has_rotated))
return;
if (roll)
quaternion_rotate_about_z( &q_rotation, -roll);
if (climb)
quaternion_rotate_about_x( &q_rotation, -climb);
if (yaw)
quaternion_rotate_about_y( &q_rotation, -yaw);
quaternion_normalise(&q_rotation);
quaternion_into_gl_matrix(q_rotation, rotMatrix);

View File

@ -1756,8 +1756,13 @@ static BOOL galactic_witchjump;
- (void) applyRoll:(GLfloat) roll1 andClimb:(GLfloat) climb1
{
quaternion_rotate_about_z( &q_rotation, -roll1);
quaternion_rotate_about_x( &q_rotation, -climb1);
if ((roll1 == 0.0)&&(climb1 == 0.0)&&(!has_rotated))
return;
if (roll1)
quaternion_rotate_about_z( &q_rotation, -roll1);
if (climb1)
quaternion_rotate_about_x( &q_rotation, -climb1);
quaternion_normalise(&q_rotation); // probably not strictly necessary but good to do to keep q_rotation sane
quaternion_into_gl_matrix(q_rotation, rotMatrix);