From bf0bb8d59a3fe8356196e5fa237d9b211764b655 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 8 Oct 2011 02:56:39 -0500 Subject: [PATCH] More dead code (renderforselect) removal. --- indra/newview/llglsandbox.cpp | 3 - indra/newview/llselectmgr.cpp | 2 - indra/newview/llviewerdisplay.cpp | 4 - indra/newview/llviewermenu.cpp | 1 - indra/newview/llviewerwindow.cpp | 148 +----------------------------- indra/newview/llviewerwindow.h | 11 --- 6 files changed, 5 insertions(+), 164 deletions(-) diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp index c4829d326..1844363d9 100644 --- a/indra/newview/llglsandbox.cpp +++ b/indra/newview/llglsandbox.cpp @@ -73,9 +73,6 @@ #include "rlvhandler.h" // [/RLVa:KB] - -extern BOOL gDebugSelect; - // Returns true if you got at least one object void LLToolSelectRect::handleRectangleSelection(S32 x, S32 y, MASK mask) { diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index a68f14594..0f75bdf24 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -113,8 +113,6 @@ const S32 TE_SELECT_MASK_ALL = 0xFFFFFFFF; // Globals // -//BOOL gDebugSelectMgr = FALSE; - //BOOL gHideSelectedObjects = FALSE; //BOOL gAllowSelectAvatar = FALSE; diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index d75f20228..e5982d4e5 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -1420,10 +1420,6 @@ void render_ui_2d() stop_glerror(); } gViewerWindow->draw(); - if (gDebugSelect) - { - gViewerWindow->drawPickBuffer(); - } // reset current origin for font rendering, in case of tiling render LLFontGL::sCurOrigin.set(0, 0); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 9faee6106..0577f7b5d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -291,7 +291,6 @@ void handle_test_load_url(void*); extern BOOL gDebugClicks; extern BOOL gDebugWindowProc; extern BOOL gDebugTextEditorTips; -//extern BOOL gDebugSelectMgr; extern BOOL gDebugAvatarRotation; extern BOOL gShowOverlayTitle; extern BOOL gOcclusionCull; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 90f87357e..6c9bd57f4 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -220,9 +220,6 @@ extern S32 gJamesInt; LLViewerWindow *gViewerWindow = NULL; LLVelocityBar *gVelocityBar = NULL; - -BOOL gDebugSelect = FALSE; - LLFrameTimer gMouseIdleTimer; LLFrameTimer gAwayTimer; LLFrameTimer gAwayTriggerTimer; @@ -3634,27 +3631,8 @@ void LLViewerWindow::pickAsync(S32 x, S32 y_from_bot, MASK mask, void (*callback pick_transparent = TRUE; } - // center initial pick frame buffer region under mouse cursor - // since that area is guaranteed to be onscreen and hence a valid - // part of the framebuffer - if (mPicks.empty()) - { - mPickScreenRegion.setCenterAndSize(x, y_from_bot, PICK_DIAMETER, PICK_DIAMETER); - - if (mPickScreenRegion.mLeft < 0) mPickScreenRegion.translate(-mPickScreenRegion.mLeft, 0); - if (mPickScreenRegion.mBottom < 0) mPickScreenRegion.translate(0, -mPickScreenRegion.mBottom); - if (mPickScreenRegion.mRight > mWindowRectRaw.getWidth() ) mPickScreenRegion.translate(mWindowRectRaw.getWidth() - mPickScreenRegion.mRight, 0); - if (mPickScreenRegion.mTop > mWindowRectRaw.getHeight() ) mPickScreenRegion.translate(0, mWindowRectRaw.getHeight() - mPickScreenRegion.mTop); - } - - // set frame buffer region for picking results - // stack multiple picks left to right - LLRect screen_region = mPickScreenRegion; - screen_region.translate(mPicks.size() * PICK_DIAMETER, 0); - - LLPickInfo pick(LLCoordGL(x, y_from_bot), screen_region, mask, pick_transparent, get_surface_info, callback); - - schedulePick(pick); + LLPickInfo pick_info(LLCoordGL(x, y_from_bot), mask, pick_transparent, get_surface_info, callback); + schedulePick(pick_info); } void LLViewerWindow::schedulePick(LLPickInfo& pick_info) @@ -3669,7 +3647,6 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info) return; } - llassert_always(pick_info.mScreenRegion.notEmpty()); mPicks.push_back(pick_info); // delay further event processing until we receive results of pick @@ -3720,11 +3697,10 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot, BOOL pick_trans return LLPickInfo(); } - pickAsync(x, y_from_bot, gKeyboard->currentMask(TRUE), NULL, pick_transparent); - // assume that pickAsync put the results in the back of the mPicks list - mLastPick = mPicks.back(); + // shortcut queueing in mPicks and just update mLastPick in place + MASK key_mask = gKeyboard->currentMask(TRUE); + mLastPick = LLPickInfo(LLCoordGL(x, y_from_bot), key_mask, pick_transparent, TRUE, NULL); mLastPick.fetchResults(); - mPicks.pop_back(); return mLastPick; } @@ -5281,12 +5257,6 @@ F32 LLViewerWindow::getDisplayAspectRatio() const } } - -void LLViewerWindow::drawPickBuffer() const -{ - mHoverPick.drawPickBuffer(); -} - void LLViewerWindow::calcDisplayScale() { F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor"); @@ -5456,13 +5426,11 @@ LLPickInfo::LLPickInfo() } LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos, - const LLRect& screen_region, MASK keyboard_mask, BOOL pick_transparent, BOOL pick_uv_coords, void (*pick_callback)(const LLPickInfo& pick_info)) : mMousePt(mouse_pos), - mScreenRegion(screen_region), mKeyMask(keyboard_mask), mPickCallback(pick_callback), mPickType(PICK_INVALID), @@ -5478,10 +5446,6 @@ LLPickInfo::LLPickInfo(const LLCoordGL& mouse_pos, { } -LLPickInfo::~LLPickInfo() -{ -} - void LLPickInfo::fetchResults() { @@ -5500,59 +5464,14 @@ void LLPickInfo::fetchResults() NULL, -1, mPickTransparent, &face_hit, &intersection, &uv, &normal, &binormal); - // read back colors and depth values from buffer - //glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, mPickBuffer); - //glReadPixels(mScreenRegion.mLeft, mScreenRegion.mBottom, mScreenRegion.getWidth(), mScreenRegion.getHeight(), GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, mPickDepthBuffer ); - - // find pick region that is fully onscreen - //LLCoordGL scaled_pick_point;; - //scaled_pick_point.mX = llclamp(llround((F32)mMousePt.mX * gViewerWindow->getDisplayScale().mV[VX]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayWidth() - PICK_HALF_WIDTH); - //scaled_pick_point.mY = llclamp(llround((F32)mMousePt.mY * gViewerWindow->getDisplayScale().mV[VY]), PICK_HALF_WIDTH, gViewerWindow->getWindowDisplayHeight() - PICK_HALF_WIDTH); - //S32 pixel_index = PICK_HALF_WIDTH * PICK_DIAMETER + PICK_HALF_WIDTH; - //S32 pick_id = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2]; - //F32 depth = mPickDepthBuffer[pixel_index]; - - //S32 x_offset = mMousePt.mX - llround((F32)scaled_pick_point.mX / gViewerWindow->getDisplayScale().mV[VX]); - //S32 y_offset = mMousePt.mY - llround((F32)scaled_pick_point.mY / gViewerWindow->getDisplayScale().mV[VY]); - mPickPt = mMousePt; - // we hit nothing, scan surrounding pixels for something useful - /*if (!pick_id) - { - S32 closest_distance = 10000; - //S32 closest_pick_name = 0; - for (S32 col = 0; col < PICK_DIAMETER; col++) - { - for (S32 row = 0; row < PICK_DIAMETER; row++) - { - S32 distance_squared = (llabs(col - x_offset - PICK_HALF_WIDTH) * llabs(col - x_offset - PICK_HALF_WIDTH)) + (llabs(row - y_offset - PICK_HALF_WIDTH) * llabs(row - y_offset - PICK_HALF_WIDTH)); - pixel_index = row * PICK_DIAMETER + col; - S32 test_name = (U32)mPickBuffer[(pixel_index * 4) + 0] << 16 | (U32)mPickBuffer[(pixel_index * 4) + 1] << 8 | (U32)mPickBuffer[(pixel_index * 4) + 2]; - if (test_name && distance_squared < closest_distance) - { - closest_distance = distance_squared; - pick_id = test_name; - depth = mPickDepthBuffer[pixel_index]; - mPickPt.mX = mMousePt.mX + (col - PICK_HALF_WIDTH); - mPickPt.mY = mMousePt.mY + (row - PICK_HALF_WIDTH); - } - } - } - }*/ - - U32 te_offset = face_hit > -1 ? face_hit : 0; - //pick_id &= 0x000fffff; //unproject relative clicked coordinate from window coordinate using GL LLViewerObject* objectp = hit_object; - //if (pick_id == (S32)GL_NAME_PARCEL_WALL) - //{ - // mPickType = PICK_PARCEL_WALL; - //} if (hit_icon && (!objectp || icon_dist < (LLViewerCamera::getInstance()->getOrigin()-intersection).magVec())) @@ -5596,20 +5515,6 @@ void LLPickInfo::fetchResults() mObjectID = objectp->mID; mObjectFace = (te_offset == NO_FACE) ? -1 : (S32)te_offset; - /*glh::matrix4f newModel((F32*)LLViewerCamera::getInstance()->getModelview().mMatrix); - - for(U32 i = 0; i < 16; ++i) - { - modelview[i] = newModel.m[i]; - projection[i] = LLViewerCamera::getInstance()->getProjection().mMatrix[i/4][i%4]; - } - glGetIntegerv( GL_VIEWPORT, viewport ); - - winX = ((F32)mPickPt.mX) * gViewerWindow->getDisplayScale().mV[VX]; - winY = ((F32)mPickPt.mY) * gViewerWindow->getDisplayScale().mV[VY]; - - gluUnProject( winX, winY, depth, modelview, projection, viewport, &posX, &posY, &posZ);*/ - mPosGlobal = gAgent.getPosGlobalFromAgent(intersection); if (mWantSurfaceInfo) @@ -5644,49 +5549,6 @@ void LLPickInfo::updateXYCoords() } } -void LLPickInfo::drawPickBuffer() const -{ - if (mPickBuffer) - { - gGL.pushMatrix(); - LLGLDisable no_blend(GL_BLEND); - LLGLDisable no_alpha_test(GL_ALPHA_TEST); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glPixelZoom(10.f, 10.f); - LLVector2 display_scale = gViewerWindow->getDisplayScale(); - glRasterPos2f(((F32)mMousePt.mX * display_scale.mV[VX] + 10.f), - ((F32)mMousePt.mY * display_scale.mV[VY] + 10.f)); - glDrawPixels(PICK_DIAMETER, PICK_DIAMETER, GL_RGBA, GL_UNSIGNED_BYTE, mPickBuffer); - glPixelZoom(1.f, 1.f); - gGL.color4fv(LLColor4::white.mV); - gl_rect_2d(llround((F32)mMousePt.mX * display_scale.mV[VX] - (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mY * display_scale.mV[VY] + (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mX * display_scale.mV[VX] + (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mY * display_scale.mV[VY] - (F32)(PICK_HALF_WIDTH)), - FALSE); - gl_line_2d(llround((F32)mMousePt.mX * display_scale.mV[VX] - (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mY * display_scale.mV[VY] + (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mX * display_scale.mV[VX] + 10.f), - llround((F32)mMousePt.mY * display_scale.mV[VY] + (F32)(PICK_DIAMETER) * 10.f + 10.f)); - gl_line_2d(llround((F32)mMousePt.mX * display_scale.mV[VX] + (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mY * display_scale.mV[VY] - (F32)(PICK_HALF_WIDTH)), - llround((F32)mMousePt.mX * display_scale.mV[VX] + (F32)(PICK_DIAMETER) * 10.f + 10.f), - llround((F32)mMousePt.mY * display_scale.mV[VY] + 10.f)); - gGL.translatef(10.f, 10.f, 0.f); - gl_rect_2d(llround((F32)mPickPt.mX * display_scale.mV[VX]), - llround((F32)mPickPt.mY * display_scale.mV[VY] + (F32)(PICK_DIAMETER) * 10.f), - llround((F32)mPickPt.mX * display_scale.mV[VX] + (F32)(PICK_DIAMETER) * 10.f), - llround((F32)mPickPt.mY * display_scale.mV[VY]), - FALSE); - gl_rect_2d(llround((F32)mPickPt.mX * display_scale.mV[VX]), - llround((F32)mPickPt.mY * display_scale.mV[VY] + 10.f), - llround((F32)mPickPt.mX * display_scale.mV[VX] + 10.f), - llround((F32)mPickPt.mY * display_scale.mV[VY]), - FALSE); - gGL.popMatrix(); - } -} - void LLPickInfo::getSurfaceInfo() { // set values to uninitialized - this is what we return if no intersection is found diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 036d23bb6..c5ae97049 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -84,18 +84,15 @@ public: public: LLPickInfo(); LLPickInfo(const LLCoordGL& mouse_pos, - const LLRect& screen_region, MASK keyboard_mask, BOOL pick_transparent, BOOL pick_surface_info, void (*pick_callback)(const LLPickInfo& pick_info)); - ~LLPickInfo(); void fetchResults(); LLPointer getObject() const; LLUUID getObjectID() const { return mObjectID; } bool isValid() const { return mPickType != PICK_INVALID; } - void drawPickBuffer() const; static bool isFlora(LLViewerObject* object); @@ -118,16 +115,12 @@ public: LLVector3 mNormal; LLVector3 mBinormal; BOOL mPickTransparent; - LLRect mScreenRegion; void getSurfaceInfo(); private: void updateXYCoords(); BOOL mWantSurfaceInfo; // do we populate mUVCoord, mNormal, mBinormal? - U8 mPickBuffer[PICK_DIAMETER * PICK_DIAMETER * 4]; - F32 mPickDepthBuffer[PICK_DIAMETER * PICK_DIAMETER]; - BOOL mPickParcelWall; }; @@ -381,8 +374,6 @@ public: const LLVector2& getDisplayScale() const { return mDisplayScale; } void calcDisplayScale(); - void drawPickBuffer() const; - private: bool shouldShowToolTipFor(LLMouseHandler *mh); static bool onAlert(const LLSD& notify); @@ -494,8 +485,6 @@ extern LLFrameTimer gMouseIdleTimer; // how long has it been since the mouse l extern LLFrameTimer gAwayTimer; // tracks time before setting the avatar away state to true extern LLFrameTimer gAwayTriggerTimer; // how long the avatar has been away -extern BOOL gDebugSelect; - extern BOOL gDebugFastUIRender; extern LLViewerObject* gDebugRaycastObject; extern LLVector3 gDebugRaycastIntersection;