From 6c8cfff7aba5a757499bde55aef6a70d1443a09f Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Tue, 11 Dec 2018 18:11:58 +0200 Subject: [PATCH 1/7] SL-10176 - [Love Me Render] MacOS Quit / Shutdown crash --- indra/llwindow/llwindowmacosx-objc.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llwindow/llwindowmacosx-objc.mm b/indra/llwindow/llwindowmacosx-objc.mm index 156d7965cd..c3eb9b8c8a 100644 --- a/indra/llwindow/llwindowmacosx-objc.mm +++ b/indra/llwindow/llwindowmacosx-objc.mm @@ -380,8 +380,8 @@ void closeWindow(NSWindowRef window) void removeGLView(GLViewRef view) { + [(LLOpenGLView*)view clearGLContext]; [(LLOpenGLView*)view removeFromSuperview]; - [(LLOpenGLView*)view release]; } void setupInputWindow(NSWindowRef window, GLViewRef glview) From 2e55e529d48a4dd3f73584728f0b59f6d71585a6 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Tue, 8 Jan 2019 18:26:34 +0200 Subject: [PATCH 2/7] SL-10194 Selecting mesh face doesn't highlight the face in any way - Implemented --- indra/newview/llface.cpp | 125 +++++++++++++++++++ indra/newview/llface.h | 1 + indra/newview/llselectmgr.cpp | 225 ++++++++-------------------------- indra/newview/llselectmgr.h | 1 - 4 files changed, 179 insertions(+), 173 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 4f18cda92f..32280d3d90 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -36,6 +36,8 @@ #include "llmatrix4a.h" #include "v3color.h" +#include "lldefs.h" + #include "lldrawpoolavatar.h" #include "lldrawpoolbump.h" #include "llgl.h" @@ -601,6 +603,129 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color) } +void renderFace(LLDrawable* drawable, LLFace *face) +{ + LLVOVolume* vobj = drawable->getVOVolume(); + if (vobj) + { + LLVertexBuffer::unbind(); + gGL.pushMatrix(); + gGL.multMatrix((F32*)vobj->getRelativeXform().mMatrix); + + LLVolume* volume = NULL; + + if (drawable->isState(LLDrawable::RIGGED)) + { + vobj->updateRiggedVolume(); + volume = vobj->getRiggedVolume(); + } + else + { + volume = vobj->getVolume(); + } + + if (volume) + { + const LLVolumeFace& vol_face = volume->getVolumeFace(face->getTEOffset()); + LLVertexBuffer::drawElements(LLRender::TRIANGLES, vol_face.mPositions, NULL, vol_face.mNumIndices, vol_face.mIndices); + } + + gGL.popMatrix(); + } +} + +void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool bSelected, bool wireframe_selection, bool bRenderHiddenSelections) +{ + //Need to because crash on ATI 3800 (and similar cards) MAINT-5018 + LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); + + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + + if (shader) + { + gDebugProgram.bind(); + } + + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); + + BOOL is_hud_object = mVObjp->isHUDAttachment(); + + if (mDrawablep->isActive()) + { + gGL.loadMatrix(gGLModelView); + gGL.multMatrix((F32*)mVObjp->getRenderMatrix().mMatrix); + } + else if (!is_hud_object) + { + gGL.loadIdentity(); + gGL.multMatrix(gGLModelView); + LLVector3 trans = mVObjp->getRegion()->getOriginAgent(); + gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); + } + + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + + + if (bRenderHiddenSelections) + { + gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE); + LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); + if (shader) + { + gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); + renderFace(mDrawablep, this); + } + else + { + LLGLEnable fog(GL_FOG); + glFogi(GL_FOG_MODE, GL_LINEAR); + float d = (LLViewerCamera::getInstance()->getPointOfInterest() - LLViewerCamera::getInstance()->getOrigin()).magVec(); + LLColor4 fogCol = color * fogCfx; + glFogf(GL_FOG_START, d); + glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); + glFogfv(GL_FOG_COLOR, fogCol.mV); + + gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); + { + gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); + renderFace(mDrawablep, this); + } + } + } + + gGL.flush(); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + + gGL.diffuseColor4f(color.mV[VRED] * 2, color.mV[VGREEN] * 2, color.mV[VBLUE] * 2, color.mV[VALPHA]); + + { + LLGLDisable depth(wireframe_selection ? 0 : GL_BLEND); + LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST); + + if (!wireframe_selection) + { //modify wireframe into outline selection mode + glStencilFunc(GL_NOTEQUAL, 2, 0xffff); + glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); + } + + LLGLEnable offset(GL_POLYGON_OFFSET_LINE); + glPolygonOffset(3.f, 3.f); + glLineWidth(5.f); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + renderFace(mDrawablep, this); + } + + glLineWidth(1.f); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + gGL.popMatrix(); + + if (shader) + { + shader->bind(); + } +} + /* removed in lieu of raycast uv detection void LLFace::renderSelectedUV() { diff --git a/indra/newview/llface.h b/indra/newview/llface.h index ee545acb94..7e68e81862 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -198,6 +198,7 @@ public: void renderSelectedUV(); void renderSelected(LLViewerTexture *image, const LLColor4 &color); + void renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool bSelected, bool wireframe_selection, bool bRenderHiddenSelections); F32 getKey() const { return mDistance; } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 20445ba56f..9c6be001f6 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5837,6 +5837,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) gGL.translatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f); gGL.scalef(cur_zoom, cur_zoom, cur_zoom); } + if (mSelectedObjects->getNumNodes()) { LLUUID inspect_item_id= LLUUID::null; @@ -5854,6 +5855,9 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) } } + bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections; + F32 fogCfx = (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0); + LLUUID focus_item_id = LLViewerMediaFocus::getInstance()->getFocusedObjectID(); for (S32 pass = 0; pass < 2; pass++) { @@ -5864,35 +5868,53 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) LLViewerObject* objectp = node->getObject(); if (!objectp) continue; - if (objectp->isHUDAttachment() != for_hud) - { - continue; - } - if (objectp->getID() == focus_item_id) - { - node->renderOneSilhouette(gFocusMgr.getFocusColor()); - } - else if(objectp->getID() == inspect_item_id) - { - node->renderOneSilhouette(sHighlightInspectColor); - } - else if (node->isTransient()) - { - BOOL oldHidden = LLSelectMgr::sRenderHiddenSelections; - LLSelectMgr::sRenderHiddenSelections = FALSE; - node->renderOneSilhouette(sContextSilhouetteColor); - LLSelectMgr::sRenderHiddenSelections = oldHidden; - } - else if (objectp->isRootEdit()) - { - node->renderOneSilhouette(sSilhouetteParentColor); - } - else - { - node->renderOneSilhouette(sSilhouetteChildColor); - } - } - } + + if (objectp->mDrawable + && objectp->mDrawable->getVOVolume() + && objectp->mDrawable->getVOVolume()->isMesh()) + { + S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); // avatars have TEs but no faces + for (S32 te = 0; te < num_tes; ++te) + { + bool bSelected = node->isTESelected(te) && getTEMode(); + + objectp->mDrawable->getFace(te)->renderOneWireframe( + !bSelected ? LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha * 2) : sHighlightInspectColor + , fogCfx, bSelected, wireframe_selection, node->isTransient() ? FALSE : LLSelectMgr::sRenderHiddenSelections); + } + } + else + { + if (objectp->isHUDAttachment() != for_hud) + { + continue; + } + if (objectp->getID() == focus_item_id) + { + node->renderOneSilhouette(gFocusMgr.getFocusColor()); + } + else if (objectp->getID() == inspect_item_id) + { + node->renderOneSilhouette(sHighlightInspectColor); + } + else if (node->isTransient()) + { + BOOL oldHidden = LLSelectMgr::sRenderHiddenSelections; + LLSelectMgr::sRenderHiddenSelections = FALSE; + node->renderOneSilhouette(sContextSilhouetteColor); + LLSelectMgr::sRenderHiddenSelections = oldHidden; + } + else if (objectp->isRootEdit()) + { + node->renderOneSilhouette(sSilhouetteParentColor); + } + else + { + node->renderOneSilhouette(sSilhouetteChildColor); + } + } + } //for all selected node's + } //for pass } if (mHighlightedObjects->getNumNodes()) @@ -6278,148 +6300,6 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power) return (mPermissions->allowOperationBy(op, proxy_agent_id, group_id)); } - -//helper function for pushing relevant vertices from drawable to GL -void pushWireframe(LLDrawable* drawable) -{ - LLVOVolume* vobj = drawable->getVOVolume(); - if (vobj) - { - LLVertexBuffer::unbind(); - gGL.pushMatrix(); - gGL.multMatrix((F32*) vobj->getRelativeXform().mMatrix); - - LLVolume* volume = NULL; - - if (drawable->isState(LLDrawable::RIGGED)) - { - vobj->updateRiggedVolume(); - volume = vobj->getRiggedVolume(); - } - else - { - volume = vobj->getVolume(); - } - - if (volume) - { - for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i) - { - const LLVolumeFace& face = volume->getVolumeFace(i); - LLVertexBuffer::drawElements(LLRender::TRIANGLES, face.mPositions, NULL, face.mNumIndices, face.mIndices); - } - } - - gGL.popMatrix(); - } - -} - -void LLSelectNode::renderOneWireframe(const LLColor4& color) -{ - //Need to because crash on ATI 3800 (and similar cards) MAINT-5018 - LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); - - LLViewerObject* objectp = getObject(); - if (!objectp) - { - return; - } - - LLDrawable* drawable = objectp->mDrawable; - if (!drawable) - { - return; - } - - LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - - if (shader) - { - gDebugProgram.bind(); - } - - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - - BOOL is_hud_object = objectp->isHUDAttachment(); - - if (drawable->isActive()) - { - gGL.loadMatrix(gGLModelView); - gGL.multMatrix((F32*)objectp->getRenderMatrix().mMatrix); - } - else if (!is_hud_object) - { - gGL.loadIdentity(); - gGL.multMatrix(gGLModelView); - LLVector3 trans = objectp->getRegion()->getOriginAgent(); - gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); - } - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - bool wireframe_selection = (gFloaterTools && gFloaterTools->getVisible()) || LLSelectMgr::sRenderHiddenSelections; - - if (LLSelectMgr::sRenderHiddenSelections) - { - gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE); - LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL); - if (shader) - { - gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); - pushWireframe(drawable); - } - else - { - LLGLEnable fog(GL_FOG); - glFogi(GL_FOG_MODE, GL_LINEAR); - float d = (LLViewerCamera::getInstance()->getPointOfInterest() - LLViewerCamera::getInstance()->getOrigin()).magVec(); - LLColor4 fogCol = color * (F32)llclamp((LLSelectMgr::getInstance()->getSelectionCenterGlobal() - gAgentCamera.getCameraPositionGlobal()).magVec() / (LLSelectMgr::getInstance()->getBBoxOfSelection().getExtentLocal().magVec() * 4), 0.0, 1.0); - glFogf(GL_FOG_START, d); - glFogf(GL_FOG_END, d*(1 + (LLViewerCamera::getInstance()->getView() / LLViewerCamera::getInstance()->getDefaultFOV()))); - glFogfv(GL_FOG_COLOR, fogCol.mV); - - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); - { - gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); - pushWireframe(drawable); - } - } - } - - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); - - gGL.diffuseColor4f(color.mV[VRED] * 2, color.mV[VGREEN] * 2, color.mV[VBLUE] * 2, LLSelectMgr::sHighlightAlpha * 2); - - { - LLGLDisable depth(wireframe_selection ? 0 : GL_BLEND); - LLGLEnable stencil(wireframe_selection ? 0 : GL_STENCIL_TEST); - - if (!wireframe_selection) - { //modify wireframe into outline selection mode - glStencilFunc(GL_NOTEQUAL, 2, 0xffff); - glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); - } - - LLGLEnable offset(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(3.f, 3.f); - glLineWidth(5.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - pushWireframe(drawable); - } - - glLineWidth(1.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - gGL.popMatrix(); - - if (shader) - { - shader->bind(); - } -} - //----------------------------------------------------------------------------- // renderOneSilhouette() //----------------------------------------------------------------------------- @@ -6440,7 +6320,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) LLVOVolume* vobj = drawable->getVOVolume(); if (vobj && vobj->isMesh()) { - renderOneWireframe(color); + //This check (if(...)) with assert here just for ensure that this situation will not happens, and can be removed later. For example on the next release. + llassert(!"renderOneWireframe() was removed SL-10194"); return; } diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index f362497b03..303a984bd0 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -177,7 +177,6 @@ public: S32 getLastSelectedTE(); S32 getLastOperatedTE(); S32 getTESelectMask() { return mTESelectMask; } - void renderOneWireframe(const LLColor4& color); void renderOneSilhouette(const LLColor4 &color); void setTransient(BOOL transient) { mTransient = transient; } BOOL isTransient() { return mTransient; } From 4f458882f4f29d441e1ba0ede1ab50aa389b2aaa Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 14 Jan 2019 18:58:30 +0200 Subject: [PATCH 3/7] - add static const --- indra/llrender/llgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 79a50d199a..c0f0cec80b 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -1890,7 +1890,7 @@ void LLGLState::checkClientArrays(const std::string& msg, U32 data_mask) GL_TEXTURE_COORD_ARRAY }; - U32 mask[] = + static const U32 mask[] = { //copied from llvertexbuffer.h 0x0001, //MAP_VERTEX, 0x0002, //MAP_NORMAL, From f6bccd6f9eb62178f9f3d912114d12a84a9e42d6 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 14 Jan 2019 19:07:00 +0200 Subject: [PATCH 4/7] - remove getDeviceScaleFactor() and replace it to getSystemUISize() according Ansariel note --- indra/llwindow/llwindow.h | 3 --- indra/llwindow/llwindowmacosx.cpp | 8 ++++---- indra/llwindow/llwindowmacosx.h | 2 +- indra/newview/llviewerwindow.cpp | 10 +++++++--- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index cb0daea2cd..a05ba8cbba 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -166,9 +166,6 @@ public: // Provide native key event data virtual LLSD getNativeKeyData() { return LLSD::emptyMap(); } - // Default scale - virtual float getDeviceScaleFactor() { return 1.0f; } - // Get system UI size based on DPI (for 96 DPI UI size should be 1.0) virtual F32 getSystemUISize() { return 1.0; } protected: diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 20853eebd9..b320b93d43 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1102,7 +1102,7 @@ BOOL LLWindowMacOSX::setCursorPosition(const LLCoordWindow position) // trigger mouse move callback LLCoordGL gl_pos; convertCoords(position, &gl_pos); - float scale = getDeviceScaleFactor(); + float scale = getSystemUISize(); gl_pos.mX *= scale; gl_pos.mY *= scale; mCallbacks->handleMouseMove(this, gl_pos, (MASK)0); @@ -1135,7 +1135,7 @@ BOOL LLWindowMacOSX::getCursorPosition(LLCoordWindow *position) cursor_point[1] += mCursorLastEventDeltaY; } - float scale = getDeviceScaleFactor(); + float scale = getSystemUISize(); position->mX = cursor_point[0] * scale; position->mY = cursor_point[1] * scale; @@ -1904,9 +1904,9 @@ MASK LLWindowMacOSX::modifiersToMask(S16 modifiers) return mask; } -F32 LLWindowMacOSX::getDeviceScaleFactor() +F32 LLWindowMacOSX::getSystemUISize() { - return gHiDPISupport ? ::getDeviceUnitSize(mGLView) : LLWindow::getDeviceScaleFactor(); + return gHiDPISupport ? ::getDeviceUnitSize(mGLView) : LLWindow::getSystemUISize(); } #if LL_OS_DRAGDROP_ENABLED diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index fc5c9a0054..24651027e8 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -112,7 +112,7 @@ public: /*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b); /*virtual*/ void interruptLanguageTextInput(); /*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async); - /*virtual*/ F32 getDeviceScaleFactor(); + /*virtual*/ F32 getSystemUISize(); static std::vector getDynamicFallbackFontList(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 413fa59879..0d3a52346a 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1770,13 +1770,17 @@ LLViewerWindow::LLViewerWindow(const Params& p) gSavedSettings.setS32("FullScreenHeight",scr.mY); } - +#if LL_DARWIN + F32 system_scale_factor = 1.f; +#else F32 system_scale_factor = mWindow->getSystemUISize(); if (system_scale_factor < MIN_UI_SCALE || system_scale_factor > MAX_UI_SCALE) { // reset to default; system_scale_factor = 1.f; } +#endif + if (p.first_run || gSavedSettings.getF32("LastSystemUIScaleFactor") != system_scale_factor) { mSystemUIScaleFactorChanged = !p.first_run; @@ -1787,7 +1791,7 @@ LLViewerWindow::LLViewerWindow(const Params& p) // Get the real window rect the window was created with (since there are various OS-dependent reasons why // the size of a window or fullscreen context may have been adjusted slightly...) - F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor"), MIN_UI_SCALE, MAX_UI_SCALE) * mWindow->getDeviceScaleFactor(); + F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor"), MIN_UI_SCALE, MAX_UI_SCALE) * mWindow->getSystemUISize(); mDisplayScale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f)); mDisplayScale *= ui_scale_factor; @@ -5382,7 +5386,7 @@ F32 LLViewerWindow::getWorldViewAspectRatio() const void LLViewerWindow::calcDisplayScale() { - F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor"), MIN_UI_SCALE, MAX_UI_SCALE) * mWindow->getDeviceScaleFactor(); + F32 ui_scale_factor = llclamp(gSavedSettings.getF32("UIScaleFactor"), MIN_UI_SCALE, MAX_UI_SCALE) * mWindow->getSystemUISize(); LLVector2 display_scale; display_scale.setVec(llmax(1.f / mWindow->getPixelAspectRatio(), 1.f), llmax(mWindow->getPixelAspectRatio(), 1.f)); display_scale *= ui_scale_factor; From 9d1ea470bedc69d57c443c4efa966acdf6f4dbcd Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Tue, 15 Jan 2019 19:44:12 +0200 Subject: [PATCH 5/7] - fix scale problem on Windows --- indra/newview/llviewerwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 0d3a52346a..d0c8145e58 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1604,7 +1604,6 @@ BOOL LLViewerWindow::handleDPIChanged(LLWindow *window, F32 ui_scale_factor, S32 if (ui_scale_factor >= MIN_UI_SCALE && ui_scale_factor <= MAX_UI_SCALE) { gSavedSettings.setF32("LastSystemUIScaleFactor", ui_scale_factor); - gSavedSettings.setF32("UIScaleFactor", ui_scale_factor); LLViewerWindow::reshape(window_width, window_height); mResDirty = true; return TRUE; From 4c0f6f5825bdd833d0bad05bf431c29acba45ae0 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Fri, 25 Jan 2019 18:26:42 +0200 Subject: [PATCH 6/7] SL-10194 Selecting mesh face doesn't highlight the face in any way - Fixed according to Steeltoe notes. - Add const modifier for some methods --- indra/newview/llface.cpp | 2 +- indra/newview/llface.h | 2 +- indra/newview/llselectmgr.cpp | 29 +++++++++++++++++------------ indra/newview/llselectmgr.h | 15 ++++++++------- 4 files changed, 27 insertions(+), 21 deletions(-) diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 32280d3d90..b2da5bb9f8 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -634,7 +634,7 @@ void renderFace(LLDrawable* drawable, LLFace *face) } } -void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool bSelected, bool wireframe_selection, bool bRenderHiddenSelections) +void LLFace::renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wireframe_selection, bool bRenderHiddenSelections) { //Need to because crash on ATI 3800 (and similar cards) MAINT-5018 LLGLDisable multisample(LLPipeline::RenderFSAASamples > 0 ? GL_MULTISAMPLE_ARB : 0); diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 7e68e81862..736d45b7ad 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -198,7 +198,7 @@ public: void renderSelectedUV(); void renderSelected(LLViewerTexture *image, const LLColor4 &color); - void renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool bSelected, bool wireframe_selection, bool bRenderHiddenSelections); + void renderOneWireframe(const LLColor4 &color, F32 fogCfx, bool wireframe_selection, bool bRenderHiddenSelections); F32 getKey() const { return mDistance; } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 9c6be001f6..b36df244f8 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -5869,6 +5869,9 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) if (!objectp) continue; + if(getTEMode() && !node->hasSelectedTE()) + continue; + if (objectp->mDrawable && objectp->mDrawable->getVOVolume() && objectp->mDrawable->getVOVolume()->isMesh()) @@ -5876,11 +5879,18 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); // avatars have TEs but no faces for (S32 te = 0; te < num_tes; ++te) { - bool bSelected = node->isTESelected(te) && getTEMode(); - - objectp->mDrawable->getFace(te)->renderOneWireframe( - !bSelected ? LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha * 2) : sHighlightInspectColor - , fogCfx, bSelected, wireframe_selection, node->isTransient() ? FALSE : LLSelectMgr::sRenderHiddenSelections); + if (!getTEMode()) + { + objectp->mDrawable->getFace(te)->renderOneWireframe( + LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha * 2) + , fogCfx, wireframe_selection, node->isTransient() ? FALSE : LLSelectMgr::sRenderHiddenSelections); + } + else if(node->isTESelected(te)) + { + objectp->mDrawable->getFace(te)->renderOneWireframe( + LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha * 2) + , fogCfx, wireframe_selection, node->isTransient() ? FALSE : LLSelectMgr::sRenderHiddenSelections); + } } } else @@ -6078,7 +6088,7 @@ void LLSelectNode::selectTE(S32 te_index, BOOL selected) mLastTESelected = te_index; } -BOOL LLSelectNode::isTESelected(S32 te_index) +BOOL LLSelectNode::isTESelected(S32 te_index) const { if (te_index < 0 || te_index >= mObject->getNumTEs()) { @@ -6087,7 +6097,7 @@ BOOL LLSelectNode::isTESelected(S32 te_index) return (mTESelectMask & (0x1 << te_index)) != 0; } -S32 LLSelectNode::getLastSelectedTE() +S32 LLSelectNode::getLastSelectedTE() const { if (!isTESelected(mLastTESelected)) { @@ -6096,11 +6106,6 @@ S32 LLSelectNode::getLastSelectedTE() return mLastTESelected; } -S32 LLSelectNode::getLastOperatedTE() -{ - return mLastTESelected; -} - LLViewerObject* LLSelectNode::getObject() { if (!mObject) diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 303a984bd0..ce0fee8803 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -173,13 +173,14 @@ public: void selectAllTEs(BOOL b); void selectTE(S32 te_index, BOOL selected); - BOOL isTESelected(S32 te_index); - S32 getLastSelectedTE(); - S32 getLastOperatedTE(); + BOOL isTESelected(S32 te_index) const; + bool hasSelectedTE() const { return TE_SELECT_MASK_ALL & mTESelectMask; } + S32 getLastSelectedTE() const; + S32 getLastOperatedTE() const { return mLastTESelected; } S32 getTESelectMask() { return mTESelectMask; } void renderOneSilhouette(const LLColor4 &color); void setTransient(BOOL transient) { mTransient = transient; } - BOOL isTransient() { return mTransient; } + BOOL isTransient() const { return mTransient; } LLViewerObject* getObject(); void setObject(LLViewerObject* object); // *NOTE: invalidate stored textures and colors when # faces change @@ -539,10 +540,10 @@ public: EGridMode getGridMode() { return mGridMode; } void getGrid(LLVector3& origin, LLQuaternion& rotation, LLVector3 &scale, bool for_snap_guides = false); - BOOL getTEMode() { return mTEMode; } - void setTEMode(BOOL b) { mTEMode = b; } + BOOL getTEMode() const { return mTEMode; } + void setTEMode(BOOL b) { mTEMode = b; } - BOOL shouldShowSelection() { return mShowSelection; } + BOOL shouldShowSelection() const { return mShowSelection; } LLBBox getBBoxOfSelection() const; LLBBox getSavedBBoxOfSelection() const { return mSavedSelectionBBox; } From 986567a6542603887c66daea7459b18f42267544 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Mon, 4 Feb 2019 18:14:03 +0200 Subject: [PATCH 7/7] SL-5570 - Align planar faces" does not work on normal or specular maps --- indra/newview/llpanelface.cpp | 66 ++++++++++++++++++++++++++++------- indra/newview/llpanelface.h | 23 ++++++------ 2 files changed, 65 insertions(+), 24 deletions(-) diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 38f181c803..5e6a44c09d 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -444,14 +444,17 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLSpinCtrl* ctrlTexOffsetS = mPanel->getChild("TexOffsetU"); LLSpinCtrl* ctrlTexOffsetT = mPanel->getChild("TexOffsetV"); LLSpinCtrl* ctrlTexRotation = mPanel->getChild("TexRot"); - LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); + LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); + LLCheckBoxCtrl* cb_planar_align = mPanel->getChild("checkbox planar align"); + bool align_planar = (cb_planar_align && cb_planar_align->get()); + llassert(comboTexGen); llassert(object); if (ctrlTexScaleS) { valid = !ctrlTexScaleS->getTentative(); // || !checkFlipScaleS->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexScaleS->get(); if (comboTexGen && @@ -460,13 +463,19 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor value *= 0.5f; } object->setTEScaleS( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, value, te); + } } } if (ctrlTexScaleT) { valid = !ctrlTexScaleT->getTentative(); // || !checkFlipScaleT->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexScaleT->get(); //if( checkFlipScaleT->get() ) @@ -479,36 +488,60 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor value *= 0.5f; } object->setTEScaleT( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, value, te); + } } } if (ctrlTexOffsetS) { valid = !ctrlTexOffsetS->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexOffsetS->get(); object->setTEOffsetS( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, value, te); + } } } if (ctrlTexOffsetT) { valid = !ctrlTexOffsetT->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexOffsetT->get(); object->setTEOffsetT( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, value, te); + } } } if (ctrlTexRotation) { valid = !ctrlTexRotation->getTentative(); - if (valid) + if (valid || align_planar) { value = ctrlTexRotation->get() * DEG_TO_RAD; object->setTERotation( te, value ); + + if (align_planar) + { + LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, value, te); + LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, value, te); + } } } return true; @@ -550,14 +583,21 @@ struct LLPanelFaceSetAlignedTEFunctor : public LLSelectedTEFunctor if (set_aligned) { object->setTEOffset(te, uv_offset.mV[VX], uv_offset.mV[VY]); - object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]); + object->setTEScale(te, uv_scale.mV[VX], uv_scale.mV[VY]); object->setTERotation(te, uv_rot); - LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te); - LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY], te); - LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te); - LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te); - LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te); - LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te); + + LLPanelFace::LLSelectedTEMaterial::setNormalRotation(mPanel, uv_rot, te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularRotation(mPanel, uv_rot, te, object->getID()); + + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetX(mPanel, uv_offset.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setNormalOffsetY(mPanel, uv_offset.mV[VY], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatX(mPanel, uv_scale.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setNormalRepeatY(mPanel, uv_scale.mV[VY], te, object->getID()); + + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetX(mPanel, uv_offset.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularOffsetY(mPanel, uv_offset.mV[VY], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatX(mPanel, uv_scale.mV[VX], te, object->getID()); + LLPanelFace::LLSelectedTEMaterial::setSpecularRepeatY(mPanel, uv_scale.mV[VY], te, object->getID()); } } if (!set_aligned) diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 4937966034..0b40d7d41a 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -252,16 +252,16 @@ private: typename DataType, typename SetValueType, void (LLMaterial::*MaterialEditFunc)(SetValueType data) > - static void edit(LLPanelFace* p, DataType data, int te = -1) + static void edit(LLPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID()) { LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data); struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor { - LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp) : _panel(panel), _edit(editp) {} + LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp, const LLUUID &only_for_object_id) : _panel(panel), _edit(editp), _only_for_object_id(only_for_object_id) {} virtual ~LLSelectedTEEditMaterial() {}; virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) { - if (_edit) + if (_edit && (_only_for_object_id.isNull() || _only_for_object_id == object->getID())) { LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material); llassert_always(new_material); @@ -325,14 +325,15 @@ private: return NULL; } LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit; - LLPanelFace* _panel; - } editor(p, &edit); - LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te); + LLPanelFace *_panel; + const LLUUID & _only_for_object_id; + } editor(p, &edit, only_for_object_id); + LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te); } template< typename DataType, - typename ReturnType, + typename ReturnType, ReturnType (LLMaterial::* const MaterialGetFunc)() const > static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType()) { @@ -437,10 +438,10 @@ public: // Mutators for selected TE material // - #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ - static void MaterialMemberFunc(LLPanelFace* p, DataType data, int te = -1) \ - { \ - edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p, data, te); \ + #define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \ + static void MaterialMemberFunc(LLPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID()) \ + { \ + edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p, data, te, only_for_object_id); \ } // Accessors for selected TE state proper (legacy settings etc)