From b70ccfe8e31cd253069a6e0ae0ec03e301d26578 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 7 Oct 2010 14:00:43 -0500 Subject: [PATCH] Add pure physics cost to UI --- indra/newview/featuretable.txt | 3 +- indra/newview/featuretable_xp.txt | 3 +- indra/newview/llfloatertools.cpp | 11 +- indra/newview/llselectmgr.cpp | 105 +++++++++++++----- indra/newview/llselectmgr.h | 3 + indra/newview/llviewerobject.cpp | 62 +++++++++-- indra/newview/llviewerobject.h | 13 ++- indra/newview/llviewerobjectlist.cpp | 9 +- indra/newview/llviewerobjectlist.h | 2 +- .../skins/default/xui/en/floater_tools.xml | 6 +- 10 files changed, 166 insertions(+), 51 deletions(-) diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index f3d6e73043..8b20086af4 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -1,4 +1,4 @@ -version 23 +version 24 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -454,6 +454,7 @@ RenderAvatarCloth 0 0 list ATI RenderUseStreamVBO 1 0 +RenderAvatarVP 1 0 /// Tweaked NVIDIA diff --git a/indra/newview/featuretable_xp.txt b/indra/newview/featuretable_xp.txt index 9b901022c4..4fa3087b9d 100644 --- a/indra/newview/featuretable_xp.txt +++ b/indra/newview/featuretable_xp.txt @@ -1,4 +1,4 @@ -version 23 +version 24 // NOTE: This is mostly identical to featuretable_mac.txt with a few differences // Should be combined into one table @@ -451,6 +451,7 @@ RenderAvatarCloth 0 0 list ATI RenderUseStreamVBO 1 0 +RenderAvatarVP 1 0 /// Tweaked NVIDIA diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 8a8177abde..e5c6fe7631 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -434,6 +434,10 @@ void LLFloaterTools::refresh() LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost(); F32 link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost(); + F32 obj_physics_cost = + LLSelectMgr::getInstance()->getSelection()->getSelectedPhysicsCost(); + F32 link_physics_cost = + LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost(); // Update the text for the counts childSetTextArg( @@ -443,11 +447,10 @@ void LLFloaterTools::refresh() childSetTextArg("object_count", "[COUNT]", object_count_string); // Update the text for the resource costs - childSetTextArg( - "linked_set_cost", - "[COST]", - llformat("%.1f", link_cost)); + childSetTextArg("linked_set_cost","[COST]",llformat("%.1f", link_cost)); childSetTextArg("object_cost", "[COST]", llformat("%.1f", obj_cost)); + childSetTextArg("linked_set_cost","[PHYSICS]",llformat("%.1f", link_physics_cost)); + childSetTextArg("object_cost", "[PHYSICS]", llformat("%.1f", obj_physics_cost)); // Display rendering cost if needed if (sShowObjectCost) diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 57e04a43a2..f819e9fcbc 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6230,6 +6230,83 @@ F32 LLObjectSelection::getSelectedObjectCost() return cost; } +F32 LLObjectSelection::getSelectedLinksetCost() +{ + cleanupNodes(); + F32 cost = 0.f; + + std::set me_roots; + + for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + + if (object) + { + LLViewerObject* root = static_cast(object->getRoot()); + if (root) + { + if (me_roots.find(root) == me_roots.end()) + { + me_roots.insert(root); + cost += root->getLinksetCost(); + } + } + } + } + + return cost; +} + +F32 LLObjectSelection::getSelectedPhysicsCost() +{ + cleanupNodes(); + F32 cost = 0.f; + + for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + + if (object) + { + cost += object->getPhysicsCost(); + } + } + + return cost; +} + +F32 LLObjectSelection::getSelectedLinksetPhysicsCost() +{ + cleanupNodes(); + F32 cost = 0.f; + + std::set me_roots; + + for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter) + { + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + + if (object) + { + LLViewerObject* root = static_cast(object->getRoot()); + if (root) + { + if (me_roots.find(root) == me_roots.end()) + { + me_roots.insert(root); + cost += root->getLinksetPhysicsCost(); + } + } + } + } + + return cost; +} + F32 LLObjectSelection::getSelectedObjectStreamingCost() { F32 cost = 0.f; @@ -6264,34 +6341,6 @@ U32 LLObjectSelection::getSelectedObjectTriangleCount() return count; } -F32 LLObjectSelection::getSelectedLinksetCost() -{ - cleanupNodes(); - F32 cost = 0.f; - - std::set me_roots; - - for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter) - { - LLSelectNode* node = *iter; - LLViewerObject* object = node->getObject(); - - if (object) - { - LLViewerObject* root = static_cast(object->getRoot()); - if (root) - { - if (me_roots.find(root) == me_roots.end()) - { - me_roots.insert(root); - cost += root->getLinksetCost(); - } - } - } - } - - return cost; -} //----------------------------------------------------------------------------- // getTECount() diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index e598ffd47d..9a896bd5e2 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -288,6 +288,9 @@ public: S32 getObjectCount(BOOL mesh_adjust = FALSE); F32 getSelectedObjectCost(); F32 getSelectedLinksetCost(); + F32 getSelectedPhysicsCost(); + F32 getSelectedLinksetPhysicsCost(); + F32 getSelectedObjectStreamingCost(); U32 getSelectedObjectTriangleCount(); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 9b3f81e193..dcd208fea5 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -240,6 +240,8 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mClickAction(0), mObjectCost(0.f), mLinksetCost(0.f), + mPhysicsCost(0.f), + mLinksetPhysicsCost(0.f), mCostStale(true), mAttachmentItemID(LLUUID::null) { @@ -2931,6 +2933,28 @@ void LLViewerObject::setLinksetCost(F32 cost) } } +void LLViewerObject::setPhysicsCost(F32 cost) +{ + mPhysicsCost = cost; + mCostStale = false; + + if (isSelected()) + { + gFloaterTools->dirty(); + } +} + +void LLViewerObject::setLinksetPhysicsCost(F32 cost) +{ + mLinksetPhysicsCost = cost; + mCostStale = false; + + if (isSelected()) + { + gFloaterTools->dirty(); + } +} + F32 LLViewerObject::getObjectCost() { @@ -2942,16 +2966,6 @@ F32 LLViewerObject::getObjectCost() return mObjectCost; } -F32 LLViewerObject::getStreamingCost() -{ - return 0.f; -} - -U32 LLViewerObject::getTriangleCount() -{ - return 0; -} - F32 LLViewerObject::getLinksetCost() { if (mCostStale) @@ -2962,7 +2976,35 @@ F32 LLViewerObject::getLinksetCost() return mLinksetCost; } +F32 LLViewerObject::getPhysicsCost() +{ + if (mCostStale) + { + gObjectList.updateObjectCost(this); + } + + return mPhysicsCost; +} +F32 LLViewerObject::getLinksetPhysicsCost() +{ + if (mCostStale) + { + gObjectList.updateObjectCost(this); + } + + return mLinksetPhysicsCost; +} + +F32 LLViewerObject::getStreamingCost() +{ + return 0.f; +} + +U32 LLViewerObject::getTriangleCount() +{ + return 0; +} void LLViewerObject::updateSpatialExtents(LLVector4a& newMin, LLVector4a &newMax) { diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 094f01ab3d..3cc23bb085 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -334,14 +334,20 @@ public: virtual void setScale(const LLVector3 &scale, BOOL damped = FALSE); - void setObjectCost(F32 cost); - F32 getObjectCost(); virtual F32 getStreamingCost(); virtual U32 getTriangleCount(); + void setObjectCost(F32 cost); + F32 getObjectCost(); + void setLinksetCost(F32 cost); F32 getLinksetCost(); + void setPhysicsCost(F32 cost); + F32 getPhysicsCost(); + + void setLinksetPhysicsCost(F32 cost); + F32 getLinksetPhysicsCost(); void sendShapeUpdate(); @@ -699,6 +705,9 @@ protected: U8 mClickAction; F32 mObjectCost; //resource cost of this object or -1 if unknown F32 mLinksetCost; + F32 mPhysicsCost; + F32 mLinksetPhysicsCost; + bool mCostStale; static U32 sNumZombieObjects; // Objects which are dead, but not deleted diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index e6f1d8e728..97b102a6a3 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -728,7 +728,10 @@ public: F32 object_cost = content[iter->asString()]["resource_cost"].asReal(); - gObjectList.updateObjectCost(object_id, object_cost, link_cost); + F32 physics_cost = content[iter->asString()]["physics_cost"].asReal(); + F32 link_physics_cost = content[iter->asString()]["linked_set_physics_cost"].asReal(); + + gObjectList.updateObjectCost(object_id, object_cost, link_cost, physics_cost, link_physics_cost); } else { @@ -1187,7 +1190,7 @@ void LLViewerObjectList::updateObjectCost(LLViewerObject* object) mStaleObjectCost.insert(object->getID()); } -void LLViewerObjectList::updateObjectCost(LLUUID object_id, F32 object_cost, F32 link_cost) +void LLViewerObjectList::updateObjectCost(LLUUID object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost) { mPendingObjectCost.erase(object_id); @@ -1196,6 +1199,8 @@ void LLViewerObjectList::updateObjectCost(LLUUID object_id, F32 object_cost, F32 { object->setObjectCost(object_cost); object->setLinksetCost(link_cost); + object->setPhysicsCost(physics_cost); + object->setLinksetPhysicsCost(link_physics_cost); } } diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 0f58e543ac..afa881ea58 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -92,7 +92,7 @@ public: void update(LLAgent &agent, LLWorld &world); void updateObjectCost(LLViewerObject* object); - void updateObjectCost(LLUUID object_id, F32 object_cost, F32 link_cost); + void updateObjectCost(LLUUID object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost); void onObjectCostFetchFailure(LLUUID object_id); void shiftObjects(const LLVector3 &offset); diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 2e3349dbe8..7dca22fd5a 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -747,8 +747,9 @@ top_delta="0" right="-10" name="linked_set_cost" + tool_tip="Cost of currently selected linked sets as [prims],[physics complexity]" width="80"> - Cost: [COST] + Cost: [COST] / [PHYSICS] - Cost: [COST] + Cost: [COST] / [PHYSICS]