diff options
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 318 |
1 files changed, 132 insertions, 186 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index a375d84..3b9e8ea 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -116,6 +116,12 @@ | |||
116 | 116 | ||
117 | //#include "vtune/vtuneapi.h" | 117 | //#include "vtune/vtuneapi.h" |
118 | 118 | ||
119 | //Ventrella | ||
120 | #include "llgesturemgr.h" //needed to trigger the voice gestculations | ||
121 | #include "llvoicevisualizer.h" | ||
122 | #include "llvoiceclient.h" | ||
123 | //end Ventrella | ||
124 | |||
119 | // Direct imports, evil | 125 | // Direct imports, evil |
120 | extern LLSky gSky; | 126 | extern LLSky gSky; |
121 | extern void set_avatar_character(void* charNameArg); | 127 | extern void set_avatar_character(void* charNameArg); |
@@ -147,9 +153,7 @@ const F32 PELVIS_LAG_WALKING = 0.4f; // ...while walking | |||
147 | const F32 PELVIS_LAG_MOUSELOOK = 0.15f; | 153 | const F32 PELVIS_LAG_MOUSELOOK = 0.15f; |
148 | const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f; | 154 | const F32 MOUSELOOK_PELVIS_FOLLOW_FACTOR = 0.5f; |
149 | 155 | ||
150 | //Ventrella | ||
151 | const F32 PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON = 0.0001f; // not zero! - something gets divided by this! | 156 | const F32 PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON = 0.0001f; // not zero! - something gets divided by this! |
152 | //end Ventrella | ||
153 | 157 | ||
154 | #define PELVIS_ROT_THRESHOLD_SLOW 60.0f // amount of deviation allowed between | 158 | #define PELVIS_ROT_THRESHOLD_SLOW 60.0f // amount of deviation allowed between |
155 | #define PELVIS_ROT_THRESHOLD_FAST 2.0f // the pelvis and the view direction | 159 | #define PELVIS_ROT_THRESHOLD_FAST 2.0f // the pelvis and the view direction |
@@ -221,10 +225,6 @@ const F32 CHAT_FADE_TIME = 8.0; | |||
221 | const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; | 225 | const F32 BUBBLE_CHAT_TIME = CHAT_FADE_TIME * 3.f; |
222 | const S32 MAX_BUBBLES = 7; | 226 | const S32 MAX_BUBBLES = 7; |
223 | 227 | ||
224 | |||
225 | const bool USING_VENTRELLA_AVATAR_MOTION_TEST = false; | ||
226 | |||
227 | |||
228 | S32 LLVOAvatar::sMaxVisible = 50; | 228 | S32 LLVOAvatar::sMaxVisible = 50; |
229 | 229 | ||
230 | LLVOAvatar::ETextureIndex LLVOAvatar::sBakedTextureIndices[BAKED_TEXTURE_COUNT] = | 230 | LLVOAvatar::ETextureIndex LLVOAvatar::sBakedTextureIndices[BAKED_TEXTURE_COUNT] = |
@@ -455,121 +455,16 @@ public: | |||
455 | // called after parameters have been set | 455 | // called after parameters have been set |
456 | // must return true to indicate success and be available for activation | 456 | // must return true to indicate success and be available for activation |
457 | virtual LLMotionInitStatus onInitialize(LLCharacter *character) | 457 | virtual LLMotionInitStatus onInitialize(LLCharacter *character) |
458 | { | 458 | { |
459 | //Ventrella | ||
460 | // I'm replacing the code below because I need to change | ||
461 | // the logic in order to add other body parts | ||
462 | /* | ||
463 | mCharacter = character; | 459 | mCharacter = character; |
464 | |||
465 | if (!mChestState.setJoint( character->getJoint("mChest"))) | ||
466 | { | ||
467 | return STATUS_FAILURE; | ||
468 | } | ||
469 | |||
470 | mChestState.setUsage(LLJointState::ROT); | ||
471 | |||
472 | addJointState( &mChestState ); | ||
473 | return STATUS_SUCCESS; | ||
474 | */ | ||
475 | |||
476 | |||
477 | bool success = true; | 460 | bool success = true; |
478 | 461 | ||
479 | if ( !mChestState.setJoint( character->getJoint( "mChest" ) ) ) { success = false; } | 462 | if ( !mChestState.setJoint( character->getJoint( "mChest" ) ) ) { success = false; } |
480 | 463 | ||
481 | if ( USING_VENTRELLA_AVATAR_MOTION_TEST ) | ||
482 | { | ||
483 | if ( !mNeckState.setJoint ( character->getJoint( "mNeck" )) ) { success = false; } | ||
484 | |||
485 | if ( !mCollarLeftState.setJoint ( character->getJoint( "mCollarLeft" )) ) { success = false; } | ||
486 | if ( !mShoulderLeftState.setJoint ( character->getJoint( "mShoulderLeft" )) ) { success = false; } | ||
487 | if ( !mElbowLeftState.setJoint ( character->getJoint( "mElbowLeft" )) ) { success = false; } | ||
488 | if ( !mWristLeftState.setJoint ( character->getJoint( "mWristLeft" )) ) { success = false; } | ||
489 | |||
490 | if ( !mCollarRightState.setJoint ( character->getJoint( "mCollarRight" )) ) { success = false; } | ||
491 | if ( !mShoulderRightState.setJoint ( character->getJoint( "mShoulderRight" )) ) { success = false; } | ||
492 | if ( !mElbowRightState.setJoint ( character->getJoint( "mElbowRight" )) ) { success = false; } | ||
493 | if ( !mWristRightState.setJoint ( character->getJoint( "mWristRight" )) ) { success = false; } | ||
494 | |||
495 | if ( !mHipLeftState.setJoint ( character->getJoint( "mHipLeft" )) ) { success = false; } | ||
496 | if ( !mKneeLeftState.setJoint ( character->getJoint( "mKneeLeft" )) ) { success = false; } | ||
497 | if ( !mAnkleLeftState.setJoint ( character->getJoint( "mAnkleLeft" )) ) { success = false; } | ||
498 | |||
499 | if ( !mHipRightState.setJoint ( character->getJoint( "mHipRight" )) ) { success = false; } | ||
500 | if ( !mKneeRightState.setJoint ( character->getJoint( "mKneeRight" )) ) { success = false; } | ||
501 | if ( !mAnkleRightState.setJoint ( character->getJoint( "mAnkleRight" )) ) { success = false; } | ||
502 | } | ||
503 | |||
504 | if ( success ) | 464 | if ( success ) |
505 | { | 465 | { |
506 | mChestState.setUsage(LLJointState::ROT); | 466 | mChestState.setUsage(LLJointState::ROT); |
507 | addJointState( &mChestState ); | 467 | addJointState( &mChestState ); |
508 | |||
509 | if ( USING_VENTRELLA_AVATAR_MOTION_TEST ) | ||
510 | { | ||
511 | //------------------------------------------- | ||
512 | // neck | ||
513 | //------------------------------------------- | ||
514 | mNeckState.setUsage(LLJointState::ROT); | ||
515 | addJointState( &mNeckState ); | ||
516 | |||
517 | //------------------------------------------- | ||
518 | // left arm | ||
519 | //------------------------------------------- | ||
520 | mCollarLeftState.setUsage(LLJointState::ROT); | ||
521 | addJointState( &mCollarLeftState ); | ||
522 | |||
523 | mShoulderLeftState.setUsage(LLJointState::ROT); | ||
524 | addJointState( &mShoulderLeftState ); | ||
525 | |||
526 | mElbowLeftState.setUsage(LLJointState::ROT); | ||
527 | addJointState( &mElbowLeftState ); | ||
528 | |||
529 | mWristLeftState.setUsage(LLJointState::ROT); | ||
530 | addJointState( &mWristLeftState ); | ||
531 | |||
532 | |||
533 | //------------------------------------------- | ||
534 | // right arm | ||
535 | //------------------------------------------- | ||
536 | mCollarRightState.setUsage(LLJointState::ROT); | ||
537 | addJointState( &mCollarRightState ); | ||
538 | |||
539 | mShoulderRightState.setUsage(LLJointState::ROT); | ||
540 | addJointState( &mShoulderRightState ); | ||
541 | |||
542 | mElbowRightState.setUsage(LLJointState::ROT); | ||
543 | addJointState( &mElbowRightState ); | ||
544 | |||
545 | mWristRightState.setUsage(LLJointState::ROT); | ||
546 | addJointState( &mWristRightState ); | ||
547 | |||
548 | //------------------------------------------- | ||
549 | // left leg | ||
550 | //------------------------------------------- | ||
551 | mHipLeftState.setUsage(LLJointState::ROT); | ||
552 | addJointState( &mHipLeftState ); | ||
553 | |||
554 | mKneeLeftState.setUsage(LLJointState::ROT); | ||
555 | addJointState( &mKneeLeftState ); | ||
556 | |||
557 | mAnkleLeftState.setUsage(LLJointState::ROT); | ||
558 | addJointState( &mAnkleLeftState ); | ||
559 | |||
560 | |||
561 | //------------------------------------------- | ||
562 | // right leg | ||
563 | //------------------------------------------- | ||
564 | mHipRightState.setUsage(LLJointState::ROT); | ||
565 | addJointState( &mHipRightState ); | ||
566 | |||
567 | mKneeRightState.setUsage(LLJointState::ROT); | ||
568 | addJointState( &mKneeRightState ); | ||
569 | |||
570 | mAnkleRightState.setUsage(LLJointState::ROT); | ||
571 | addJointState( &mAnkleRightState ); | ||
572 | } | ||
573 | } | 468 | } |
574 | 469 | ||
575 | if ( success ) | 470 | if ( success ) |
@@ -580,7 +475,6 @@ public: | |||
580 | { | 475 | { |
581 | return STATUS_FAILURE; | 476 | return STATUS_FAILURE; |
582 | } | 477 | } |
583 | //end Ventrella | ||
584 | } | 478 | } |
585 | 479 | ||
586 | // called when a motion is activated | 480 | // called when a motion is activated |
@@ -599,37 +493,9 @@ public: | |||
599 | 493 | ||
600 | mChestState.setRotation(LLQuaternion(breathe_amt, LLVector3(0.f, 1.f, 0.f))); | 494 | mChestState.setRotation(LLQuaternion(breathe_amt, LLVector3(0.f, 1.f, 0.f))); |
601 | 495 | ||
602 | //Ventrella | ||
603 | if ( USING_VENTRELLA_AVATAR_MOTION_TEST ) | ||
604 | { | ||
605 | F32 wave = ( sinf ( time * 2.0f ) * 0.5f ); | ||
606 | |||
607 | mChestState.setRotation ( LLQuaternion( wave, LLVector3( -1.0f, 0.0f, 0.0f ) ) ); | ||
608 | |||
609 | mCollarLeftState.setRotation ( LLQuaternion( wave, LLVector3( 1.0f, 0.0f, 0.0f ) ) ); | ||
610 | mShoulderLeftState.setRotation ( LLQuaternion( wave, LLVector3( 1.0f, 0.0f, 0.0f ) ) ); | ||
611 | mElbowLeftState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, 0.0f, 1.0f ) ) ); | ||
612 | mWristLeftState.setRotation ( LLQuaternion( wave, LLVector3( 1.0f, 0.0f, 0.0f ) ) ); | ||
613 | |||
614 | mCollarRightState.setRotation ( LLQuaternion( wave, LLVector3( -1.0f, 0.0f, 0.0f ) ) ); | ||
615 | mShoulderRightState.setRotation ( LLQuaternion( wave, LLVector3( 1.0f, 0.0f, 0.0f ) ) ); | ||
616 | mElbowRightState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, 0.0f, 1.0f ) ) ); | ||
617 | mWristRightState.setRotation ( LLQuaternion( wave, LLVector3( 1.0f, 0.0f, 0.0f ) ) ); | ||
618 | |||
619 | mHipLeftState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, 1.0f, 0.0f ) ) ); | ||
620 | mKneeLeftState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, -1.0f, 0.0f ) ) ); | ||
621 | mAnkleLeftState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, 1.0f, 0.0f ) ) ); | ||
622 | |||
623 | mHipRightState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, 1.0f, 0.0f ) ) ); | ||
624 | mKneeRightState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, -1.0f, 0.0f ) ) ); | ||
625 | mAnkleRightState.setRotation ( LLQuaternion( wave, LLVector3( 0.0f, 1.0f, 0.0f ) ) ); | ||
626 | } | ||
627 | //end Ventrella | ||
628 | |||
629 | return TRUE; | 496 | return TRUE; |
630 | } | 497 | } |
631 | 498 | ||
632 | |||
633 | // called when a motion is deactivated | 499 | // called when a motion is deactivated |
634 | virtual void onDeactivate() {} | 500 | virtual void onDeactivate() {} |
635 | 501 | ||
@@ -637,26 +503,7 @@ public: | |||
637 | //------------------------------------------------------------------------- | 503 | //------------------------------------------------------------------------- |
638 | // joint states to be animated | 504 | // joint states to be animated |
639 | //------------------------------------------------------------------------- | 505 | //------------------------------------------------------------------------- |
640 | LLJointState mChestState; | 506 | LLJointState mChestState; |
641 | |||
642 | //Ventrella | ||
643 | LLJointState mNeckState; | ||
644 | LLJointState mCollarLeftState; | ||
645 | LLJointState mShoulderLeftState; | ||
646 | LLJointState mElbowLeftState; | ||
647 | LLJointState mWristLeftState; | ||
648 | LLJointState mCollarRightState; | ||
649 | LLJointState mShoulderRightState; | ||
650 | LLJointState mElbowRightState; | ||
651 | LLJointState mWristRightState; | ||
652 | LLJointState mHipLeftState; | ||
653 | LLJointState mKneeLeftState; | ||
654 | LLJointState mAnkleLeftState; | ||
655 | LLJointState mHipRightState; | ||
656 | LLJointState mKneeRightState; | ||
657 | LLJointState mAnkleRightState; | ||
658 | //end Ventrella | ||
659 | |||
660 | F32 mBreatheRate; | 507 | F32 mBreatheRate; |
661 | LLCharacter* mCharacter; | 508 | LLCharacter* mCharacter; |
662 | }; | 509 | }; |
@@ -819,6 +666,10 @@ LLVOAvatar::LLVOAvatar( | |||
819 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 666 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
820 | 667 | ||
821 | //VTResume(); // VTune | 668 | //VTResume(); // VTune |
669 | |||
670 | // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline | ||
671 | bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job | ||
672 | mVoiceVisualizer = ( LLVoiceVisualizer *)gHUDManager->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); | ||
822 | 673 | ||
823 | lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; | 674 | lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; |
824 | 675 | ||
@@ -1069,9 +920,13 @@ LLVOAvatar::LLVOAvatar( | |||
1069 | createMotion( ANIM_AGENT_CUSTOMIZE_DONE); | 920 | createMotion( ANIM_AGENT_CUSTOMIZE_DONE); |
1070 | 921 | ||
1071 | //VTPause(); // VTune | 922 | //VTPause(); // VTune |
923 | |||
924 | //Ventrella | ||
925 | mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) ); | ||
926 | mCurrentGesticulationLevel = 0; | ||
927 | //END Ventrella | ||
1072 | } | 928 | } |
1073 | 929 | ||
1074 | |||
1075 | //------------------------------------------------------------------------ | 930 | //------------------------------------------------------------------------ |
1076 | // LLVOAvatar::~LLVOAvatar() | 931 | // LLVOAvatar::~LLVOAvatar() |
1077 | //------------------------------------------------------------------------ | 932 | //------------------------------------------------------------------------ |
@@ -1143,6 +998,8 @@ void LLVOAvatar::markDead() | |||
1143 | sNumVisibleChatBubbles--; | 998 | sNumVisibleChatBubbles--; |
1144 | } | 999 | } |
1145 | 1000 | ||
1001 | mVoiceVisualizer->markDead(); | ||
1002 | |||
1146 | mBeam = NULL; | 1003 | mBeam = NULL; |
1147 | LLViewerObject::markDead(); | 1004 | LLViewerObject::markDead(); |
1148 | } | 1005 | } |
@@ -2459,7 +2316,84 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2459 | 2316 | ||
2460 | updateCharacter(agent); | 2317 | updateCharacter(agent); |
2461 | 2318 | ||
2319 | //Ventrella | ||
2320 | bool voiceEnabled = gVoiceClient->getVoiceEnabled( mID ) && gVoiceClient->inProximalChannel(); | ||
2321 | // disable voice visualizer when in mouselook | ||
2322 | mVoiceVisualizer->setVoiceEnabled( voiceEnabled && !(mIsSelf && gAgent.cameraMouselook()) ); | ||
2323 | if ( voiceEnabled ) | ||
2324 | { | ||
2325 | //---------------------------------------------------------------- | ||
2326 | // Only do gesture triggering for your own avatar, and only when you're in a proximal channel. | ||
2327 | //---------------------------------------------------------------- | ||
2328 | if( mIsSelf ) | ||
2329 | { | ||
2330 | //---------------------------------------------------------------------------------------- | ||
2331 | // The following takes the voice signal and uses that to trigger gesticulations. | ||
2332 | //---------------------------------------------------------------------------------------- | ||
2333 | int lastGesticulationLevel = mCurrentGesticulationLevel; | ||
2334 | mCurrentGesticulationLevel = mVoiceVisualizer->getCurrentGesticulationLevel(); | ||
2335 | |||
2336 | //--------------------------------------------------------------------------------------------------- | ||
2337 | // If "current gesticulation level" changes, we catch this, and trigger the new gesture | ||
2338 | //--------------------------------------------------------------------------------------------------- | ||
2339 | if ( lastGesticulationLevel != mCurrentGesticulationLevel ) | ||
2340 | { | ||
2341 | if ( mCurrentGesticulationLevel != VOICE_GESTICULATION_LEVEL_OFF ) | ||
2342 | { | ||
2343 | LLString gestureString = "unInitialized"; | ||
2344 | if ( mCurrentGesticulationLevel == 0 ) { gestureString = "/voicelevel1"; } | ||
2345 | else if ( mCurrentGesticulationLevel == 1 ) { gestureString = "/voicelevel2"; } | ||
2346 | else if ( mCurrentGesticulationLevel == 2 ) { gestureString = "/voicelevel3"; } | ||
2347 | else { printf( "oops - CurrentGesticulationLevel can be only 0, 1, or 2\n" ); } | ||
2348 | |||
2349 | // this is the call that Karl S. created for triggering gestures from within the code. | ||
2350 | gGestureManager.triggerAndReviseString( gestureString ); | ||
2351 | } | ||
2352 | } | ||
2353 | |||
2354 | } //if( mIsSelf ) | ||
2355 | |||
2356 | //----------------------------------------------------------------------------------------------------------------- | ||
2357 | // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer. | ||
2358 | // Also, here we trigger voice visualizer start and stop speaking, so it can animate the voice symbol. | ||
2359 | // | ||
2360 | // Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been | ||
2361 | // "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. | ||
2362 | //----------------------------------------------------------------------------------------------------------------- | ||
2363 | if ( gVoiceClient->getIsSpeaking( mID ) ) | ||
2364 | { | ||
2365 | if ( ! mVoiceVisualizer->getCurrentlySpeaking() ) | ||
2366 | { | ||
2367 | mVoiceVisualizer->setStartSpeaking(); | ||
2368 | |||
2369 | //printf( "gAwayTimer.reset();\n" ); | ||
2370 | } | ||
2371 | |||
2372 | mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) ); | ||
2373 | |||
2374 | if( mIsSelf ) | ||
2375 | { | ||
2376 | gAgent.clearAFK(); | ||
2377 | } | ||
2378 | } | ||
2379 | else | ||
2380 | { | ||
2381 | if ( mVoiceVisualizer->getCurrentlySpeaking() ) | ||
2382 | { | ||
2383 | mVoiceVisualizer->setStopSpeaking(); | ||
2384 | } | ||
2385 | } | ||
2386 | |||
2387 | //-------------------------------------------------------------------------------------------- | ||
2388 | // here we get the approximate head position and set as sound source for the voice symbol | ||
2389 | // (the following version uses a tweak of "mHeadOffset" which handle sitting vs. standing) | ||
2390 | //-------------------------------------------------------------------------------------------- | ||
2391 | LLVector3 headOffset = LLVector3( 0.0f, 0.0f, mHeadOffset.mV[2] ); | ||
2392 | mVoiceVisualizer->setVoiceSourceWorldPosition( mRoot.getWorldPosition() + headOffset ); | ||
2462 | 2393 | ||
2394 | }//if ( voiceEnabled ) | ||
2395 | //End Ventrella | ||
2396 | |||
2463 | 2397 | ||
2464 | if (LLVOAvatar::sJointDebug) | 2398 | if (LLVOAvatar::sJointDebug) |
2465 | { | 2399 | { |
@@ -2469,7 +2403,6 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2469 | LLJoint::sNumUpdates = 0; | 2403 | LLJoint::sNumUpdates = 0; |
2470 | LLJoint::sNumTouches = 0; | 2404 | LLJoint::sNumTouches = 0; |
2471 | 2405 | ||
2472 | |||
2473 | if (gNoRender) | 2406 | if (gNoRender) |
2474 | { | 2407 | { |
2475 | return TRUE; | 2408 | return TRUE; |
@@ -3272,14 +3205,7 @@ void LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3272 | 3205 | ||
3273 | LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); | 3206 | LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); |
3274 | F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST); | 3207 | F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST); |
3275 | 3208 | ||
3276 | //Ventrella | ||
3277 | //if ( gAgent.getCameraMode() == CAMERA_MODE_FOLLOW ) | ||
3278 | //{ | ||
3279 | // pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, 1.0f, 1.0f); | ||
3280 | //} | ||
3281 | //end Ventrella | ||
3282 | |||
3283 | if (self_in_mouselook) | 3209 | if (self_in_mouselook) |
3284 | { | 3210 | { |
3285 | pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR; | 3211 | pelvis_rot_threshold *= MOUSELOOK_PELVIS_FOLLOW_FACTOR; |
@@ -3357,13 +3283,6 @@ void LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3357 | pelvis_lag_time = PELVIS_LAG_WALKING; | 3283 | pelvis_lag_time = PELVIS_LAG_WALKING; |
3358 | } | 3284 | } |
3359 | 3285 | ||
3360 | //Ventrella | ||
3361 | //if ( gAgent.getCameraMode() == CAMERA_MODE_FOLLOW ) | ||
3362 | //{ | ||
3363 | // pelvis_lag_time = PELVIS_LAG_WHEN_FOLLOW_CAM_IS_ON; | ||
3364 | //} | ||
3365 | //end Ventrella | ||
3366 | |||
3367 | F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f); | 3286 | F32 u = llclamp((deltaTime / pelvis_lag_time), 0.0f, 1.0f); |
3368 | 3287 | ||
3369 | mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) ); | 3288 | mRoot.setWorldRotation( slerp(u, mRoot.getWorldRotation(), wQv) ); |
@@ -3481,13 +3400,13 @@ void LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3481 | // AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, | 3400 | // AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, |
3482 | // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); | 3401 | // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); |
3483 | 3402 | ||
3484 | F32 gain = gSavedSettings.getF32("AudioLevelFootsteps"); | 3403 | F32 gain = .30f * gSavedSettings.getF32("AudioLevelAmbient"); |
3485 | LLUUID& step_sound_id = getStepSound(); | 3404 | LLUUID& step_sound_id = getStepSound(); |
3486 | 3405 | ||
3487 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); | 3406 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); |
3488 | 3407 | ||
3489 | if (gParcelMgr && gParcelMgr->canHearSound(foot_pos_global) | 3408 | if (gParcelMgr && gParcelMgr->canHearSound(foot_pos_global) |
3490 | && gMuteListp && !gMuteListp->isMuted(getID())) | 3409 | && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds)) |
3491 | { | 3410 | { |
3492 | gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); | 3411 | gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); |
3493 | } | 3412 | } |
@@ -3496,6 +3415,32 @@ void LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3496 | 3415 | ||
3497 | mRoot.updateWorldMatrixChildren(); | 3416 | mRoot.updateWorldMatrixChildren(); |
3498 | 3417 | ||
3418 | // Send the speaker position to the spatialized voice system. | ||
3419 | if(mIsSelf) | ||
3420 | { | ||
3421 | LLMatrix3 rot; | ||
3422 | LLVector3d pos; | ||
3423 | #if 1 | ||
3424 | // character rotation (stable, shouldn't move with animations) | ||
3425 | rot = mRoot.getWorldRotation().getMatrix3(); | ||
3426 | #else | ||
3427 | // actual head rotation (moves with animations, probably a bit too much) | ||
3428 | rot.setRows( | ||
3429 | LLVector3::x_axis * mSkullp->getWorldRotation(), | ||
3430 | LLVector3::y_axis * mSkullp->getWorldRotation(), | ||
3431 | LLVector3::z_axis * mSkullp->getWorldRotation()); | ||
3432 | #endif | ||
3433 | |||
3434 | pos = getPositionGlobal(); | ||
3435 | pos += LLVector3d(mHeadOffset); | ||
3436 | |||
3437 | // MBW -- XXX -- Setting velocity to 0 for now. May figure it out later... | ||
3438 | gVoiceClient->setAvatarPosition( | ||
3439 | pos, // position | ||
3440 | LLVector3::zero, // velocity | ||
3441 | rot); // rotation matrix | ||
3442 | } | ||
3443 | |||
3499 | if (!mDebugText.size() && mText.notNull()) | 3444 | if (!mDebugText.size() && mText.notNull()) |
3500 | { | 3445 | { |
3501 | mText->markDead(); | 3446 | mText->markDead(); |
@@ -4203,7 +4148,7 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4203 | 4148 | ||
4204 | if( render_avatar ) | 4149 | if( render_avatar ) |
4205 | { | 4150 | { |
4206 | mShadowImagep->addTextureStats(mPixelArea, 1.f); | 4151 | mShadowImagep->addTextureStats(mPixelArea); |
4207 | } | 4152 | } |
4208 | } | 4153 | } |
4209 | 4154 | ||
@@ -4418,18 +4363,20 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL | |||
4418 | { | 4363 | { |
4419 | LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition()); | 4364 | LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition()); |
4420 | if (gParcelMgr && gParcelMgr->canHearSound(char_pos_global) | 4365 | if (gParcelMgr && gParcelMgr->canHearSound(char_pos_global) |
4421 | && gMuteListp && !gMuteListp->isMuted(getID())) | 4366 | && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds)) |
4422 | { | 4367 | { |
4423 | // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed | 4368 | // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed |
4424 | // to support both spatialized and non-spatialized instances of the same sound | 4369 | // to support both spatialized and non-spatialized instances of the same sound |
4425 | //if (mIsSelf) | 4370 | //if (mIsSelf) |
4426 | //{ | 4371 | //{ |
4427 | // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 0.8f); | 4372 | // F32 volume = gain * gSavedSettings.getF32("AudioLevelUI") |
4373 | // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), volume); | ||
4428 | //} | 4374 | //} |
4429 | //else | 4375 | //else |
4430 | { | 4376 | { |
4431 | LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); | 4377 | LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); |
4432 | gAudiop->triggerSound(sound_id, getID(), 1.f, char_pos_global); | 4378 | F32 volume = gSavedSettings.getF32("AudioLevelSFX"); |
4379 | gAudiop->triggerSound(sound_id, getID(), volume, char_pos_global); | ||
4433 | } | 4380 | } |
4434 | } | 4381 | } |
4435 | } | 4382 | } |
@@ -4818,7 +4765,6 @@ LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) | |||
4818 | return (LLJoint*)&mSkeleton[num]; | 4765 | return (LLJoint*)&mSkeleton[num]; |
4819 | } | 4766 | } |
4820 | 4767 | ||
4821 | |||
4822 | //----------------------------------------------------------------------------- | 4768 | //----------------------------------------------------------------------------- |
4823 | // requestStopMotion() | 4769 | // requestStopMotion() |
4824 | //----------------------------------------------------------------------------- | 4770 | //----------------------------------------------------------------------------- |
@@ -5810,7 +5756,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) | |||
5810 | { | 5756 | { |
5811 | LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object); | 5757 | LLViewerJointAttachment* attachment = getTargetAttachmentPoint(viewer_object); |
5812 | 5758 | ||
5813 | if (!attachment->addObject(viewer_object)) | 5759 | if (!attachment || !attachment->addObject(viewer_object)) |
5814 | { | 5760 | { |
5815 | return FALSE; | 5761 | return FALSE; |
5816 | } | 5762 | } |