MAINT-5560: Correct imposter rendering flaws for avatars that have not had any attachments

master
Oz Linden 2015-08-25 17:51:35 -04:00
parent 75304b4ca8
commit 206ef7a156
6 changed files with 36 additions and 40 deletions

View File

@ -267,9 +267,10 @@ void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regio
avatar->calculateUpdateRenderComplexity(); // Make sure the numbers are up-to-date
LLSD info = LLSD::emptyMap();
if (avatar->getVisualComplexity() > 0)
U32 avatar_complexity = avatar->getVisualComplexity();
if (avatar_complexity > 0)
{
info[KEY_WEIGHT] = avatar->getVisualComplexity();
info[KEY_WEIGHT] = (S32)(avatar_complexity < S32_MAX ? avatar_complexity : S32_MAX);
info[KEY_TOO_COMPLEX] = LLSD::Boolean(avatar->isTooComplex());
agents[avatar->getID().asString()] = info;

View File

@ -133,9 +133,10 @@ void LLAvatarRenderNotifier::updateNotification()
// next 'over limit' update should be displayed as soon as possible if there is anything noteworthy
mPopUpDelayTimer.resetWithExpiry(0);
}
else if ((mPopUpDelayTimer.hasExpired() || is_visible)
&& (mOverLimitPct > 0 || mLatestOverLimitPct > 0)
&& abs(mOverLimitPct - mLatestOverLimitPct) > mLatestOverLimitPct * RENDER_ALLOWED_CHANGE_PCT)
else if ( (mPopUpDelayTimer.hasExpired() || is_visible)
&& (mOverLimitPct > 0 || mLatestOverLimitPct > 0)
&& std::abs(mOverLimitPct - mLatestOverLimitPct) > mLatestOverLimitPct * RENDER_ALLOWED_CHANGE_PCT
)
{
// display in case of drop to/from zero and in case of significant (RENDER_ALLOWED_CHANGE_PCT) changes
display_notification = true;

View File

@ -862,10 +862,8 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
{
if (bridge->mAvatar.notNull())
{
bridge->mAvatar->mAttachmentGeometryBytes -= mGeometryBytes;
bridge->mAvatar->mAttachmentGeometryBytes = llmax(bridge->mAvatar->mAttachmentGeometryBytes, 0);
bridge->mAvatar->mAttachmentSurfaceArea -= mSurfaceArea;
bridge->mAvatar->mAttachmentSurfaceArea = llmax(bridge->mAvatar->mAttachmentSurfaceArea, 0.f);
bridge->mAvatar->modifyAttachmentGeometryBytes( -mGeometryBytes );
bridge->mAvatar->modifyAttachmentSurfaceArea( -mSurfaceArea );
}
}

View File

@ -182,7 +182,7 @@ const F32 NAMETAG_UPDATE_THRESHOLD = 0.3f;
const F32 NAMETAG_VERTICAL_SCREEN_OFFSET = 25.f;
const F32 NAMETAG_VERT_OFFSET_WEIGHT = 0.17f;
const S32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0;
const U32 LLVOAvatar::VISUAL_COMPLEXITY_UNKNOWN = 0;
enum ERenderName
{
@ -668,8 +668,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
LLAvatarAppearance(&gAgentWearables),
LLViewerObject(id, pcode, regionp),
mSpecialRenderMode(0),
mAttachmentGeometryBytes(-1),
mAttachmentSurfaceArea(-1.f),
mAttachmentGeometryBytes(0),
mAttachmentSurfaceArea(0.f),
mReportedVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN),
mTurning(FALSE),
mLastSkeletonSerialNum( 0 ),
@ -8283,6 +8283,16 @@ void LLVOAvatar::idleUpdateRenderComplexity()
}
}
void LLVOAvatar::modifyAttachmentGeometryBytes(S32 delta)
{
mAttachmentGeometryBytes = llmax(mAttachmentGeometryBytes + delta, 0);
}
void LLVOAvatar::modifyAttachmentSurfaceArea(F32 delta)
{
F32 newval = mAttachmentSurfaceArea + delta;
mAttachmentSurfaceArea = ( newval > 0.0 ? newval : 0.0 );
}
void LLVOAvatar::updateVisualComplexity()
{

View File

@ -253,15 +253,17 @@ public:
void addNameTagLine(const std::string& line, const LLColor4& color, S32 style, const LLFontGL* font);
void idleUpdateRenderComplexity();
void calculateUpdateRenderComplexity();
static const S32 VISUAL_COMPLEXITY_UNKNOWN;
static const U32 VISUAL_COMPLEXITY_UNKNOWN;
void updateVisualComplexity();
S32 getVisualComplexity() { return mVisualComplexity; }; // Numbers calculated here by rendering AV
U32 getVisualComplexity() { return mVisualComplexity; }; // Numbers calculated here by rendering AV
S32 getAttachmentGeometryBytes() { return mAttachmentGeometryBytes; }; // number of bytes in attached geometry
void modifyAttachmentGeometryBytes(S32 delta);
F32 getAttachmentSurfaceArea() { return mAttachmentSurfaceArea; }; // estimated surface area of attachments
void modifyAttachmentSurfaceArea(F32 delta);
S32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server
void setReportedVisualComplexity(S32 value) { mReportedVisualComplexity = value; };
U32 getReportedVisualComplexity() { return mReportedVisualComplexity; }; // Numbers as reported by the SL server
void setReportedVisualComplexity(U32 value) { mReportedVisualComplexity = value; };
S32 getUpdatePeriod() { return mUpdatePeriod; };
const LLColor4 & getMutedAVColor() { return mMutedAVColor; };
@ -405,10 +407,10 @@ public:
static void destroyGL();
static void restoreGL();
S32 mSpecialRenderMode; // special lighting
private:
S32 mAttachmentGeometryBytes; //number of bytes in attached geometry
F32 mAttachmentSurfaceArea; //estimated surface area of attachments
private:
bool shouldAlphaMask();
BOOL mNeedsSkin; // avatar has been animated and verts have not been updated
@ -418,9 +420,9 @@ private:
S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer.
// the isTooComplex method uses these mutable values to avoid recalculating too frequently
mutable S32 mVisualComplexity;
mutable U32 mVisualComplexity;
mutable bool mVisualComplexityStale;
S32 mReportedVisualComplexity; // from other viewers through the simulator
U32 mReportedVisualComplexity; // from other viewers through the simulator
VisualMuteSettings mVisuallyMuteSetting; // Always or never visually mute this AV

View File

@ -4703,10 +4703,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (pAvatarVO)
{
pAvatarVO->mAttachmentGeometryBytes -= group->mGeometryBytes;
pAvatarVO->mAttachmentGeometryBytes = llmax(pAvatarVO->mAttachmentGeometryBytes, 0);
pAvatarVO->mAttachmentSurfaceArea -= group->mSurfaceArea;
pAvatarVO->mAttachmentSurfaceArea = llmax(pAvatarVO->mAttachmentSurfaceArea, 0.f);
pAvatarVO->modifyAttachmentGeometryBytes( -group->mGeometryBytes );
pAvatarVO->modifyAttachmentSurfaceArea( -group->mSurfaceArea );
}
group->mGeometryBytes = 0;
@ -5260,24 +5258,10 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)
if (pAvatarVO)
{
if (pAvatarVO->mAttachmentGeometryBytes < 0)
{ // First time through value is -1
pAvatarVO->mAttachmentGeometryBytes = group->mGeometryBytes;
}
else
{
pAvatarVO->mAttachmentGeometryBytes += group->mGeometryBytes;
}
if (pAvatarVO->mAttachmentSurfaceArea < 0.f)
{ // First time through value is -1
pAvatarVO->mAttachmentSurfaceArea = group->mSurfaceArea;
}
else
{
pAvatarVO->mAttachmentSurfaceArea += group->mSurfaceArea;
pAvatarVO->modifyAttachmentGeometryBytes( group->mGeometryBytes );
pAvatarVO->modifyAttachmentSurfaceArea( group->mSurfaceArea );
}
}
}
static LLTrace::BlockTimerStatHandle FTM_REBUILD_MESH_FLUSH("Flush Mesh");