SH-2689 WIP - tracking cloud/gray/textured state for avs, display with rendering cost

master
Brad Payne (Vir Linden) 2012-02-27 17:20:55 -05:00
parent 51d5147f47
commit 55b5d6b7b4
6 changed files with 68 additions and 14 deletions

1
indra/newview/llviewerjointmesh.cpp Normal file → Executable file
View File

@ -577,7 +577,6 @@ U32 LLViewerJointMesh::drawShape( F32 pixelArea, BOOL first_pass, BOOL is_dummy)
{
old_mode = mTexture->getAddressMode();
}
gGL.getTexUnit(diffuse_channel)->bind(mTexture.get());
gGL.getTexUnit(diffuse_channel)->bind(mTexture);
gGL.getTexUnit(diffuse_channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
}

1
indra/newview/llviewerjointmesh.h Normal file → Executable file
View File

@ -61,6 +61,7 @@ public:
//-----------------------------------------------------------------------------
class LLViewerJointMesh : public LLViewerJoint
{
friend class LLVOAvatar;
protected:
LLColor4 mColor; // color value
// LLColor4 mSpecular; // specular color (always white for now)

View File

@ -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);

View File

@ -277,9 +277,11 @@ public:
public:
BOOL isFullyLoaded() const;
bool isTooComplex() const;
bool visualParamWeightsAreDefault();
bool visualParamWeightsAreDefault();
virtual BOOL getIsCloud() const;
BOOL isFullyTextured() const;
BOOL hasGray() const;
protected:
virtual BOOL getIsCloud();
BOOL updateIsFullyLoaded();
BOOL processFullyLoadedChange(bool loading);
void updateRuthTimer(bool loading);
@ -519,7 +521,6 @@ public:
virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, U32 index = 0) const;
virtual BOOL isTextureVisible(LLVOAvatarDefines::ETextureIndex type, LLWearable *wearable) const;
protected:
BOOL isFullyBaked();
static BOOL areAllNearbyInstancesBaked(S32& grey_avatars);

View File

@ -1888,7 +1888,7 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl;
}
BOOL LLVOAvatarSelf::getIsCloud()
BOOL LLVOAvatarSelf::getIsCloud() const
{
// do we have our body parts?
if (gAgentWearables.getWearableCount(LLWearableType::WT_SHAPE) == 0 ||

View File

@ -121,7 +121,7 @@ public:
// Loading state
//--------------------------------------------------------------------
public:
/*virtual*/ BOOL getIsCloud();
/*virtual*/ BOOL getIsCloud() const;
//--------------------------------------------------------------------
// Region state