diff options
author | Rider Linden <rider@lindenlab.com> | 2018-05-31 11:49:27 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2018-05-31 11:49:27 -0700 |
commit | bd84cbfa11fbe2b3aa5ceba5978841310488b8e4 (patch) | |
tree | cd4ddab644af5f7a560a4ee53db9d36033e8e0ad /indra/newview/llselectmgr.cpp | |
parent | 460d944b082ae73bbad3cf1d72a47ffa88970fb9 (diff) | |
parent | 40d4e8b2e6d25a625c7a5ef5dd3e94321d18ce82 (diff) |
Merge
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r-- | indra/newview/llselectmgr.cpp | 167 |
1 files changed, 91 insertions, 76 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index c44aca6fa5..ddae109030 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -6271,92 +6271,107 @@ void pushWireframe(LLDrawable* drawable) 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); + //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; - } + LLViewerObject* objectp = getObject(); + if (!objectp) + { + return; + } - LLDrawable* drawable = objectp->mDrawable; - if(!drawable) - { - return; - } + LLDrawable* drawable = objectp->mDrawable; + if (!drawable) + { + return; + } - LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; - if (shader) - { - gDebugProgram.bind(); - } + if (shader) + { + gDebugProgram.bind(); + } - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.pushMatrix(); - - BOOL is_hud_object = objectp->isHUDAttachment(); + gGL.matrixMode(LLRender::MM_MODELVIEW); + gGL.pushMatrix(); - 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); - - if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible()) - { - 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); + BOOL is_hud_object = objectp->isHUDAttachment(); - gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); - { - gGL.diffuseColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f); - pushWireframe(drawable); - } - } - } + 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]); + } - gGL.flush(); - gGL.setSceneBlendType(LLRender::BT_ALPHA); + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.diffuseColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2); - - LLGLEnable offset(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(3.f, 3.f); - glLineWidth(3.f); - pushWireframe(drawable); - glLineWidth(1.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - gGL.popMatrix(); + if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible()) + { + 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); + } + } + } - if (shader) - { - shader->bind(); - } + gGL.flush(); + gGL.setSceneBlendType(LLRender::BT_ALPHA); + + gGL.diffuseColor4f(color.mV[VRED] * 2, color.mV[VGREEN] * 2, color.mV[VBLUE] * 2, LLSelectMgr::sHighlightAlpha * 2); + + { + bool wireframe_selection = gFloaterTools && gFloaterTools->getVisible(); + + 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(); + } } //----------------------------------------------------------------------------- |