summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp124
1 files changed, 116 insertions, 8 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 9540894646..f45abca246 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -69,6 +69,7 @@
#include "llhudmanager.h"
#include "llinventorymodel.h"
#include "llmenugl.h"
+#include "llmeshrepository.h"
#include "llmutelist.h"
#include "llsidepaneltaskinfo.h"
#include "llslurl.h"
@@ -180,7 +181,6 @@ LLObjectSelection *get_null_object_selection()
// Build time optimization, generate this function once here
template class LLSelectMgr* LLSingleton<class LLSelectMgr>::getInstance();
-
//-----------------------------------------------------------------------------
// LLSelectMgr()
//-----------------------------------------------------------------------------
@@ -4919,13 +4919,15 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
// set up transform to encompass bounding box of HUD
glMatrixMode(GL_PROJECTION);
- glPushMatrix();
+ gGL.pushMatrix();
glLoadIdentity();
F32 depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
glOrtho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, depth);
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.pushMatrix();
+ gGL.pushUIMatrix();
+ gGL.loadUIIdentity();
glLoadIdentity();
glLoadMatrixf(OGL_TO_CFR_ROTATION); // Load Cory's favorite reference frame
glTranslatef(-hud_bbox.getCenterLocal().mV[VX] + (depth *0.5f), 0.f, 0.f);
@@ -5022,10 +5024,11 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
if (for_hud && avatar)
{
glMatrixMode(GL_PROJECTION);
- glPopMatrix();
+ gGL.popMatrix();
glMatrixMode(GL_MODELVIEW);
- glPopMatrix();
+ gGL.popMatrix();
+ gGL.popUIMatrix();
stop_glerror();
}
@@ -5344,6 +5347,78 @@ BOOL LLSelectNode::allowOperationOnNode(PermissionBit op, U64 group_proxy_power)
return (mPermissions->allowOperationBy(op, proxy_agent_id, group_id));
}
+void LLSelectNode::renderOneWireframe(const LLColor4& color)
+{
+ LLViewerObject* objectp = getObject();
+ if (!objectp)
+ {
+ return;
+ }
+
+ LLDrawable* drawable = objectp->mDrawable;
+ if(!drawable)
+ {
+ return;
+ }
+
+ glMatrixMode(GL_MODELVIEW);
+ gGL.pushMatrix();
+
+ BOOL is_hud_object = objectp->isHUDAttachment();
+
+ if (!is_hud_object)
+ {
+ glLoadIdentity();
+ glMultMatrixd(gGLModelView);
+ }
+
+ if (drawable->isActive())
+ {
+ glMultMatrixf((F32*) objectp->getRenderMatrix().mMatrix);
+ }
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ if (LLSelectMgr::sRenderHiddenSelections) // && gFloaterTools && gFloaterTools->getVisible())
+ {
+ gGL.blendFunc(LLRender::BF_SOURCE_COLOR, LLRender::BF_ONE);
+ 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()-gAgent.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);
+
+ LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE, GL_GEQUAL);
+ gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
+ {
+ glColor4f(color.mV[VRED], color.mV[VGREEN], color.mV[VBLUE], 0.4f);
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ LLFace* face = drawable->getFace(i);
+ pushVerts(face, LLVertexBuffer::MAP_VERTEX);
+ }
+ }
+ }
+
+ gGL.flush();
+ gGL.setSceneBlendType(LLRender::BT_ALPHA);
+
+ glColor4f(color.mV[VRED]*2, color.mV[VGREEN]*2, color.mV[VBLUE]*2, LLSelectMgr::sHighlightAlpha*2);
+ LLGLEnable offset(GL_POLYGON_OFFSET_LINE);
+ glPolygonOffset(3.f, 2.f);
+ glLineWidth(3.f);
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ LLFace* face = drawable->getFace(i);
+ pushVerts(face, LLVertexBuffer::MAP_VERTEX);
+ }
+ glLineWidth(1.f);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ gGL.popMatrix();
+}
+
//-----------------------------------------------------------------------------
// renderOneSilhouette()
//-----------------------------------------------------------------------------
@@ -5361,6 +5436,13 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
return;
}
+ LLVOVolume* vobj = drawable->getVOVolume();
+ if (vobj && vobj->isMesh())
+ {
+ renderOneWireframe(color);
+ return;
+ }
+
if (!mSilhouetteExists)
{
return;
@@ -5374,7 +5456,10 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
}
glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
+ gGL.pushMatrix();
+ gGL.pushUIMatrix();
+ gGL.loadUIIdentity();
+
if (!is_hud_object)
{
glLoadIdentity();
@@ -5493,7 +5578,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
gGL.end();
gGL.flush();
}
- glPopMatrix();
+ gGL.popMatrix();
+ gGL.popUIMatrix();
}
//
@@ -6047,10 +6133,32 @@ BOOL LLObjectSelection::isEmpty() const
//-----------------------------------------------------------------------------
// getObjectCount() - returns number of non null objects
//-----------------------------------------------------------------------------
-S32 LLObjectSelection::getObjectCount()
+S32 LLObjectSelection::getObjectCount(BOOL mesh_adjust)
{
cleanupNodes();
S32 count = mList.size();
+
+ if (mesh_adjust)
+ {
+ for (list_t::iterator iter = mList.begin(); iter != mList.end(); ++iter)
+ {
+ LLSelectNode* node = *iter;
+ LLViewerObject* object = node->getObject();
+
+ if (object && object->getVolume())
+ {
+ LLVOVolume* vobj = (LLVOVolume*) object;
+ if (vobj->isMesh())
+ {
+ LLUUID mesh_id = vobj->getVolume()->getParams().getSculptID();
+ U32 cost = gMeshRepo.getResourceCost(mesh_id);
+ count += cost-1;
+ }
+ }
+
+ }
+ }
+
return count;
}