summaryrefslogtreecommitdiff
path: root/indra/newview/llvovolume.cpp
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2009-11-12 20:54:00 -0500
committerNyx (Neal Orman) <nyx@lindenlab.com>2009-11-12 20:54:00 -0500
commit1aa4e4e68d972ed118ebab14d01c829dc79cfc18 (patch)
tree823ff4c3326c303e6ce1f7f0dfb88de27a09591a /indra/newview/llvovolume.cpp
parent31ceac828920bac39c330ba1eb6b7f7d9cc918b1 (diff)
EXT-2434 update avatar rendering cost
First crack at updating the rendering cost calculation for avatars to account for the possibility of invisible avatars. Also generalized rendering cost of attachments to be more general - added debug code to build floater will be post-reviewed
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rw-r--r--indra/newview/llvovolume.cpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index 2def905bbb..e5531a1497 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -2541,6 +2541,107 @@ const LLMatrix4 LLVOVolume::getRenderMatrix() const
return mDrawable->getWorldMatrix();
}
+U32 LLVOVolume::getRenderCost() const
+{
+ U32 shame = 0;
+
+ U32 invisi = 0;
+ U32 shiny = 0;
+ U32 glow = 0;
+ U32 alpha = 0;
+ U32 flexi = 0;
+ U32 animtex = 0;
+ U32 particles = 0;
+ U32 scale = 0;
+ U32 bump = 0;
+ U32 planar = 0;
+
+ if (isFlexible())
+ {
+ flexi = 1;
+ }
+ if (isParticleSource())
+ {
+ particles = 1;
+ }
+
+ const LLVector3& sc = getScale();
+ scale += (U32) sc.mV[0] + (U32) sc.mV[1] + (U32) sc.mV[2];
+
+ const LLDrawable* drawablep = mDrawable;
+
+ if (isSculpted())
+ {
+ const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT);
+ LLUUID sculpt_id = sculpt_params->getSculptTexture();
+ shame += 5;
+ }
+
+ for (S32 i = 0; i < drawablep->getNumFaces(); ++i)
+ {
+ const LLFace* face = drawablep->getFace(i);
+ const LLTextureEntry* te = face->getTextureEntry();
+ const LLViewerTexture* img = face->getTexture();
+
+ shame += 5;
+
+ if (face->getPoolType() == LLDrawPool::POOL_ALPHA)
+ {
+ alpha++;
+ }
+ else if (img->getPrimaryFormat() == GL_ALPHA)
+ {
+ invisi = 1;
+ }
+
+ if (te)
+ {
+ if (te->getBumpmap())
+ {
+ bump = 1;
+ }
+ if (te->getShiny())
+ {
+ shiny = 1;
+ }
+ if (te->getGlow() > 0.f)
+ {
+ glow = 1;
+ }
+ if (face->mTextureMatrix != NULL)
+ {
+ animtex++;
+ }
+ if (te->getTexGen())
+ {
+ planar++;
+ }
+ }
+ }
+
+ shame += invisi + shiny + glow + alpha*4 + flexi*8 + animtex*4 + particles*16+bump*4+scale+planar;
+
+ LLViewerObject::const_child_list_t& child_list = getChildren();
+ for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin();
+ iter != child_list.end();
+ ++iter)
+ {
+ const LLViewerObject* child_objectp = *iter;
+ const LLDrawable* child_drawablep = child_objectp->mDrawable;
+ if (child_drawablep)
+ {
+ const LLVOVolume* child_volumep = child_drawablep->getVOVolume();
+ if (child_volumep)
+ {
+ shame += child_volumep->getRenderCost();
+ }
+ }
+ }
+
+ return shame;
+
+}
+
//static
void LLVOVolume::preUpdateGeom()
{