summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2012-02-27 17:20:55 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2012-02-27 17:20:55 -0500
commit55b5d6b7b45e956d6927461d8a0ef153ec3c7770 (patch)
tree4e78262d66d67a30978ea9bce0fbe1e895c4c00f /indra/newview/llvoavatar.cpp
parent51d5147f470d114c16674df75608cc6153df3b3f (diff)
SH-2689 WIP - tracking cloud/gray/textured state for avs, display with rendering cost
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rwxr-xr-xindra/newview/llvoavatar.cpp69
1 files changed, 61 insertions, 8 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 21ba3b60f3..f027429c79 100755
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -777,7 +777,14 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
std::string LLVOAvatar::avString() const
{
- return " Avatar '" + getFullname() + "' ";
+ std::string viz_string;
+ if (getIsCloud())
+ viz_string = "cloud";
+ else if (isFullyTextured())
+ viz_string = "textured";
+ else
+ viz_string = "gray";
+ return " Avatar '" + getFullname() + "' " + viz_string + " ";
}
void LLVOAvatar::debugAvatarRezTime(std::string notification_name, std::string comment)
@@ -895,6 +902,44 @@ BOOL LLVOAvatar::isFullyBaked()
return TRUE;
}
+BOOL LLVOAvatar::isFullyTextured() const
+{
+ for (std::vector<LLViewerJoint*>::const_iterator jointIter = mMeshLOD.begin();
+ jointIter != mMeshLOD.end(); ++jointIter)
+ {
+ LLViewerJoint* joint = (LLViewerJoint*) *jointIter;
+ if (!joint)
+ {
+ continue; // nonexistent LOD OK.
+ }
+ std::vector<LLViewerJointMesh*>::iterator meshIter = joint->mMeshParts.begin();
+ if (meshIter != joint->mMeshParts.end())
+ {
+ LLViewerJointMesh *mesh = (LLViewerJointMesh *) *meshIter;
+ if (!mesh)
+ {
+ continue; // nonexistent mesh OK
+ }
+ if (mesh->mTexture.notNull() && mesh->mTexture->hasGLTexture())
+ {
+ continue; // Mesh exists and has a baked texture.
+ }
+ if (mesh->mLayerSet && mesh->mLayerSet->hasComposite())
+ {
+ continue; // Mesh exists and has a composite texture.
+ }
+ // Fail
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
+BOOL LLVOAvatar::hasGray() const
+{
+ return !getIsCloud() && !isFullyTextured();
+}
+
void LLVOAvatar::deleteLayerSetCaches(bool clearAll)
{
for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
@@ -4122,11 +4167,11 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)
{ //LOD changed or new mesh created, allocate new vertex buffer if needed
if (needs_rebuild || mDirtyMesh >= 2 || mVisibilityRank <= 4)
{
- updateMeshData();
+ updateMeshData();
mDirtyMesh = 0;
- mNeedsSkin = TRUE;
- mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
- }
+ mNeedsSkin = TRUE;
+ mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY);
+ }
}
if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) <= 0)
@@ -6385,10 +6430,10 @@ BOOL LLVOAvatar::isVisible() const
}
// Determine if we have enough avatar data to render
-BOOL LLVOAvatar::getIsCloud()
+BOOL LLVOAvatar::getIsCloud() const
{
// Do we have a shape?
- if (visualParamWeightsAreDefault())
+ if ((const_cast<LLVOAvatar*>(this))->visualParamWeightsAreDefault())
{
return TRUE;
}
@@ -8468,7 +8513,15 @@ void LLVOAvatar::idleUpdateRenderCost()
}
}
- setDebugText(llformat("%d", cost));
+
+ std::string viz_string;
+ if (getIsCloud())
+ viz_string = "cloud";
+ else if (isFullyTextured())
+ viz_string = "textured";
+ else
+ viz_string = "gray";
+ setDebugText(llformat("%s %d", viz_string.c_str(), cost));
mVisualComplexity = cost;
F32 green = 1.f-llclamp(((F32) cost-(F32)ARC_LIMIT)/(F32)ARC_LIMIT, 0.f, 1.f);
F32 red = llmin((F32) cost/(F32)ARC_LIMIT, 1.f);