diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 59325ab3c..ca33d5d3b 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -2155,6 +2155,8 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate) if (mCameraMode != CAMERA_MODE_MOUSELOOK) { + mMouselookTimer.reset(); + gFocusMgr.setKeyboardFocus( NULL ); if (gSavedSettings.getBOOL("AONoStandsInMouselook")) LLFloaterAO::stopMotion(LLFloaterAO::getCurrentStandId(), FALSE,TRUE); diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index c09ba546c..ee477a12c 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -370,6 +370,11 @@ private: ** ** *******************************************************************************/ +//Custom +public: + F32 getMouseLookDuration() const { return mMouselookTimer.getElapsedTimeF32(); } +private: + LLTimer mMouselookTimer; }; extern LLAgentCamera gAgentCamera; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 954834d60..fd16b8f65 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4501,6 +4501,20 @@ void LLViewerWindow::destroyWindow() void LLViewerWindow::drawMouselookInstructions() { + static const F32 INSTRUCTIONS_OPAQUE_TIME = 10.f; + static const F32 INSTRUCTIONS_FADE_TIME = 5.f; + + F32 mouselook_duration = gAgentCamera.getMouseLookDuration(); + if( mouselook_duration >= (INSTRUCTIONS_OPAQUE_TIME+INSTRUCTIONS_OPAQUE_TIME) ) + return; + + F32 alpha = 1.f; + + if( mouselook_duration > INSTRUCTIONS_OPAQUE_TIME) //instructions are fading + { + alpha = (F32) sqrt(1.f-pow(((mouselook_duration-INSTRUCTIONS_OPAQUE_TIME)/INSTRUCTIONS_FADE_TIME),2.f)); + } + // Draw instructions for mouselook ("Press ESC to leave Mouselook" in a box at the top of the screen.) const std::string instructions = "Press ESC to leave Mouselook."; const LLFontGL* font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF ); @@ -4515,7 +4529,7 @@ void LLViewerWindow::drawMouselookInstructions() { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - gGL.color4f( 0.9f, 0.9f, 0.9f, 1.0f ); + gGL.color4f( 0.9f, 0.9f, 0.9f, alpha ); gl_rect_2d( instructions_rect ); } @@ -4523,7 +4537,7 @@ void LLViewerWindow::drawMouselookInstructions() instructions, 0, instructions_rect.mLeft + INSTRUCTIONS_PAD, instructions_rect.mTop - INSTRUCTIONS_PAD, - LLColor4( 0.0f, 0.0f, 0.0f, 1.f ), + LLColor4( 0.0f, 0.0f, 0.0f, alpha ), LLFontGL::LEFT, LLFontGL::TOP); }