diff options
Diffstat (limited to 'indra/newview/llviewerobjectlist.cpp')
-rw-r--r-- | indra/newview/llviewerobjectlist.cpp | 139 |
1 files changed, 69 insertions, 70 deletions
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 49bd5007c4..6167129077 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -65,10 +65,10 @@ #include "lltoolmgr.h" #include "lltoolpie.h" #include "llkeyboard.h" +#include "llmeshrepository.h" #include "u64.h" #include "llviewertexturelist.h" #include "lldatapacker.h" -#include "llcallstack.h" #ifdef LL_USESYSTEMLIBS #include <zlib.h> #else @@ -86,7 +86,7 @@ #include <iterator> extern F32 gMinObjectDistance; -extern BOOL gAnimateTextures; +extern bool gAnimateTextures; #define MAX_CONCURRENT_PHYSICS_REQUESTS 256 @@ -99,8 +99,6 @@ extern LLPipeline gPipeline; // Statics for object lookup tables. U32 LLViewerObjectList::sSimulatorMachineIndex = 1; // Not zero deliberately, to speed up index check. -std::map<U64, U32> LLViewerObjectList::sIPAndPortToIndex; -std::map<U64, LLUUID> LLViewerObjectList::sIndexAndLocalIDToUUID; LLViewerObjectList::LLViewerObjectList() { @@ -109,7 +107,7 @@ LLViewerObjectList::LLViewerObjectList() mNumDeadObjects = 0; mNumOrphans = 0; mNumNewObjects = 0; - mWasPaused = FALSE; + mWasPaused = false; mNumDeadObjectUpdates = 0; mNumUnknownUpdates = 0; } @@ -138,17 +136,17 @@ void LLViewerObjectList::getUUIDFromLocal(LLUUID &id, { U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; if (!index) { index = sSimulatorMachineIndex++; - sIPAndPortToIndex[ipport] = index; + mIPAndPortToIndex[ipport] = index; } U64 indexid = (((U64)index) << 32) | (U64)local_id; - id = get_if_there(sIndexAndLocalIDToUUID, indexid, LLUUID::null); + id = get_if_there(mIndexAndLocalIDToUUID, indexid, LLUUID::null); } U64 LLViewerObjectList::getIndex(const U32 local_id, @@ -157,7 +155,7 @@ U64 LLViewerObjectList::getIndex(const U32 local_id, { U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; if (!index) { @@ -167,7 +165,7 @@ U64 LLViewerObjectList::getIndex(const U32 local_id, return (((U64)index) << 32) | (U64)local_id; } -BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) +bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) { LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK; @@ -177,30 +175,30 @@ BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp) U32 ip = objectp->getRegion()->getHost().getAddress(); U32 port = objectp->getRegion()->getHost().getPort(); U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; // LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL; U64 indexid = (((U64)index) << 32) | (U64)local_id; - std::map<U64, LLUUID>::iterator iter = sIndexAndLocalIDToUUID.find(indexid); - if (iter == sIndexAndLocalIDToUUID.end()) + std::map<U64, LLUUID>::iterator iter = mIndexAndLocalIDToUUID.find(indexid); + if (iter == mIndexAndLocalIDToUUID.end()) { - return FALSE; + return false; } // Found existing entry if (iter->second == objectp->getID()) { // Full UUIDs match, so remove the entry - sIndexAndLocalIDToUUID.erase(iter); - return TRUE; + mIndexAndLocalIDToUUID.erase(iter); + return true; } // UUIDs did not match - this would zap a valid entry, so don't erase it //LL_INFOS() << "Tried to erase entry where id in table (" // << iter->second << ") did not match object " << object.getID() << LL_ENDL; } - return FALSE ; + return false ; } void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, @@ -210,17 +208,17 @@ void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id, { U64 ipport = (((U64)ip) << 32) | (U64)port; - U32 index = sIPAndPortToIndex[ipport]; + U32 index = mIPAndPortToIndex[ipport]; if (!index) { index = sSimulatorMachineIndex++; - sIPAndPortToIndex[ipport] = index; + mIPAndPortToIndex[ipport] = index; } U64 indexid = (((U64)index) << 32) | (U64)local_id; - sIndexAndLocalIDToUUID[indexid] = id; + mIndexAndLocalIDToUUID[indexid] = id; //LL_INFOS() << "Adding object to table, full ID " << id // << ", local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL; @@ -247,7 +245,6 @@ void LLViewerObjectList::processUpdateCore(LLViewerObject* objectp, // ignore returned flags LL_DEBUGS("ObjectUpdate") << "uuid " << objectp->mID << " calling processUpdateMessage " << objectp << " just_created " << just_created << " from_cache " << from_cache << " msg " << msg << LL_ENDL; - dumpStack("ObjectUpdateStack"); objectp->processUpdateMessage(msg, user_data, i, update_type, dpp); @@ -364,7 +361,6 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* objectp = createObjectFromCache(pcode, regionp, fullid, entry->getLocalID()); LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " created objectp " << objectp << LL_ENDL; - dumpStack("ObjectUpdateStack"); if (!objectp) { @@ -391,7 +387,7 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry* else { objectp->setLastUpdateType(OUT_FULL_COMPRESSED); //newly cached - objectp->setLastUpdateCached(TRUE); + objectp->setLastUpdateCached(true); } LLVOAvatar::cullAvatarsByPixelArea(); @@ -471,7 +467,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, for (i = 0; i < num_objects; i++) { - BOOL justCreated = FALSE; + bool justCreated = false; bool update_cache = false; //update object cache if it is a full-update or terse update if (compressed) @@ -559,7 +555,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, LL_DEBUGS("ObjectUpdate") << "uuid " << fullid << " objectp " << objectp << " update_cache " << (S32) update_cache << " compressed " << compressed << " update_type " << update_type << LL_ENDL; - dumpStack("ObjectUpdateStack"); if(update_cache) { @@ -637,7 +632,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, objectp = createObject(pcode, regionp, fullid, local_id, gMessageSystem->getSender()); LL_DEBUGS("ObjectUpdate") << "creating object " << fullid << " result " << objectp << LL_ENDL; - dumpStack("ObjectUpdateStack"); if (!objectp) { @@ -646,7 +640,7 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys, continue; } - justCreated = TRUE; + justCreated = true; mNumNewObjects++; } @@ -731,7 +725,6 @@ void LLViewerObjectList::processCachedObjectUpdate(LLMessageSystem *mesgsys, mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_UpdateFlags, flags, i); LL_DEBUGS("ObjectUpdate") << "got probe for id " << id << " crc " << crc << LL_ENDL; - dumpStack("ObjectUpdateStack"); // Lookup data packer and add this id to cache miss lists if necessary. U8 cache_miss_type = LLViewerRegion::CACHE_MISS_TYPE_NONE; @@ -891,6 +884,7 @@ void LLViewerObjectList::update(LLAgent &agent) static std::vector<LLViewerObject*> idle_list; U32 idle_count = 0; + mNumAvatars = 0; { for (std::vector<LLPointer<LLViewerObject> >::iterator active_iter = mActiveObjects.begin(); @@ -908,6 +902,10 @@ void LLViewerObjectList::update(LLAgent &agent) idle_list[idle_count] = objectp; } ++idle_count; + if (objectp->isAvatar()) + { + mNumAvatars++; + } } else { // There shouldn't be any NULL pointers in the list, but they have caused @@ -1129,10 +1127,10 @@ void LLViewerObjectList::fetchObjectCostsCoro(std::string url) { LLSD objectData = result[it->asString()]; - F32 linkCost = objectData["linked_set_resource_cost"].asReal(); - F32 objectCost = objectData["resource_cost"].asReal(); - F32 physicsCost = objectData["physics_cost"].asReal(); - F32 linkPhysicsCost = objectData["linked_set_physics_cost"].asReal(); + F32 linkCost = (F32)objectData["linked_set_resource_cost"].asReal(); + F32 objectCost = (F32)objectData["resource_cost"].asReal(); + F32 physicsCost = (F32)objectData["physics_cost"].asReal(); + F32 linkPhysicsCost = (F32)objectData["linked_set_physics_cost"].asReal(); gObjectList.updateObjectCost(objectId, objectCost, linkCost, physicsCost, linkPhysicsCost); } @@ -1257,10 +1255,10 @@ void LLViewerObjectList::fetchPhisicsFlagsCoro(std::string url) if (data.has("Density")) { - F32 density = data["Density"].asReal(); - F32 friction = data["Friction"].asReal(); - F32 restitution = data["Restitution"].asReal(); - F32 gravityMult = data["GravityMultiplier"].asReal(); + F32 density = (F32)data["Density"].asReal(); + F32 friction = (F32)data["Friction"].asReal(); + F32 restitution = (F32)data["Restitution"].asReal(); + F32 gravityMult = (F32)data["GravityMultiplier"].asReal(); gObjectList.updatePhysicsProperties(objectId, density, friction, restitution, gravityMult); @@ -1302,7 +1300,6 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) // Remove from object map so noone can look it up. LL_DEBUGS("ObjectUpdate") << " dereferencing id " << objectp->mID << LL_ENDL; - dumpStack("ObjectUpdateStack"); mUUIDObjectMap.erase(objectp->mID); @@ -1318,7 +1315,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) if (objectp->onActiveList()) { //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list in cleanupReferences." << LL_ENDL; - objectp->setOnActiveList(FALSE); + objectp->setOnActiveList(false); removeFromActiveList(objectp); } @@ -1335,7 +1332,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp) } } -BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) +bool LLViewerObjectList::killObject(LLViewerObject *objectp) { LL_PROFILE_ZONE_SCOPED; // Don't ever kill gAgentAvatarp, just force it to the agent's region @@ -1343,7 +1340,7 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) if ((objectp == gAgentAvatarp) && gAgent.getRegion()) { objectp->setRegion(gAgent.getRegion()); - return FALSE; + return false; } // When we're killing objects, all we do is mark them as dead. @@ -1356,10 +1353,10 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) // so create a pointer to make sure object will stay alive untill markDead() finishes LLPointer<LLViewerObject> sp(objectp); sp->markDead(); // does the right thing if object already dead - return TRUE; + return true; } - return FALSE; + return false; } void LLViewerObjectList::killObjects(LLViewerRegion *regionp) @@ -1379,7 +1376,7 @@ void LLViewerObjectList::killObjects(LLViewerRegion *regionp) } // Have to clean right away because the region is becoming invalid. - cleanDeadObjects(FALSE); + cleanDeadObjects(false); } void LLViewerObjectList::killAllObjects() @@ -1395,7 +1392,7 @@ void LLViewerObjectList::killAllObjects() llassert((objectp == gAgentAvatarp) || objectp->isDead()); } - cleanDeadObjects(FALSE); + cleanDeadObjects(false); if(!mObjects.empty()) { @@ -1416,13 +1413,17 @@ void LLViewerObjectList::killAllObjects() } } -void LLViewerObjectList::cleanDeadObjects(BOOL use_timer) +void LLViewerObjectList::cleanDeadObjects(bool use_timer) { if (!mNumDeadObjects) { // No dead objects, don't need to scan object list. return; } + if ((LLApp::isExiting()) || (mNumDeadObjects == (S32)mObjects.size())) + { + gMeshRepo.unregisterAllMeshes(); + } LL_PROFILE_ZONE_SCOPED; @@ -1480,7 +1481,7 @@ void LLViewerObjectList::removeFromActiveList(LLViewerObject* objectp) objectp->setListIndex(-1); - S32 last_index = mActiveObjects.size()-1; + S32 last_index = static_cast<S32>(mActiveObjects.size()) - 1; if (idx != last_index) { @@ -1501,7 +1502,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) return; // We don't update dead objects! } - BOOL active = objectp->isActive(); + bool active = objectp->isActive(); if (active != objectp->onActiveList()) { if (active) @@ -1511,8 +1512,8 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) if (idx <= -1) { mActiveObjects.push_back(objectp); - objectp->setListIndex(mActiveObjects.size()-1); - objectp->setOnActiveList(TRUE); + objectp->setListIndex(static_cast<S32>(mActiveObjects.size()) - 1); + objectp->setOnActiveList(true); } else { @@ -1530,7 +1531,7 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp) { //LL_INFOS() << "Removing " << objectp->mID << " " << objectp->getPCodeString() << " from active list." << LL_ENDL; removeFromActiveList(objectp); - objectp->setOnActiveList(FALSE); + objectp->setOnActiveList(false); } } @@ -1717,15 +1718,15 @@ void LLViewerObjectList::clearAllMapObjectsInRegion(LLViewerRegion* regionp) void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { - LLColor4 above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); - LLColor4 below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); - LLColor4 you_own_above_water_color = + static const LLUIColor above_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnAboveWater" ); + static const LLUIColor below_water_color = LLUIColorTable::instance().getColor( "NetMapOtherOwnBelowWater" ); + static const LLUIColor you_own_above_water_color = LLUIColorTable::instance().getColor( "NetMapYouOwnAboveWater" ); - LLColor4 you_own_below_water_color = + static const LLUIColor you_own_below_water_color = LLUIColorTable::instance().getColor( "NetMapYouOwnBelowWater" ); - LLColor4 group_own_above_water_color = + static const LLUIColor group_own_above_water_color = LLUIColorTable::instance().getColor( "NetMapGroupOwnAboveWater" ); - LLColor4 group_own_below_water_color = + static const LLUIColor group_own_below_water_color = LLUIColorTable::instance().getColor( "NetMapGroupOwnBelowWater" ); F32 max_radius = gSavedSettings.getF32("MiniMapPrimMaxRadius"); @@ -1755,7 +1756,7 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) // See DEV-17370 and DEV-29869/SNOW-79 for details. approx_radius = llmin(approx_radius, max_radius); - LLColor4U color = above_water_color; + LLColor4U color = above_water_color.get(); if( objectp->permYouOwner() ) { const F32 MIN_RADIUS_FOR_OWNED_OBJECTS = 2.f; @@ -1768,29 +1769,29 @@ void LLViewerObjectList::renderObjectsForMap(LLNetMap &netmap) { if ( objectp->permGroupOwner() ) { - color = group_own_above_water_color; + color = group_own_above_water_color.get(); } else { - color = you_own_above_water_color; + color = you_own_above_water_color.get(); } } else { if ( objectp->permGroupOwner() ) { - color = group_own_below_water_color; + color = group_own_below_water_color.get(); } else { - color = you_own_below_water_color; + color = you_own_below_water_color.get(); } } } else if( pos.mdV[VZ] < water_height ) { - color = below_water_color; + color = below_water_color.get(); } netmap.renderScaledPointGlobal( @@ -1804,7 +1805,7 @@ void LLViewerObjectList::renderObjectBounds(const LLVector3 ¢er) { } -extern BOOL gCubeSnapshot; +extern bool gCubeSnapshot; void LLViewerObjectList::addDebugBeacon(const LLVector3 &pos_agent, const std::string &string, @@ -1854,7 +1855,6 @@ LLViewerObject *LLViewerObjectList::createObjectFromCache(const LLPCode pcode, L llassert_always(uuid.notNull()); LL_DEBUGS("ObjectUpdate") << "creating " << uuid << " local_id " << local_id << LL_ENDL; - dumpStack("ObjectUpdateStack"); LLViewerObject *objectp = LLViewerObject::createObject(uuid, pcode, regionp); if (!objectp) @@ -1890,7 +1890,6 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe } LL_DEBUGS("ObjectUpdate") << "createObject creating " << fullid << LL_ENDL; - dumpStack("ObjectUpdateStack"); LLViewerObject *objectp = LLViewerObject::createObject(fullid, pcode, regionp); if (!objectp) @@ -1953,7 +1952,7 @@ void LLViewerObjectList::orphanize(LLViewerObject *childp, U32 parent_id, U32 ip LL_DEBUGS("ORPHANS") << "Orphaning object " << childp->getID() << " with parent " << parent_id << LL_ENDL; // We're an orphan, flag things appropriately. - childp->mOrphaned = TRUE; + childp->mOrphaned = true; if (childp->mDrawable.notNull()) { bool make_invisible = true; @@ -2026,7 +2025,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) } U64 parent_info = getIndex(objectp->mLocalID, ip, port); - BOOL orphans_found = FALSE; + bool orphans_found = false; // Iterate through the orphan list, and set parents of matching children. for (std::vector<OrphanInfo>::iterator iter = mOrphanChildren.begin(); iter != mOrphanChildren.end(); ) @@ -2058,7 +2057,7 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) objectp->setChanged(LLXform::MOVED | LLXform::SILHOUETTE); // Flag the object as no longer orphaned - childp->mOrphaned = FALSE; + childp->mOrphaned = false; if (childp->mDrawable.notNull()) { // Make the drawable visible again and set the drawable parent @@ -2068,10 +2067,10 @@ void LLViewerObjectList::findOrphans(LLViewerObject* objectp, U32 ip, U32 port) } // Make certain particles, icon and HUD aren't hidden - childp->hideExtraDisplayItems( FALSE ); + childp->hideExtraDisplayItems( false ); objectp->addChild(childp); - orphans_found = TRUE; + orphans_found = true; ++iter; } else |