diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 41930f539..4350152ac 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -249,7 +249,7 @@ BOOL LLVorbisDecodeState::initDecode() llwarns << "Bad sound caught by zmagic" << llendl; abort_decode = true; } - else + else if(!gAudiop->getAllowLargeSounds()) { // //Much more restrictive than zmagic. Perhaps make toggleable. diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index fa5444cf5..59977faf2 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -115,6 +115,8 @@ void LLAudioEngine::setDefaults() for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) mSecondaryGain[i] = 1.0f; + + mAllowLargeSounds = false; } diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index c41458553..7f07a5bc2 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -187,6 +187,8 @@ public: bool updateBufferForData(LLAudioData *adp, const LLUUID &audio_uuid = LLUUID::null); + void setAllowLargeSounds(bool allow) { mAllowLargeSounds = allow ;} + bool getAllowLargeSounds() const {return mAllowLargeSounds;} // Asset callback when we're retrieved a sound from the asset server. void startNextTransfer(); @@ -260,6 +262,8 @@ protected: private: void setDefaults(); LLStreamingAudioInterface *mStreamingAudioImpl; + + bool mAllowLargeSounds; }; diff --git a/indra/llaudio/llaudioengine_fmod.cpp b/indra/llaudio/llaudioengine_fmod.cpp index 8d3f70f89..cdd27ec3e 100644 --- a/indra/llaudio/llaudioengine_fmod.cpp +++ b/indra/llaudio/llaudioengine_fmod.cpp @@ -107,6 +107,7 @@ bool LLAudioEngine_FMOD::init(const S32 num_channels, void* userdata) // This means we also try to play audio when minimized, // so we manually handle muting in that case. JC fmod_flags |= FSOUND_INIT_GLOBALFOCUS; + fmod_flags |= FSOUND_INIT_DSOUND_HRTF_FULL; #endif #if LL_LINUX diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 87f011643..bbf1746bf 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -233,6 +233,7 @@ LLIOPipe::EStatus LLURLRequest::process_impl( LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST); //llinfos << "LLURLRequest::process_impl()" << llendl; if(!buffer) return STATUS_ERROR; + if(!mDetail) return STATUS_ERROR; //Seems to happen on occasion. Need to hunt down why. switch(mState) { case STATE_INITIALIZED: diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index b10c77c1a..552814c7e 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -307,6 +307,11 @@ bool LLTexUnit::bind(LLCubeMap* cubeMap) return false; } + if (cubeMap->mImages[0].isNull()) + { + llwarns << "NULL LLTexUnit::bind cubeMap->mImages[0]" << llendl; + return false; + } if (mCurrTexture != cubeMap->mImages[0]->getTexName()) { if (gGLManager.mHasCubeMap && LLCubeMap::sUseCubeMaps) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2c02d444f..07da20141 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9,6 +9,17 @@ settings_rlv.xml + AllowLargeSounds + + Comment + Bypass stricter sound size/sample checks, which were introduced in SL2.x, for sound decoding. + Persist + 1 + Type + Boolean + Value + 0 + FloaterAvatarTextRect Comment diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 2e5a4a7f5..23da0629b 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -96,6 +96,7 @@ void LLFloaterHardwareSettings::refreshEnabledState() childSetMinValue("GrapicsCardTextureMemory", min_tex_mem); childSetMaxValue("GrapicsCardTextureMemory", max_tex_mem); + mLastVBOState = LLVertexBuffer::sEnableVBOs; if (!LLFeatureManager::getInstance()->isFeatureAvailable("RenderVBOEnable") || !gGLManager.mHasVertexBufferObject) { @@ -158,6 +159,13 @@ void LLFloaterHardwareSettings::onClose(bool app_quitting) } } +// virtual +void LLFloaterHardwareSettings::draw() +{ + if(mLastVBOState == !LLVertexBuffer::sEnableVBOs) + refreshEnabledState(); + LLFloater::draw(); +} //============================================================================ diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h index bdf3fb13b..0d78d67a2 100644 --- a/indra/newview/llfloaterhardwaresettings.h +++ b/indra/newview/llfloaterhardwaresettings.h @@ -75,6 +75,9 @@ public: /// sync up menu with parameters void refresh(); + /// Draw the panel... + void draw(); + /// Apply the changed values. void apply(); @@ -87,6 +90,7 @@ public: protected: LLSliderCtrl* mCtrlVideoCardMem; + //Retained values for cancel/reset BOOL mUseVBO; BOOL mUseFBO; BOOL mUseAniso; @@ -96,6 +100,7 @@ protected: F32 mFogRatio; BOOL mProbeHardwareOnStartup; + bool mLastVBOState; //track changes to LLVertexBuffer::sEnableVBOs every frame. Bleh. private: // one instance on the inside static LLFloaterHardwareSettings* sHardwareSettings; diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index e7bb0f502..716573d12 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -603,14 +603,14 @@ void LLFloaterWorldMap::trackLandmark( const LLUUID& landmark_item_id ) void LLFloaterWorldMap::trackEvent(const LLItemInfo &event_info) { mTrackedStatus = LLTracker::TRACKING_LOCATION; - LLTracker::trackLocation(event_info.mPosGlobal, event_info.mName, event_info.mToolTip, LLTracker::LOCATION_EVENT); + LLTracker::trackLocation(event_info.getGlobalPosition(), event_info.getName(), event_info.getToolTip(), LLTracker::LOCATION_EVENT); setDefaultBtn("Teleport"); } void LLFloaterWorldMap::trackGenericItem(const LLItemInfo &item) { mTrackedStatus = LLTracker::TRACKING_LOCATION; - LLTracker::trackLocation(item.mPosGlobal, item.mName, item.mToolTip, LLTracker::LOCATION_ITEM); + LLTracker::trackLocation(item.getGlobalPosition(), item.getName(), item.getToolTip(), LLTracker::LOCATION_ITEM); setDefaultBtn("Teleport"); } @@ -629,7 +629,7 @@ void LLFloaterWorldMap::trackLocation(const LLVector3d& pos_global) setDefaultBtn(""); return; } - if (sim_info->mAccess == SIM_ACCESS_DOWN) + if (sim_info->isDown()) { // Down sim. Show the blue circle of death! LLWorldMap::getInstance()->mIsTrackingUnknownLocation = TRUE; @@ -840,8 +840,11 @@ void LLFloaterWorldMap::friendsChanged() if(avatar_id.notNull()) { LLCtrlSelectionInterface *iface = childGetSelectionInterface("friend combo"); - if(!iface || !iface->setCurrentByID(avatar_id) || - !t.getBuddyInfo(avatar_id)->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION) || gAgent.isGodlike()) + const LLRelationship* buddy_info = t.getBuddyInfo(avatar_id); + if(!iface || + !iface->setCurrentByID(avatar_id) || + (buddy_info && !buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) || + gAgent.isGodlike()) { LLTracker::stopTracking(NULL); } @@ -856,11 +859,10 @@ void LLFloaterWorldMap::buildAvatarIDList() // Delete all but the "None" entry S32 list_size = list->getItemCount(); - while (list_size > 1) + if (list_size > 1) { - list->selectNthItem(1); + list->selectItemRange(1, -1); list->operateOnSelection(LLCtrlListInterface::OP_DELETE); - --list_size; } LLSD default_column; @@ -1565,10 +1567,10 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim) BOOL match_found = FALSE; S32 num_results = 0; std::map::const_iterator it; - for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) + for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { LLSimInfo* info = (*it).second; - std::string sim_name = info->mName; + std::string sim_name = info->getName(); std::string sim_name_lower = sim_name; LLStringUtil::toLower(sim_name_lower); @@ -1653,15 +1655,13 @@ void LLFloaterWorldMap::onCommitSearchResult(LLUICtrl*, void* userdata) LLStringUtil::toLower(sim_name); std::map::const_iterator it; - for (it = LLWorldMap::getInstance()->mSimInfoMap.begin(); it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) + for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { - LLSimInfo* info = (*it).second; - std::string info_sim_name = info->mName; - LLStringUtil::toLower(info_sim_name); - - if (sim_name == info_sim_name) + LLSimInfo* info = it->second; + + if (info->isName(sim_name)) { - LLVector3d pos_global = from_region_handle( info->mHandle ); + LLVector3d pos_global = info->getGlobalOrigin(); F64 local_x = self->childGetValue("spin x"); F64 local_y = self->childGetValue("spin y"); F64 local_z = self->childGetValue("spin z"); diff --git a/indra/newview/llmapresponders.cpp b/indra/newview/llmapresponders.cpp index 60758a396..ae0090e42 100644 --- a/indra/newview/llmapresponders.cpp +++ b/indra/newview/llmapresponders.cpp @@ -154,25 +154,17 @@ void LLMapLayerResponder::result(const LLSD& result) // llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; - LLSimInfo* siminfo = new LLSimInfo(); - LLWorldMap::sim_info_map_t::iterator iter = LLWorldMap::getInstance()->mSimInfoMap.find(handle); - if (iter != LLWorldMap::getInstance()->mSimInfoMap.end()) + LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); + if (siminfo == NULL) { - LLSimInfo* oldinfo = iter->second; - for (S32 image=0; imagemMapImageID[image] = oldinfo->mMapImageID[image]; - } - delete oldinfo; + siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } - LLWorldMap::getInstance()->mSimInfoMap[handle] = siminfo; - siminfo->mHandle = handle; - siminfo->mName.assign( name ); - siminfo->mAccess = access; /*Flawfinder: ignore*/ - siminfo->mRegionFlags = region_flags; - siminfo->mWaterHeight = (F32) water_height; - siminfo->mMapImageID[agent_flags] = image_id; + siminfo->setName( name ); + siminfo->setAccess( access ); /*Flawfinder: ignore*/ + siminfo->setRegionFlags( region_flags ); + siminfo->setWaterHeight( (F32) water_height ); + siminfo->setMapImageID( image_id, agent_flags ); if (use_web_map_tiles) { siminfo->mCurrentImage = LLWorldMap::loadObjectsTile((U32)x_regions, (U32)y_regions); @@ -199,7 +191,7 @@ void LLMapLayerResponder::result(const LLSD& result) LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { - if (siminfo->mAccess == SIM_ACCESS_DOWN) + if (siminfo->isDown()) { // We were tracking this location, but it doesn't exist LLWorldMap::getInstance()->mInvalidLocation = true; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 9a3add526..c3c27fc9b 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -1717,14 +1717,7 @@ void LLPanelAvatar::resetGroupList() row["id"] = id ; row["columns"][0]["value"] = group_string; row["columns"][0]["font"] = "SANSSERIF_SMALL"; - if (group_data.mListInProfile) - { - row["columns"][0]["color"] = gColors.getColor("DefaultListText").getValue(); - } - else - { - row["columns"][0]["color"] = gColors.getColor("ScrollUnselectedColor").getValue(); - } + row["columns"][0]["font-style"] = group_data.mListInProfile ? "BOLD" : "NORMAL"; row["columns"][0]["width"] = 0; group_list->addElement(row); } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 9383a67b9..d6839c0ed 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -687,6 +687,8 @@ bool idle_startup() if(init) { gAudiop->setMuted(TRUE); + if(gSavedSettings.getBOOL("AllowLargeSounds")) + gAudiop->setAllowLargeSounds(true); } else { diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 3e0519987..3808cfa25 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -583,6 +583,12 @@ static bool handlePhoenixNameSystemChanged(const LLSD& newvalue) } // [/Ansariel: Display name support] +static bool handleAllowLargeSounds(const LLSD& newvalue) +{ + if(gAudiop) + gAudiop->setAllowLargeSounds(newvalue.asBoolean()); + return true; +} //////////////////////////////////////////////////////////////////////////// void settings_setup_listeners() { @@ -754,6 +760,8 @@ void settings_setup_listeners() // [Ansariel: Display name support] gSavedSettings.getControl("PhoenixNameSystem")->getSignal()->connect(boost::bind(&handlePhoenixNameSystemChanged, _1)); // [/Ansariel: Display name support] + + gSavedSettings.getControl("AllowLargeSounds")->getSignal()->connect(boost::bind(&handleAllowLargeSounds, _1)); } template <> eControlType get_control_type(const U32& in, LLSD& out) diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 1a64a25c9..36f451f04 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -931,21 +931,24 @@ BOOL LLViewerObjectList::killObject(LLViewerObject *objectp) void LLViewerObjectList::killObjects(LLViewerRegion *regionp) { + LLTimer kill_timer; LLViewerObject *objectp; - + S32 count = 0; for (vobj_list_t::iterator iter = mObjects.begin(); iter != mObjects.end(); ++iter) { objectp = *iter; if (objectp->mRegionp == regionp) { + ++count; killObject(objectp); } } // Have to clean right away because the region is becoming invalid. cleanDeadObjects(FALSE); + llinfos << "Removed " << count << " objects for region " << regionp->getName() << ". (" << kill_timer.getElapsedTimeF64()*1000.0 << "ms)" << llendl; } void LLViewerObjectList::killAllObjects() diff --git a/indra/newview/llworldmap.cpp b/indra/newview/llworldmap.cpp index cec853e8b..c6ec2047a 100644 --- a/indra/newview/llworldmap.cpp +++ b/indra/newview/llworldmap.cpp @@ -49,6 +49,7 @@ #include "llregionflags.h" #include "hippogridmanager.h" bool LLWorldMap::sGotMapURL = false; +const F32 AGENTS_UPDATE_TIMER = 60.0; // Seconds between 2 agent requests for a region const F32 REQUEST_ITEMS_TIMER = 10.f * 60.f; // 10 minutes // For DEV-17507, do lazy image loading in llworldmapview.cpp instead, @@ -73,8 +74,8 @@ LLItemInfo::LLItemInfo(F32 global_x, F32 global_y, mRegionHandle = to_region_handle(mPosGlobal); } -LLSimInfo::LLSimInfo() -: mHandle(0), +LLSimInfo::LLSimInfo(U64 handle) +: mHandle(handle), mName(), mAgentsUpdateTime(0), mShowAgentLocations(FALSE), @@ -86,12 +87,8 @@ LLSimInfo::LLSimInfo() } -LLVector3d LLSimInfo::getGlobalOrigin() const -{ - return from_region_handle(mHandle); -} -LLVector3d LLSimInfo::getGlobalPos(LLVector3 local_pos) const +LLVector3d LLSimInfo::getGlobalPos(const LLVector3& local_pos) const { LLVector3d pos = from_region_handle(mHandle); pos.mdV[VX] += local_pos.mV[VX]; @@ -100,6 +97,47 @@ LLVector3d LLSimInfo::getGlobalPos(LLVector3 local_pos) const return pos; } +LLVector3d LLSimInfo::getGlobalOrigin() const +{ + return from_region_handle(mHandle); +} +LLVector3 LLSimInfo::getLocalPos(LLVector3d global_pos) const +{ + LLVector3d sim_origin = from_region_handle(mHandle); + return LLVector3(global_pos - sim_origin); +} + +void LLSimInfo::clearImage() +{ + if (!mOverlayImage.isNull()) + { + mOverlayImage->setBoostLevel(0); + mOverlayImage = NULL; + } +} + +void LLSimInfo::dropImagePriority() +{ + if (!mOverlayImage.isNull()) + { + mOverlayImage->setBoostLevel(0); + } +} + +// Update the agent count for that region +void LLSimInfo::updateAgentCount(F64 time) +{ + if ((time - mAgentsUpdateTime > AGENTS_UPDATE_TIMER) || mFirstAgentRequest) + { + LLWorldMap::getInstance()->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, mHandle); + mAgentsUpdateTime = time; + mFirstAgentRequest = false; + } +} +bool LLSimInfo::isName(const std::string& name) const +{ + return (LLStringUtil::compareInsensitive(name, mName) == 0); +} //--------------------------------------------------------------------------- // World Map @@ -203,20 +241,23 @@ void LLWorldMap::eraseItems() void LLWorldMap::clearImageRefs() { + // We clear the reference to the images we're holding. + // Images hold by the world mipmap first mWorldMipmap.reset(); + // Images hold by the region map + LLSimInfo* sim_info = NULL; for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { - LLSimInfo* info = (*it).second; - if (info->mCurrentImage) + sim_info = it->second; + if(sim_info) { - info->mCurrentImage->setBoostLevel(0); - info->mCurrentImage = NULL; - } - if (info->mOverlayImage) - { - info->mOverlayImage->setBoostLevel(0); - info->mOverlayImage = NULL; + if (sim_info->mCurrentImage) + { + sim_info->mCurrentImage->setBoostLevel(0); + sim_info->mCurrentImage = NULL; + } + sim_info->clearImage(); } } } @@ -233,6 +274,13 @@ void LLWorldMap::clearSimFlags() } } +LLSimInfo* LLWorldMap::createSimInfoFromHandle(const U64 handle) +{ + LLSimInfo* sim_info = new LLSimInfo(handle); + mSimInfoMap[handle] = sim_info; + return sim_info; +} + void LLWorldMap::equalizeBoostLevels() { mWorldMipmap.equalizeBoostLevels(); @@ -250,11 +298,7 @@ LLSimInfo* LLWorldMap::simInfoFromHandle(const U64 handle) sim_info_map_t::iterator it = mSimInfoMap.find(handle); if (it != mSimInfoMap.end()) { - LLSimInfo* sim_info = (*it).second; - if (sim_info) - { - return sim_info; - } + return it->second; } return NULL; } @@ -265,39 +309,38 @@ LLSimInfo* LLWorldMap::simInfoFromName(const std::string& sim_name) LLSimInfo* sim_info = NULL; if (!sim_name.empty()) { - for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) + // Iterate through the entire sim info map and compare the name + sim_info_map_t::iterator it; + for (it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { - sim_info = (*it).second; - if (sim_info - && (0 == LLStringUtil::compareInsensitive(sim_name, sim_info->mName)) ) + sim_info = it->second; + if (sim_info && sim_info->isName(sim_name) ) { + // break out of loop if success break; } - sim_info = NULL; } + // If we got to the end, we haven't found the sim. Reset the ouput value to NULL. + if (it == mSimInfoMap.end()) + sim_info = NULL; } return sim_info; } bool LLWorldMap::simNameFromPosGlobal(const LLVector3d& pos_global, std::string & outSimName ) { - bool gotSimName = true; + LLSimInfo* sim_info = simInfoFromPosGlobal(pos_global); - U64 handle = to_region_handle(pos_global); - - sim_info_map_t::iterator it = mSimInfoMap.find(handle); - if (it != mSimInfoMap.end()) + if (sim_info) { - LLSimInfo* info = (*it).second; - outSimName = info->mName; + outSimName = sim_info->getName(); } else { - gotSimName = false; outSimName = "(unknown region)"; } - return gotSimName; + return (sim_info != NULL); } void LLWorldMap::setCurrentLayer(S32 layer, bool request_layer) @@ -657,28 +700,20 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) y_meters, x_meters+REGION_WIDTH_UNITS, y_meters+REGION_WIDTH_UNITS) || adjust; - -// llinfos << "Map sim " << name << " image layer " << agent_flags << " ID " << image_id.getString() << llendl; - - LLSimInfo* siminfo = new LLSimInfo(); - sim_info_map_t::iterator iter = LLWorldMap::getInstance()->mSimInfoMap.find(handle); - if (iter != LLWorldMap::getInstance()->mSimInfoMap.end()) + //LL_INFOS("World Map") << "Map sim : " << name << ", ID : " << image_id.getString() << LL_ENDL; + // Insert the region in the region map of the world map + // Loading the LLSimInfo object with what we got and insert it in the map + LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); + if (siminfo == NULL) { - LLSimInfo* oldinfo = iter->second; - for (S32 image=0; imagemMapImageID[image] = oldinfo->mMapImageID[image]; - } - delete oldinfo; + siminfo = LLWorldMap::getInstance()->createSimInfoFromHandle(handle); } - LLWorldMap::getInstance()->mSimInfoMap[handle] = siminfo; - siminfo->mHandle = handle; - siminfo->mName.assign( name ); - siminfo->mAccess = accesscode; - siminfo->mRegionFlags = region_flags; - siminfo->mWaterHeight = (F32) water_height; - siminfo->mMapImageID[agent_flags] = image_id; + siminfo->setName( name ); + siminfo->setAccess( accesscode ); + siminfo->setRegionFlags( region_flags ); + siminfo->setWaterHeight((F32) water_height); + siminfo->setMapImageID( image_id, agent_flags ); #ifdef IMMEDIATE_IMAGE_LOAD if (use_web_map_tiles) @@ -710,7 +745,7 @@ void LLWorldMap::processMapBlockReply(LLMessageSystem* msg, void**) LLWorldMap::getInstance()->mUnknownLocation.mdV[1] >= y_meters && LLWorldMap::getInstance()->mUnknownLocation.mdV[1] < y_meters + 256) { - if (siminfo->mAccess == SIM_ACCESS_DOWN) + if (siminfo->isDown()) { // We were tracking this location, but it doesn't exist LLWorldMap::getInstance()->mInvalidLocation = true; @@ -783,7 +818,7 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) Y /= REGION_WIDTH_UNITS; LLItemInfo new_item(world_x, world_y, name, uuid, extra, extra2); - LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(new_item.mRegionHandle); + LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(new_item.getRegionHandle()); switch (type) { @@ -826,13 +861,13 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) S32 display_hour = timep->tm_hour % 12; if (display_hour == 0) display_hour = 12; - new_item.mToolTip = llformat( "%d:%02d %s", + new_item.setTooltip( llformat( "%d:%02d %s", display_hour, timep->tm_min, - (timep->tm_hour < 12 ? "AM" : "PM") ); + (timep->tm_hour < 12 ? "AM" : "PM") ) ); // HACK: store Z in extra2 - new_item.mPosGlobal.mdV[VZ] = (F64)extra2; + new_item.setElevation((F64)extra2); if (type == MAP_ITEM_PG_EVENT) { LLWorldMap::getInstance()->mPGEvents.push_back(new_item); @@ -851,9 +886,9 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) case MAP_ITEM_LAND_FOR_SALE: // land for sale case MAP_ITEM_LAND_FOR_SALE_ADULT: // adult land for sale { - new_item.mToolTip = llformat("%d sq. m. %s%d", new_item.mExtra, + new_item.setTooltip(llformat("%d sq. m. %s%d", new_item.mExtra, gHippoGridManager->getConnectedGrid()->getCurrencySymbol().c_str(), - new_item.mExtra2); + new_item.mExtra2)); if (type == MAP_ITEM_LAND_FOR_SALE) { LLWorldMap::getInstance()->mLandForSale.push_back(new_item); @@ -873,19 +908,19 @@ void LLWorldMap::processMapItemReply(LLMessageSystem* msg, void**) { if (!siminfo) { - llinfos << "siminfo missing for " << new_item.mPosGlobal.mdV[0] << ", " << new_item.mPosGlobal.mdV[1] << llendl; + llinfos << "siminfo missing for " << new_item.getGlobalPosition().mdV[0] << ", " << new_item.getGlobalPosition().mdV[1] << llendl; break; } // llinfos << "New Location " << new_item.mName << llendl; - item_info_list_t& agentcounts = LLWorldMap::getInstance()->mAgentLocationsMap[new_item.mRegionHandle]; + item_info_list_t& agentcounts = LLWorldMap::getInstance()->mAgentLocationsMap[new_item.getRegionHandle()]; // Find the last item in the list with a different name and erase them item_info_list_t::iterator lastiter; for (lastiter = agentcounts.begin(); lastiter!=agentcounts.end(); ++lastiter) { const LLItemInfo& info = *lastiter; - if (info.mName == new_item.mName) + if (info.isName(new_item.getName())) { break; } @@ -918,10 +953,10 @@ void LLWorldMap::dump() from_region_handle(handle, &x_pos, &y_pos); llinfos << x_pos << "," << y_pos - << " " << info->mName - << " " << (S32)info->mAccess - << " " << std::hex << info->mRegionFlags << std::dec - << " " << info->mWaterHeight + << " " << info->getName() + << " " << (S32)info->getAccess() + << " " << std::hex << info->getRegionFlags() << std::dec + << " " << info->getWaterHeight() //<< " " << info->mTelehubName //<< " " << info->mTelehubPosition << llendl; @@ -1088,9 +1123,6 @@ void LLWorldMap::dropImagePriorities() for (sim_info_map_t::iterator it = mSimInfoMap.begin(); it != mSimInfoMap.end(); ++it) { LLSimInfo* info = it->second; - if (!info->mOverlayImage.isNull()) - { - info->mOverlayImage->setBoostLevel(0); - } + info->dropImagePriority(); } } diff --git a/indra/newview/llworldmap.h b/indra/newview/llworldmap.h index a8d9c748e..c87b514ad 100644 --- a/indra/newview/llworldmap.h +++ b/indra/newview/llworldmap.h @@ -44,6 +44,7 @@ #include "llworldmipmap.h" #include "lluuid.h" #include "llmemory.h" +#include "llviewerregion.h" #include "llviewertexture.h" #include "lleventinfo.h" #include "v3color.h" @@ -56,14 +57,26 @@ class LLItemInfo public: LLItemInfo(F32 global_x, F32 global_y, const std::string& name, LLUUID id, S32 extra = 0, S32 extra2 = 0); + // Setters + void setTooltip(const std::string& tooltip) { mToolTip = tooltip; } + void setElevation(F64 z) { mPosGlobal.mdV[VZ] = z; } + // Accessors + const LLVector3d& getGlobalPosition() const { return mPosGlobal; } + const std::string& getName() const { return mName; } + const std::string& getToolTip() const { return mToolTip; } + const LLUUID& getUUID() const { return mID; } + U64 getRegionHandle() const { return mRegionHandle; } + bool isName(const std::string& name) const { return (mName == name); } // True if name same as item's name +private: std::string mName; std::string mToolTip; LLVector3d mPosGlobal; LLUUID mID; + U64 mRegionHandle; +public: //public for now.. non-standard. BOOL mSelected; S32 mExtra; S32 mExtra2; - U64 mRegionHandle; }; #define MAP_SIM_IMAGE_TYPES 3 @@ -74,25 +87,55 @@ public: class LLSimInfo { public: - LLSimInfo(); + LLSimInfo(U64 handle); - LLVector3d getGlobalPos(LLVector3 local_pos) const; + // Convert local region coordinates into world coordinates + LLVector3d getGlobalPos(const LLVector3& local_pos) const; // Get the world coordinates of the SW corner of that region LLVector3d getGlobalOrigin() const; + LLVector3 getLocalPos(LLVector3d global_pos) const; -public: + void clearImage(); // Clears the reference to the Land for sale image for that region + void dropImagePriority(); // Drops the boost level of the Land for sale image for that region + void updateAgentCount(F64 time); // Send an item request for agent count on that region if time's up + // Setters + void setName(std::string& name) { mName = name; } + void setAccess (U8 accesscode) { mAccess = accesscode; } + void setRegionFlags (U32 region_flags) { mRegionFlags = region_flags; } + void setWaterHeight (F32 water_height) { mWaterHeight = water_height; } + void setAlpha(F32 alpha) { mAlpha = alpha; } + + void setMapImageID (const LLUUID& id, const U8 &layer) { mMapImageID[layer] = id; } + + // Accessors + std::string getName() const { return mName; } + const std::string getFlagsString() const { return LLViewerRegion::regionFlagsToString(mRegionFlags); } + const U32 getRegionFlags() const { return mRegionFlags; } + const std::string getAccessString() const { return LLViewerRegion::accessToString((U8)mAccess); } + const U8 getAccess() const { return mAccess; } + + const F32 getWaterHeight() const { return mWaterHeight; } + const F32 getAlpha() const { return mAlpha; } + const U64 getHandle() const { return mHandle; } + bool isName(const std::string& name) const; + bool isDown() { return (mAccess == SIM_ACCESS_DOWN); } + bool isPG() { return (mAccess <= SIM_ACCESS_PG); } + bool isAdult() { return (mAccess == SIM_ACCESS_ADULT); } +private: U64 mHandle; std::string mName; - F64 mAgentsUpdateTime; - BOOL mShowAgentLocations; // are agents visible? - + F64 mAgentsUpdateTime; // Time stamp giving the last time the agents information was requested for that region + bool mFirstAgentRequest; // Init agent request flag U8 mAccess; U32 mRegionFlags; F32 mWaterHeight; F32 mAlpha; +public: + BOOL mShowAgentLocations; // are agents visible? + // Image ID for the current overlay mode. LLUUID mMapImageID[MAP_SIM_IMAGE_TYPES]; @@ -116,6 +159,7 @@ struct LLWorldMapLayer class LLWorldMap : public LLSingleton { + friend class LLMapLayerResponder; public: typedef void(*url_callback_t)(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport); @@ -138,6 +182,9 @@ public: // Drops the priority of the images being fetched void dropImagePriorities(); + // Region Map access + typedef std::map sim_info_map_t; + const LLWorldMap::sim_info_map_t& getRegionMap() const { return mSimInfoMap; } // Returns simulator information, or NULL if out of range LLSimInfo* simInfoFromHandle(const U64 handle); @@ -195,11 +242,14 @@ public: private: bool clearItems(bool force = false); // Clears the item lists -public: + // Create a region record corresponding to the handle, insert it in the region map and returns a pointer + LLSimInfo* createSimInfoFromHandle(const U64 handle); + // Map from region-handle to simulator info - typedef std::map sim_info_map_t; sim_info_map_t mSimInfoMap; +public: + BOOL mIsTrackingUnknownLocation, mInvalidLocation, mIsTrackingDoubleClick, mIsTrackingCommit; LLVector3d mUnknownLocation; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 4cff8c1e8..d4c9c7f66 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -127,10 +127,6 @@ std::map LLWorldMapView::sStringsMap; #define SIM_MAP_AGENT_SCALE 8 // width in pixels, where we start drawing agents #define SIM_MAP_SCALE 4 // width in pixels, where we start drawing sim tiles -// Updates for agent locations. -#define AGENTS_UPDATE_TIME 60.0 // in seconds - - void LLWorldMapView::initClass() { @@ -261,7 +257,7 @@ void LLWorldMapView::setScale( F32 scale ) F32 old_scale = sMapScale; sMapScale = scale; - if (sMapScale == 0.f) + if (sMapScale <= 0.f) { sMapScale = 0.1f; } @@ -308,7 +304,7 @@ void LLWorldMapView::setPan( S32 x, S32 y, BOOL snap ) BOOL is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) { - return ((region && info) && (info->mName == region->getName())); + return ((region && info) && (info->isName(region->getName()))); } @@ -328,6 +324,8 @@ void LLWorldMapView::draw() const S32 width = getRect().getWidth(); const S32 height = getRect().getHeight(); + const F32 half_width = F32(width) / 2.0f; + const F32 half_height = F32(height) / 2.0f; LLVector3d camera_global = gAgentCamera.getCameraPositionGlobal(); LLLocalClipRect clip(getLocalRect()); @@ -346,6 +344,7 @@ void LLWorldMapView::draw() } gGL.flush(); + gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); gGL.setColorMask(true, true); gGL.setSceneBlendType(LLRender::BT_ALPHA); @@ -354,17 +353,15 @@ void LLWorldMapView::draw() drawMipmap(width, height); else drawTiles(width, height); - + gGL.flush(); LLFontGL* font = LLFontGL::getFontSansSerifSmall(); - const F32 half_width = F32(width) / 2.0f; - const F32 half_height = F32(height) / 2.0f; // Draw the region name in the lower left corner - for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); - it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) + for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); + it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { U64 handle = it->first; - LLSimInfo* info = (*it).second; + LLSimInfo* info = it->second; LLVector3d origin_global = from_region_handle(handle); @@ -372,29 +369,26 @@ void LLWorldMapView::draw() LLVector3d rel_region_pos = origin_global - camera_global; F32 relative_x = (rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * sMapScale; F32 relative_y = (rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * sMapScale; - - F32 bottom = sPanY + half_height + relative_y; - F32 left = sPanX + half_width + relative_x; - F32 top = bottom + sMapScale ; - F32 right = left + sMapScale ; - - // disregard regions that are outside the rectangle - if (top < 0.f || - bottom > height || - right < 0.f || - left > width ) + + // Coordinates of the sim in pixels in the UI panel + // When the view isn't panned, 0,0 = center of rectangle + F32 bottom = sPanY + half_height + relative_y; + F32 left = sPanX + half_width + relative_x; + F32 top = bottom + sMapScale ; + F32 right = left + sMapScale ; + + // Discard if region is outside the screen rectangle (not visible on screen) + if ((top < 0.f) || (bottom > height) || + (right < 0.f) || (left > width) ) { + // Drop the "land for sale" fetching priority since it's outside the view rectangle + info->dropImagePriority(); continue; } info->mShowAgentLocations = (sMapScale >= SIM_MAP_AGENT_SCALE); mVisibleRegions.push_back(handle); - // See if the agents need updating - if (current_time - info->mAgentsUpdateTime > AGENTS_UPDATE_TIME) - { - LLWorldMap::getInstance()->sendItemRequest(MAP_ITEM_AGENT_LOCATIONS, info->mHandle); - info->mAgentsUpdateTime = current_time; - } + info->updateAgentCount(current_time); std::string mesg; if (sMapScale < sThresholdA) @@ -416,14 +410,14 @@ void LLWorldMapView::draw() mesg = RlvStrings::getString(RLV_STRING_HIDDEN); } // [/RLVa:KB] - else if (info->mAccess == SIM_ACCESS_DOWN) + else if (info->isDown()) { - mesg = llformat( "%s (%s)", info->mName.c_str(), sStringsMap["offline"].c_str()); + mesg = llformat( "%s (%s)", info->getName().c_str(), sStringsMap["offline"].c_str()); } else { - mesg = info->mName; - U8 access = info->mAccess; + mesg = info->getName(); + U8 access = info->getAccess(); switch(access) { case SIM_ACCESS_MIN: @@ -615,8 +609,8 @@ void LLWorldMapView::setVisible(BOOL visible) } } } - for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); - it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) + for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); + it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { LLSimInfo* info = (*it).second; if (info->mCurrentImage.notNull()) @@ -742,8 +736,8 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { bool use_web_map_tiles = LLWorldMap::useWebMapTiles(); - for (LLWorldMap::sim_info_map_t::iterator it = LLWorldMap::getInstance()->mSimInfoMap.begin(); - it != LLWorldMap::getInstance()->mSimInfoMap.end(); ++it) + for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); + it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) { U64 handle = (*it).first; LLSimInfo* info = (*it).second; @@ -776,7 +770,7 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { // 1. Tiles are zoomed out small enough, or // 2. Sim's texture has not been loaded yet F32 map_scale_cutoff = SIM_MAP_SCALE; - if ((info->mRegionFlags & REGION_FLAGS_NULL_LAYER) > 0) + if ((info->getRegionFlags() & REGION_FLAGS_NULL_LAYER) > 0) { map_scale_cutoff = SIM_NULL_MAP_SCALE; } @@ -789,18 +783,18 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { if (sim_visible) { // Fade in - if (info->mAlpha < 0.0f) - info->mAlpha = 1.f; // don't fade initially + if (info->getAlpha() < 0.0f) + info->setAlpha( 1.f ); // don't fade initially else - info->mAlpha = lerp(info->mAlpha, 1.f, LLCriticalDamp::getInterpolant(0.15f)); + info->setAlpha(lerp(info->getAlpha(), 1.f, LLCriticalDamp::getInterpolant(0.15f))); } else { // Fade out - if (info->mAlpha < 0.0f) - info->mAlpha = 0.f; // don't fade initially + if (info->getAlpha() < 0.0f) + info->setAlpha( 0.f ); // don't fade initially else - info->mAlpha = lerp(info->mAlpha, 0.f, LLCriticalDamp::getInterpolant(0.15f)); + info->setAlpha(lerp(info->getAlpha(), 0.f, LLCriticalDamp::getInterpolant(0.15f))); } // discard regions that are outside the rectangle @@ -870,7 +864,7 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { // LLTextureView::addDebugImage(simimage); - if (sim_visible && info->mAlpha > 0.001f) + if (sim_visible && info->getAlpha() > 0.001f) { // Draw using the texture. If we don't clamp we get artifact at // the edge. @@ -879,7 +873,7 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { gGL.getTexUnit(0)->bind(simimage); gGL.setSceneBlendType(LLRender::BT_ALPHA); - F32 alpha = sim_alpha * info->mAlpha; + F32 alpha = sim_alpha * info->getAlpha(); gGL.color4f(1.f, 1.0f, 1.0f, alpha); gGL.begin(LLRender::QUADS); @@ -909,7 +903,7 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { gGL.end(); } - if ((info->mRegionFlags & REGION_FLAGS_NULL_LAYER) == 0) + if ((info->getRegionFlags() & REGION_FLAGS_NULL_LAYER) == 0) { // draw an alpha of 1 where the sims are visible (except NULL sims) gGL.flush(); @@ -930,7 +924,7 @@ void LLWorldMapView::drawTiles(S32 width, S32 height) { } } - if (info->mAccess == SIM_ACCESS_DOWN) + if (info->isDown()) { // Draw a transparent red square over down sims gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_SOURCE_ALPHA); @@ -980,7 +974,7 @@ void LLWorldMapView::drawGenericItems(const LLWorldMap::item_info_list_t& items, void LLWorldMapView::drawGenericItem(const LLItemInfo& item, LLUIImagePtr image) { - drawImage(item.mPosGlobal, image); + drawImage(item.getGlobalPosition(), image); } @@ -1018,7 +1012,7 @@ void LLWorldMapView::drawAgents() { U64 handle = *iter; LLSimInfo* siminfo = LLWorldMap::getInstance()->simInfoFromHandle(handle); - if (siminfo && (siminfo->mAccess == SIM_ACCESS_DOWN)) + if (siminfo && (siminfo->isDown())) { continue; } @@ -1036,7 +1030,7 @@ void LLWorldMapView::drawAgents() sim_agent_count += info.mExtra; // Here's how we'd choose the color if info.mID were available but it's not being sent: //LLColor4 color = (agent_count == 1 && is_agent_friend(info.mID)) ? friend_color : avatar_color; - drawImageStack(info.mPosGlobal, sAvatarSmallImage, agent_count, 3.f, avatar_color); + drawImageStack(info.getGlobalPosition(), sAvatarSmallImage, agent_count, 3.f, avatar_color); } LLWorldMap::getInstance()->mNumAgents[handle] = sim_agent_count; // override mNumAgents for this sim } @@ -1427,14 +1421,14 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* stic // std::string message = llformat("%s (%s)", info->getName().c_str(), info->getAccessString().c_str()); // [RLVa:KB] - Alternate: Snowglobe-1.2.4 | Checked: 2009-07-04 (RLVa-1.0.0a) std::string message = llformat("%s (%s)", - (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? info->mName.c_str() : RlvStrings::getString(RLV_STRING_HIDDEN).c_str(), - LLViewerRegion::accessToString(info->mAccess).c_str()); + (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ? info->getName().c_str() : RlvStrings::getString(RLV_STRING_HIDDEN).c_str(), + info->getAccessString().c_str()); // [/RLVa:KB] - if (info->mAccess != SIM_ACCESS_DOWN) + if (!info->isDown()) { - S32 agent_count = LLWorldMap::getInstance()->mNumAgents[info->mHandle]; - if (region && region->getHandle() == info->mHandle) + S32 agent_count = LLWorldMap::getInstance()->mNumAgents[info->getHandle()]; + if (region && region->getHandle() == info->getHandle()) { ++agent_count; // Bump by 1 if we're here } @@ -1458,7 +1452,7 @@ BOOL LLWorldMapView::handleToolTip( S32 x, S32 y, std::string& msg, LLRect* stic msg.assign( message ); // Optionally show region flags - std::string region_flags = LLViewerRegion::regionFlagsToString(info->mRegionFlags); + std::string region_flags = info->getFlagsString(); if (!region_flags.empty()) { @@ -1808,7 +1802,7 @@ void LLWorldMapView::reshape( S32 width, S32 height, BOOL called_from_parent ) bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bool track) { - LLVector3 pos_view = globalPosToView(item.mPosGlobal); + LLVector3 pos_view = globalPosToView(item.getGlobalPosition()); S32 item_x = llround(pos_view.mV[VX]); S32 item_y = llround(pos_view.mV[VY]); @@ -1817,12 +1811,12 @@ bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bo if (y < item_y - BIG_DOT_RADIUS) return false; if (y > item_y + BIG_DOT_RADIUS) return false; - LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(item.mRegionHandle); + LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromHandle(item.getRegionHandle()); if (sim_info) { if (track) { - gFloaterWorldMap->trackLocation(item.mPosGlobal); + gFloaterWorldMap->trackLocation(item.getGlobalPosition()); } } @@ -1832,7 +1826,7 @@ bool LLWorldMapView::checkItemHit(S32 x, S32 y, LLItemInfo& item, LLUUID* id, bo } item.mSelected = TRUE; - *id = item.mID; + *id = item.getUUID(); return true; } @@ -2167,7 +2161,7 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask ) // Teleport if we got a valid location LLVector3d pos_global = viewPosToGlobal(x,y); LLSimInfo* sim_info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global); - if (sim_info && sim_info->mAccess != SIM_ACCESS_DOWN) + if (sim_info && !sim_info->isDown()) { gAgent.teleportViaLocation( pos_global ); } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3b5a8b2ef..9ece8613b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -929,6 +929,8 @@ void LLPipeline::restoreGL() } } } + + resetLocalLights(); //Default all gl light parameters. Fixes light brightness problems on fullscren toggle } @@ -4679,6 +4681,29 @@ static F32 calc_light_dist(LLVOVolume* light, const LLVector3& cam_pos, F32 max_ return dist; } +//Default all gl light parameters. Used upon restoreGL. Fixes brightness problems on fullscren toggle +void LLPipeline::resetLocalLights() +{ + glEnable(GL_LIGHTING); + for (S32 i = 0; i < 8; ++i) + { + LLLightState *pLight = gGL.getLight(i); + pLight->enable(); + pLight->setAmbient(LLColor4::black); + pLight->setConstantAttenuation(0.f); + pLight->setDiffuse(LLColor4::black); + pLight->setLinearAttenuation(0.f); + pLight->setPosition(LLVector4(0.f,0.f,0.f,0.f)); + pLight->setQuadraticAttenuation(0.f); + pLight->setSpecular(LLColor4::black); + pLight->setSpotCutoff(0.f); + pLight->setSpotDirection(LLVector3(0.f,0.f,0.f)); + pLight->setSpotExponent(0.f); + pLight->disable(); + } + glDisable(GL_LIGHTING); +} + void LLPipeline::calcNearbyLights(LLCamera& camera) { assertInitialized(); @@ -4712,6 +4737,7 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) LLVOVolume* volight = drawable->getVOVolume(); if (!volight || !drawable->isState(LLDrawable::LIGHT)) { + setLight(drawable,false); //remove from mLight list drawable->clearState(LLDrawable::NEARBY_LIGHT); continue; } diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 56720d027..4145a9476 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -242,6 +242,7 @@ public: S32 getLightCount() const { return mLights.size(); } + void resetLocalLights(); //Default all gl light parameters. Used upon restoreGL. Fixes light brightness problems on fullscren toggle void calcNearbyLights(LLCamera& camera); void setupHWLights(LLDrawPool* pool); void setupAvatarLights(BOOL for_edit = FALSE);