diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappearancemgr.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llfloatertools.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llfloatertools.h | 1 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 121 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 101 | ||||
-rw-r--r-- | indra/newview/llvovolume.h | 2 |
7 files changed, 147 insertions, 150 deletions
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index aac0fd6088..e46cfe6af9 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -325,44 +325,6 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items) items = new_items; } -static void removeDuplicateItems(LLInventoryModel::item_array_t& dst, const LLInventoryModel::item_array_t& src) -{ - LLInventoryModel::item_array_t new_dst; - std::set<LLUUID> mark_inventory; - - S32 inventory_dups = 0; - - for (LLInventoryModel::item_array_t::const_iterator src_pos = src.begin(); - src_pos != src.end(); - ++src_pos) - { - LLUUID src_item_id = (*src_pos)->getLinkedUUID(); - mark_inventory.insert(src_item_id); - } - - for (LLInventoryModel::item_array_t::const_iterator dst_pos = dst.begin(); - dst_pos != dst.end(); - ++dst_pos) - { - LLUUID dst_item_id = (*dst_pos)->getLinkedUUID(); - - if (mark_inventory.find(dst_item_id) == mark_inventory.end()) - { - // Item is not already present in COF. - new_dst.put(*dst_pos); - mark_inventory.insert(dst_item_id); - } - else - { - inventory_dups++; - } - } - llinfos << "removeDups, original " << dst.count() << " final " << new_dst.count() - << " inventory dups " << inventory_dups << llendl; - - dst = new_dst; -} - static void onWearableAssetFetch(LLWearable* wearable, void* data) { LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data; diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 3c3dfb760e..9854d2594b 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -422,10 +422,17 @@ void LLFloaterTools::refresh() LLResMgr::getInstance()->getIntegerString(prim_count_string, LLSelectMgr::getInstance()->getSelection()->getObjectCount()); childSetTextArg("prim_count", "[COUNT]", prim_count_string); + // calculate selection rendering cost + std::string prim_cost_string; + LLResMgr::getInstance()->getIntegerString(prim_cost_string, calcRenderCost()); + childSetTextArg("RenderingCost", "[COUNT]", prim_cost_string); + + // disable the object and prim counts if nothing selected bool have_selection = ! LLSelectMgr::getInstance()->getSelection()->isEmpty(); childSetEnabled("obj_count", have_selection); childSetEnabled("prim_count", have_selection); + childSetEnabled("RenderingCost", have_selection); // Refresh child tabs mPanelPermissions->refresh(); @@ -556,6 +563,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask) mBtnEdit ->setToggleState( edit_visible ); mRadioGroupEdit->setVisible( edit_visible ); + childSetVisible("RenderingCost", edit_visible || focus_visible || move_visible); if (mCheckSelectIndividual) { @@ -964,6 +972,27 @@ void LLFloaterTools::onClickGridOptions() //floaterp->addDependentFloater(LLFloaterBuildOptions::getInstance(), FALSE); } +S32 LLFloaterTools::calcRenderCost() +{ + S32 cost = 0; + for (LLObjectSelection::iterator selection_iter = LLSelectMgr::getInstance()->getSelection()->begin(); + selection_iter != LLSelectMgr::getInstance()->getSelection()->end(); + ++selection_iter) + { + LLSelectNode *select_node = *selection_iter; + if (select_node) + { + LLVOVolume *viewer_volume = (LLVOVolume*)select_node->getObject(); + if (viewer_volume) + { + cost += viewer_volume->getRenderCost(); + } + } + } + + return cost; +} + // static void LLFloaterTools::setEditTool(void* tool_pointer) { diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index a3e0cac034..05a88a31d3 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -121,6 +121,7 @@ private: static bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response); static void setObjectType( LLPCode pcode ); void onClickGridOptions(); + S32 calcRenderCost(); public: LLButton *mBtnFocus; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1054223dcf..90a79698f6 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1015,7 +1015,10 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated) } // SL-53351: Make sure we're not in mouselook when minimised, to prevent control issues - gAgent.changeCameraToDefault(); + if (gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + { + gAgent.changeCameraToDefault(); + } send_agent_pause(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 62ac8adad0..b6c1ee2f11 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -624,7 +624,6 @@ F32 LLVOAvatar::sGreyUpdateTime = 0.f; // Helper functions //----------------------------------------------------------------------------- static F32 calc_bouncy_animation(F32 x); -static U32 calc_shame(const LLVOVolume* volume, std::set<LLUUID> &textures); //----------------------------------------------------------------------------- // LLVOAvatar() @@ -7637,9 +7636,17 @@ void LLVOAvatar::idleUpdateRenderCost() return; } - U32 shame = 1; + U32 shame = 0; - std::set<LLUUID> textures; + for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) + { + const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index); + ETextureIndex tex_index = baked_dict->mTextureIndex; + if (isTextureVisible(tex_index)) + { + shame +=20; + } + } for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); iter != mAttachmentPoints.end(); @@ -7660,15 +7667,13 @@ void LLVOAvatar::idleUpdateRenderCost() const LLVOVolume* volume = drawable->getVOVolume(); if (volume) { - shame += calc_shame(volume, textures); + shame += volume->getRenderCost(); } } } } } - shame += textures.size() * 5; - setDebugText(llformat("%d", shame)); F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f); F32 red = llmin((F32) shame/1024.f, 1.f); @@ -7713,110 +7718,6 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const } -U32 calc_shame(const LLVOVolume* volume, std::set<LLUUID> &textures) -{ - if (!volume) - { - return 0; - } - - 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 (volume->isFlexible()) - { - flexi = 1; - } - if (volume->isParticleSource()) - { - particles = 1; - } - - const LLVector3& sc = volume->getScale(); - scale += (U32) sc.mV[0] + (U32) sc.mV[1] + (U32) sc.mV[2]; - - const LLDrawable* drawablep = volume->mDrawable; - - if (volume->isSculpted()) - { - const LLSculptParams *sculpt_params = (LLSculptParams *) volume->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - LLUUID sculpt_id = sculpt_params->getSculptTexture(); - textures.insert(sculpt_id); - } - - for (S32 i = 0; i < drawablep->getNumFaces(); ++i) - { - const LLFace* face = drawablep->getFace(i); - const LLTextureEntry* te = face->getTextureEntry(); - const LLViewerTexture* img = face->getTexture(); - - textures.insert(img->getID()); - - 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 = volume->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 += calc_shame(child_volumep, textures); - } - } - } - - return shame; -} //virtual S32 LLVOAvatar::getTexImageSize() const 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() { diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 10fc8865fc..fb543efc04 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -120,7 +120,7 @@ public: const LLMatrix4& getRelativeXform() const { return mRelativeXform; } const LLMatrix3& getRelativeXformInvTrans() const { return mRelativeXformInvTrans; } /*virtual*/ const LLMatrix4 getRenderMatrix() const; - + U32 getRenderCost() const; /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, S32 face = -1, // which face to check, -1 = ALL_SIDES |