diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llviewerwindow.cpp | 90 |
1 files changed, 70 insertions, 20 deletions
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index 109b3c2..2f49b67 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp | |||
@@ -4,7 +4,7 @@ | |||
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2001&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2001-2008, Linden Research, Inc. | 7 | * Copyright (c) 2001-2009, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
@@ -181,6 +181,7 @@ | |||
181 | #include "llspatialpartition.h" | 181 | #include "llspatialpartition.h" |
182 | #include "llviewerjoystick.h" | 182 | #include "llviewerjoystick.h" |
183 | #include "llviewernetwork.h" | 183 | #include "llviewernetwork.h" |
184 | #include "llpostprocess.h" | ||
184 | 185 | ||
185 | #if LL_WINDOWS | 186 | #if LL_WINDOWS |
186 | #include <tchar.h> // For Unicode conversion methods | 187 | #include <tchar.h> // For Unicode conversion methods |
@@ -3535,6 +3536,29 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans | |||
3535 | return mLastPick; | 3536 | return mLastPick; |
3536 | } | 3537 | } |
3537 | 3538 | ||
3539 | LLHUDIcon* LLViewerWindow::cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 depth, | ||
3540 | LLVector3* intersection) | ||
3541 | { | ||
3542 | S32 x = mouse_x; | ||
3543 | S32 y = mouse_y; | ||
3544 | |||
3545 | if ((mouse_x == -1) && (mouse_y == -1)) // use current mouse position | ||
3546 | { | ||
3547 | x = getCurrentMouseX(); | ||
3548 | y = getCurrentMouseY(); | ||
3549 | } | ||
3550 | |||
3551 | // world coordinates of mouse | ||
3552 | LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y); | ||
3553 | LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin(); | ||
3554 | LLVector3 mouse_world_start = mouse_point_global; | ||
3555 | LLVector3 mouse_world_end = mouse_point_global + mouse_direction_global * depth; | ||
3556 | |||
3557 | return LLHUDIcon::lineSegmentIntersectAll(mouse_world_start, mouse_world_end, intersection); | ||
3558 | |||
3559 | |||
3560 | } | ||
3561 | |||
3538 | LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 depth, | 3562 | LLViewerObject* LLViewerWindow::cursorIntersect(S32 mouse_x, S32 mouse_y, F32 depth, |
3539 | LLViewerObject *this_object, | 3563 | LLViewerObject *this_object, |
3540 | S32 this_face, | 3564 | S32 this_face, |
@@ -3644,7 +3668,7 @@ LLVector3 LLViewerWindow::mousePointHUD(const S32 x, const S32 y) const | |||
3644 | F32 hud_x = -((F32)x - (F32)width/2.f) / height; | 3668 | F32 hud_x = -((F32)x - (F32)width/2.f) / height; |
3645 | F32 hud_y = ((F32)y - (F32)height/2.f) / height; | 3669 | F32 hud_y = ((F32)y - (F32)height/2.f) / height; |
3646 | 3670 | ||
3647 | return LLVector3(0.f, hud_x, hud_y); | 3671 | return LLVector3(0.f, hud_x/gAgent.mHUDCurZoom, hud_y/gAgent.mHUDCurZoom); |
3648 | } | 3672 | } |
3649 | 3673 | ||
3650 | // Returns unit vector relative to camera in camera space | 3674 | // Returns unit vector relative to camera in camera space |
@@ -4512,6 +4536,10 @@ void LLViewerWindow::dumpState() | |||
4512 | 4536 | ||
4513 | void LLViewerWindow::stopGL(BOOL save_state) | 4537 | void LLViewerWindow::stopGL(BOOL save_state) |
4514 | { | 4538 | { |
4539 | //Note: --bao | ||
4540 | //if not necessary, do not change the order of the function calls in this function. | ||
4541 | //if change something, make sure it will not break anything. | ||
4542 | //especially be careful to put anything behind gImageList.destroyGL(save_state); | ||
4515 | if (!gGLManager.mIsDisabled) | 4543 | if (!gGLManager.mIsDisabled) |
4516 | { | 4544 | { |
4517 | llinfos << "Shutting down GL..." << llendl; | 4545 | llinfos << "Shutting down GL..." << llendl; |
@@ -4520,12 +4548,12 @@ void LLViewerWindow::stopGL(BOOL save_state) | |||
4520 | LLAppViewer::getTextureCache()->pause(); | 4548 | LLAppViewer::getTextureCache()->pause(); |
4521 | LLAppViewer::getImageDecodeThread()->pause(); | 4549 | LLAppViewer::getImageDecodeThread()->pause(); |
4522 | LLAppViewer::getTextureFetch()->pause(); | 4550 | LLAppViewer::getTextureFetch()->pause(); |
4523 | 4551 | ||
4524 | gSky.destroyGL(); | 4552 | gSky.destroyGL(); |
4525 | stop_glerror(); | 4553 | stop_glerror(); |
4526 | 4554 | ||
4527 | gImageList.destroyGL(save_state); | 4555 | LLManipTranslate::destroyGL() ; |
4528 | stop_glerror(); | 4556 | stop_glerror(); |
4529 | 4557 | ||
4530 | gBumpImageList.destroyGL(); | 4558 | gBumpImageList.destroyGL(); |
4531 | stop_glerror(); | 4559 | stop_glerror(); |
@@ -4549,6 +4577,14 @@ void LLViewerWindow::stopGL(BOOL save_state) | |||
4549 | gSphere.cleanupGL(); | 4577 | gSphere.cleanupGL(); |
4550 | gCylinder.cleanupGL(); | 4578 | gCylinder.cleanupGL(); |
4551 | 4579 | ||
4580 | if(gPostProcess) | ||
4581 | { | ||
4582 | gPostProcess->invalidate(); | ||
4583 | } | ||
4584 | |||
4585 | gImageList.destroyGL(save_state); | ||
4586 | stop_glerror(); | ||
4587 | |||
4552 | gGLManager.mIsDisabled = TRUE; | 4588 | gGLManager.mIsDisabled = TRUE; |
4553 | stop_glerror(); | 4589 | stop_glerror(); |
4554 | 4590 | ||
@@ -4558,25 +4594,32 @@ void LLViewerWindow::stopGL(BOOL save_state) | |||
4558 | 4594 | ||
4559 | void LLViewerWindow::restoreGL(const std::string& progress_message) | 4595 | void LLViewerWindow::restoreGL(const std::string& progress_message) |
4560 | { | 4596 | { |
4597 | //Note: --bao | ||
4598 | //if not necessary, do not change the order of the function calls in this function. | ||
4599 | //if change something, make sure it will not break anything. | ||
4600 | //especially, be careful to put something before gImageList.restoreGL(); | ||
4561 | if (gGLManager.mIsDisabled) | 4601 | if (gGLManager.mIsDisabled) |
4562 | { | 4602 | { |
4563 | llinfos << "Restoring GL..." << llendl; | 4603 | llinfos << "Restoring GL..." << llendl; |
4564 | gGLManager.mIsDisabled = FALSE; | 4604 | gGLManager.mIsDisabled = FALSE; |
4605 | |||
4606 | initGLDefaults(); | ||
4607 | LLGLState::restoreGL(); | ||
4608 | gImageList.restoreGL(); | ||
4565 | 4609 | ||
4566 | // for future support of non-square pixels, and fonts that are properly stretched | 4610 | // for future support of non-square pixels, and fonts that are properly stretched |
4567 | //LLFontGL::destroyDefaultFonts(); | 4611 | //LLFontGL::destroyDefaultFonts(); |
4568 | initFonts(); | 4612 | initFonts(); |
4569 | initGLDefaults(); | 4613 | |
4570 | LLGLState::restoreGL(); | ||
4571 | gSky.restoreGL(); | 4614 | gSky.restoreGL(); |
4572 | gPipeline.restoreGL(); | 4615 | gPipeline.restoreGL(); |
4573 | LLDrawPoolWater::restoreGL(); | 4616 | LLDrawPoolWater::restoreGL(); |
4574 | LLManipTranslate::restoreGL(); | 4617 | LLManipTranslate::restoreGL(); |
4575 | gImageList.restoreGL(); | 4618 | |
4576 | gBumpImageList.restoreGL(); | 4619 | gBumpImageList.restoreGL(); |
4577 | LLDynamicTexture::restoreGL(); | 4620 | LLDynamicTexture::restoreGL(); |
4578 | LLVOAvatar::restoreGL(); | 4621 | LLVOAvatar::restoreGL(); |
4579 | 4622 | ||
4580 | gResizeScreenTexture = TRUE; | 4623 | gResizeScreenTexture = TRUE; |
4581 | 4624 | ||
4582 | if (gFloaterCustomize && gFloaterCustomize->getVisible()) | 4625 | if (gFloaterCustomize && gFloaterCustomize->getVisible()) |
@@ -4625,6 +4668,7 @@ void LLViewerWindow::toggleFullscreen(BOOL show_progress) | |||
4625 | if (mWindow) | 4668 | if (mWindow) |
4626 | { | 4669 | { |
4627 | mWantFullscreen = mWindow->getFullscreen() ? FALSE : TRUE; | 4670 | mWantFullscreen = mWindow->getFullscreen() ? FALSE : TRUE; |
4671 | mIsFullscreenChecked = mWindow->getFullscreen() ? FALSE : TRUE; | ||
4628 | mShowFullscreenProgress = show_progress; | 4672 | mShowFullscreenProgress = show_progress; |
4629 | } | 4673 | } |
4630 | } | 4674 | } |
@@ -5202,6 +5246,13 @@ void LLPickInfo::fetchResults() | |||
5202 | LLVector3 intersection, normal, binormal; | 5246 | LLVector3 intersection, normal, binormal; |
5203 | LLVector2 uv; | 5247 | LLVector2 uv; |
5204 | 5248 | ||
5249 | LLHUDIcon* hit_icon = gViewerWindow->cursorIntersectIcon(mMousePt.mX, mMousePt.mY, 512.f, &intersection); | ||
5250 | |||
5251 | F32 icon_dist = 0.f; | ||
5252 | if (hit_icon) | ||
5253 | { | ||
5254 | icon_dist = (LLViewerCamera::getInstance()->getOrigin()-intersection).magVec(); | ||
5255 | } | ||
5205 | LLViewerObject* hit_object = gViewerWindow->cursorIntersect(mMousePt.mX, mMousePt.mY, 512.f, | 5256 | LLViewerObject* hit_object = gViewerWindow->cursorIntersect(mMousePt.mX, mMousePt.mY, 512.f, |
5206 | NULL, -1, mPickTransparent, &face_hit, | 5257 | NULL, -1, mPickTransparent, &face_hit, |
5207 | &intersection, &uv, &normal, &binormal); | 5258 | &intersection, &uv, &normal, &binormal); |
@@ -5311,16 +5362,15 @@ void LLPickInfo::fetchResults() | |||
5311 | } | 5362 | } |
5312 | } | 5363 | } |
5313 | } | 5364 | } |
5314 | //else | 5365 | if (hit_icon && |
5315 | //{ | 5366 | (!objectp || |
5367 | icon_dist < (LLViewerCamera::getInstance()->getOrigin()-intersection).magVec())) | ||
5368 | { | ||
5316 | // was this name referring to a hud icon? | 5369 | // was this name referring to a hud icon? |
5317 | // mHUDIcon = LLHUDIcon::handlePick(pick_id); | 5370 | mHUDIcon = hit_icon; |
5318 | // if (mHUDIcon) | 5371 | mPickType = PICK_ICON; |
5319 | // { | 5372 | mPosGlobal = mHUDIcon->getPositionGlobal(); |
5320 | // mPickType = PICK_ICON; | 5373 | } |
5321 | // mPosGlobal = mHUDIcon->getPositionGlobal(); | ||
5322 | // } | ||
5323 | //} | ||
5324 | 5374 | ||
5325 | if (mPickCallback) | 5375 | if (mPickCallback) |
5326 | { | 5376 | { |