summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
authorAnchor <none@none>2019-04-10 11:47:57 -0700
committerAnchor <none@none>2019-04-10 11:47:57 -0700
commit4b1c786c6e7236d45be33bbf216be142dbfa33c2 (patch)
treee414dd7a512d6d885b3f6e1ac2ea236ec4e82619 /indra/newview/llselectmgr.cpp
parent83fe55c429181a2adb67346db79becf00d501536 (diff)
parent5cf18cb867be567bf921f0b94a78fd822e4112ad (diff)
Merge
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 c8fd4177a9..5aa22d0fb2 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2092,29 +2092,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
@@ -5836,6 +5840,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;
@@ -5853,6 +5858,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++)
{
@@ -5863,35 +5871,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())
@@ -6055,7 +6091,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())
{
@@ -6064,7 +6100,7 @@ BOOL LLSelectNode::isTESelected(S32 te_index)
return (mTESelectMask & (0x1 << te_index)) != 0;
}
-S32 LLSelectNode::getLastSelectedTE()
+S32 LLSelectNode::getLastSelectedTE() const
{
if (!isTESelected(mLastTESelected))
{
@@ -6073,11 +6109,6 @@ S32 LLSelectNode::getLastSelectedTE()
return mLastTESelected;
}
-S32 LLSelectNode::getLastOperatedTE()
-{
- return mLastTESelected;
-}
-
LLViewerObject* LLSelectNode::getObject()
{
if (!mObject)
@@ -6277,148 +6308,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()
//-----------------------------------------------------------------------------
@@ -6439,7 +6328,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;
}
@@ -8053,3 +7943,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; \
+}
+