aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/newview/llviewerwindow.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerwindow.cpp337
1 files changed, 156 insertions, 181 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index dc2db19..a4d38f8 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -133,6 +133,8 @@
133#include "llimview.h" 133#include "llimview.h"
134#include "lltexlayer.h" 134#include "lltexlayer.h"
135#include "lltextbox.h" 135#include "lltextbox.h"
136#include "lltexturecache.h"
137#include "lltexturefetch.h"
136#include "lltextureview.h" 138#include "lltextureview.h"
137#include "lltool.h" 139#include "lltool.h"
138#include "lltoolbar.h" 140#include "lltoolbar.h"
@@ -397,7 +399,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
397 if (gToolMgr) 399 if (gToolMgr)
398 { 400 {
399 // Don't let the user move the mouse out of the window until mouse up. 401 // Don't let the user move the mouse out of the window until mouse up.
400 if( gToolMgr->getCurrentTool(mask)->clipMouseWhenDown() ) 402 if( gToolMgr->getCurrentTool()->clipMouseWhenDown() )
401 { 403 {
402 mWindow->setMouseClipping(TRUE); 404 mWindow->setMouseClipping(TRUE);
403 } 405 }
@@ -448,7 +450,7 @@ BOOL LLViewerWindow::handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask
448 450
449 if (gToolMgr) 451 if (gToolMgr)
450 { 452 {
451 if(gToolMgr->getCurrentTool(mask)->handleMouseDown( x, y, mask ) ) 453 if(gToolMgr->getCurrentTool()->handleMouseDown( x, y, mask ) )
452 { 454 {
453 // This is necessary to force clicks in the world to cause edit 455 // This is necessary to force clicks in the world to cause edit
454 // boxes that might have keyboard focus to relinquish it, and hence 456 // boxes that might have keyboard focus to relinquish it, and hence
@@ -526,7 +528,7 @@ BOOL LLViewerWindow::handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK ma
526 528
527 if (gToolMgr) 529 if (gToolMgr)
528 { 530 {
529 if(gToolMgr->getCurrentTool(mask)->handleDoubleClick( x, y, mask ) ) 531 if(gToolMgr->getCurrentTool()->handleDoubleClick( x, y, mask ) )
530 { 532 {
531 return TRUE; 533 return TRUE;
532 } 534 }
@@ -569,7 +571,7 @@ BOOL LLViewerWindow::handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
569 LLTool *tool = NULL; 571 LLTool *tool = NULL;
570 if (gToolMgr) 572 if (gToolMgr)
571 { 573 {
572 tool = gToolMgr->getCurrentTool(mask); 574 tool = gToolMgr->getCurrentTool();
573 575
574 if( tool->clipMouseWhenDown() ) 576 if( tool->clipMouseWhenDown() )
575 { 577 {
@@ -668,7 +670,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
668 if (gToolMgr) 670 if (gToolMgr)
669 { 671 {
670 // Don't let the user move the mouse out of the window until mouse up. 672 // Don't let the user move the mouse out of the window until mouse up.
671 if( gToolMgr->getCurrentTool(mask)->clipMouseWhenDown() ) 673 if( gToolMgr->getCurrentTool()->clipMouseWhenDown() )
672 { 674 {
673 mWindow->setMouseClipping(TRUE); 675 mWindow->setMouseClipping(TRUE);
674 } 676 }
@@ -711,7 +713,7 @@ BOOL LLViewerWindow::handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK
711 713
712 if (gToolMgr) 714 if (gToolMgr)
713 { 715 {
714 if(gToolMgr->getCurrentTool(mask)->handleRightMouseDown( x, y, mask ) ) 716 if(gToolMgr->getCurrentTool()->handleRightMouseDown( x, y, mask ) )
715 { 717 {
716 // This is necessary to force clicks in the world to cause edit 718 // This is necessary to force clicks in the world to cause edit
717 // boxes that might have keyboard focus to relinquish it, and hence 719 // boxes that might have keyboard focus to relinquish it, and hence
@@ -769,7 +771,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
769 LLTool *tool = NULL; 771 LLTool *tool = NULL;
770 if (gToolMgr) 772 if (gToolMgr)
771 { 773 {
772 tool = gToolMgr->getCurrentTool(mask); 774 tool = gToolMgr->getCurrentTool();
773 775
774 if( tool->clipMouseWhenDown() ) 776 if( tool->clipMouseWhenDown() )
775 { 777 {
@@ -1080,19 +1082,19 @@ BOOL LLViewerWindow::handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S
1080 gAgent.getName(name_str); 1082 gAgent.getName(name_str);
1081 1083
1082 S32 len; 1084 S32 len;
1083 char temp_str[255]; 1085 char temp_str[255]; /* Flawfinder: ignore */
1084 sprintf(temp_str, "%s FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", 1086 snprintf(temp_str, sizeof(temp_str), "%s FPS %3.1f Phy FPS %2.1f Time Dil %1.3f", /* Flawfinder: ignore */
1085 name_str.c_str(), 1087 name_str.c_str(),
1086 gViewerStats->mFPSStat.getMeanPerSec(), 1088 gViewerStats->mFPSStat.getMeanPerSec(),
1087 gViewerStats->mSimPhysicsFPS.getPrev(0), 1089 gViewerStats->mSimPhysicsFPS.getPrev(0),
1088 gViewerStats->mSimTimeDilation.getPrev(0)); 1090 gViewerStats->mSimTimeDilation.getPrev(0));
1089 len = strlen(temp_str); 1091 len = strlen(temp_str); /* Flawfinder: ignore */
1090 TextOutA(hdc, 0, 0, temp_str, len); 1092 TextOutA(hdc, 0, 0, temp_str, len);
1091 1093
1092 1094
1093 LLVector3d pos_global = gAgent.getPositionGlobal(); 1095 LLVector3d pos_global = gAgent.getPositionGlobal();
1094 sprintf(temp_str, "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); 1096 snprintf(temp_str, sizeof(temp_str), "Avatar pos %6.1lf %6.1lf %6.1lf", pos_global.mdV[0], pos_global.mdV[1], pos_global.mdV[2]); /* Flawfinder: ignore */
1095 len = strlen(temp_str); 1097 len = strlen(temp_str); /* Flawfinder: ignore */
1096 TextOutA(hdc, 0, 25, temp_str, len); 1098 TextOutA(hdc, 0, 25, temp_str, len);
1097 1099
1098 TextOutA(hdc, 0, 50, "Set \"DisableRendering FALSE\" in settings.ini file to reenable", 61); 1100 TextOutA(hdc, 0, 50, "Set \"DisableRendering FALSE\" in settings.ini file to reenable", 61);
@@ -1169,15 +1171,13 @@ LLViewerWindow::LLViewerWindow(
1169 mSuppressToolbox( FALSE ), 1171 mSuppressToolbox( FALSE ),
1170 mHideCursorPermanent( FALSE ), 1172 mHideCursorPermanent( FALSE ),
1171 mPickPending(FALSE), 1173 mPickPending(FALSE),
1172 mIgnoreActivate( FALSE ), 1174 mIgnoreActivate( FALSE )
1173 mRenderFullFrame(FALSE)
1174{ 1175{
1175 // Default to application directory. 1176 // Default to application directory.
1176 strcpy(LLViewerWindow::sSnapshotBaseName, "Snapshot"); 1177 strcpy(LLViewerWindow::sSnapshotBaseName, "Snapshot"); /* Flawfinder: ignore */
1177 strcpy(LLViewerWindow::sMovieBaseName, "SLmovie"); 1178 strcpy(LLViewerWindow::sMovieBaseName, "SLmovie"); /* Flawfinder: ignore */
1178 LLViewerWindow::sSnapshotDir[0] = '\0'; 1179 LLViewerWindow::sSnapshotDir[0] = '\0';
1179 1180
1180 mFastFrameTimer.stop();
1181 1181
1182 // create window 1182 // create window
1183 mWindow = LLWindowManager::createWindow( 1183 mWindow = LLWindowManager::createWindow(
@@ -1224,6 +1224,13 @@ LLViewerWindow::LLViewerWindow(
1224 1224
1225 LLFontManager::initClass(); 1225 LLFontManager::initClass();
1226 1226
1227 if (!gFeatureManagerp->isFeatureAvailable("RenderVBO") ||
1228 !gGLManager.mHasVertexBufferObject)
1229 {
1230 gSavedSettings.setBOOL("RenderVBOEnable", FALSE);
1231 }
1232 LLVertexBuffer::initClass(gSavedSettings.getBOOL("RenderVBOEnable"));
1233
1227 // 1234 //
1228 // We want to set this stuff up BEFORE we initialize the pipeline, so we can turn off 1235 // We want to set this stuff up BEFORE we initialize the pipeline, so we can turn off
1229 // stuff like AGP if we think that it'll crash the viewer. 1236 // stuff like AGP if we think that it'll crash the viewer.
@@ -1252,7 +1259,6 @@ LLViewerWindow::LLViewerWindow(
1252 gPipeline.init(); 1259 gPipeline.init();
1253 stop_glerror(); 1260 stop_glerror();
1254 initGLDefaults(); 1261 initGLDefaults();
1255 LLViewerImage::initClass();
1256 } 1262 }
1257 1263
1258 // 1264 //
@@ -1265,11 +1271,11 @@ LLViewerWindow::LLViewerWindow(
1265 // Init the image list. Must happen after GL is initialized and before the images that 1271 // Init the image list. Must happen after GL is initialized and before the images that
1266 // LLViewerWindow needs are requested. 1272 // LLViewerWindow needs are requested.
1267 gImageList.init(); 1273 gImageList.init();
1274 LLViewerImage::initClass();
1268 gBumpImageList.init(); 1275 gBumpImageList.init();
1269 1276
1270 // Create container for all sub-views 1277 // Create container for all sub-views
1271 mRootView = new LLRootView("root", mVirtualWindowRect, FALSE); 1278 mRootView = new LLRootView("root", mVirtualWindowRect, FALSE);
1272 mRootView->setRenderInFastFrame(FALSE);
1273 1279
1274 if (!gNoRender) 1280 if (!gNoRender)
1275 { 1281 {
@@ -1632,8 +1638,14 @@ void LLViewerWindow::initWorldUI()
1632 1638
1633 gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE); 1639 gStatusBar->reshape(root_rect.getWidth(), gStatusBar->getRect().getHeight(), TRUE);
1634 gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight()); 1640 gStatusBar->translate(0, root_rect.getHeight() - gStatusBar->getRect().getHeight());
1641 // sync bg color with menu bar
1642 gStatusBar->setBackgroundColor( gMenuBarView->getBackgroundColor() );
1643
1635 1644
1636 gViewerWindow->getRootView()->addChild(gStatusBar); 1645 gViewerWindow->getRootView()->addChild(gStatusBar);
1646
1647 // menu holder appears on top to get first pass at all mouse events
1648 gViewerWindow->getRootView()->sendChildToFront(gMenuHolder);
1637} 1649}
1638 1650
1639 1651
@@ -1693,11 +1705,23 @@ LLViewerWindow::~LLViewerWindow()
1693 1705
1694 LLWorldMapView::cleanupTextures(); 1706 LLWorldMapView::cleanupTextures();
1695 1707
1708 llinfos << "Cleaning up pipeline" << llendl;
1709 gPipeline.cleanup();
1710 stop_glerror();
1711
1696 LLViewerImage::cleanupClass(); 1712 LLViewerImage::cleanupClass();
1697 1713
1698 delete[] mPickBuffer; 1714 delete[] mPickBuffer;
1699 mPickBuffer = NULL; 1715 mPickBuffer = NULL;
1700 1716
1717 if (gSelectMgr)
1718 {
1719 llinfos << "Cleaning up select manager" << llendl;
1720 gSelectMgr->cleanup();
1721 }
1722
1723 LLVertexBuffer::cleanupClass();
1724
1701 llinfos << "Stopping GL during shutdown" << llendl; 1725 llinfos << "Stopping GL during shutdown" << llendl;
1702 if (!gNoRender) 1726 if (!gNoRender)
1703 { 1727 {
@@ -1705,15 +1729,7 @@ LLViewerWindow::~LLViewerWindow()
1705 stop_glerror(); 1729 stop_glerror();
1706 } 1730 }
1707 1731
1708 if (gSelectMgr)
1709 {
1710 llinfos << "Cleaning up select manager" << llendl;
1711 gSelectMgr->cleanup();
1712 }
1713 1732
1714 llinfos << "Cleaning up pipeline" << llendl;
1715 gPipeline.cleanup();
1716 stop_glerror();
1717 llinfos << "Destroying Window" << llendl; 1733 llinfos << "Destroying Window" << llendl;
1718 destroyWindow(); 1734 destroyWindow();
1719} 1735}
@@ -1876,7 +1892,7 @@ void LLViewerWindow::draw()
1876 if (gSavedSettings.getBOOL("DisplayTimecode")) 1892 if (gSavedSettings.getBOOL("DisplayTimecode"))
1877 { 1893 {
1878 // draw timecode block 1894 // draw timecode block
1879 char text[256]; 1895 char text[256]; /* Flawfinder: ignore */
1880 1896
1881 glLoadIdentity(); 1897 glLoadIdentity();
1882 1898
@@ -1925,7 +1941,7 @@ void LLViewerWindow::draw()
1925 if (gToolMgr) 1941 if (gToolMgr)
1926 { 1942 {
1927 // Draw tool specific overlay on world 1943 // Draw tool specific overlay on world
1928 gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) )->draw(); 1944 gToolMgr->getCurrentTool()->draw();
1929 } 1945 }
1930 1946
1931 if( gAgent.cameraMouselook() ) 1947 if( gAgent.cameraMouselook() )
@@ -2113,7 +2129,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
2113 2129
2114 if (gToolMgr) 2130 if (gToolMgr)
2115 { 2131 {
2116 if( gToolMgr->getCurrentTool(mask)->handleKey(key, mask) ) 2132 if( gToolMgr->getCurrentTool()->handleKey(key, mask) )
2117 { 2133 {
2118 return TRUE; 2134 return TRUE;
2119 } 2135 }
@@ -2175,7 +2191,9 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
2175 } 2191 }
2176 2192
2177 // don't pass keys on to world when something in ui has focus 2193 // don't pass keys on to world when something in ui has focus
2178 return gFocusMgr.childHasKeyboardFocus(mRootView) || (gMenuBarView && gMenuBarView->getHighlightedItem()); 2194 return gFocusMgr.childHasKeyboardFocus(mRootView)
2195 || LLMenuGL::getKeyboardMode()
2196 || (gMenuBarView && gMenuBarView->getHighlightedItem() && gMenuBarView->getHighlightedItem()->isActive());
2179} 2197}
2180 2198
2181 2199
@@ -2279,44 +2297,15 @@ void LLViewerWindow::handleScrollWheel(S32 clicks)
2279 2297
2280void LLViewerWindow::moveCursorToCenter() 2298void LLViewerWindow::moveCursorToCenter()
2281{ 2299{
2282#if 1 // old version
2283
2284#if 0 // Dave's changes - this reportedly is making the drift worse on some systems?
2285 S32 x = llround((F32) mVirtualWindowRect.getWidth() / 2);
2286 S32 y = llround((F32) mVirtualWindowRect.getHeight() / 2);
2287#else
2288 S32 x = mVirtualWindowRect.getWidth() / 2; 2300 S32 x = mVirtualWindowRect.getWidth() / 2;
2289 S32 y = mVirtualWindowRect.getHeight() / 2; 2301 S32 y = mVirtualWindowRect.getHeight() / 2;
2290#endif
2291 2302
2292 //on a forced move, all deltas get zeroed out to prevent jumping 2303 //on a forced move, all deltas get zeroed out to prevent jumping
2293 mCurrentMousePoint.set(x,y); 2304 mCurrentMousePoint.set(x,y);
2294 mLastMousePoint.set(x,y); 2305 mLastMousePoint.set(x,y);
2295 mCurrentMouseDelta.set(0,0); 2306 mCurrentMouseDelta.set(0,0);
2296 2307
2297 LLUI::setCursorPositionScreen(x, y); 2308 LLUI::setCursorPositionScreen(x, y);
2298
2299#else // Richard's version - fails on intel macs
2300
2301 S32 x = llround((F32) mWindowRect.getWidth() / 2);
2302 S32 y = llround((F32) mWindowRect.getHeight() / 2);
2303
2304 LLCoordWindow window_point;
2305 mWindow->convertCoords(LLCoordGL(x, y), &window_point);
2306 mWindow->setCursorPosition(window_point);
2307
2308 // read back cursor position
2309 mWindow->getCursorPosition(&window_point);
2310 LLCoordGL new_mouse_pos;
2311 mWindow->convertCoords(window_point, &new_mouse_pos);
2312 new_mouse_pos.mX = llround((F32)new_mouse_pos.mX / mDisplayScale.mV[VX]);
2313 new_mouse_pos.mY = llround((F32)new_mouse_pos.mY / mDisplayScale.mV[VY]);
2314
2315 //on a forced move, all deltas get zeroed out to prevent jumping
2316 mCurrentMousePoint = new_mouse_pos;
2317 mLastMousePoint = new_mouse_pos;
2318 mCurrentMouseDelta.set(0,0);
2319#endif
2320} 2309}
2321 2310
2322////////////////////////////////////////////////////////////////////// 2311//////////////////////////////////////////////////////////////////////
@@ -2345,10 +2334,29 @@ BOOL LLViewerWindow::handlePerFrameHover()
2345 mMouseInWindow = TRUE; 2334 mMouseInWindow = TRUE;
2346 } 2335 }
2347 2336
2348 S32 dx = mCurrentMousePoint.mX - mLastMousePoint.mX; 2337 S32 dx = lltrunc((F32) (mCurrentMousePoint.mX - mLastMousePoint.mX) * LLUI::sGLScaleFactor.mV[VX]);
2349 S32 dy = mCurrentMousePoint.mY - mLastMousePoint.mY; 2338 S32 dy = lltrunc((F32) (mCurrentMousePoint.mY - mLastMousePoint.mY) * LLUI::sGLScaleFactor.mV[VY]);
2350 mCurrentMouseDelta.set(dx,dy); 2339
2351 LLVector2 mouse_vel((F32)dx, (F32)dy); 2340 LLVector2 mouse_vel;
2341
2342 if (gSavedSettings.getBOOL("MouseSmooth"))
2343 {
2344 static F32 fdx = 0.f;
2345 static F32 fdy = 0.f;
2346
2347 F32 amount = 16.f;
2348 fdx = fdx + ((F32) dx - fdx) * llmin(gFrameIntervalSeconds*amount,1.f);
2349 fdy = fdy + ((F32) dy - fdy) * llmin(gFrameIntervalSeconds*amount,1.f);
2350
2351 mCurrentMouseDelta.set(llround(fdx), llround(fdy));
2352 mouse_vel.setVec(fdx,fdy);
2353 }
2354 else
2355 {
2356 mCurrentMouseDelta.set(dx, dy);
2357 mouse_vel.setVec((F32) dx, (F32) dy);
2358 }
2359
2352 mMouseVelocityStat.addValue(mouse_vel.magVec()); 2360 mMouseVelocityStat.addValue(mouse_vel.magVec());
2353 2361
2354 if (gNoRender) 2362 if (gNoRender)
@@ -2473,7 +2481,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
2473 LLTool *tool = NULL; 2481 LLTool *tool = NULL;
2474 if (gToolMgr && gHoverView) 2482 if (gToolMgr && gHoverView)
2475 { 2483 {
2476 tool = gToolMgr->getCurrentTool(mask); 2484 tool = gToolMgr->getCurrentTool();
2477 2485
2478 if(!handled && tool) 2486 if(!handled && tool)
2479 { 2487 {
@@ -2493,8 +2501,8 @@ BOOL LLViewerWindow::handlePerFrameHover()
2493 // Suppress the toolbox view if our source tool was the pie tool, 2501 // Suppress the toolbox view if our source tool was the pie tool,
2494 // and we've overridden to something else. 2502 // and we've overridden to something else.
2495 mSuppressToolbox = 2503 mSuppressToolbox =
2496 (gToolMgr->getCurrentTool(MASK_NONE) == gToolPie) && 2504 (gToolMgr->getBaseTool() == gToolPie) &&
2497 (gToolMgr->getCurrentTool(mask) != gToolPie); 2505 (gToolMgr->getCurrentTool() != gToolPie);
2498 2506
2499 } 2507 }
2500 2508
@@ -2555,15 +2563,15 @@ BOOL LLViewerWindow::handlePerFrameHover()
2555 (tool != gToolPie // not default tool 2563 (tool != gToolPie // not default tool
2556 && tool != gToolGun // not coming out of mouselook 2564 && tool != gToolGun // not coming out of mouselook
2557 && !mSuppressToolbox // not override in third person 2565 && !mSuppressToolbox // not override in third person
2558 && gCurrentToolset != gFaceEditToolset // not special mode 2566 && gToolMgr->getCurrentToolset() != gFaceEditToolset // not special mode
2559 && gCurrentToolset != gMouselookToolset 2567 && gToolMgr->getCurrentToolset() != gMouselookToolset
2560 && (!captor || captor->isView())) // not dragging 2568 && (!captor || captor->isView())) // not dragging
2561 ) 2569 )
2562 { 2570 {
2563 // Force floater tools to be visible (unless minimized) 2571 // Force floater tools to be visible (unless minimized)
2564 if (!gFloaterTools->getVisible()) 2572 if (!gFloaterTools->getVisible())
2565 { 2573 {
2566 gFloaterTools->open(); 2574 gFloaterTools->open(); /* Flawfinder: ignore */
2567 } 2575 }
2568 // Update the location of the blue box tool popup 2576 // Update the location of the blue box tool popup
2569 LLCoordGL select_center_screen; 2577 LLCoordGL select_center_screen;
@@ -2669,7 +2677,7 @@ BOOL LLViewerWindow::handlePerFrameHover()
2669 mLastMousePoint = mCurrentMousePoint; 2677 mLastMousePoint = mCurrentMousePoint;
2670 2678
2671 // last ditch force of edit menu to selection manager 2679 // last ditch force of edit menu to selection manager
2672 if (gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getObjectCount()) 2680 if (gEditMenuHandler == NULL && gSelectMgr && gSelectMgr->getSelection()->getObjectCount())
2673 { 2681 {
2674 gEditMenuHandler = gSelectMgr; 2682 gEditMenuHandler = gSelectMgr;
2675 } 2683 }
@@ -2705,15 +2713,15 @@ BOOL LLViewerWindow::handlePerFrameHover()
2705 gChatBar->startChat(NULL); 2713 gChatBar->startChat(NULL);
2706 } 2714 }
2707 2715
2708 // sync land selection with edit and about land dialogs 2716 // cleanup unused selections when no modal dialogs are open
2709 if (gParcelMgr 2717 if (gParcelMgr && LLModalDialog::activeCount() == 0)
2710 && !gMenuHolder->hasVisibleMenu() 2718 {
2711 && !LLFloaterLand::floaterVisible() 2719 gParcelMgr->deselectUnused();
2712 && !LLFloaterBuyLand::isOpen() 2720 }
2713 && !LLPanelLandGeneral::buyPassDialogVisible() 2721
2714 && (!gFloaterTools || !gFloaterTools->getVisible())) 2722 if (gSelectMgr && LLModalDialog::activeCount() == 0)
2715 { 2723 {
2716 gParcelMgr->deselectLand(); 2724 gSelectMgr->deselectUnused();
2717 } 2725 }
2718 2726
2719 return handled; 2727 return handled;
@@ -2761,6 +2769,7 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point)
2761void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud ) 2769void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, BOOL for_hud )
2762{ 2770{
2763 LLViewerObject* object; 2771 LLViewerObject* object;
2772 LLObjectSelectionHandle selection = gSelectMgr->getSelection();
2764 2773
2765 if (!for_hud && !for_gl_pick) 2774 if (!for_hud && !for_gl_pick)
2766 { 2775 {
@@ -2776,15 +2785,15 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
2776 gParcelMgr->renderParcelCollision(); 2785 gParcelMgr->renderParcelCollision();
2777 } 2786 }
2778 } 2787 }
2779 else if (( for_hud && gSelectMgr->getSelectType() == SELECT_TYPE_HUD) || 2788 else if (( for_hud && selection->getSelectType() == SELECT_TYPE_HUD) ||
2780 (!for_hud && gSelectMgr->getSelectType() != SELECT_TYPE_HUD)) 2789 (!for_hud && selection->getSelectType() != SELECT_TYPE_HUD))
2781 { 2790 {
2782 gSelectMgr->renderSilhouettes(for_hud); 2791 gSelectMgr->renderSilhouettes(for_hud);
2783 2792
2784 stop_glerror(); 2793 stop_glerror();
2785 2794
2786 // setup HUD render 2795 // setup HUD render
2787 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getObjectCount()) 2796 if (selection->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getSelection()->getObjectCount())
2788 { 2797 {
2789 LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox(); 2798 LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox();
2790 2799
@@ -2810,12 +2819,12 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
2810 LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE); 2819 LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
2811 glMatrixMode(GL_MODELVIEW); 2820 glMatrixMode(GL_MODELVIEW);
2812 glPushMatrix(); 2821 glPushMatrix();
2813 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD) 2822 if (selection->getSelectType() == SELECT_TYPE_HUD)
2814 { 2823 {
2815 F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom; 2824 F32 zoom = gAgent.getAvatarObject()->mHUDCurZoom;
2816 glScalef(zoom, zoom, zoom); 2825 glScalef(zoom, zoom, zoom);
2817 } 2826 }
2818 for( object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() ) 2827 for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
2819 { 2828 {
2820 LLDrawable* drawable = object->mDrawable; 2829 LLDrawable* drawable = object->mDrawable;
2821 if (drawable && drawable->isLight()) 2830 if (drawable && drawable->isLight())
@@ -2850,7 +2859,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
2850 // not be recalculated at this time. If they are, then group rotations will break. 2859 // not be recalculated at this time. If they are, then group rotations will break.
2851 2860
2852 // Draw arrows at average center of all selected objects 2861 // Draw arrows at average center of all selected objects
2853 LLTool* tool = gToolMgr->getCurrentTool( gKeyboard->currentMask(TRUE) ); 2862 LLTool* tool = gToolMgr->getCurrentTool();
2854 if (tool) 2863 if (tool)
2855 { 2864 {
2856 if(tool->isAlwaysRendered()) 2865 if(tool->isAlwaysRendered())
@@ -2859,13 +2868,13 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
2859 } 2868 }
2860 else 2869 else
2861 { 2870 {
2862 if( !gSelectMgr->isEmpty() ) 2871 if( !gSelectMgr->getSelection()->isEmpty() )
2863 { 2872 {
2864 BOOL moveable_object_selected = FALSE; 2873 BOOL moveable_object_selected = FALSE;
2865 BOOL all_selected_objects_move = TRUE; 2874 BOOL all_selected_objects_move = TRUE;
2866 BOOL all_selected_objects_modify = TRUE; 2875 BOOL all_selected_objects_modify = TRUE;
2867 BOOL selecting_linked_set = gSavedSettings.getBOOL("SelectLinkedSet"); 2876 BOOL selecting_linked_set = gSavedSettings.getBOOL("SelectLinkedSet");
2868 for( object = gSelectMgr->getFirstObject(); object; object = gSelectMgr->getNextObject() ) 2877 for( object = gSelectMgr->getSelection()->getFirstObject(); object; object = gSelectMgr->getSelection()->getNextObject() )
2869 { 2878 {
2870 BOOL this_object_movable = FALSE; 2879 BOOL this_object_movable = FALSE;
2871 if (object->permMove() && (object->permModify() || selecting_linked_set)) 2880 if (object->permMove() && (object->permModify() || selecting_linked_set))
@@ -2900,7 +2909,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
2900 } 2909 }
2901 } 2910 }
2902 } 2911 }
2903 if (gSelectMgr->getSelectType() == SELECT_TYPE_HUD && gSelectMgr->getObjectCount()) 2912 if (selection->getSelectType() == SELECT_TYPE_HUD && selection->getObjectCount())
2904 { 2913 {
2905 glMatrixMode(GL_PROJECTION); 2914 glMatrixMode(GL_PROJECTION);
2906 glPopMatrix(); 2915 glPopMatrix();
@@ -2963,8 +2972,6 @@ void LLViewerWindow::hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask
2963 S32 scaled_x = llround((F32)x * mDisplayScale.mV[VX]); 2972 S32 scaled_x = llround((F32)x * mDisplayScale.mV[VX]);
2964 S32 scaled_y = llround((F32)y_from_bot * mDisplayScale.mV[VY]); 2973 S32 scaled_y = llround((F32)y_from_bot * mDisplayScale.mV[VY]);
2965 2974
2966 F32 delta_time = gAlphaFadeTimer.getElapsedTimeAndResetF32();
2967
2968 BOOL in_build_mode = gFloaterTools && gFloaterTools->getVisible(); 2975 BOOL in_build_mode = gFloaterTools && gFloaterTools->getVisible();
2969 if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha) 2976 if (in_build_mode || LLDrawPoolAlpha::sShowDebugAlpha)
2970 { 2977 {
@@ -2974,17 +2981,6 @@ void LLViewerWindow::hitObjectOrLandGlobalAsync(S32 x, S32 y_from_bot, MASK mask
2974 } 2981 }
2975 gPickTransparent = pick_transparent; 2982 gPickTransparent = pick_transparent;
2976 2983
2977 if (gPickTransparent)
2978 {
2979 gPickAlphaTargetThreshold = 0.f;
2980 gPickAlphaThreshold = llmax(gPickAlphaTargetThreshold, gPickAlphaThreshold - (delta_time * 0.7f));
2981 }
2982 else
2983 {
2984 gPickAlphaTargetThreshold = 1.f;
2985 gPickAlphaThreshold = llmin(gPickAlphaTargetThreshold, gPickAlphaThreshold + (delta_time * 0.7f));
2986 }
2987
2988 gUseGLPick = FALSE; 2984 gUseGLPick = FALSE;
2989 mPickCallback = callback; 2985 mPickCallback = callback;
2990 2986
@@ -3151,8 +3147,6 @@ void LLViewerWindow::performPick()
3151 return; 3147 return;
3152 } 3148 }
3153 3149
3154 finishFastFrame();
3155
3156 mPickPending = FALSE; 3150 mPickPending = FALSE;
3157 U32 te_offset = NO_FACE; 3151 U32 te_offset = NO_FACE;
3158 3152
@@ -3407,8 +3401,8 @@ void LLViewerWindow::analyzeHit(
3407 const S32 UV_PICK_WIDTH = 41; 3401 const S32 UV_PICK_WIDTH = 41;
3408 const S32 UV_PICK_HALF_WIDTH = (UV_PICK_WIDTH - 1) / 2; 3402 const S32 UV_PICK_HALF_WIDTH = (UV_PICK_WIDTH - 1) / 2;
3409 U8 uv_pick_buffer[UV_PICK_WIDTH * UV_PICK_WIDTH * 4]; 3403 U8 uv_pick_buffer[UV_PICK_WIDTH * UV_PICK_WIDTH * 4];
3410 S32 pick_face = ((LLVOVolume*)objectp)->getAllTEsSame() ? 0 : face; 3404 S32 pick_face = face;
3411 LLFace* facep = objectp->mDrawable->getFace(objectp->getFaceIndexOffset() + pick_face); 3405 LLFace* facep = objectp->mDrawable->getFace(pick_face);
3412 gCamera->setPerspective(FOR_SELECTION, scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH, FALSE); 3406 gCamera->setPerspective(FOR_SELECTION, scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH, FALSE);
3413 glViewport(scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH); 3407 glViewport(scaled_x - UV_PICK_HALF_WIDTH, scaled_y - UV_PICK_HALF_WIDTH, UV_PICK_WIDTH, UV_PICK_WIDTH);
3414 gPipeline.renderFaceForUVSelect(facep); 3408 gPipeline.renderFaceForUVSelect(facep);
@@ -3438,45 +3432,6 @@ void LLViewerWindow::analyzeHit(
3438 //llinfos << "DEBUG Hit Nothing " << llendl; 3432 //llinfos << "DEBUG Hit Nothing " << llendl;
3439} 3433}
3440 3434
3441
3442void LLViewerWindow::requestFastFrame(LLView *view)
3443{
3444 if (!mPickPending &&
3445 mWindow->getSwapMethod() != LLWindow::SWAP_METHOD_UNDEFINED &&
3446 gStartupState >= STATE_STARTED &&
3447 gSavedSettings.getBOOL("RenderFastUI") &&
3448 !gbCapturing)
3449 {
3450 if (!mFastFrameTimer.getStarted())
3451 {
3452 // we're double buffered, so when first requesting a fast ui update
3453 // we need to render the scene again so that the front and back buffers
3454 // are synced
3455 mRenderFullFrame = TRUE;
3456 }
3457 // calculation new expiration time and reset timer
3458 F32 expiration;
3459 if (mFastFrameTimer.hasExpired())
3460 {
3461 expiration = FAST_FRAME_INCREMENT;
3462 }
3463 else
3464 {
3465 expiration = llmin(MAX_FAST_FRAME_TIME, mFastFrameTimer.getTimeToExpireF32() + FAST_FRAME_INCREMENT);
3466 }
3467
3468 mFastFrameTimer.start();
3469 mFastFrameTimer.setTimerExpirySec(expiration);
3470
3471 LLView::sFastFrameView = view->getRootMostFastFrameView();
3472 if (!LLView::sFastFrameView)
3473 {
3474 LLView::sFastFrameView = view;
3475 }
3476 }
3477}
3478
3479
3480// Returns unit vector relative to camera 3435// Returns unit vector relative to camera
3481// indicating direction of point on screen x,y 3436// indicating direction of point on screen x,y
3482LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const 3437LLVector3 LLViewerWindow::mouseDirectionGlobal(const S32 x, const S32 y) const
@@ -3673,37 +3628,54 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d
3673} 3628}
3674 3629
3675// Saves an image to the harddrive as "SnapshotX" where X >= 1. 3630// Saves an image to the harddrive as "SnapshotX" where X >= 1.
3676BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw) 3631BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw, const LLString& extension_in)
3677{ 3632{
3678 if (! raw) 3633 if (! raw)
3679 { 3634 {
3680 return FALSE; 3635 return FALSE;
3681 } 3636 }
3637
3638 LLString extension(extension_in);
3639 if (extension.empty())
3640 {
3641 extension = (gSavedSettings.getBOOL("CompressSnapshotsToDisk")) ? ".j2c" : ".bmp";
3642 }
3643
3644 LLFilePicker::ESaveFilter pick_type;
3645 if (extension == ".j2c")
3646 pick_type = LLFilePicker::FFSAVE_J2C;
3647 else if (extension == ".bmp")
3648 pick_type = LLFilePicker::FFSAVE_BMP;
3649 else if (extension == ".tga")
3650 pick_type = LLFilePicker::FFSAVE_TGA;
3651 else
3652 pick_type = LLFilePicker::FFSAVE_ALL; // ???
3682 3653
3683 // Get a directory if this is the first time. 3654 // Get a directory if this is the first time.
3684 if (strlen(sSnapshotDir) == 0) 3655 if (strlen(sSnapshotDir) == 0) /* Flawfinder: ignore */
3685 { 3656 {
3686 LLString proposed_name( sSnapshotBaseName ); 3657 LLString proposed_name( sSnapshotBaseName );
3687 proposed_name.append( ".bmp" ); 3658 proposed_name.append( extension );
3688 3659
3689 // pick a directory in which to save 3660 // pick a directory in which to save
3690 LLFilePicker& picker = LLFilePicker::instance(); 3661 LLFilePicker& picker = LLFilePicker::instance();
3691 if (!picker.getSaveFile(LLFilePicker::FFSAVE_BMP, proposed_name.c_str())) 3662 if (!picker.getSaveFile(pick_type, proposed_name.c_str()))
3692 { 3663 {
3693 // Clicked cancel 3664 // Clicked cancel
3694 return FALSE; 3665 return FALSE;
3695 } 3666 }
3696 3667
3697 // Copy the directory + file name 3668 // Copy the directory + file name
3698 char directory[LL_MAX_PATH]; 3669 char directory[LL_MAX_PATH]; /* Flawfinder: ignore */
3699 strcpy(directory, picker.getFirstFile()); 3670 strncpy(directory, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */
3671 directory[LL_MAX_PATH -1] = '\0';
3700 3672
3701 // Smash the file extension 3673 // Smash the file extension
3702 S32 length = strlen(directory); 3674 S32 length = strlen(directory); /* Flawfinder: ignore */
3703 S32 index = length; 3675 S32 index = length;
3704 3676
3705 // Back up over ".bmp" 3677 // Back up over extension
3706 index -= 4; 3678 index -= extension.length();
3707 if (index >= 0 && directory[index] == '.') 3679 if (index >= 0 && directory[index] == '.')
3708 { 3680 {
3709 directory[index] = '\0'; 3681 directory[index] = '\0';
@@ -3724,12 +3696,14 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw)
3724 { 3696 {
3725 if (index + 1 <= length) 3697 if (index + 1 <= length)
3726 { 3698 {
3727 strcpy(LLViewerWindow::sSnapshotBaseName, directory + index + 1); 3699 strncpy(LLViewerWindow::sSnapshotBaseName, directory + index + 1, LL_MAX_PATH -1); /* Flawfinder: ignore */
3700 LLViewerWindow::sSnapshotBaseName[LL_MAX_PATH -1] = '\0';
3728 } 3701 }
3729 3702
3730 index++; 3703 index++;
3731 directory[index] = '\0'; 3704 directory[index] = '\0';
3732 strcpy(LLViewerWindow::sSnapshotDir, directory); 3705 strncpy(LLViewerWindow::sSnapshotDir, directory, LL_MAX_PATH -1); /* Flawfinder: ignore */
3706 LLViewerWindow::sSnapshotDir[LL_MAX_PATH -1] = '\0';
3733 } 3707 }
3734 } 3708 }
3735 3709
@@ -3740,10 +3714,9 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw)
3740 3714
3741 do 3715 do
3742 { 3716 {
3743 char extension[100];
3744 sprintf( extension, "_%.3d.bmp", i );
3745 filepath = sSnapshotDir; 3717 filepath = sSnapshotDir;
3746 filepath += sSnapshotBaseName; 3718 filepath += sSnapshotBaseName;
3719 filepath += llformat("_%.3d",i);
3747 filepath += extension; 3720 filepath += extension;
3748 3721
3749 struct stat stat_info; 3722 struct stat stat_info;
@@ -3752,12 +3725,12 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageRaw *raw)
3752 } 3725 }
3753 while( -1 != err ); // search until the file is not found (i.e., stat() gives an error). 3726 while( -1 != err ); // search until the file is not found (i.e., stat() gives an error).
3754 3727
3755 LLPointer<LLImageBMP> bmp_image = new LLImageBMP; 3728 LLPointer<LLImageFormatted> formatted_image = LLImageFormatted::createFromExtension(extension);
3756 LLImageBase::setSizeOverride(TRUE); 3729 LLImageBase::setSizeOverride(TRUE);
3757 BOOL success = bmp_image->encode(raw); 3730 BOOL success = formatted_image->encode(raw);
3758 if( success ) 3731 if( success )
3759 { 3732 {
3760 success = bmp_image->save(filepath); 3733 success = formatted_image->save(filepath);
3761 } 3734 }
3762 else 3735 else
3763 { 3736 {
@@ -3773,7 +3746,7 @@ void LLViewerWindow::saveMovieNumbered(void*)
3773 if (!gbCapturing) 3746 if (!gbCapturing)
3774 { 3747 {
3775 // Get a directory if this is the first time. 3748 // Get a directory if this is the first time.
3776 if (strlen(sSnapshotDir) == 0) 3749 if (strlen(sSnapshotDir) == 0) /* Flawfinder: ignore */
3777 { 3750 {
3778 LLString proposed_name( sMovieBaseName ); 3751 LLString proposed_name( sMovieBaseName );
3779#if LL_DARWIN 3752#if LL_DARWIN
@@ -3791,11 +3764,12 @@ void LLViewerWindow::saveMovieNumbered(void*)
3791 } 3764 }
3792 3765
3793 // Copy the directory + file name 3766 // Copy the directory + file name
3794 char directory[LL_MAX_PATH]; 3767 char directory[LL_MAX_PATH]; /* Flawfinder: ignore */
3795 strcpy(directory, picker.getFirstFile()); 3768 strncpy(directory, picker.getFirstFile(), LL_MAX_PATH -1); /* Flawfinder: ignore */
3769 directory[LL_MAX_PATH -1] = '\0';
3796 3770
3797 // Smash the file extension 3771 // Smash the file extension
3798 S32 length = strlen(directory); 3772 S32 length = strlen(directory); /* Flawfinder: ignore */
3799 S32 index = length; 3773 S32 index = length;
3800 3774
3801 // Back up over ".bmp" 3775 // Back up over ".bmp"
@@ -3820,12 +3794,14 @@ void LLViewerWindow::saveMovieNumbered(void*)
3820 { 3794 {
3821 if (index + 1 <= length) 3795 if (index + 1 <= length)
3822 { 3796 {
3823 strcpy(LLViewerWindow::sMovieBaseName, directory + index + 1); 3797 strncpy(LLViewerWindow::sMovieBaseName, directory + index + 1, LL_MAX_PATH -1); /* Flawfinder: ignore */
3798 LLViewerWindow::sMovieBaseName[LL_MAX_PATH -1] = '\0';
3824 } 3799 }
3825 3800
3826 index++; 3801 index++;
3827 directory[index] = '\0'; 3802 directory[index] = '\0';
3828 strcpy(LLViewerWindow::sSnapshotDir, directory); 3803 strncpy(LLViewerWindow::sSnapshotDir, directory, LL_MAX_PATH -1); /* Flawfinder: ignore */
3804 LLViewerWindow::sSnapshotDir[LL_MAX_PATH -1] = '\0';
3829 } 3805 }
3830 } 3806 }
3831 3807
@@ -3836,11 +3812,11 @@ void LLViewerWindow::saveMovieNumbered(void*)
3836 3812
3837 do 3813 do
3838 { 3814 {
3839 char extension[100]; 3815 char extension[100]; /* Flawfinder: ignore */
3840#if LL_DARWIN 3816#if LL_DARWIN
3841 sprintf( extension, "_%.3d.mov", i ); 3817 snprintf( extension, sizeof(extension), "_%.3d.mov", i ); /* Flawfinder: ignore */
3842#else 3818#else
3843 sprintf( extension, "_%.3d.avi", i ); 3819 snprintf( extension, sizeof(extension), "_%.3d.avi", i ); /* Flawfinder: ignore */
3844#endif 3820#endif
3845 filepath.assign( sSnapshotDir ); 3821 filepath.assign( sSnapshotDir );
3846 filepath.append( sMovieBaseName ); 3822 filepath.append( sMovieBaseName );
@@ -3944,9 +3920,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
3944 return FALSE; 3920 return FALSE;
3945 } 3921 }
3946 3922
3947 // IW 3/5/04 We don'a wan' nunna yer fest frumes har!
3948 finishFastFrame();
3949
3950 // PRE SNAPSHOT 3923 // PRE SNAPSHOT
3951 3924
3952 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); 3925 glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@@ -3960,10 +3933,11 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
3960 LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI); 3933 LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI);
3961 } 3934 }
3962 3935
3963 BOOL hide_hud = !gSavedSettings.getBOOL("RenderHUDInSnapshot") && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_HUD); 3936
3937 BOOL hide_hud = !gSavedSettings.getBOOL("RenderHUDInSnapshot") && LLPipeline::sShowHUDAttachments;
3964 if (hide_hud) 3938 if (hide_hud)
3965 { 3939 {
3966 LLPipeline::toggleRenderType((void*)LLPipeline::RENDER_TYPE_HUD); 3940 LLPipeline::sShowHUDAttachments = FALSE;
3967 } 3941 }
3968 3942
3969 // Copy screen to a buffer 3943 // Copy screen to a buffer
@@ -4027,7 +4001,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
4027 setupViewport(); 4001 setupViewport();
4028 BOOL first_time_through = (subimage_x + subimage_y == 0); 4002 BOOL first_time_through = (subimage_x + subimage_y == 0);
4029 gPickTransparent = FALSE; 4003 gPickTransparent = FALSE;
4030 gPickAlphaThreshold = 0.1f;
4031 gObjectList.renderObjectsForSelect(*gCamera, FALSE, !first_time_through); 4004 gObjectList.renderObjectsForSelect(*gCamera, FALSE, !first_time_through);
4032 } 4005 }
4033 else 4006 else
@@ -4101,7 +4074,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei
4101 4074
4102 if (hide_hud) 4075 if (hide_hud)
4103 { 4076 {
4104 LLPipeline::toggleRenderType((void*)LLPipeline::RENDER_TYPE_HUD); 4077 LLPipeline::sShowHUDAttachments = TRUE;
4105 } 4078 }
4106 4079
4107 if (high_res) 4080 if (high_res)
@@ -4363,6 +4336,12 @@ void LLViewerWindow::stopGL(BOOL save_state)
4363 if (!gGLManager.mIsDisabled) 4336 if (!gGLManager.mIsDisabled)
4364 { 4337 {
4365 llinfos << "Shutting down GL..." << llendl; 4338 llinfos << "Shutting down GL..." << llendl;
4339
4340 // Pause texture decode threads (will get unpaused during main loop)
4341 gTextureCache->pause();
4342 gImageDecodeThread->pause();
4343 gTextureFetch->pause();
4344
4366 gSky.destroyGL(); 4345 gSky.destroyGL();
4367 stop_glerror(); 4346 stop_glerror();
4368 4347
@@ -4381,8 +4360,6 @@ void LLViewerWindow::stopGL(BOOL save_state)
4381 LLDynamicTexture::destroyGL(); 4360 LLDynamicTexture::destroyGL();
4382 stop_glerror(); 4361 stop_glerror();
4383 4362
4384 if(gParcelMgr) gParcelMgr->destroyGL();
4385
4386 gPipeline.destroyGL(); 4363 gPipeline.destroyGL();
4387 4364
4388 gCone.cleanupGL(); 4365 gCone.cleanupGL();
@@ -4415,10 +4392,8 @@ void LLViewerWindow::restoreGL(const LLString& progress_message)
4415 LLManipTranslate::restoreGL(); 4392 LLManipTranslate::restoreGL();
4416 gImageList.restoreGL(); 4393 gImageList.restoreGL();
4417 gBumpImageList.restoreGL(); 4394 gBumpImageList.restoreGL();
4418 gPipeline.setUseAGP(gSavedSettings.getBOOL("RenderUseAGP"));
4419 LLDynamicTexture::restoreGL(); 4395 LLDynamicTexture::restoreGL();
4420 LLVOAvatar::restoreGL(); 4396 LLVOAvatar::restoreGL();
4421 if (gParcelMgr) gParcelMgr->restoreGL();
4422 4397
4423 if (gFloaterCustomize && gFloaterCustomize->getVisible()) 4398 if (gFloaterCustomize && gFloaterCustomize->getVisible())
4424 { 4399 {