diff options
-rw-r--r-- | indra/llcommon/llstring.cpp | 19 | ||||
-rw-r--r-- | indra/llcommon/llstring.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 36 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 1 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llvoavatar.h | 1 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 57 |
7 files changed, 104 insertions, 26 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index c45db3b185..9a02fecd72 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -869,6 +869,25 @@ std::string LLStringOps::getDatetimeCode (std::string key) } } +std::string LLStringOps::getReadableNumber(F64 num) +{ + if (fabs(num)>=1e9) + { + return llformat("%.2lfB", num / 1e9); + } + else if (fabs(num)>=1e6) + { + return llformat("%.2lfM", num / 1e6); + } + else if (fabs(num)>=1e3) + { + return llformat("%.2lfK", num / 1e3); + } + else + { + return llformat("%.2lf", num); + } +} namespace LLStringFn { diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h index abe5fda603..627ca05f14 100644 --- a/indra/llcommon/llstring.h +++ b/indra/llcommon/llstring.h @@ -211,6 +211,9 @@ public: static bool getPacificDaylightTime(void) { return sPacificDaylightTime;} static std::string getDatetimeCode (std::string key); + + // Express a value like 1234567 as "1.23M" + static std::string getReadableNumber(F64 num); }; /** diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 94e1390c42..17e3d68c72 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -3643,6 +3643,42 @@ U32 LLViewerObject::recursiveGetTriangleCount(S32* vcount) const return total_tris; } +// This is using the stored surface area for each volume (which +// defaults to 1.0 for the case of everything except a sculpt) and +// then scaling it linearly based on the largest dimension in the +// prim's scale. Should revisit at some point. +F32 LLViewerObject::recursiveGetScaledSurfaceArea() const +{ + F32 area = 0.f; + const LLDrawable* drawable = mDrawable; + if (drawable) + { + const LLVOVolume* volume = drawable->getVOVolume(); + if (volume) + { + if (volume->getVolume()) + { + const LLVector3& scale = volume->getScale(); + area += volume->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]); + } + LLViewerObject::const_child_list_t children = volume->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator child_iter = children.begin(); + child_iter != children.end(); + ++child_iter) + { + LLViewerObject* child_obj = *child_iter; + LLVOVolume *child = dynamic_cast<LLVOVolume*>( child_obj ); + if (child && child->getVolume()) + { + const LLVector3& scale = child->getScale(); + area += child->getVolume()->getSurfaceArea() * llmax(llmax(scale.mV[0], scale.mV[1]), scale.mV[2]); + } + } + } + } + return area; +} + void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) { LLVector4a center; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index a84b6da96c..e2deb89e55 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -363,6 +363,7 @@ public: virtual F32 getStreamingCost(S32* bytes = NULL, S32* visible_bytes = NULL, F32* unscaled_value = NULL) const; virtual U32 getTriangleCount(S32* vcount = NULL) const; virtual U32 getHighLODTriangleCount(); + F32 recursiveGetScaledSurfaceArea() const; U32 recursiveGetTriangleCount(S32* vcount = NULL) const; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index d5301c38ba..e849e14a5b 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -620,6 +620,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, LLViewerObject(id, pcode, regionp), mSpecialRenderMode(0), mAttachmentSurfaceArea(0.f), + mDirectAttachmentSurfaceArea(0.f), mAttachmentVisibleTriangleCount(0), mAttachmentEstTriangleCount(0.f), mReportedVisualComplexity(VISUAL_COMPLEXITY_UNKNOWN), @@ -9230,12 +9231,14 @@ void LLVOAvatar::idleUpdateRenderComplexity() mText->addLine(info_line, info_color, info_style); // Triangle count - mText->addLine(llformat("Tris %u",mAttachmentVisibleTriangleCount), info_color, info_style); - mText->addLine(llformat("Est Tris %f",mAttachmentEstTriangleCount), info_color, info_style); + mText->addLine(std::string("VisTris ") + LLStringOps::getReadableNumber(mAttachmentVisibleTriangleCount), + info_color, info_style); + mText->addLine(std::string("EstMaxTris ") + LLStringOps::getReadableNumber(mAttachmentEstTriangleCount), + info_color, info_style); // Attachment Surface Area static LLCachedControl<F32> max_attachment_area(gSavedSettings, "RenderAutoMuteSurfaceAreaLimit", 1000.0f); - info_line = llformat("%.0f m^2", mAttachmentSurfaceArea); + info_line = llformat("%.0f m^2 (%.0f)", mAttachmentSurfaceArea, mDirectAttachmentSurfaceArea); if (max_render_cost != 0 && max_attachment_area != 0) // zero means don't care, so don't bother coloring based on this { @@ -9288,6 +9291,7 @@ void LLVOAvatar::accountRenderComplexityForObject( { mAttachmentVisibleTriangleCount += attached_object->recursiveGetTriangleCount(); mAttachmentEstTriangleCount += attached_object->recursiveGetEstTrianglesMax(); + mDirectAttachmentSurfaceArea += attached_object->recursiveGetScaledSurfaceArea(); textures.clear(); const LLDrawable* drawable = attached_object->mDrawable; @@ -9441,7 +9445,8 @@ void LLVOAvatar::calculateUpdateRenderComplexity() mAttachmentVisibleTriangleCount = 0; mAttachmentEstTriangleCount = 0.f; - + mDirectAttachmentSurfaceArea = 0.f; + // A standalone animated object needs to be accounted for // using its associated volume. Attached animated objects // will be covered by the subsequent loop over attachments. diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5f7d23050e..f9a1d7b424 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -438,6 +438,7 @@ public: private: F32 mAttachmentSurfaceArea; //estimated surface area of attachments + F32 mDirectAttachmentSurfaceArea; //estimated surface area of attachments U32 mAttachmentVisibleTriangleCount; F32 mAttachmentEstTriangleCount; bool shouldAlphaMask(); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 7fec240d1b..981ec6ec33 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4905,8 +4905,6 @@ static LLDrawPoolAvatar* get_avatar_drawpool(LLViewerObject* vobj) void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { - - if (group->changeLOD()) { group->mLastUpdateDistance = group->mDistance; @@ -4927,13 +4925,16 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) group->mBuilt = 1.f; - LLVOAvatar* pAvatarVO = NULL; - LLVOAvatar *attached_av = NULL; + LLVOAvatar *rigged_av = NULL; + LLVOAvatar *attached_av = NULL; LLSpatialBridge* bridge = group->getSpatialPartition()->asBridge(); + LLViewerObject *vobj = NULL; + LLVOVolume *vol_obj = NULL; if (bridge) { - LLViewerObject* vobj = bridge->mDrawable->getVObj(); + vobj = bridge->mDrawable->getVObj(); + vol_obj = dynamic_cast<LLVOVolume*>(vobj); if (bridge->mAvatar.isNull()) { if (vobj) @@ -4941,17 +4942,25 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bridge->mAvatar = vobj->getAvatar(); } } - if (vobj) - { - attached_av = vobj->getAvatarAncestor(); - } - pAvatarVO = bridge->mAvatar; + rigged_av = bridge->mAvatar; } + if (vobj) + { + attached_av = vobj->getAvatarAncestor(); + } - if (attached_av) - { - attached_av->subtractAttachmentArea( group->mSurfaceArea ); - } + if (attached_av) + { + attached_av->subtractAttachmentArea( group->mSurfaceArea ); + } + if (rigged_av && (rigged_av != attached_av)) + { + rigged_av->subtractAttachmentArea( group->mSurfaceArea ); + } + if (vol_obj) + { + vol_obj->updateVisualComplexity(); + } group->mGeometryBytes = 0; group->mSurfaceArea = 0; @@ -5046,7 +5055,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) } if (vobj->getControlAvatar()) { - pAvatarVO = vobj->getControlAvatar(); + rigged_av = vobj->getControlAvatar(); } } else @@ -5066,13 +5075,13 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) bool is_rigged = false; // AXON handle NPC case - if (rigged && pAvatarVO && !vobj->isAnimatedObject()) + if (rigged && rigged_av && !vobj->isAnimatedObject()) { - pAvatarVO->addAttachmentOverridesForObject(vobj); - if (!LLApp::isExiting() && pAvatarVO->isSelf() && debugLoggingEnabled("AvatarAttachments")) + rigged_av->addAttachmentOverridesForObject(vobj); + if (!LLApp::isExiting() && rigged_av->isSelf() && debugLoggingEnabled("AvatarAttachments")) { bool verbose = true; - pAvatarVO->showAttachmentOverrides(verbose); + rigged_av->showAttachmentOverrides(verbose); } } @@ -5527,10 +5536,14 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) mFaceList.clear(); - if (attached_av) - { + if (attached_av) + { attached_av->addAttachmentArea( group->mSurfaceArea ); - } + } + if (rigged_av && (rigged_av != attached_av)) + { + rigged_av->addAttachmentArea( group->mSurfaceArea ); + } } static LLTrace::BlockTimerStatHandle FTM_REBUILD_MESH_FLUSH("Flush Mesh"); |