diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-02-27 17:20:55 -0500 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2012-02-27 17:20:55 -0500 |
commit | 55b5d6b7b45e956d6927461d8a0ef153ec3c7770 (patch) | |
tree | 4e78262d66d67a30978ea9bce0fbe1e895c4c00f | |
parent | 51d5147f470d114c16674df75608cc6153df3b3f (diff) |
SH-2689 WIP - tracking cloud/gray/textured state for avs, display with rendering cost
-rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerjointmesh.cpp | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | indra/newview/llviewerjointmesh.h | 1 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.cpp | 69 | ||||
-rwxr-xr-x | indra/newview/llvoavatar.h | 7 | ||||
-rwxr-xr-x | indra/newview/llvoavatarself.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatarself.h | 2 |
6 files changed, 68 insertions, 14 deletions
diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 76f4e18c27..20573c8fba 100644..100755 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -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); } diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index 0191f0cae8..dd5dae1dc1 100644..100755 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -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) 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); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index e2a6617c5f..bab4f02caf 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -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); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a13b32e0e7..fcdb4e3c63 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -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 || diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 54dbe81993..6aadf4533e 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -121,7 +121,7 @@ public: // Loading state //-------------------------------------------------------------------- public: - /*virtual*/ BOOL getIsCloud(); + /*virtual*/ BOOL getIsCloud() const; //-------------------------------------------------------------------- // Region state |