diff options
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 313 |
1 files changed, 253 insertions, 60 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index 957ea5c..7989704 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -138,6 +138,7 @@ LLVOAvatarSkeletonInfo* LLVOAvatar::sSkeletonInfo = NULL; | |||
138 | LLVOAvatarInfo* LLVOAvatar::sAvatarInfo = NULL; | 138 | LLVOAvatarInfo* LLVOAvatar::sAvatarInfo = NULL; |
139 | 139 | ||
140 | BOOL gDebugAvatarRotation = FALSE; | 140 | BOOL gDebugAvatarRotation = FALSE; |
141 | S32 LLVOAvatar::sFreezeCounter = 0 ; | ||
141 | 142 | ||
142 | //extern BOOL gVelocityInterpolate; | 143 | //extern BOOL gVelocityInterpolate; |
143 | 144 | ||
@@ -283,7 +284,7 @@ BOOL LLVOAvatar::sShowFootPlane = FALSE; | |||
283 | BOOL LLVOAvatar::sShowCollisionVolumes = FALSE; | 284 | BOOL LLVOAvatar::sShowCollisionVolumes = FALSE; |
284 | BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; | 285 | BOOL LLVOAvatar::sVisibleInFirstPerson = FALSE; |
285 | F32 LLVOAvatar::sLODFactor = 1.f; | 286 | F32 LLVOAvatar::sLODFactor = 1.f; |
286 | BOOL LLVOAvatar::sUseImpostors = TRUE; | 287 | BOOL LLVOAvatar::sUseImpostors = FALSE; |
287 | BOOL LLVOAvatar::sJointDebug = FALSE; | 288 | BOOL LLVOAvatar::sJointDebug = FALSE; |
288 | 289 | ||
289 | S32 LLVOAvatar::sCurJoint = 0; | 290 | S32 LLVOAvatar::sCurJoint = 0; |
@@ -663,6 +664,7 @@ LLVOAvatar::LLVOAvatar( | |||
663 | mNameAway(FALSE), | 664 | mNameAway(FALSE), |
664 | mNameBusy(FALSE), | 665 | mNameBusy(FALSE), |
665 | mNameMute(FALSE), | 666 | mNameMute(FALSE), |
667 | mRenderGroupTitles(sRenderGroupTitles), | ||
666 | mNameAppearance(FALSE), | 668 | mNameAppearance(FALSE), |
667 | mLastRegionHandle(0), | 669 | mLastRegionHandle(0), |
668 | mRegionCrossingCount(0), | 670 | mRegionCrossingCount(0), |
@@ -692,7 +694,7 @@ LLVOAvatar::LLVOAvatar( | |||
692 | 694 | ||
693 | // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline | 695 | // mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline |
694 | bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job | 696 | bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job |
695 | mVoiceVisualizer = ( LLVoiceVisualizer *)gHUDManager->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); | 697 | mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim ); |
696 | 698 | ||
697 | lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; | 699 | lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl; |
698 | 700 | ||
@@ -755,8 +757,7 @@ LLVOAvatar::LLVOAvatar( | |||
755 | 757 | ||
756 | mRippleTimeLast = 0.f; | 758 | mRippleTimeLast = 0.f; |
757 | 759 | ||
758 | mShadowImageID = LLUUID( gViewerArt.getString("foot_shadow.tga")); | 760 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); |
759 | mShadowImagep = gImageList.getImage(mShadowImageID); | ||
760 | mShadowImagep->bind(); | 761 | mShadowImagep->bind(); |
761 | mShadowImagep->setClamp(TRUE, TRUE); | 762 | mShadowImagep->setClamp(TRUE, TRUE); |
762 | 763 | ||
@@ -1726,7 +1727,7 @@ BOOL LLVOAvatar::buildSkeleton(LLVOAvatarSkeletonInfo *info) | |||
1726 | mScreenp = new LLViewerJoint("mScreen", NULL); | 1727 | mScreenp = new LLViewerJoint("mScreen", NULL); |
1727 | // for now, put screen at origin, as it is only used during special | 1728 | // for now, put screen at origin, as it is only used during special |
1728 | // HUD rendering mode | 1729 | // HUD rendering mode |
1729 | F32 aspect = gCamera->getAspect(); | 1730 | F32 aspect = LLViewerCamera::getInstance()->getAspect(); |
1730 | LLVector3 scale(1.f, aspect, 1.f); | 1731 | LLVector3 scale(1.f, aspect, 1.f); |
1731 | mScreenp->setScale(scale); | 1732 | mScreenp->setScale(scale); |
1732 | mScreenp->setWorldPosition(LLVector3::zero); | 1733 | mScreenp->setWorldPosition(LLVector3::zero); |
@@ -2377,7 +2378,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2377 | { | 2378 | { |
2378 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 2379 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
2379 | LLFastTimer t(LLFastTimer::FTM_AVATAR_UPDATE); | 2380 | LLFastTimer t(LLFastTimer::FTM_AVATAR_UPDATE); |
2380 | 2381 | ||
2381 | if (isDead()) | 2382 | if (isDead()) |
2382 | { | 2383 | { |
2383 | llinfos << "Warning! Idle on dead avatar" << llendl; | 2384 | llinfos << "Warning! Idle on dead avatar" << llendl; |
@@ -2570,7 +2571,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2570 | if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid()) | 2571 | if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid()) |
2571 | { | 2572 | { |
2572 | // if selecting any attachments, update all of them as non-damped | 2573 | // if selecting any attachments, update all of them as non-damped |
2573 | if (gSelectMgr->getSelection()->getObjectCount() && gSelectMgr->getSelection()->isAttachment()) | 2574 | if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment()) |
2574 | { | 2575 | { |
2575 | gPipeline.updateMoveNormalAsync(attached_object->mDrawable); | 2576 | gPipeline.updateMoveNormalAsync(attached_object->mDrawable); |
2576 | } | 2577 | } |
@@ -2605,7 +2606,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2605 | F32 old_angle = mImpostorAngle.mV[i]; | 2606 | F32 old_angle = mImpostorAngle.mV[i]; |
2606 | F32 angle_diff = fabsf(cur_angle-old_angle); | 2607 | F32 angle_diff = fabsf(cur_angle-old_angle); |
2607 | 2608 | ||
2608 | if (angle_diff > 3.14159f/16.f) | 2609 | if (angle_diff > 3.14159f/512.f*distance) |
2609 | { | 2610 | { |
2610 | mNeedsImpostorUpdate = TRUE; | 2611 | mNeedsImpostorUpdate = TRUE; |
2611 | } | 2612 | } |
@@ -2792,6 +2793,12 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2792 | mVisibleChat = visible_chat; | 2793 | mVisibleChat = visible_chat; |
2793 | new_name = TRUE; | 2794 | new_name = TRUE; |
2794 | } | 2795 | } |
2796 | |||
2797 | if (sRenderGroupTitles != mRenderGroupTitles) | ||
2798 | { | ||
2799 | mRenderGroupTitles = sRenderGroupTitles; | ||
2800 | new_name = TRUE; | ||
2801 | } | ||
2795 | 2802 | ||
2796 | // First Calculate Alpha | 2803 | // First Calculate Alpha |
2797 | // If alpha > 0, create mNameText if necessary, otherwise delete it | 2804 | // If alpha > 0, create mNameText if necessary, otherwise delete it |
@@ -2840,11 +2847,11 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2840 | mNameText->setUsePixelSize(TRUE); | 2847 | mNameText->setUsePixelSize(TRUE); |
2841 | LLVector3 pixel_right_vec; | 2848 | LLVector3 pixel_right_vec; |
2842 | LLVector3 pixel_up_vec; | 2849 | LLVector3 pixel_up_vec; |
2843 | gCamera->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); | 2850 | LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); |
2844 | LLVector3 camera_to_av = root_pos_last - gCamera->getOrigin(); | 2851 | LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); |
2845 | camera_to_av.normVec(); | 2852 | camera_to_av.normVec(); |
2846 | LLVector3 local_camera_at = camera_to_av * ~root_rot; | 2853 | LLVector3 local_camera_at = camera_to_av * ~root_rot; |
2847 | LLVector3 local_camera_up = camera_to_av % gCamera->getLeftAxis(); | 2854 | LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); |
2848 | local_camera_up.normVec(); | 2855 | local_camera_up.normVec(); |
2849 | local_camera_up = local_camera_up * ~root_rot; | 2856 | local_camera_up = local_camera_up * ~root_rot; |
2850 | 2857 | ||
@@ -2868,7 +2875,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2868 | LLNameValue *title = getNVPair("Title"); | 2875 | LLNameValue *title = getNVPair("Title"); |
2869 | LLNameValue* firstname = getNVPair("FirstName"); | 2876 | LLNameValue* firstname = getNVPair("FirstName"); |
2870 | LLNameValue* lastname = getNVPair("LastName"); | 2877 | LLNameValue* lastname = getNVPair("LastName"); |
2871 | 2878 | ||
2872 | if (mNameText.notNull() && firstname && lastname) | 2879 | if (mNameText.notNull() && firstname && lastname) |
2873 | { | 2880 | { |
2874 | BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); | 2881 | BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); |
@@ -2881,7 +2888,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
2881 | } | 2888 | } |
2882 | else | 2889 | else |
2883 | { | 2890 | { |
2884 | is_muted = gMuteListp->isMuted(getID()); | 2891 | is_muted = LLMuteList::getInstance()->isMuted(getID()); |
2885 | } | 2892 | } |
2886 | 2893 | ||
2887 | if (mNameString.empty() || | 2894 | if (mNameString.empty() || |
@@ -3062,6 +3069,8 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
3062 | sNumVisibleChatBubbles--; | 3069 | sNumVisibleChatBubbles--; |
3063 | } | 3070 | } |
3064 | 3071 | ||
3072 | shame(); | ||
3073 | |||
3065 | //-------------------------------------------------------------------- | 3074 | //-------------------------------------------------------------------- |
3066 | // draw tractor beam when editing objects | 3075 | // draw tractor beam when editing objects |
3067 | //-------------------------------------------------------------------- | 3076 | //-------------------------------------------------------------------- |
@@ -3078,7 +3087,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
3078 | else if (!mBeam || mBeam->isDead()) | 3087 | else if (!mBeam || mBeam->isDead()) |
3079 | { | 3088 | { |
3080 | // VEFFECT: Tractor Beam | 3089 | // VEFFECT: Tractor Beam |
3081 | mBeam = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); | 3090 | mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM); |
3082 | mBeam->setColor(LLColor4U(gAgent.getEffectColor())); | 3091 | mBeam->setColor(LLColor4U(gAgent.getEffectColor())); |
3083 | mBeam->setSourceObject(this); | 3092 | mBeam->setSourceObject(this); |
3084 | mBeamTimer.reset(); | 3093 | mBeamTimer.reset(); |
@@ -3086,7 +3095,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
3086 | 3095 | ||
3087 | if (!mBeam.isNull()) | 3096 | if (!mBeam.isNull()) |
3088 | { | 3097 | { |
3089 | LLObjectSelectionHandle selection = gSelectMgr->getSelection(); | 3098 | LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); |
3090 | 3099 | ||
3091 | if (gAgent.mPointAt.notNull()) | 3100 | if (gAgent.mPointAt.notNull()) |
3092 | { | 3101 | { |
@@ -3103,7 +3112,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) | |||
3103 | else | 3112 | else |
3104 | { | 3113 | { |
3105 | mBeam->setTargetObject(NULL); | 3114 | mBeam->setTargetObject(NULL); |
3106 | LLTool *tool = gToolMgr->getCurrentTool(); | 3115 | LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); |
3107 | if (tool->isEditing()) | 3116 | if (tool->isEditing()) |
3108 | { | 3117 | { |
3109 | if (tool->getEditingObject()) | 3118 | if (tool->getEditingObject()) |
@@ -3159,9 +3168,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3159 | { | 3168 | { |
3160 | LLMemType mt(LLMemType::MTYPE_AVATAR); | 3169 | LLMemType mt(LLMemType::MTYPE_AVATAR); |
3161 | // update screen joint size | 3170 | // update screen joint size |
3171 | |||
3162 | if (mScreenp) | 3172 | if (mScreenp) |
3163 | { | 3173 | { |
3164 | F32 aspect = gCamera->getAspect(); | 3174 | F32 aspect = LLViewerCamera::getInstance()->getAspect(); |
3165 | LLVector3 scale(1.f, aspect, 1.f); | 3175 | LLVector3 scale(1.f, aspect, 1.f); |
3166 | mScreenp->setScale(scale); | 3176 | mScreenp->setScale(scale); |
3167 | mScreenp->updateWorldMatrixChildren(); | 3177 | mScreenp->updateWorldMatrixChildren(); |
@@ -3228,10 +3238,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3228 | // the rest should only be done occasionally for far away avatars | 3238 | // the rest should only be done occasionally for far away avatars |
3229 | //-------------------------------------------------------------------- | 3239 | //-------------------------------------------------------------------- |
3230 | 3240 | ||
3231 | if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate) | 3241 | if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) |
3232 | { | 3242 | { |
3233 | F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); | 3243 | F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); |
3234 | if (visible && mPixelArea <= impostor_area) | 3244 | if (LLMuteList::getInstance()->isMuted(getID())) |
3245 | { | ||
3246 | mUpdatePeriod = 16; | ||
3247 | visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE; | ||
3248 | } | ||
3249 | else if (visible && mPixelArea <= impostor_area) | ||
3235 | { | 3250 | { |
3236 | mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mPixelArea), 2, 8); | 3251 | mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mPixelArea), 2, 8); |
3237 | 3252 | ||
@@ -3337,7 +3352,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3337 | 3352 | ||
3338 | resolveHeightGlobal(root_pos, ground_under_pelvis, normal); | 3353 | resolveHeightGlobal(root_pos, ground_under_pelvis, normal); |
3339 | F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); | 3354 | F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]); |
3340 | BOOL in_air = ( (!gWorldPointer->getRegionFromPosGlobal(ground_under_pelvis)) || | 3355 | BOOL in_air = ( (!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) || |
3341 | foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); | 3356 | foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE); |
3342 | 3357 | ||
3343 | if (in_air && !mInAir) | 3358 | if (in_air && !mInAir) |
@@ -3398,11 +3413,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3398 | // make sure fwdDir stays in same general direction as primdir | 3413 | // make sure fwdDir stays in same general direction as primdir |
3399 | if (gAgent.getFlying()) | 3414 | if (gAgent.getFlying()) |
3400 | { | 3415 | { |
3401 | fwdDir = gCamera->getAtAxis(); | 3416 | fwdDir = LLViewerCamera::getInstance()->getAtAxis(); |
3402 | } | 3417 | } |
3403 | else | 3418 | else |
3404 | { | 3419 | { |
3405 | LLVector3 at_axis = gCamera->getAtAxis(); | 3420 | LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); |
3406 | LLVector3 up_vector = gAgent.getReferenceUpVector(); | 3421 | LLVector3 up_vector = gAgent.getReferenceUpVector(); |
3407 | at_axis -= up_vector * (at_axis * up_vector); | 3422 | at_axis -= up_vector * (at_axis * up_vector); |
3408 | at_axis.normVec(); | 3423 | at_axis.normVec(); |
@@ -3618,8 +3633,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3618 | 3633 | ||
3619 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); | 3634 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); |
3620 | 3635 | ||
3621 | if (gParcelMgr && gParcelMgr->canHearSound(foot_pos_global) | 3636 | if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global) |
3622 | && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds)) | 3637 | && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) |
3623 | { | 3638 | { |
3624 | gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); | 3639 | gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); |
3625 | } | 3640 | } |
@@ -3678,7 +3693,7 @@ void LLVOAvatar::updateHeadOffset() | |||
3678 | // since we only care about Z, just grab one of the eyes | 3693 | // since we only care about Z, just grab one of the eyes |
3679 | LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); | 3694 | LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); |
3680 | midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); | 3695 | midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); |
3681 | midEyePt.mV[VZ] = llmax(-mPelvisToFoot + gCamera->getNear(), midEyePt.mV[VZ]); | 3696 | midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]); |
3682 | 3697 | ||
3683 | if (mDrawable.notNull()) | 3698 | if (mDrawable.notNull()) |
3684 | { | 3699 | { |
@@ -3713,7 +3728,7 @@ void LLVOAvatar::updateVisibility() | |||
3713 | else | 3728 | else |
3714 | { | 3729 | { |
3715 | // calculate avatar distance wrt head | 3730 | // calculate avatar distance wrt head |
3716 | mDrawable->updateDistance(*gCamera); | 3731 | mDrawable->updateDistance(*LLViewerCamera::getInstance()); |
3717 | 3732 | ||
3718 | if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible()) | 3733 | if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible()) |
3719 | { | 3734 | { |
@@ -3767,15 +3782,15 @@ void LLVOAvatar::updateVisibility() | |||
3767 | llinfos << "Avatar not in frustum" << llendl; | 3782 | llinfos << "Avatar not in frustum" << llendl; |
3768 | }*/ | 3783 | }*/ |
3769 | 3784 | ||
3770 | /*if (gCamera->sphereInFrustum(sel_pos_agent, 2.0f)) | 3785 | /*if (LLViewerCamera::getInstance()->sphereInFrustum(sel_pos_agent, 2.0f)) |
3771 | { | 3786 | { |
3772 | llinfos << "Sel pos visible" << llendl; | 3787 | llinfos << "Sel pos visible" << llendl; |
3773 | } | 3788 | } |
3774 | if (gCamera->sphereInFrustum(wrist_right_pos_agent, 0.2f)) | 3789 | if (LLViewerCamera::getInstance()->sphereInFrustum(wrist_right_pos_agent, 0.2f)) |
3775 | { | 3790 | { |
3776 | llinfos << "Wrist pos visible" << llendl; | 3791 | llinfos << "Wrist pos visible" << llendl; |
3777 | } | 3792 | } |
3778 | if (gCamera->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f)) | 3793 | if (LLViewerCamera::getInstance()->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f)) |
3779 | { | 3794 | { |
3780 | llinfos << "Agent visible" << llendl; | 3795 | llinfos << "Agent visible" << llendl; |
3781 | }*/ | 3796 | }*/ |
@@ -3841,16 +3856,16 @@ BOOL LLVOAvatar::needsRenderBeam() | |||
3841 | { | 3856 | { |
3842 | return FALSE; | 3857 | return FALSE; |
3843 | } | 3858 | } |
3844 | LLTool *tool = gToolMgr->getCurrentTool(); | 3859 | LLTool *tool = LLToolMgr::getInstance()->getCurrentTool(); |
3845 | 3860 | ||
3846 | BOOL is_touching_or_grabbing = (tool == gToolGrab && gToolGrab->isEditing()); | 3861 | BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing()); |
3847 | if (gToolGrab->getEditingObject() && | 3862 | if (LLToolGrab::getInstance()->getEditingObject() && |
3848 | gToolGrab->getEditingObject()->isAttachment()) | 3863 | LLToolGrab::getInstance()->getEditingObject()->isAttachment()) |
3849 | { | 3864 | { |
3850 | // don't render selection beam on hud objects | 3865 | // don't render selection beam on hud objects |
3851 | is_touching_or_grabbing = FALSE; | 3866 | is_touching_or_grabbing = FALSE; |
3852 | } | 3867 | } |
3853 | return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && gSelectMgr->shouldShowSelection()); | 3868 | return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection()); |
3854 | } | 3869 | } |
3855 | 3870 | ||
3856 | //----------------------------------------------------------------------------- | 3871 | //----------------------------------------------------------------------------- |
@@ -3890,7 +3905,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) | |||
3890 | { | 3905 | { |
3891 | mEyeLashLOD.updateGeometry(); | 3906 | mEyeLashLOD.updateGeometry(); |
3892 | mHeadLOD.updateGeometry(); | 3907 | mHeadLOD.updateGeometry(); |
3893 | mHairLOD.updateGeometry(); | 3908 | mHairLOD.updateGeometry(); |
3894 | } | 3909 | } |
3895 | mNeedsSkin = FALSE; | 3910 | mNeedsSkin = FALSE; |
3896 | 3911 | ||
@@ -4112,8 +4127,13 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
4112 | } | 4127 | } |
4113 | 4128 | ||
4114 | LLVector3 pos(getRenderPosition()+mImpostorOffset); | 4129 | LLVector3 pos(getRenderPosition()+mImpostorOffset); |
4115 | LLVector3 left = gCamera->getLeftAxis()*mImpostorDim.mV[0]; | 4130 | LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin()); |
4116 | LLVector3 up = gCamera->getUpAxis()*mImpostorDim.mV[1]; | 4131 | at.normVec(); |
4132 | LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at; | ||
4133 | LLVector3 up = at%left; | ||
4134 | |||
4135 | left *= mImpostorDim.mV[0]; | ||
4136 | up *= mImpostorDim.mV[1]; | ||
4117 | 4137 | ||
4118 | LLGLEnable test(GL_ALPHA_TEST); | 4138 | LLGLEnable test(GL_ALPHA_TEST); |
4119 | glAlphaFunc(GL_GREATER, 0.f); | 4139 | glAlphaFunc(GL_GREATER, 0.f); |
@@ -4432,7 +4452,7 @@ void LLVOAvatar::resolveHeightAgent(const LLVector3 &in_pos_agent, LLVector3 &ou | |||
4432 | void LLVOAvatar::resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm) | 4452 | void LLVOAvatar::resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm) |
4433 | { | 4453 | { |
4434 | LLViewerObject *obj; | 4454 | LLViewerObject *obj; |
4435 | gWorldPointer->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj); | 4455 | LLWorld::getInstance()->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj); |
4436 | } | 4456 | } |
4437 | 4457 | ||
4438 | 4458 | ||
@@ -4442,7 +4462,7 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos | |||
4442 | LLVector3d p0 = inPos + zVec; | 4462 | LLVector3d p0 = inPos + zVec; |
4443 | LLVector3d p1 = inPos - zVec; | 4463 | LLVector3d p1 = inPos - zVec; |
4444 | LLViewerObject *obj; | 4464 | LLViewerObject *obj; |
4445 | gWorldPointer->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj); | 4465 | LLWorld::getInstance()->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj); |
4446 | if (!obj) | 4466 | if (!obj) |
4447 | { | 4467 | { |
4448 | mStepOnLand = TRUE; | 4468 | mStepOnLand = TRUE; |
@@ -4593,8 +4613,8 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL | |||
4593 | if (gAudiop) | 4613 | if (gAudiop) |
4594 | { | 4614 | { |
4595 | LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition()); | 4615 | LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition()); |
4596 | if (gParcelMgr && gParcelMgr->canHearSound(char_pos_global) | 4616 | if (LLViewerParcelMgr::getInstance()->canHearSound(char_pos_global) |
4597 | && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds)) | 4617 | && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) |
4598 | { | 4618 | { |
4599 | // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed | 4619 | // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed |
4600 | // to support both spatialized and non-spatialized instances of the same sound | 4620 | // to support both spatialized and non-spatialized instances of the same sound |
@@ -4878,7 +4898,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age | |||
4878 | p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec; | 4898 | p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec; |
4879 | LLViewerObject *obj; | 4899 | LLViewerObject *obj; |
4880 | LLVector3d out_pos_global; | 4900 | LLVector3d out_pos_global; |
4881 | gWorldPointer->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj); | 4901 | LLWorld::getInstance()->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj); |
4882 | out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global); | 4902 | out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global); |
4883 | } | 4903 | } |
4884 | 4904 | ||
@@ -5614,7 +5634,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) | |||
5614 | LLVector3 center = (ext[1] + ext[0]) * 0.5f; | 5634 | LLVector3 center = (ext[1] + ext[0]) * 0.5f; |
5615 | LLVector3 size = (ext[1]-ext[0])*0.5f; | 5635 | LLVector3 size = (ext[1]-ext[0])*0.5f; |
5616 | 5636 | ||
5617 | mPixelArea = LLPipeline::calcPixelArea(center, size, *gCamera); | 5637 | mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance()); |
5618 | 5638 | ||
5619 | F32 range = mDrawable->mDistanceWRTCamera; | 5639 | F32 range = mDrawable->mDistanceWRTCamera; |
5620 | 5640 | ||
@@ -5643,6 +5663,8 @@ BOOL LLVOAvatar::updateJointLODs() | |||
5643 | F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE)); | 5663 | F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE)); |
5644 | F32 avatar_num_min_factor = clamp_rescale(sLODFactor, 0.f, 1.f, 0.25f, 0.6f); | 5664 | F32 avatar_num_min_factor = clamp_rescale(sLODFactor, 0.f, 1.f, 0.25f, 0.6f); |
5645 | F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor); | 5665 | F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor); |
5666 | F32 area_scale = 0.16f; | ||
5667 | |||
5646 | { | 5668 | { |
5647 | if (mIsSelf) | 5669 | if (mIsSelf) |
5648 | { | 5670 | { |
@@ -5652,7 +5674,7 @@ BOOL LLVOAvatar::updateJointLODs() | |||
5652 | } | 5674 | } |
5653 | else | 5675 | else |
5654 | { | 5676 | { |
5655 | mAdjustedPixelArea = mPixelArea; | 5677 | mAdjustedPixelArea = mPixelArea*area_scale; |
5656 | } | 5678 | } |
5657 | } | 5679 | } |
5658 | else if (mIsDummy) | 5680 | else if (mIsDummy) |
@@ -5662,7 +5684,7 @@ BOOL LLVOAvatar::updateJointLODs() | |||
5662 | else | 5684 | else |
5663 | { | 5685 | { |
5664 | // reported avatar pixel area is dependent on avatar render load, based on number of visible avatars | 5686 | // reported avatar pixel area is dependent on avatar render load, based on number of visible avatars |
5665 | mAdjustedPixelArea = (F32)mPixelArea * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor; | 5687 | mAdjustedPixelArea = (F32)mPixelArea * area_scale * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor; |
5666 | } | 5688 | } |
5667 | 5689 | ||
5668 | // now select meshes to render based on adjusted pixel area | 5690 | // now select meshes to render based on adjusted pixel area |
@@ -5749,7 +5771,7 @@ void LLVOAvatar::updateShadowFaces() | |||
5749 | return; | 5771 | return; |
5750 | } | 5772 | } |
5751 | 5773 | ||
5752 | LLSprite sprite(mShadowImageID); | 5774 | LLSprite sprite(mShadowImagep.notNull() ? mShadowImagep->getID() : LLUUID::null); |
5753 | sprite.setFollow(FALSE); | 5775 | sprite.setFollow(FALSE); |
5754 | const F32 cos_angle = gSky.getSunDirection().mV[2]; | 5776 | const F32 cos_angle = gSky.getSunDirection().mV[2]; |
5755 | F32 cos_elev = sqrt(1 - cos_angle * cos_angle); | 5777 | F32 cos_elev = sqrt(1 - cos_angle * cos_angle); |
@@ -5987,8 +6009,8 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) | |||
5987 | 6009 | ||
5988 | if (viewer_object->isSelected()) | 6010 | if (viewer_object->isSelected()) |
5989 | { | 6011 | { |
5990 | gSelectMgr->updateSelectionCenter(); | 6012 | LLSelectMgr::getInstance()->updateSelectionCenter(); |
5991 | gSelectMgr->updatePointAt(); | 6013 | LLSelectMgr::getInstance()->updatePointAt(); |
5992 | } | 6014 | } |
5993 | 6015 | ||
5994 | if (mIsSelf) | 6016 | if (mIsSelf) |
@@ -6295,6 +6317,22 @@ void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLIm | |||
6295 | self->updateMeshTextures(); | 6317 | self->updateMeshTextures(); |
6296 | } | 6318 | } |
6297 | } | 6319 | } |
6320 | else if (final) | ||
6321 | { | ||
6322 | LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID); | ||
6323 | LLVOAvatar::ELocTexIndex idx = data->mIndex; | ||
6324 | // Failed: asset is missing | ||
6325 | if( self && | ||
6326 | (!self->mLocalTextureBaked[ idx ]) && | ||
6327 | (self->mLocalTexture[ idx ].notNull()) && | ||
6328 | (self->mLocalTexture[ idx ]->getID() == src_id)) | ||
6329 | { | ||
6330 | self->mLocalTextureDiscard[idx] = 0; // we check that it's missing later | ||
6331 | self->requestLayerSetUpdate( idx ); | ||
6332 | self->updateMeshTextures(); | ||
6333 | } | ||
6334 | |||
6335 | } | ||
6298 | 6336 | ||
6299 | if( final || !success ) | 6337 | if( final || !success ) |
6300 | { | 6338 | { |
@@ -6459,7 +6497,7 @@ void LLVOAvatar::forceBakeAllTextures(bool slam_for_debug) | |||
6459 | 6497 | ||
6460 | BOOL set_by_user = TRUE; | 6498 | BOOL set_by_user = TRUE; |
6461 | invalidateComposite(layer_set, set_by_user); | 6499 | invalidateComposite(layer_set, set_by_user); |
6462 | gViewerStats->incStat(LLViewerStats::ST_TEX_REBAKES); | 6500 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); |
6463 | } | 6501 | } |
6464 | else | 6502 | else |
6465 | { | 6503 | { |
@@ -6497,7 +6535,7 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**) | |||
6497 | BOOL set_by_user = TRUE; | 6535 | BOOL set_by_user = TRUE; |
6498 | self->invalidateComposite(layer_set, set_by_user); | 6536 | self->invalidateComposite(layer_set, set_by_user); |
6499 | found = TRUE; | 6537 | found = TRUE; |
6500 | gViewerStats->incStat(LLViewerStats::ST_TEX_REBAKES); | 6538 | LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES); |
6501 | } | 6539 | } |
6502 | } | 6540 | } |
6503 | } | 6541 | } |
@@ -7346,7 +7384,10 @@ void LLVOAvatar::clearChat() | |||
7346 | 7384 | ||
7347 | S32 LLVOAvatar::getLocalDiscardLevel( S32 index ) | 7385 | S32 LLVOAvatar::getLocalDiscardLevel( S32 index ) |
7348 | { | 7386 | { |
7349 | if (index >= 0 && mLocalTexture[index].notNull() && mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR) | 7387 | if (index >= 0 |
7388 | && mLocalTexture[index].notNull() | ||
7389 | && (mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR) | ||
7390 | && !mLocalTexture[index]->isMissingAsset()) | ||
7350 | { | 7391 | { |
7351 | return mLocalTexture[index]->getDiscardLevel(); | 7392 | return mLocalTexture[index]->getDiscardLevel(); |
7352 | } | 7393 | } |
@@ -9351,13 +9392,13 @@ void LLVOAvatar::updateRegion(LLViewerRegion *regionp) | |||
9351 | { | 9392 | { |
9352 | ++mRegionCrossingCount; | 9393 | ++mRegionCrossingCount; |
9353 | F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); | 9394 | F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32(); |
9354 | F64 avg = (mRegionCrossingCount == 1) ? 0 : gViewerStats->getStat(LLViewerStats::ST_CROSSING_AVG); | 9395 | F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG); |
9355 | F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; | 9396 | F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount; |
9356 | gViewerStats->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); | 9397 | LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg); |
9357 | 9398 | ||
9358 | F64 max = (mRegionCrossingCount == 1) ? 0 : gViewerStats->getStat(LLViewerStats::ST_CROSSING_MAX); | 9399 | F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX); |
9359 | max = llmax(delta, max); | 9400 | max = llmax(delta, max); |
9360 | gViewerStats->setStat(LLViewerStats::ST_CROSSING_MAX, max); | 9401 | LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max); |
9361 | } | 9402 | } |
9362 | mLastRegionHandle = regionp->getHandle(); | 9403 | mLastRegionHandle = regionp->getHandle(); |
9363 | } | 9404 | } |
@@ -9433,6 +9474,23 @@ LLHost LLVOAvatar::getObjectHost() const | |||
9433 | } | 9474 | } |
9434 | } | 9475 | } |
9435 | 9476 | ||
9477 | //static | ||
9478 | void LLVOAvatar::updateFreezeCounter(S32 counter) | ||
9479 | { | ||
9480 | if(counter) | ||
9481 | { | ||
9482 | sFreezeCounter = counter ; | ||
9483 | } | ||
9484 | else if(sFreezeCounter > 0) | ||
9485 | { | ||
9486 | sFreezeCounter-- ; | ||
9487 | } | ||
9488 | else | ||
9489 | { | ||
9490 | sFreezeCounter = 0 ; | ||
9491 | } | ||
9492 | } | ||
9493 | |||
9436 | BOOL LLVOAvatar::updateLOD() | 9494 | BOOL LLVOAvatar::updateLOD() |
9437 | { | 9495 | { |
9438 | BOOL res = updateJointLODs(); | 9496 | BOOL res = updateJointLODs(); |
@@ -9486,7 +9544,7 @@ BOOL LLVOAvatar::isImpostor() const | |||
9486 | 9544 | ||
9487 | BOOL LLVOAvatar::needsImpostorUpdate() const | 9545 | BOOL LLVOAvatar::needsImpostorUpdate() const |
9488 | { | 9546 | { |
9489 | return mNeedsImpostorUpdate; | 9547 | return mNeedsImpostorUpdate ; |
9490 | } | 9548 | } |
9491 | 9549 | ||
9492 | const LLVector3& LLVOAvatar::getImpostorOffset() const | 9550 | const LLVector3& LLVOAvatar::getImpostorOffset() const |
@@ -9515,10 +9573,145 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di | |||
9515 | extents[0] = ext[0]; | 9573 | extents[0] = ext[0]; |
9516 | extents[1] = ext[1]; | 9574 | extents[1] = ext[1]; |
9517 | 9575 | ||
9518 | LLVector3 at = gCamera->getOrigin()-(getRenderPosition()+mImpostorOffset); | 9576 | LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset); |
9519 | distance = at.normVec(); | 9577 | distance = at.normVec(); |
9520 | angle.mV[0] = acosf(at.mV[0]); | 9578 | F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis()); |
9521 | angle.mV[1] = acosf(at.mV[1]); | 9579 | angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da; |
9522 | angle.mV[2] = acosf(at.mV[2]); | 9580 | angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da; |
9581 | angle.mV[2] = da; | ||
9582 | } | ||
9583 | |||
9584 | U32 calc_shame(LLVOVolume* volume, std::set<LLUUID> &textures) | ||
9585 | { | ||
9586 | if (!volume) | ||
9587 | { | ||
9588 | return 0; | ||
9589 | } | ||
9590 | |||
9591 | U32 shame = 0; | ||
9592 | |||
9593 | U32 invisi = 0; | ||
9594 | U32 shiny = 0; | ||
9595 | U32 glow = 0; | ||
9596 | U32 alpha = 0; | ||
9597 | U32 flexi = 0; | ||
9598 | U32 animtex = 0; | ||
9599 | U32 particles = 0; | ||
9600 | U32 scale = 0; | ||
9601 | U32 bump = 0; | ||
9602 | U32 planar = 0; | ||
9603 | |||
9604 | if (volume->isFlexible()) | ||
9605 | { | ||
9606 | flexi = 1; | ||
9607 | } | ||
9608 | if (volume->isParticleSource()) | ||
9609 | { | ||
9610 | particles = 1; | ||
9611 | } | ||
9612 | |||
9613 | const LLVector3& sc = volume->getScale(); | ||
9614 | scale += (U32) sc.mV[0] + (U32) sc.mV[1] + (U32) sc.mV[2]; | ||
9615 | |||
9616 | LLDrawable* drawablep = volume->mDrawable; | ||
9617 | |||
9618 | if (volume->isSculpted()) | ||
9619 | { | ||
9620 | LLSculptParams *sculpt_params = (LLSculptParams *) volume->getParameterEntry(LLNetworkData::PARAMS_SCULPT); | ||
9621 | LLUUID sculpt_id = sculpt_params->getSculptTexture(); | ||
9622 | textures.insert(sculpt_id); | ||
9623 | } | ||
9624 | |||
9625 | for (S32 i = 0; i < drawablep->getNumFaces(); ++i) | ||
9626 | { | ||
9627 | LLFace* face = drawablep->getFace(i); | ||
9628 | const LLTextureEntry* te = face->getTextureEntry(); | ||
9629 | LLViewerImage* img = face->getTexture(); | ||
9630 | |||
9631 | textures.insert(img->getID()); | ||
9632 | |||
9633 | if (face->getPoolType() == LLDrawPool::POOL_ALPHA) | ||
9634 | { | ||
9635 | alpha++; | ||
9636 | } | ||
9637 | else if (img->getPrimaryFormat() == GL_ALPHA) | ||
9638 | { | ||
9639 | invisi = 1; | ||
9640 | } | ||
9641 | |||
9642 | if (te) | ||
9643 | { | ||
9644 | if (te->getBumpmap()) | ||
9645 | { | ||
9646 | bump = 1; | ||
9647 | } | ||
9648 | if (te->getShiny()) | ||
9649 | { | ||
9650 | shiny = 1; | ||
9651 | } | ||
9652 | if (te->getGlow() > 0.f) | ||
9653 | { | ||
9654 | glow = 1; | ||
9655 | } | ||
9656 | if (face->mTextureMatrix != NULL) | ||
9657 | { | ||
9658 | animtex++; | ||
9659 | } | ||
9660 | if (te->getTexGen()) | ||
9661 | { | ||
9662 | planar++; | ||
9663 | } | ||
9664 | } | ||
9665 | } | ||
9666 | |||
9667 | shame += invisi + shiny + glow + alpha*4 + flexi*8 + animtex*4 + particles*16+bump*4+scale+planar; | ||
9668 | |||
9669 | for (U32 i = 0; i < drawablep->getChildCount(); ++i) | ||
9670 | { | ||
9671 | shame += calc_shame(drawablep->getChild(i)->getVOVolume(), textures); | ||
9672 | } | ||
9673 | |||
9674 | return shame; | ||
9675 | } | ||
9676 | |||
9677 | void LLVOAvatar::shame() | ||
9678 | { | ||
9679 | if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) | ||
9680 | { | ||
9681 | return; | ||
9682 | } | ||
9683 | |||
9684 | U32 shame = 1; | ||
9685 | |||
9686 | std::set<LLUUID> textures; | ||
9687 | |||
9688 | attachment_map_t::const_iterator iter; | ||
9689 | for (iter = mAttachmentPoints.begin(); | ||
9690 | iter != mAttachmentPoints.end(); | ||
9691 | ++iter) | ||
9692 | { | ||
9693 | LLViewerJointAttachment* attachment = iter->second; | ||
9694 | LLViewerObject* object = attachment->getObject(); | ||
9695 | if (object && !object->isHUDAttachment()) | ||
9696 | { | ||
9697 | LLDrawable* drawable = object->mDrawable; | ||
9698 | if (drawable) | ||
9699 | { | ||
9700 | shame += 10; | ||
9701 | LLVOVolume* volume = drawable->getVOVolume(); | ||
9702 | if (volume) | ||
9703 | { | ||
9704 | shame += calc_shame(volume, textures); | ||
9705 | } | ||
9706 | } | ||
9707 | } | ||
9708 | } | ||
9709 | |||
9710 | shame += textures.size() * 5; | ||
9711 | |||
9712 | setDebugText(llformat("%d", shame)); | ||
9713 | F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f); | ||
9714 | F32 red = llmin((F32) shame/1024.f, 1.f); | ||
9715 | mText->setColor(LLColor4(red,green,0,1)); | ||
9523 | } | 9716 | } |
9524 | 9717 | ||