diff options
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r-- | indra/newview/llvoavatar.cpp | 123 |
1 files changed, 71 insertions, 52 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0e0ebce949..310a6a2adb 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -126,6 +126,9 @@ const F32 MIN_HOVER_Z = -2.0; const F32 MIN_ATTACHMENT_COMPLEXITY = 0.f; const F32 DEFAULT_MAX_ATTACHMENT_COMPLEXITY = 1.0e6f; +const F32 FIRST_APPEARANCE_CLOUD_MIN_DELAY = 3.f; // seconds +const F32 FIRST_APPEARANCE_CLOUD_MAX_DELAY = 45.f; + using namespace LLAvatarAppearanceDefines; //----------------------------------------------------------------------------- @@ -328,6 +331,7 @@ public: // must return FALSE when the motion is completed. virtual BOOL onUpdate(F32 time, U8* joint_mask) { + LL_PROFILE_ZONE_SCOPED; F32 nx[2]; nx[0]=time*TORSO_NOISE_SPEED; nx[1]=0.0f; @@ -448,6 +452,7 @@ public: // must return FALSE when the motion is completed. virtual BOOL onUpdate(F32 time, U8* joint_mask) { + LL_PROFILE_ZONE_SCOPED; mBreatheRate = 1.f; F32 breathe_amt = (sinf(mBreatheRate * time) * BREATHE_ROT_MOTION_STRENGTH); @@ -549,6 +554,7 @@ public: // must return FALSE when the motion is completed. virtual BOOL onUpdate(F32 time, U8* joint_mask) { + LL_PROFILE_ZONE_SCOPED; mPelvisState->setPosition(LLVector3::zero); return TRUE; @@ -664,6 +670,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mVisuallyMuteSetting(AV_RENDER_NORMALLY), mMutedAVColor(LLColor4::white /* used for "uninitialize" */), mFirstFullyVisible(TRUE), + mFirstUseDelaySeconds(FIRST_APPEARANCE_CLOUD_MIN_DELAY), mFullyLoaded(FALSE), mPreviousFullyLoaded(FALSE), mFullyLoadedInitialized(FALSE), @@ -738,7 +745,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mCurrentGesticulationLevel = 0; - + mFirstSeenTimer.reset(); mRuthTimer.reset(); mRuthDebugTimer.reset(); mDebugExistenceTimer.reset(); @@ -1318,11 +1325,9 @@ void LLVOAvatar::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) } -static LLTrace::BlockTimerStatHandle FTM_AVATAR_EXTENT_UPDATE("Av Upd Extent"); - void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax) { - LL_RECORD_BLOCK_TIME(FTM_AVATAR_EXTENT_UPDATE); + LL_PROFILE_ZONE_SCOPED; S32 box_detail = gSavedSettings.getS32("AvatarBoundingBoxComplexity"); if (getOverallAppearance() != AOA_NORMAL) @@ -2491,10 +2496,6 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) return setTETextureCore(te, image); } -static LLTrace::BlockTimerStatHandle FTM_AVATAR_UPDATE("Avatar Update"); -static LLTrace::BlockTimerStatHandle FTM_AVATAR_UPDATE_COMPLEXITY("Avatar Update Complexity"); -static LLTrace::BlockTimerStatHandle FTM_JOINT_UPDATE("Update Joints"); - //------------------------------------------------------------------------ // LLVOAvatar::dumpAnimationState() //------------------------------------------------------------------------ @@ -2527,7 +2528,7 @@ void LLVOAvatar::dumpAnimationState() //------------------------------------------------------------------------ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) { - LL_RECORD_BLOCK_TIME(FTM_AVATAR_UPDATE); + LL_PROFILE_ZONE_SCOPED; if (isDead()) { @@ -2563,8 +2564,6 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) // force asynchronous drawable update if(mDrawable.notNull()) { - LL_RECORD_BLOCK_TIME(FTM_JOINT_UPDATE); - if (isSitting() && getParent()) { LLViewerObject *root_object = (LLViewerObject*)getRoot(); @@ -2664,9 +2663,8 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time) if ((LLFrameTimer::getFrameCount() + mID.mData[0]) % compl_upd_freq == 0) { - LL_RECORD_BLOCK_TIME(FTM_AVATAR_UPDATE_COMPLEXITY); - idleUpdateRenderComplexity(); -} + idleUpdateRenderComplexity(); + } idleUpdateDebugInfo(); } @@ -2779,10 +2777,9 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) }//if ( voiceEnabled ) } -static LLTrace::BlockTimerStatHandle FTM_ATTACHMENT_UPDATE("Update Attachments"); - void LLVOAvatar::idleUpdateMisc(bool detailed_update) { + LL_PROFILE_ZONE_SCOPED; if (LLVOAvatar::sJointDebug) { LL_INFOS() << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL; @@ -2796,7 +2793,6 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) // update attachments positions if (detailed_update) { - LL_RECORD_BLOCK_TIME(FTM_ATTACHMENT_UPDATE); for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter) @@ -3136,6 +3132,8 @@ void LLVOAvatar::idleUpdateWindEffect() void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) { + LL_PROFILE_ZONE_SCOPED; + // update chat bubble //-------------------------------------------------------------------- // draw text label over character's head @@ -4884,6 +4882,8 @@ bool LLVOAvatar::shouldAlphaMask() //----------------------------------------------------------------------------- U32 LLVOAvatar::renderSkinned() { + LL_PROFILE_ZONE_SCOPED; + U32 num_indices = 0; if (!mIsBuilt) @@ -6158,27 +6158,29 @@ LLJoint *LLVOAvatar::getJoint( const std::string &name ) LLJoint *LLVOAvatar::getJoint( S32 joint_num ) { LLJoint *pJoint = NULL; - S32 collision_start = mNumBones; - S32 attachment_start = mNumBones + mNumCollisionVolumes; - if (joint_num>=attachment_start) + if (joint_num >= 0) { - // Attachment IDs start at 1 - S32 attachment_id = joint_num - attachment_start + 1; - attachment_map_t::iterator iter = mAttachmentPoints.find(attachment_id); - if (iter != mAttachmentPoints.end()) + if (joint_num < mNumBones) { - pJoint = iter->second; + pJoint = mSkeleton[joint_num]; + } + else if (joint_num < mNumBones + mNumCollisionVolumes) + { + S32 collision_id = joint_num - mNumBones; + pJoint = &mCollisionVolumes[collision_id]; + } + else + { + // Attachment IDs start at 1 + S32 attachment_id = joint_num - (mNumBones + mNumCollisionVolumes) + 1; + attachment_map_t::iterator iter = mAttachmentPoints.find(attachment_id); + if (iter != mAttachmentPoints.end()) + { + pJoint = iter->second; + } } } - else if (joint_num>=collision_start) - { - S32 collision_id = joint_num-collision_start; - pJoint = &mCollisionVolumes[collision_id]; - } - else if (joint_num>=0) - { - pJoint = mSkeleton[joint_num]; - } + llassert(!pJoint || pJoint->getJointNum() == joint_num); return pJoint; } @@ -6513,7 +6515,7 @@ void LLVOAvatar::addAttachmentOverridesForObject(LLViewerObject *vo, std::set<LL LLJoint* pJoint = getJoint( lookingForJoint ); if (pJoint) { - const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation(); + const LLVector3& jointPos = LLVector3(pSkinData->mAlternateBindMatrix[i].getTranslation()); if (pJoint->aboveJointPosThreshold(jointPos)) { bool override_changed; @@ -7117,6 +7119,7 @@ void LLVOAvatar::updateGL() { if (mMeshTexturesDirty) { + LL_PROFILE_ZONE_SCOPED updateMeshTextures(); mMeshTexturesDirty = FALSE; } @@ -7125,10 +7128,9 @@ void LLVOAvatar::updateGL() //----------------------------------------------------------------------------- // updateGeometry() //----------------------------------------------------------------------------- -static LLTrace::BlockTimerStatHandle FTM_UPDATE_AVATAR("Update Avatar"); BOOL LLVOAvatar::updateGeometry(LLDrawable *drawable) { - LL_RECORD_BLOCK_TIME(FTM_UPDATE_AVATAR); + LL_PROFILE_ZONE_SCOPED; if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR))) { return TRUE; @@ -7862,6 +7864,8 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color) // Do rigged mesh attachments display with this av? bool LLVOAvatar::shouldRenderRigged() const { + LL_PROFILE_ZONE_SCOPED; + if (getOverallAppearance() == AOA_NORMAL) { return true; @@ -8126,16 +8130,35 @@ void LLVOAvatar::updateRuthTimer(bool loading) BOOL LLVOAvatar::processFullyLoadedChange(bool loading) { // We wait a little bit before giving the 'all clear', to let things to - // settle down (models to snap into place, textures to get first packets) + // settle down (models to snap into place, textures to get first packets). + // And if viewer isn't aware of some parts yet, this gives them a chance + // to arrive. const F32 LOADED_DELAY = 1.f; - const F32 FIRST_USE_DELAY = 3.f; - if (loading) - mFullyLoadedTimer.reset(); + if (loading) + { + mFullyLoadedTimer.reset(); + } if (mFirstFullyVisible) { - mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > FIRST_USE_DELAY); + if (!isSelf() && loading) + { + // Note that textures can causes 60s delay on thier own + // so this delay might end up on top of textures' delay + mFirstUseDelaySeconds = llclamp( + mFirstSeenTimer.getElapsedTimeF32(), + FIRST_APPEARANCE_CLOUD_MIN_DELAY, + FIRST_APPEARANCE_CLOUD_MAX_DELAY); + + if (shouldImpostor()) + { + // Impostors are less of a priority, + // let them stay cloud longer + mFirstUseDelaySeconds *= 1.25; + } + } + mFullyLoaded = (mFullyLoadedTimer.getElapsedTimeF32() > mFirstUseDelaySeconds); } else { @@ -8353,6 +8376,7 @@ void LLVOAvatar::updateMeshVisibility() // virtual void LLVOAvatar::updateMeshTextures() { + LL_PROFILE_ZONE_SCOPED static S32 update_counter = 0; mBakedTextureDebugText.clear(); @@ -10184,6 +10208,7 @@ void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32& void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes) { + LL_PROFILE_ZONE_SCOPED; for ( LLVOAvatar::attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter ) { LLViewerJointAttachment* attachment = iter->second; @@ -10241,27 +10266,19 @@ void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes) } } -static LLTrace::BlockTimerStatHandle FTM_AVATAR_RIGGING_INFO_UPDATE("Av Upd Rig Info"); -static LLTrace::BlockTimerStatHandle FTM_AVATAR_RIGGING_KEY_UPDATE("Av Upd Rig Key"); -static LLTrace::BlockTimerStatHandle FTM_AVATAR_RIGGING_AVOL_UPDATE("Av Upd Avol"); - // virtual void LLVOAvatar::updateRiggingInfo() { - LL_RECORD_BLOCK_TIME(FTM_AVATAR_RIGGING_INFO_UPDATE); + LL_PROFILE_ZONE_SCOPED; LL_DEBUGS("RigSpammish") << getFullname() << " updating rig tab" << LL_ENDL; std::vector<LLVOVolume*> volumes; - { - LL_RECORD_BLOCK_TIME(FTM_AVATAR_RIGGING_AVOL_UPDATE); - getAssociatedVolumes(volumes); - } + getAssociatedVolumes(volumes); std::map<LLUUID,S32> curr_rigging_info_key; { - LL_RECORD_BLOCK_TIME(FTM_AVATAR_RIGGING_KEY_UPDATE); // Get current rigging info key for (std::vector<LLVOVolume*>::iterator it = volumes.begin(); it != volumes.end(); ++it) { @@ -10423,6 +10440,7 @@ void LLVOAvatar::updateImpostorRendering(U32 newMaxNonImpostorsValue) void LLVOAvatar::idleUpdateRenderComplexity() { + LL_PROFILE_ZONE_SCOPED; if (isControlAvatar()) { LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this); @@ -10950,6 +10968,7 @@ void LLVOAvatar::updateOverallAppearanceAnimations() // Based on isVisuallyMuted(), but has 3 possible results. LLVOAvatar::AvatarOverallAppearance LLVOAvatar::getOverallAppearance() const { + LL_PROFILE_ZONE_SCOPED; AvatarOverallAppearance result = AOA_NORMAL; // Priority order (highest priority first) |