Commit ca0a699c authored by Ruslan Teliuk's avatar Ruslan Teliuk
Browse files

Merged in ruslantproductengine/viewer-cougar-4cr-5 (pull request #55)



SL-11160 Test build viewer can crash (assert) on multi selection
Approved-by: default avatarAndrey Lihatskiy <andreylproductengine@lindenlab.com>
Approved-by: default avatarAndrey Kleshchev <andreykproductengine@lindenlab.com>
Approved-by: default avatarSimon Linden <simon@lindenlab.com>
parents aefb0503 dea87520
......@@ -5838,6 +5838,82 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
gGL.scalef(cur_zoom, cur_zoom, cur_zoom);
}
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);
static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha);
static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha);
auto renderMeshSelection_f = [fogCfx, wireframe_selection](LLSelectNode* node, LLViewerObject* objectp)
{
//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 = objectp->isHUDAttachment();
if (objectp->mDrawable->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]);
}
LLColor4 hlColor = objectp->isRootEdit() ? sParentColor : sChildColor;
bool bRenderHidenSelection = node->isTransient() ? false : LLSelectMgr::sRenderHiddenSelections;
LLVOVolume* vobj = objectp->mDrawable->getVOVolume();
if (vobj)
{
LLVertexBuffer::unbind();
gGL.pushMatrix();
gGL.multMatrix((F32*)vobj->getRelativeXform().mMatrix);
if (objectp->mDrawable->isState(LLDrawable::RIGGED))
{
vobj->updateRiggedVolume();
}
}
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); // avatars have TEs but no faces
for (S32 te = 0; te < num_tes; ++te)
{
if (node->isTESelected(te))
{
objectp->mDrawable->getFace(te)->renderOneWireframe(hlColor, fogCfx, wireframe_selection, bRenderHidenSelection, nullptr != shader);
}
}
gGL.popMatrix();
gGL.popMatrix();
glLineWidth(1.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (shader)
{
shader->bind();
}
};
if (mSelectedObjects->getNumNodes())
{
LLUUID inspect_item_id= LLUUID::null;
......@@ -5855,12 +5931,6 @@ 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);
static LLColor4 sParentColor = LLColor4(sSilhouetteParentColor[VRED], sSilhouetteParentColor[VGREEN], sSilhouetteParentColor[VBLUE], LLSelectMgr::sHighlightAlpha);
static LLColor4 sChildColor = LLColor4(sSilhouetteChildColor[VRED], sSilhouetteChildColor[VGREEN], sSilhouetteChildColor[VBLUE], LLSelectMgr::sHighlightAlpha);
LLUUID focus_item_id = LLViewerMediaFocus::getInstance()->getFocusedObjectID();
for (S32 pass = 0; pass < 2; pass++)
{
......@@ -5880,72 +5950,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
&& objectp->mDrawable->getVOVolume()
&& objectp->mDrawable->getVOVolume()->isMesh())
{
//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 = objectp->isHUDAttachment();
if (objectp->mDrawable->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]);
}
LLColor4 hlColor = objectp->isRootEdit() ? sParentColor : sChildColor;
bool bRenderHidenSelection = node->isTransient() ? false : LLSelectMgr::sRenderHiddenSelections;
LLVOVolume* vobj = objectp->mDrawable->getVOVolume();
if (vobj)
{
LLVertexBuffer::unbind();
gGL.pushMatrix();
gGL.multMatrix((F32*)vobj->getRelativeXform().mMatrix);
if (objectp->mDrawable->isState(LLDrawable::RIGGED))
{
vobj->updateRiggedVolume();
}
}
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
S32 num_tes = llmin((S32)objectp->getNumTEs(), (S32)objectp->getNumFaces()); // avatars have TEs but no faces
for (S32 te = 0; te < num_tes; ++te)
{
if (node->isTESelected(te))
{
objectp->mDrawable->getFace(te)->renderOneWireframe(hlColor, fogCfx, wireframe_selection, bRenderHidenSelection, nullptr != shader);
}
}
gGL.popMatrix();
gGL.popMatrix();
glLineWidth(1.f);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (shader)
{
shader->bind();
}
renderMeshSelection_f(node, objectp);
}
else
{
......@@ -5999,7 +6004,13 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
continue;
}
if (subtracting_from_selection)
if (objectp->mDrawable
&& objectp->mDrawable->getVOVolume()
&& objectp->mDrawable->getVOVolume()->isMesh())
{
renderMeshSelection_f(node, objectp);
}
else if (subtracting_from_selection)
{
node->renderOneSilhouette(LLColor4::red);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment