diff options
Diffstat (limited to 'indra/newview/llviewerregion.cpp')
-rwxr-xr-x | indra/newview/llviewerregion.cpp | 154 |
1 files changed, 92 insertions, 62 deletions
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index d24e15a7d3..19a1990665 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -55,6 +55,7 @@ #include "llfloaterregioninfo.h" #include "llgltfmateriallist.h" #include "llhttpnode.h" +#include "llpbrterrainfeatures.h" #include "llregioninfomodel.h" #include "llsdutil.h" #include "llstartup.h" @@ -100,14 +101,11 @@ const S32 MAX_CAP_REQUEST_ATTEMPTS = 30; const U32 DEFAULT_MAX_REGION_WIDE_PRIM_COUNT = 15000; -BOOL LLViewerRegion::sVOCacheCullingEnabled = FALSE; +bool LLViewerRegion::sVOCacheCullingEnabled = false; S32 LLViewerRegion::sLastCameraUpdated = 0; S32 LLViewerRegion::sNewObjectCreationThrottle = -1; LLViewerRegion::vocache_entry_map_t LLViewerRegion::sRegionCacheCleanup; -const std::string LLViewerRegion::IL_MODE_DEFAULT = "default"; -const std::string LLViewerRegion::IL_MODE_360 = "360"; - typedef std::map<std::string, std::string> CapabilityMap; static void log_capabilities(const CapabilityMap &capmap); @@ -139,7 +137,7 @@ public: bool handle(const LLSD& params, const LLSD& query_map, const std::string& grid, LLMediaCtrl* web) { // make sure that we at least have a region name - int num_params = params.size(); + auto num_params = params.size(); if (num_params < 1) { return false; @@ -153,7 +151,7 @@ public: } boost::regex name_rx("[A-Za-z0-9()_%]+"); boost::regex coord_rx("[0-9]+"); - for (int i = 0; i < num_params; i++) + for (size_t i = 0; i < num_params; i++) { if (i > 0) { @@ -626,7 +624,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mTimeDilation(1.0f), mName(""), mZoning(""), - mIsEstateManager(FALSE), + mIsEstateManager(false), mRegionFlags( REGION_FLAGS_DEFAULT ), mRegionProtocols( 0 ), mSimAccess( SIM_ACCESS_MIN ), @@ -639,17 +637,17 @@ LLViewerRegion::LLViewerRegion(const U64 &handle, mProductSKU("unknown"), mProductName("unknown"), mViewerAssetUrl(""), - mCacheLoaded(FALSE), - mCacheDirty(FALSE), - mReleaseNotesRequested(FALSE), + mCacheLoaded(false), + mCacheDirty(false), + mReleaseNotesRequested(false), mCapabilitiesState(CAPABILITIES_STATE_INIT), mSimulatorFeaturesReceived(false), mBitsReceived(0.f), mPacketsReceived(0.f), - mDead(FALSE), + mDead(false), mLastVisitedEntry(NULL), mInvisibilityCheckHistory(-1), - mPaused(FALSE), + mPaused(false), mRegionCacheHitCount(0), mRegionCacheMissCount(0), mInterestListMode(IL_MODE_DEFAULT) @@ -725,7 +723,7 @@ static LLTrace::BlockTimerStatHandle FTM_SAVE_REGION_CACHE("Save Region Cache"); LLViewerRegion::~LLViewerRegion() { LL_PROFILE_ZONE_SCOPED; - mDead = TRUE; + mDead = true; mImpl->mActiveSet.clear(); mImpl->mVisibleEntries.clear(); mImpl->mVisibleGroups.clear(); @@ -789,7 +787,7 @@ void LLViewerRegion::loadObjectCache() } // Presume success. If it fails, we don't want to try again. - mCacheLoaded = TRUE; + mCacheLoaded = true; if(LLVOCache::instanceExists()) { @@ -800,7 +798,7 @@ void LLViewerRegion::loadObjectCache() if (mImpl->mCacheMap.empty()) { - mCacheDirty = TRUE; + mCacheDirty = true; } } } @@ -827,7 +825,7 @@ void LLViewerRegion::saveObjectCache() instance.writeToCache(mHandle, mImpl->mCacheID, mImpl->mCacheMap, mCacheDirty, removal_enabled); instance.writeGenericExtrasToCache(mHandle, mImpl->mCacheID, mImpl->mGLTFOverridesLLSD, mCacheDirty, removal_enabled); - mCacheDirty = FALSE; + mCacheDirty = false; } if (LLAppViewer::instance()->isQuitting()) @@ -863,7 +861,7 @@ F32 LLViewerRegion::getWaterHeight() const return mImpl->mLandp->getWaterHeight(); } -BOOL LLViewerRegion::isVoiceEnabled() const +bool LLViewerRegion::isVoiceEnabled() const { return getRegionFlag(REGION_FLAGS_ALLOW_VOICE); } @@ -926,7 +924,7 @@ const LLUUID& LLViewerRegion::getOwner() const void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) { std::string::size_type pipe_pos = name_zone.find('|'); - S32 length = name_zone.size(); + auto length = name_zone.size(); if (pipe_pos != std::string::npos) { mName = name_zone.substr(0, pipe_pos); @@ -942,7 +940,7 @@ void LLViewerRegion::setRegionNameAndZone (const std::string& name_zone) LLStringUtil::stripNonprintable(mZoning); } -BOOL LLViewerRegion::canManageEstate() const +bool LLViewerRegion::canManageEstate() const { return gAgent.isGodlike() || isEstateManager() @@ -1169,7 +1167,7 @@ void LLViewerRegion::killCacheEntry(LLVOCacheEntry* entry, bool for_rendering) //will remove it from the object cache, real deletion entry->setState(LLVOCacheEntry::INACTIVE); entry->removeOctreeEntry(); - entry->setValid(FALSE); + entry->setValid(false); } @@ -1181,7 +1179,7 @@ void LLViewerRegion::killCacheEntry(U32 local_id) U32 LLViewerRegion::getNumOfActiveCachedObjects() const { - return mImpl->mActiveSet.size(); + return static_cast<U32>(mImpl->mActiveSet.size()); } void LLViewerRegion::addActiveCacheEntry(LLVOCacheEntry* entry) @@ -1268,7 +1266,7 @@ bool LLViewerRegion::addVisibleGroup(LLViewerOctreeGroup* group) U32 LLViewerRegion::getNumOfVisibleGroups() const { - return mImpl ? mImpl->mVisibleGroups.size() : 0; + return mImpl ? static_cast<U32>(mImpl->mVisibleGroups.size()) : 0; } void LLViewerRegion::updateReflectionProbes() @@ -1497,12 +1495,12 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) } if(mImpl->mWaitingList.empty()) { - mImpl->mVOCachePartition->setCullHistory(FALSE); + mImpl->mVOCachePartition->setCullHistory(false); return; } S32 throttle = sNewObjectCreationThrottle; - BOOL has_new_obj = FALSE; + bool has_new_obj = false; LLTimer update_timer; for(LLVOCacheEntry::vocache_entry_priority_list_t::iterator iter = mImpl->mWaitingList.begin(); iter != mImpl->mWaitingList.end(); ++iter) @@ -1512,7 +1510,7 @@ void LLViewerRegion::createVisibleObjects(F32 max_time) if(vo_entry->getState() < LLVOCacheEntry::WAITING) { addNewObject(vo_entry); - has_new_obj = TRUE; + has_new_obj = true; if(throttle > 0 && !(--throttle) && update_timer.getElapsedTimeF32() > max_time) { break; @@ -1532,7 +1530,7 @@ void LLViewerRegion::clearCachedVisibleObjects() //reset all occluders mImpl->mVOCachePartition->resetOccluders(); - mPaused = TRUE; + mPaused = true; //clean visible entries for(LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mVisibleEntries.begin(); iter != mImpl->mVisibleEntries.end();) @@ -1644,7 +1642,7 @@ void LLViewerRegion::idleUpdate(F32 max_update_time) } if(mPaused) { - mPaused = FALSE; //unpause. + mPaused = false; //unpause. } LLViewerCamera::eCameraID old_camera_id = LLViewerCamera::sCurCameraID; @@ -1717,7 +1715,7 @@ void LLViewerRegion::calcNewObjectCreationThrottle() LLVOCacheEntry::updateDebugSettings(); } -BOOL LLViewerRegion::isViewerCameraStatic() +bool LLViewerRegion::isViewerCameraStatic() { return sLastCameraUpdated < LLViewerOctreeEntryData::getCurrentFrame(); } @@ -1756,7 +1754,7 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) } std::vector<LLDrawable*> delete_list; - S32 update_counter = llmin(max_update, mImpl->mActiveSet.size()); + auto update_counter = llmin(max_update, mImpl->mActiveSet.size()); LLVOCacheEntry::vocache_entry_set_t::iterator iter = mImpl->mActiveSet.upper_bound(mLastVisitedEntry); for(; update_counter > 0; --update_counter, ++iter) @@ -1795,10 +1793,9 @@ void LLViewerRegion::killInvisibleObjects(F32 max_time) if(!delete_list.empty()) { mInvisibilityCheckHistory |= 1; - S32 count = delete_list.size(); - for(S32 i = 0; i < count; i++) + for (auto drawable : delete_list) { - gObjectList.killObject(delete_list[i]->getVObj()); + gObjectList.killObject(drawable->getVObj()); } delete_list.clear(); } @@ -2138,27 +2135,27 @@ S32 LLViewerRegion::getHttpResponderID() const return mImpl->mHttpResponderID; } -BOOL LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const +bool LLViewerRegion::pointInRegionGlobal(const LLVector3d &point_global) const { LLVector3 pos_region = getPosRegionFromGlobal(point_global); if (pos_region.mV[VX] < 0) { - return FALSE; + return false; } if (pos_region.mV[VX] >= mWidth) { - return FALSE; + return false; } if (pos_region.mV[VY] < 0) { - return FALSE; + return false; } if (pos_region.mV[VY] >= mWidth) { - return FALSE; + return false; } - return TRUE; + return true; } LLVector3 LLViewerRegion::getPosRegionFromGlobal(const LLVector3d &point_global) const @@ -2197,24 +2194,24 @@ bool LLViewerRegion::isAlive() return mAlive; } -BOOL LLViewerRegion::isOwnedSelf(const LLVector3& pos) +bool LLViewerRegion::isOwnedSelf(const LLVector3& pos) { if (mParcelOverlay) { return mParcelOverlay->isOwnedSelf(pos); } else { - return FALSE; + return false; } } // Owned by a group you belong to? (officer or member) -BOOL LLViewerRegion::isOwnedGroup(const LLVector3& pos) +bool LLViewerRegion::isOwnedGroup(const LLVector3& pos) { if (mParcelOverlay) { return mParcelOverlay->isOwnedGroup(pos); } else { - return FALSE; + return false; } } @@ -2259,7 +2256,7 @@ public: LLSD::array_iterator locs_it = locs.beginArray(), agents_it = agents.beginArray(); - BOOL has_agent_data = input["body"].has("AgentData"); + bool has_agent_data = input["body"].has("AgentData"); for(int i=0; locs_it != locs.endArray(); @@ -2327,7 +2324,7 @@ void LLViewerRegion::updateCoarseLocations(LLMessageSystem* msg) msg->getS16Fast(_PREHASH_Index, _PREHASH_You, agent_index); msg->getS16Fast(_PREHASH_Index, _PREHASH_Prey, target_index); - BOOL has_agent_data = msg->has(_PREHASH_AgentData); + bool has_agent_data = msg->has(_PREHASH_AgentData); S32 count = msg->getNumberOfBlocksFast(_PREHASH_Location); for(S32 i = 0; i < count; i++) { @@ -2484,13 +2481,30 @@ void LLViewerRegion::setSimulatorFeatures(const LLSD& sim_features) { gSavedSettings.setBOOL("UIPreviewMaterial", false); } + + if (features.has("GLTFEnabled")) + { + bool enabled = features["GLTFEnabled"]; + gSavedSettings.setBOOL("GLTFEnabled", enabled); + } + else + { + gSavedSettings.setBOOL("GLTFEnabled", false); + } + + if (features.has("PBRTerrainTransformsEnabled")) + { + bool enabled = features["PBRTerrainTransformsEnabled"]; + gSavedSettings.setBOOL("RenderTerrainPBRTransformsEnabled", enabled); + } + else + { + gSavedSettings.setBOOL("RenderTerrainPBRTransformsEnabled", false); + } }; - auto workqueue = LL::WorkQueue::getInstance("mainloop"); - if (workqueue) - { - LL::WorkQueue::postMaybe(workqueue, work); - } + + LLAppViewer::instance()->postToMainCoro(work); } //this is called when the parent is not cacheable. @@ -2659,10 +2673,9 @@ void LLViewerRegion::decodeBoundingInfo(LLVOCacheEntry* entry) if(iter != mOrphanMap.end()) { std::vector<U32>* orphans = &mOrphanMap[entry->getLocalID()]; - S32 size = orphans->size(); - for(S32 i = 0; i < size; i++) + for (U32 orphan : *orphans) { - LLVOCacheEntry* child = getCacheEntry((*orphans)[i]); + LLVOCacheEntry* child = getCacheEntry(orphan); if(child) { entry->addChild(child); @@ -2841,7 +2854,11 @@ bool LLViewerRegion::probeCache(U32 local_id, U32 crc, U32 flags, U8 &cache_miss if(entry->isState(LLVOCacheEntry::ACTIVE)) { - ((LLDrawable*)entry->getEntry()->getDrawable())->getVObj()->loadFlags(flags); + LLDrawable* drawable = (LLDrawable*)entry->getEntry()->getDrawable(); + if (drawable && drawable->getVObj()) + { + drawable->getVObj()->loadFlags(flags); + } return true; } @@ -2888,7 +2905,7 @@ void LLViewerRegion::requestCacheMisses() } LLMessageSystem* msg = gMessageSystem; - BOOL start_new_message = TRUE; + bool start_new_message = true; S32 blocks = 0; //send requests for all cache-missed objects @@ -2900,7 +2917,7 @@ void LLViewerRegion::requestCacheMisses() msg->nextBlockFast(_PREHASH_AgentData); msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - start_new_message = FALSE; + start_new_message = false; } msg->nextBlockFast(_PREHASH_ObjectData); @@ -2914,7 +2931,7 @@ void LLViewerRegion::requestCacheMisses() if (blocks >= 255) { sendReliableMessage(); - start_new_message = TRUE; + start_new_message = true; blocks = 0; } } @@ -2925,9 +2942,9 @@ void LLViewerRegion::requestCacheMisses() sendReliableMessage(); } - mCacheDirty = TRUE ; + mCacheDirty = true ; // LL_INFOS() << "KILLDEBUG Sent cache miss full " << full_count << " crc " << crc_count << LL_ENDL; - LLViewerStatsRecorder::instance().requestCacheMissesEvent(mCacheMissList.size()); + LLViewerStatsRecorder::instance().requestCacheMissesEvent(static_cast<S32>(mCacheMissList.size())); mCacheMissList.clear(); } @@ -2986,7 +3003,7 @@ void LLViewerRegion::unpackRegionHandshake() U8 sim_access; std::string sim_name; LLUUID sim_owner; - BOOL is_estate_manager; + bool is_estate_manager; F32 water_height; F32 billable_factor; LLUUID cache_id; @@ -3125,6 +3142,17 @@ void LLViewerRegion::unpackRegionHandshake() { compp->setParamsReady(); } + + LLPBRTerrainFeatures::queueQuery(*this, [](LLUUID region_id, bool success, const LLModifyRegion& composition_changes) + { + if (!success) { return; } + LLViewerRegion* region = LLWorld::getInstance()->getRegionFromID(region_id); + if (!region) { return; } + LLVLComposition* compp = region->getComposition(); + if (!compp) { return; } + compp->apply(composition_changes); + LLFloaterRegionInfo::sRefreshFromRegion(region); + }); } @@ -3222,6 +3250,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("MapLayerGod"); capabilityNames.append("MeshUploadFlag"); capabilityNames.append("ModifyMaterialParams"); + capabilityNames.append("ModifyRegion"); capabilityNames.append("NavMeshGenerationStatus"); capabilityNames.append("NewFileAgentInventory"); capabilityNames.append("ObjectAnimation"); @@ -3232,6 +3261,7 @@ void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames) capabilityNames.append("ParcelVoiceInfoRequest"); capabilityNames.append("ProductInfoRequest"); capabilityNames.append("ProvisionVoiceAccountRequest"); + capabilityNames.append("VoiceSignalingRequest"); capabilityNames.append("ReadOfflineMsgs"); // Requires to respond reliably: AcceptFriendship, AcceptGroupInvite, DeclineFriendship, DeclineGroupInvite capabilityNames.append("RegionObjects"); capabilityNames.append("RemoteParcelRequest"); @@ -3534,7 +3564,7 @@ void LLViewerRegion::setInterestListMode(const std::string &new_mode) { mInterestListMode = new_mode; - if (mInterestListMode != std::string(IL_MODE_DEFAULT) && mInterestListMode != std::string(IL_MODE_360)) + if (mInterestListMode != IL_MODE_DEFAULT && mInterestListMode != IL_MODE_360) { LL_WARNS("360Capture") << "Region " << getRegionID() << " setInterestListMode() invalid interest list mode: " << mInterestListMode << ", setting to default" << LL_ENDL; @@ -3642,12 +3672,12 @@ void LLViewerRegion::showReleaseNotes() if (url.empty()) { // HACK haven't received the capability yet, we'll wait until // it arives. - mReleaseNotesRequested = TRUE; + mReleaseNotesRequested = true; return; } LLWeb::loadURL(url); - mReleaseNotesRequested = FALSE; + mReleaseNotesRequested = false; } std::string LLViewerRegion::getDescription() const |