diff options
Diffstat (limited to 'indra/newview/llworld.cpp')
-rw-r--r-- | indra/newview/llworld.cpp | 99 |
1 files changed, 65 insertions, 34 deletions
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 692efd2b7a..5760d04a08 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -2,31 +2,25 @@ * @file llworld.cpp * @brief Initial test structure to organize viewer regions * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -45,9 +39,10 @@ #include "llhttpnode.h" #include "llregionhandle.h" #include "llsurface.h" +#include "lltrans.h" #include "llviewercamera.h" -#include "llviewerimage.h" -#include "llviewerimagelist.h" +#include "llviewertexture.h" +#include "llviewertexturelist.h" #include "llviewernetwork.h" #include "llviewerobjectlist.h" #include "llviewerparceloverlay.h" @@ -90,7 +85,8 @@ LLWorld::LLWorld() : mLastPacketsIn(0), mLastPacketsOut(0), mLastPacketsLost(0), - mSpaceTimeUSec(0) + mSpaceTimeUSec(0), + mClassicCloudsEnabled(TRUE) { for (S32 i = 0; i < 8; i++) { @@ -109,8 +105,8 @@ LLWorld::LLWorld() : *(default_texture++) = MAX_WATER_COLOR.mV[2]; *(default_texture++) = MAX_WATER_COLOR.mV[3]; - mDefaultWaterTexturep = new LLViewerImage(raw, FALSE); - gGL.getTexUnit(0)->bind(mDefaultWaterTexturep.get()); + mDefaultWaterTexturep = LLViewerTextureManager::getLocalTexture(raw.get(), FALSE); + gGL.getTexUnit(0)->bind(mDefaultWaterTexturep); mDefaultWaterTexturep->setAddressMode(LLTexUnit::TAM_CLAMP); } @@ -118,12 +114,14 @@ LLWorld::LLWorld() : void LLWorld::destroyClass() { + mHoleWaterObjects.clear(); gObjectList.destroy(); for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); ) { LLViewerRegion* region_to_delete = *region_it++; removeRegion(region_to_delete->getHost()); } + LLVOCache::getInstance()->destroyClass() ; LLViewerPartSim::getInstance()->destroyClass(); } @@ -131,10 +129,11 @@ void LLWorld::destroyClass() LLViewerRegion* LLWorld::addRegion(const U64 ®ion_handle, const LLHost &host) { LLMemType mt(LLMemType::MTYPE_REGIONS); - + llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl; LLViewerRegion *regionp = getRegionFromHandle(region_handle); if (regionp) { + llinfos << "Region exists, removing it " << llendl; LLHost old_host = regionp->getHost(); // region already exists! if (host == old_host && regionp->isAlive()) @@ -257,7 +256,9 @@ void LLWorld::removeRegion(const LLHost &host) llwarns << "gFrameTimeSeconds " << gFrameTimeSeconds << llendl; llwarns << "Disabling region " << regionp->getName() << " that agent is in!" << llendl; - LLAppViewer::instance()->forceDisconnect("You have been disconnected from the region you were in."); + LLAppViewer::instance()->forceDisconnect(LLTrans::getString("YouHaveBeenDisconnected")); + + regionp->saveObjectCache() ; //force to save objects here in case that the object cache is about to be destroyed. return; } @@ -656,16 +657,44 @@ void LLWorld::updateParticles() void LLWorld::updateClouds(const F32 dt) { - if (gSavedSettings.getBOOL("FreezeTime") || - !gSavedSettings.getBOOL("SkyUseClassicClouds")) + static LLFastTimer::DeclareTimer ftm("World Clouds"); + LLFastTimer t(ftm); + + if ( gSavedSettings.getBOOL("FreezeTime") ) { // don't move clouds in snapshot mode return; } + + if ( + mClassicCloudsEnabled != + gSavedSettings.getBOOL("SkyUseClassicClouds") ) + { + // The classic cloud toggle has been flipped + // gotta update all of the cloud layers + mClassicCloudsEnabled = + gSavedSettings.getBOOL("SkyUseClassicClouds"); + + if ( !mClassicCloudsEnabled && mActiveRegionList.size() ) + { + // We've transitioned to having classic clouds disabled + // reset all cloud layers. + for ( + region_list_t::iterator iter = mActiveRegionList.begin(); + iter != mActiveRegionList.end(); + ++iter) + { + LLViewerRegion* regionp = *iter; + regionp->mCloudLayer.reset(); + } + + return; + } + } + else if ( !mClassicCloudsEnabled ) return; + if (mActiveRegionList.size()) { - // Update all the cloud puff positions, and timer based stuff - // such as death decay for (region_list_t::iterator iter = mActiveRegionList.begin(); iter != mActiveRegionList.end(); ++iter) { @@ -962,7 +991,7 @@ void LLWorld::shiftRegions(const LLVector3& offset) LLViewerPartSim::getInstance()->shift(offset); } -LLViewerImage* LLWorld::getDefaultWaterTexture() +LLViewerTexture* LLWorld::getDefaultWaterTexture() { return mDefaultWaterTexturep; } @@ -1023,9 +1052,11 @@ void LLWorld::disconnectRegions() } } +static LLFastTimer::DeclareTimer FTM_ENABLE_SIMULATOR("Enable Sim"); void process_enable_simulator(LLMessageSystem *msg, void **user_data) { + LLFastTimer t(FTM_ENABLE_SIMULATOR); // enable the appropriate circuit for this simulator and // add its values into the gSimulator structure U64 handle; @@ -1204,7 +1235,7 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3 return pos_global; } -void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const +void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const { if(avatar_ids != NULL) { |