summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2022-05-31 01:58:09 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2022-05-31 01:58:09 +0300
commit9b0569840f06137ee2379463f5028a5342c3555a (patch)
tree279eaa517131fe4e073d8d9781e0b69e747a0bb9 /indra/newview/llvoavatar.cpp
parent1e09d25d9ce8b7ec8da28ad5364d81c0faab9d0a (diff)
parentcdbd06e8ed6e3f4285a61f5c0b607a65dfdf8dfd (diff)
Merge branch 'master' into DRTVWR-544-maint
# Conflicts: # indra/llprimitive/llmodel.cpp # indra/llprimitive/llmodel.h # indra/newview/llappviewer.cpp # indra/newview/llappviewer.h
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp316
1 files changed, 217 insertions, 99 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index df34dda65e..c16295821e 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -111,6 +111,7 @@
#include "llsdserialize.h"
#include "llcallstack.h"
#include "llrendersphere.h"
+#include "llskinningutil.h"
#include <boost/lexical_cast.hpp>
@@ -126,6 +127,12 @@ const F32 MIN_HOVER_Z = -2.0;
const F32 MIN_ATTACHMENT_COMPLEXITY = 0.f;
const F32 DEFAULT_MAX_ATTACHMENT_COMPLEXITY = 1.0e6f;
+// Unlike with 'self' avatar, server doesn't inform viewer about
+// expected attachments so viewer has to wait to see if anything
+// else will arrive
+const F32 FIRST_APPEARANCE_CLOUD_MIN_DELAY = 3.f; // seconds
+const F32 FIRST_APPEARANCE_CLOUD_MAX_DELAY = 45.f;
+
using namespace LLAvatarAppearanceDefines;
//-----------------------------------------------------------------------------
@@ -326,6 +333,7 @@ public:
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
F32 nx[2];
nx[0]=time*TORSO_NOISE_SPEED;
nx[1]=0.0f;
@@ -446,6 +454,7 @@ public:
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
mBreatheRate = 1.f;
F32 breathe_amt = (sinf(mBreatheRate * time) * BREATHE_ROT_MOTION_STRENGTH);
@@ -547,6 +556,7 @@ public:
// must return FALSE when the motion is completed.
virtual BOOL onUpdate(F32 time, U8* joint_mask)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
mPelvisState->setPosition(LLVector3::zero);
return TRUE;
@@ -605,6 +615,7 @@ F32 LLVOAvatar::sUnbakedTime = 0.f;
F32 LLVOAvatar::sUnbakedUpdateTime = 0.f;
F32 LLVOAvatar::sGreyTime = 0.f;
F32 LLVOAvatar::sGreyUpdateTime = 0.f;
+LLPointer<LLViewerTexture> LLVOAvatar::sCloudTexture = NULL;
//-----------------------------------------------------------------------------
// Helper functions
@@ -660,6 +671,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),
@@ -734,7 +746,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
mCurrentGesticulationLevel = 0;
-
+ mFirstAppearanceMessageTimer.reset();
mRuthTimer.reset();
mRuthDebugTimer.reset();
mDebugExistenceTimer.reset();
@@ -1128,6 +1140,7 @@ void LLVOAvatar::initClass()
LLControlAvatar::sRegionChangedSlot = gAgent.addRegionChangedCallback(&LLControlAvatar::onRegionChanged);
+ sCloudTexture = LLViewerTextureManager::getFetchedTextureFromFile("cloud-particle.j2c");
}
@@ -1320,11 +1333,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_CATEGORY_AVATAR;
static LLCachedControl<S32> box_detail_cache(gSavedSettings, "AvatarBoundingBoxComplexity");
S32 box_detail = box_detail_cache;
@@ -1428,7 +1439,7 @@ void LLVOAvatar::calculateSpatialExtents(LLVector4a& newMin, LLVector4a& newMax)
continue;
}
LLDrawable* drawable = attached_object->mDrawable;
- if (drawable && !drawable->isState(LLDrawable::RIGGED))
+ if (drawable && !drawable->isState(LLDrawable::RIGGED | LLDrawable::RIGGED_CHILD)) // <-- don't extend bounding box if any rigged objects are present
{
LLSpatialBridge* bridge = drawable->getSpatialBridge();
if (bridge)
@@ -2494,10 +2505,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()
//------------------------------------------------------------------------
@@ -2530,7 +2537,7 @@ void LLVOAvatar::dumpAnimationState()
//------------------------------------------------------------------------
void LLVOAvatar::idleUpdate(LLAgent &agent, const F64 &time)
{
- LL_RECORD_BLOCK_TIME(FTM_AVATAR_UPDATE);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
if (isDead())
{
@@ -2567,8 +2574,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();
@@ -2668,9 +2673,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();
}
@@ -2784,10 +2788,17 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
}//if ( voiceEnabled )
}
-static LLTrace::BlockTimerStatHandle FTM_ATTACHMENT_UPDATE("Update Attachments");
+static void override_bbox(LLDrawable* drawable, LLVector4a* extents)
+{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL;
+ drawable->setSpatialExtents(extents[0], extents[1]);
+ drawable->setPositionGroup(LLVector4a(0, 0, 0));
+ drawable->movePartition();
+}
void LLVOAvatar::idleUpdateMisc(bool detailed_update)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
if (LLVOAvatar::sJointDebug)
{
LL_INFOS() << getFullname() << ": joint touches: " << LLJoint::sNumTouches << " updates: " << LLJoint::sNumUpdates << LL_ENDL;
@@ -2801,7 +2812,7 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
// update attachments positions
if (detailed_update)
{
- LL_RECORD_BLOCK_TIME(FTM_ATTACHMENT_UPDATE);
+ U32 draw_order = 0;
for (attachment_map_t::iterator iter = mAttachmentPoints.begin();
iter != mAttachmentPoints.end();
++iter)
@@ -2812,28 +2823,72 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update)
attachment_iter != attachment->mAttachedObjects.end();
++attachment_iter)
{
- LLViewerObject* attached_object = attachment_iter->get();
- BOOL visibleAttachment = visible || (attached_object &&
- !(attached_object->mDrawable->getSpatialBridge() &&
- attached_object->mDrawable->getSpatialBridge()->getRadius() < 2.0));
+ LLViewerObject* attached_object = attachment_iter->get();
+ if (!attached_object
+ || attached_object->isDead()
+ || !attachment->getValid()
+ || attached_object->mDrawable.isNull())
+ {
+ continue;
+ }
+
+ LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge();
- if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid())
+ if (visible || !(bridge && bridge->getRadius() < 2.0))
{
- // if selecting any attachments, update all of them as non-damped
- if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment())
- {
- gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
- }
- else
- {
- gPipeline.updateMoveDampedAsync(attached_object->mDrawable);
- }
-
- LLSpatialBridge* bridge = attached_object->mDrawable->getSpatialBridge();
- if (bridge)
- {
- gPipeline.updateMoveNormalAsync(bridge);
- }
+ //override rigged attachments' octree spatial extents with this avatar's bounding box
+ bool rigged = false;
+ if (bridge)
+ {
+ //transform avatar bounding box into attachment's coordinate frame
+ LLVector4a extents[2];
+ bridge->transformExtents(mDrawable->getSpatialExtents(), extents);
+
+ if (attached_object->mDrawable->isState(LLDrawable::RIGGED | LLDrawable::RIGGED_CHILD))
+ {
+ rigged = true;
+ override_bbox(attached_object->mDrawable, extents);
+ }
+ }
+
+ // if selecting any attachments, update all of them as non-damped
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment())
+ {
+ gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
+ }
+ else
+ {
+ // Note: SL-17415; While most objects follow joints,
+ // some objects get position updates from server
+ gPipeline.updateMoveDampedAsync(attached_object->mDrawable);
+ }
+
+ // override_bbox calls movePartition() and getSpatialPartition(),
+ // so bridge might no longer be valid, get it again.
+ // ex: animesh stops being an animesh
+ bridge = attached_object->mDrawable->getSpatialBridge();
+ if (bridge)
+ {
+ if (!rigged)
+ {
+ gPipeline.updateMoveNormalAsync(bridge);
+ }
+ else
+ {
+ //specialized impl of updateMoveNormalAsync just for rigged attachment SpatialBridge
+ bridge->setState(LLDrawable::MOVE_UNDAMPED);
+ bridge->updateMove();
+ bridge->setState(LLDrawable::EARLY_MOVE);
+
+ LLSpatialGroup* group = attached_object->mDrawable->getSpatialGroup();
+ if (group)
+ { //set draw order of group
+ group->mAvatarp = this;
+ group->mRenderOrder = draw_order++;
+ }
+ }
+ }
+
attached_object->updateText();
}
}
@@ -3057,8 +3112,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
particle_parameters.mPartData.mStartColor = LLColor4(1, 1, 1, 0.5f);
particle_parameters.mPartData.mEndColor = LLColor4(1, 1, 1, 0.0f);
particle_parameters.mPartData.mStartScale.mV[VX] = 0.8f;
- LLViewerTexture* cloud = LLViewerTextureManager::getFetchedTextureFromFile("cloud-particle.j2c");
- particle_parameters.mPartImageID = cloud->getID();
+ particle_parameters.mPartImageID = sCloudTexture->getID();
particle_parameters.mMaxAge = 0.f;
particle_parameters.mPattern = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE;
particle_parameters.mInnerAngle = F_PI;
@@ -3141,6 +3195,8 @@ void LLVOAvatar::idleUpdateWindEffect()
void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+
// update chat bubble
//--------------------------------------------------------------------
// draw text label over character's head
@@ -4893,6 +4949,8 @@ bool LLVOAvatar::shouldAlphaMask()
//-----------------------------------------------------------------------------
U32 LLVOAvatar::renderSkinned()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+
U32 num_indices = 0;
if (!mIsBuilt)
@@ -5025,11 +5083,6 @@ U32 LLVOAvatar::renderSkinned()
bool should_alpha_mask = shouldAlphaMask();
LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
- }
-
BOOL first_pass = TRUE;
if (!LLDrawPoolAvatar::sSkipOpaque)
{
@@ -5076,11 +5129,6 @@ U32 LLVOAvatar::renderSkinned()
}
}
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
- }
-
if (!LLDrawPoolAvatar::sSkipTransparent || LLPipeline::sImpostorRender)
{
LLGLState blend(GL_BLEND, !mIsDummy);
@@ -5096,21 +5144,21 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
U32 num_indices = 0;
if( isWearingWearableType( LLWearableType::WT_SKIRT ) && (isUIAvatar() || isTextureVisible(TEX_SKIRT_BAKED)) )
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.25f);
+ gGL.flush();
LLViewerJoint* skirt_mesh = getViewerJoint(MESH_ID_SKIRT);
if (skirt_mesh)
{
num_indices += skirt_mesh->render(mAdjustedPixelArea, FALSE);
}
first_pass = FALSE;
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ gGL.flush();
}
if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender)
{
if (LLPipeline::sImpostorRender)
{
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
+ gGL.flush();
}
if (isTextureVisible(TEX_HEAD_BAKED))
@@ -5133,7 +5181,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass)
}
if (LLPipeline::sImpostorRender)
{
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ gGL.flush();
}
}
@@ -5165,11 +5213,6 @@ U32 LLVOAvatar::renderRigid()
bool should_alpha_mask = shouldAlphaMask();
LLGLState test(GL_ALPHA_TEST, should_alpha_mask);
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f);
- }
-
if (isTextureVisible(TEX_EYES_BAKED) || (getOverallAppearance() == AOA_JELLYDOLL && !isControlAvatar()) || isUIAvatar())
{
LLViewerJoint* eyeball_left = getViewerJoint(MESH_ID_EYEBALL_LEFT);
@@ -5184,11 +5227,6 @@ U32 LLVOAvatar::renderRigid()
}
}
- if (should_alpha_mask && !LLGLSLShader::sNoFixedFunction)
- {
- gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
- }
-
return num_indices;
}
@@ -5239,7 +5277,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel)
}
{
LLGLEnable test(GL_ALPHA_TEST);
- gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.f);
+ gGL.flush();
gGL.color4ubv(color.mV);
gGL.getTexUnit(diffuse_channel)->bind(&mImpostor);
@@ -6132,27 +6170,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;
}
@@ -6397,6 +6437,16 @@ void LLVOAvatar::updateAttachmentOverrides()
#endif
}
+void LLVOAvatar::notifyAttachmentMeshLoaded()
+{
+ if (!isFullyLoaded())
+ {
+ // We just received mesh or skin info
+ // Reset timer to wait for more potential meshes or changes
+ mFullyLoadedTimer.reset();
+ }
+}
+
//-----------------------------------------------------------------------------
// addAttachmentOverridesForObject
//-----------------------------------------------------------------------------
@@ -6487,7 +6537,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;
@@ -7091,6 +7141,7 @@ void LLVOAvatar::updateGL()
{
if (mMeshTexturesDirty)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
updateMeshTextures();
mMeshTexturesDirty = FALSE;
}
@@ -7099,10 +7150,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_CATEGORY_AVATAR;
if (!(gPipeline.hasRenderType(mIsControlAvatar ? LLPipeline::RENDER_TYPE_CONTROL_AV : LLPipeline::RENDER_TYPE_AVATAR)))
{
return TRUE;
@@ -7844,6 +7894,8 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color)
// Do rigged mesh attachments display with this av?
bool LLVOAvatar::shouldRenderRigged() const
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+
if (getOverallAppearance() == AOA_NORMAL)
{
return true;
@@ -8108,16 +8160,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(
+ mFirstAppearanceMessageTimer.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
{
@@ -8336,6 +8407,7 @@ void LLVOAvatar::updateMeshVisibility()
// virtual
void LLVOAvatar::updateMeshTextures()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR
static S32 update_counter = 0;
mBakedTextureDebugText.clear();
@@ -8876,6 +8948,9 @@ void LLVOAvatar::onFirstTEMessageReceived()
mMeshTexturesDirty = TRUE;
gPipeline.markGLRebuild(this);
+
+ mFirstAppearanceMessageTimer.reset();
+ mFullyLoadedTimer.reset();
}
}
@@ -9407,6 +9482,54 @@ LLViewerTexture* LLVOAvatar::getBakedTexture(const U8 te)
}
+const LLVOAvatar::MatrixPaletteCache& LLVOAvatar::updateSkinInfoMatrixPalette(const LLMeshSkinInfo* skin)
+{
+ U64 hash = skin->mHash;
+ MatrixPaletteCache& entry = mMatrixPaletteCache[hash];
+
+ if (entry.mFrame != gFrameCount)
+ {
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
+
+ entry.mFrame = gFrameCount;
+
+ //build matrix palette
+ U32 count = LLSkinningUtil::getMeshJointCount(skin);
+ entry.mMatrixPalette.resize(count);
+ LLSkinningUtil::initSkinningMatrixPalette(&(entry.mMatrixPalette[0]), count, skin, this);
+
+ const LLMatrix4a* mat = &(entry.mMatrixPalette[0]);
+
+ entry.mGLMp.resize(count * 12);
+
+ F32* mp = &(entry.mGLMp[0]);
+
+ for (U32 i = 0; i < count; ++i)
+ {
+ F32* m = (F32*)mat[i].mMatrix[0].getF32ptr();
+
+ U32 idx = i * 12;
+
+ mp[idx + 0] = m[0];
+ mp[idx + 1] = m[1];
+ mp[idx + 2] = m[2];
+ mp[idx + 3] = m[12];
+
+ mp[idx + 4] = m[4];
+ mp[idx + 5] = m[5];
+ mp[idx + 6] = m[6];
+ mp[idx + 7] = m[13];
+
+ mp[idx + 8] = m[8];
+ mp[idx + 9] = m[9];
+ mp[idx + 10] = m[10];
+ mp[idx + 11] = m[14];
+ }
+ }
+
+ return entry;
+}
+
// static
void LLVOAvatar::getAnimLabels( std::vector<std::string>* labels )
{
@@ -10153,6 +10276,7 @@ void showRigInfoTabExtents(LLVOAvatar *avatar, LLJointRiggingInfoTab& tab, S32&
void LLVOAvatar::getAssociatedVolumes(std::vector<LLVOVolume*>& volumes)
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
for ( LLVOAvatar::attachment_map_t::iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); ++iter )
{
LLViewerJointAttachment* attachment = iter->second;
@@ -10210,27 +10334,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_CATEGORY_AVATAR;
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)
{
@@ -10392,6 +10508,7 @@ void LLVOAvatar::updateImpostorRendering(U32 newMaxNonImpostorsValue)
void LLVOAvatar::idleUpdateRenderComplexity()
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
if (isControlAvatar())
{
LLControlAvatar *cav = dynamic_cast<LLControlAvatar*>(this);
@@ -10919,6 +11036,7 @@ void LLVOAvatar::updateOverallAppearanceAnimations()
// Based on isVisuallyMuted(), but has 3 possible results.
LLVOAvatar::AvatarOverallAppearance LLVOAvatar::getOverallAppearance() const
{
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR;
AvatarOverallAppearance result = AOA_NORMAL;
// Priority order (highest priority first)