diff options
author | Jacek Antonelli | 2008-08-15 23:45:01 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:01 -0500 |
commit | 28d8d4e7664bcd6c8369cc18832e42096af7cad2 (patch) | |
tree | 069020fe66339aff2ca4176370ff743b14713f2d /linden/indra/llcharacter/llheadrotmotion.cpp | |
parent | Second Life viewer sources 1.17.2.0 (diff) | |
download | meta-impy-28d8d4e7664bcd6c8369cc18832e42096af7cad2.zip meta-impy-28d8d4e7664bcd6c8369cc18832e42096af7cad2.tar.gz meta-impy-28d8d4e7664bcd6c8369cc18832e42096af7cad2.tar.bz2 meta-impy-28d8d4e7664bcd6c8369cc18832e42096af7cad2.tar.xz |
Second Life viewer sources 1.17.3.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llcharacter/llheadrotmotion.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/linden/indra/llcharacter/llheadrotmotion.cpp b/linden/indra/llcharacter/llheadrotmotion.cpp index cfab048..73f8e8b 100644 --- a/linden/indra/llcharacter/llheadrotmotion.cpp +++ b/linden/indra/llcharacter/llheadrotmotion.cpp | |||
@@ -438,6 +438,10 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) | |||
438 | up.setVec(eye_look_at % left); | 438 | up.setVec(eye_look_at % left); |
439 | 439 | ||
440 | target_eye_rot = LLQuaternion(eye_look_at, left, up); | 440 | target_eye_rot = LLQuaternion(eye_look_at, left, up); |
441 | // convert target rotation to head-local coordinates | ||
442 | target_eye_rot *= ~mHeadJoint->getWorldRotation(); | ||
443 | // constrain target orientation to be in front of avatar's face | ||
444 | target_eye_rot.constrain(EYE_ROT_LIMIT_ANGLE); | ||
441 | 445 | ||
442 | // calculate vergence | 446 | // calculate vergence |
443 | F32 interocular_dist = (mLeftEyeState.getJoint()->getWorldPosition() - mRightEyeState.getJoint()->getWorldPosition()).magVec(); | 447 | F32 interocular_dist = (mLeftEyeState.getJoint()->getWorldPosition() - mRightEyeState.getJoint()->getWorldPosition()).magVec(); |
@@ -446,7 +450,7 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) | |||
446 | } | 450 | } |
447 | else | 451 | else |
448 | { | 452 | { |
449 | target_eye_rot = mHeadJoint->getWorldRotation(); | 453 | target_eye_rot = LLQuaternion::DEFAULT; |
450 | vergence = 0.f; | 454 | vergence = 0.f; |
451 | } | 455 | } |
452 | 456 | ||
@@ -488,18 +492,8 @@ BOOL LLEyeMotion::onUpdate(F32 time, U8* joint_mask) | |||
488 | vergence_quat.transQuat(); | 492 | vergence_quat.transQuat(); |
489 | right_eye_rot = vergence_quat * eye_jitter_rot * right_eye_rot; | 493 | right_eye_rot = vergence_quat * eye_jitter_rot * right_eye_rot; |
490 | 494 | ||
491 | //set final eye rotations | 495 | mLeftEyeState.setRotation( left_eye_rot ); |
492 | // start with left | 496 | mRightEyeState.setRotation( right_eye_rot ); |
493 | LLQuaternion tQw = mLeftEyeState.getJoint()->getParent()->getWorldRotation(); | ||
494 | LLQuaternion tQh = left_eye_rot * ~tQw; | ||
495 | tQh.constrain(EYE_ROT_LIMIT_ANGLE); | ||
496 | mLeftEyeState.setRotation( tQh ); | ||
497 | |||
498 | // now do right eye | ||
499 | tQw = mRightEyeState.getJoint()->getParent()->getWorldRotation(); | ||
500 | tQh = right_eye_rot * ~tQw; | ||
501 | tQh.constrain(EYE_ROT_LIMIT_ANGLE); | ||
502 | mRightEyeState.setRotation( tQh ); | ||
503 | 497 | ||
504 | return TRUE; | 498 | return TRUE; |
505 | } | 499 | } |