summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2019-04-02 22:19:20 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2019-04-02 22:19:20 +0300
commit64341c8b1907f8526b93a6b3d3d124924d44c2d9 (patch)
tree8b7647bb5fa02612405ec0e05b88cc303f429e3d /indra/newview/llselectmgr.cpp
parent8ec6aba9c06bb8e5b9454b350a6947a1d8c16179 (diff)
parent5cf18cb867be567bf921f0b94a78fd822e4112ad (diff)
Merged in lindenlab/viewer-release
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp311
1 files changed, 119 insertions, 192 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 4a2d545b33..b36df244f8 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2089,29 +2089,33 @@ void LLSelectMgr::selectionSetGlow(F32 glow)
mSelectedObjects->applyToObjects( &func2 );
}
-void LLSelectMgr::selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func)
+void LLSelectMgr::selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func, int te)
{
struct f1 : public LLSelectedTEFunctor
{
LLMaterialPtr mMaterial;
- f1(LLSelectedTEMaterialFunctor* material_func) : _material_func(material_func) {}
+ f1(LLSelectedTEMaterialFunctor* material_func, int te) : _material_func(material_func), _specific_te(te) {}
- bool apply(LLViewerObject* object, S32 face)
+ bool apply(LLViewerObject* object, S32 te)
{
- if (object && object->permModify() && _material_func)
- {
- LLTextureEntry* tep = object->getTE(face);
- if (tep)
- {
- LLMaterialPtr current_material = tep->getMaterialParams();
- _material_func->apply(object, face, tep, current_material);
- }
- }
+ if (_specific_te == -1 || (te == _specific_te))
+ {
+ if (object && object->permModify() && _material_func)
+ {
+ LLTextureEntry* tep = object->getTE(te);
+ if (tep)
+ {
+ LLMaterialPtr current_material = tep->getMaterialParams();
+ _material_func->apply(object, te, tep, current_material);
+ }
+ }
+ }
return true;
}
LLSelectedTEMaterialFunctor* _material_func;
- } func1(material_func);
+ int _specific_te;
+ } func1(material_func, te);
mSelectedObjects->applyToTEs( &func1 );
struct f2 : public LLSelectedObjectFunctor
@@ -5833,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;
@@ -5850,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++)
{
@@ -5860,35 +5868,63 @@ 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(getTEMode() && !node->hasSelectedTE())
+ continue;
+
+ 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)
+ {
+ 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
+ {
+ 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())
@@ -6052,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())
{
@@ -6061,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))
{
@@ -6070,11 +6106,6 @@ S32 LLSelectNode::getLastSelectedTE()
return mLastTESelected;
}
-S32 LLSelectNode::getLastOperatedTE()
-{
- return mLastTESelected;
-}
-
LLViewerObject* LLSelectNode::getObject()
{
if (!mObject)
@@ -6274,148 +6305,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);
-
- 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);
- }
- }
- }
-
- 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();
- }
-}
-
//-----------------------------------------------------------------------------
// renderOneSilhouette()
//-----------------------------------------------------------------------------
@@ -6436,7 +6325,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;
}
@@ -8050,3 +7940,40 @@ void LLSelectMgr::sendSelectionMove()
//saveSelectedObjectTransform(SELECT_ACTION_TYPE_PICK);
}
+
+template<>
+bool LLCheckIdenticalFunctor<F32>::same(const F32& a, const F32& b, const F32& tolerance)
+{
+ F32 delta = (a - b);
+ F32 abs_delta = fabs(delta);
+ return abs_delta <= tolerance;
+}
+
+#define DEF_DUMMY_CHECK_FUNCTOR(T) \
+template<> \
+bool LLCheckIdenticalFunctor<T>::same(const T& a, const T& b, const T& tolerance) \
+{ \
+ (void)tolerance; \
+ return a == b; \
+}
+
+DEF_DUMMY_CHECK_FUNCTOR(LLUUID)
+DEF_DUMMY_CHECK_FUNCTOR(LLGLenum)
+DEF_DUMMY_CHECK_FUNCTOR(LLTextureEntry)
+DEF_DUMMY_CHECK_FUNCTOR(LLTextureEntry::e_texgen)
+DEF_DUMMY_CHECK_FUNCTOR(bool)
+DEF_DUMMY_CHECK_FUNCTOR(U8)
+DEF_DUMMY_CHECK_FUNCTOR(int)
+DEF_DUMMY_CHECK_FUNCTOR(LLColor4)
+DEF_DUMMY_CHECK_FUNCTOR(LLMediaEntry)
+DEF_DUMMY_CHECK_FUNCTOR(LLPointer<LLMaterial>)
+DEF_DUMMY_CHECK_FUNCTOR(std::string)
+DEF_DUMMY_CHECK_FUNCTOR(std::vector<std::string>)
+
+template<>
+bool LLCheckIdenticalFunctor<class LLFace *>::same(class LLFace* const & a, class LLFace* const & b, class LLFace* const & tolerance) \
+{ \
+ (void)tolerance; \
+ return a == b; \
+}
+