diff options
author | Armin Weatherwax | 2010-02-22 17:57:35 +0100 |
---|---|---|
committer | Jacek Antonelli | 2010-03-05 14:18:48 -0600 |
commit | d0936606412ccaf05a2e17894d2bc9a3c18506ab (patch) | |
tree | fb15bb14014eb9f6cc0512f4f3fbf408de8459e3 /linden/indra/newview/llvoavatar.cpp | |
parent | Fixed some notifications that were ported from 1.2 incorrectly. (diff) | |
download | meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.zip meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.tar.gz meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.tar.bz2 meta-impy-d0936606412ccaf05a2e17894d2bc9a3c18506ab.tar.xz |
Ported breast physics from Emerald.
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 138 |
1 files changed, 136 insertions, 2 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index 3692b1b..10e2ec7 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -706,6 +706,8 @@ F32 LLVOAvatar::sLODFactor = 1.f; | |||
706 | BOOL LLVOAvatar::sUseImpostors = FALSE; | 706 | BOOL LLVOAvatar::sUseImpostors = FALSE; |
707 | BOOL LLVOAvatar::sJointDebug = FALSE; | 707 | BOOL LLVOAvatar::sJointDebug = FALSE; |
708 | 708 | ||
709 | EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig; | ||
710 | |||
709 | F32 LLVOAvatar::sUnbakedTime = 0.f; | 711 | F32 LLVOAvatar::sUnbakedTime = 0.f; |
710 | F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; | 712 | F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; |
711 | F32 LLVOAvatar::sGreyTime = 0.f; | 713 | F32 LLVOAvatar::sGreyTime = 0.f; |
@@ -764,7 +766,10 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, | |||
764 | mVisibleChat( FALSE ), | 766 | mVisibleChat( FALSE ), |
765 | mFullyLoadedInitialized(FALSE), | 767 | mFullyLoadedInitialized(FALSE), |
766 | mFullyLoaded(FALSE), | 768 | mFullyLoaded(FALSE), |
767 | mHasBakedHair( FALSE ) | 769 | mHasBakedHair( FALSE ), |
770 | mFirstSetActualBoobGravRan( false ), | ||
771 | mFirstSetActualButtGravRan( false ), | ||
772 | mFirstSetActualFatGravRan( false ) | ||
768 | { | 773 | { |
769 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 774 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
770 | //VTResume(); // VTune | 775 | //VTResume(); // VTune |
@@ -985,6 +990,16 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, | |||
985 | 990 | ||
986 | } | 991 | } |
987 | 992 | ||
993 | // grab the boob savedparams (prob a better place for this) | ||
994 | sBoobConfig.mass = EmeraldBoobUtils::convertMass(gSavedSettings.getF32("EmeraldBoobMass")); | ||
995 | sBoobConfig.hardness = EmeraldBoobUtils::convertHardness(gSavedSettings.getF32("EmeraldBoobHardness")); | ||
996 | sBoobConfig.velMax = EmeraldBoobUtils::convertVelMax(gSavedSettings.getF32("EmeraldBoobVelMax")); | ||
997 | sBoobConfig.velMin = EmeraldBoobUtils::convertVelMin(gSavedSettings.getF32("EmeraldBoobVelMin")); | ||
998 | sBoobConfig.friction = EmeraldBoobUtils::convertFriction(gSavedSettings.getF32("EmeraldBoobFriction")); | ||
999 | sBoobConfig.enabled = gSavedSettings.getBOOL("EmeraldBreastPhysicsToggle"); | ||
1000 | sBoobConfig.XYInfluence = gSavedSettings.getF32("EmeraldBoobXYInfluence"); | ||
1001 | |||
1002 | |||
988 | if (gNoRender) | 1003 | if (gNoRender) |
989 | { | 1004 | { |
990 | return; | 1005 | return; |
@@ -2625,7 +2640,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2625 | idleUpdateVoiceVisualizer( voice_enabled ); | 2640 | idleUpdateVoiceVisualizer( voice_enabled ); |
2626 | idleUpdateMisc( detailed_update ); | 2641 | idleUpdateMisc( detailed_update ); |
2627 | idleUpdateAppearanceAnimation(); | 2642 | idleUpdateAppearanceAnimation(); |
2628 | 2643 | idleUpdateBoobEffect(); | |
2629 | idleUpdateLipSync( voice_enabled ); | 2644 | idleUpdateLipSync( voice_enabled ); |
2630 | idleUpdateLoadingEffect(); | 2645 | idleUpdateLoadingEffect(); |
2631 | idleUpdateBelowWater(); // wind effect uses this | 2646 | idleUpdateBelowWater(); // wind effect uses this |
@@ -2879,6 +2894,8 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() | |||
2879 | { | 2894 | { |
2880 | if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) | 2895 | if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE) |
2881 | { | 2896 | { |
2897 | // so boobs don't go spastic when a shape's changed, but still seems buggy | ||
2898 | //if(param->getID() != 507) | ||
2882 | param->animate(morph_amt, mAppearanceAnimSetByUser); | 2899 | param->animate(morph_amt, mAppearanceAnimSetByUser); |
2883 | } | 2900 | } |
2884 | } | 2901 | } |
@@ -2897,6 +2914,107 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() | |||
2897 | } | 2914 | } |
2898 | } | 2915 | } |
2899 | 2916 | ||
2917 | // ------------------------------------------------------------ | ||
2918 | // Danny: ZOMG Boob Phsyics go! | ||
2919 | // ------------------------------------------------------------ | ||
2920 | void LLVOAvatar::idleUpdateBoobEffect() | ||
2921 | { | ||
2922 | if(mFirstSetActualBoobGravRan) | ||
2923 | { | ||
2924 | // should probably be moved somewhere where it is only called when boobsize changes | ||
2925 | LLVisualParam *param; | ||
2926 | |||
2927 | // BOOBS | ||
2928 | param = getVisualParam(105); //boob size | ||
2929 | mLocalBoobConfig.boobSize = param->getCurrentWeight(); | ||
2930 | EmeraldBoobInputs boobInputs; | ||
2931 | boobInputs.type = 0; | ||
2932 | boobInputs.chestPosition = mChestp->getWorldPosition(); | ||
2933 | boobInputs.chestRotation = mChestp->getWorldRotation(); | ||
2934 | boobInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32(); | ||
2935 | boobInputs.appearanceFlag = getAppearanceFlag(); | ||
2936 | |||
2937 | |||
2938 | EmeraldBoobState newBoobState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mBoobState, boobInputs); | ||
2939 | |||
2940 | if(mBoobState.boobGrav != newBoobState.boobGrav) | ||
2941 | { | ||
2942 | LLVisualParam *param; | ||
2943 | param = getVisualParam(507); | ||
2944 | |||
2945 | ESex avatar_sex = getSex(); | ||
2946 | |||
2947 | param->stopAnimating(FALSE); | ||
2948 | param->setWeight(llclamp(newBoobState.boobGrav+getActualBoobGrav(), -1.5f, 2.f), FALSE); | ||
2949 | param->apply(avatar_sex); | ||
2950 | updateVisualParams(); | ||
2951 | } | ||
2952 | |||
2953 | mBoobState = newBoobState; | ||
2954 | } | ||
2955 | /* | ||
2956 | if(mFirstSetActualButtGravRan) | ||
2957 | { | ||
2958 | // BUTT | ||
2959 | EmeraldBoobInputs buttInputs; | ||
2960 | buttInputs.type = 1; | ||
2961 | buttInputs.chestPosition = mPelvisp->getWorldPosition(); | ||
2962 | buttInputs.chestRotation = mPelvisp->getWorldRotation(); | ||
2963 | buttInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32(); | ||
2964 | buttInputs.appearanceFlag = getAppearanceFlag(); | ||
2965 | |||
2966 | |||
2967 | EmeraldBoobState newButtState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mButtState, buttInputs); | ||
2968 | |||
2969 | if(mButtState.boobGrav != newButtState.boobGrav) | ||
2970 | { | ||
2971 | LLVisualParam *param; | ||
2972 | param = getVisualParam(795); | ||
2973 | |||
2974 | ESex avatar_sex = getSex(); | ||
2975 | |||
2976 | param->stopAnimating(FALSE); | ||
2977 | param->setWeight(newButtState.boobGrav*0.3f+getActualButtGrav(), FALSE); | ||
2978 | param->apply(avatar_sex); | ||
2979 | updateVisualParams(); | ||
2980 | } | ||
2981 | |||
2982 | mButtState = newButtState; | ||
2983 | } | ||
2984 | |||
2985 | if(mFirstSetActualFatGravRan) | ||
2986 | { | ||
2987 | // FAT | ||
2988 | EmeraldBoobInputs fatInputs; | ||
2989 | fatInputs.type = 2; | ||
2990 | fatInputs.chestPosition = mPelvisp->getWorldPosition(); | ||
2991 | fatInputs.chestRotation = mPelvisp->getWorldRotation(); | ||
2992 | fatInputs.elapsedTime = mBoobBounceTimer.getElapsedTimeF32(); | ||
2993 | fatInputs.appearanceFlag = getAppearanceFlag(); | ||
2994 | |||
2995 | |||
2996 | EmeraldBoobState newFatState = EmeraldBoobUtils::idleUpdate(sBoobConfig, mLocalBoobConfig, mFatState, fatInputs); | ||
2997 | |||
2998 | if(mFatState.boobGrav != newFatState.boobGrav) | ||
2999 | { | ||
3000 | LLVisualParam *param; | ||
3001 | param = getVisualParam(157); | ||
3002 | |||
3003 | ESex avatar_sex = getSex(); | ||
3004 | |||
3005 | param->stopAnimating(FALSE); | ||
3006 | param->setWeight(newFatState.boobGrav*0.3f+getActualFatGrav(), FALSE); | ||
3007 | param->apply(avatar_sex); | ||
3008 | updateVisualParams(); | ||
3009 | } | ||
3010 | |||
3011 | mFatState = newFatState; | ||
3012 | } | ||
3013 | */ | ||
3014 | |||
3015 | } | ||
3016 | |||
3017 | |||
2900 | void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) | 3018 | void LLVOAvatar::idleUpdateLipSync(bool voice_enabled) |
2901 | { | 3019 | { |
2902 | // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync | 3020 | // Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync |
@@ -8342,6 +8460,22 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) | |||
8342 | mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); | 8460 | mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); |
8343 | F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); | 8461 | F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); |
8344 | 8462 | ||
8463 | if(param->getID() == 507 && newWeight != getActualBoobGrav()) | ||
8464 | { | ||
8465 | llwarns << "Boob Grav SET to " << newWeight << " for " << getFullname() << llendl; | ||
8466 | setActualBoobGrav(newWeight); | ||
8467 | } | ||
8468 | if(param->getID() == 795 && newWeight != getActualButtGrav()) | ||
8469 | { | ||
8470 | llwarns << "Butt Grav SET to " << newWeight << " for " << getFullname() << llendl; | ||
8471 | setActualButtGrav(newWeight); | ||
8472 | } | ||
8473 | if(param->getID() == 157 && newWeight != getActualFatGrav()) | ||
8474 | { | ||
8475 | llwarns << "Fat Grav SET to " << newWeight << " for " << getFullname() << llendl; | ||
8476 | setActualFatGrav(newWeight); | ||
8477 | } | ||
8478 | |||
8345 | if (is_first_appearance_message || (param->getWeight() != newWeight)) | 8479 | if (is_first_appearance_message || (param->getWeight() != newWeight)) |
8346 | { | 8480 | { |
8347 | //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; | 8481 | //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; |