summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-05-15 02:45:58 -0500
committerDave Parks <davep@lindenlab.com>2010-05-15 02:45:58 -0500
commit246dd9c168550bfe4b1b71bba75f5af9456e86dd (patch)
treeb95e0fa776c7a6d8d6cf7fb652a877011cd6f518 /indra/newview/llspatialpartition.cpp
parent8be6ad300a320b8a9debbd3abbf4b5c252db70a9 (diff)
Highlight for object cost and proper retrieval/display of prim object cost and linkset cost.
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r--indra/newview/llspatialpartition.cpp51
1 files changed, 34 insertions, 17 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index f11195303e..1290e6b9a6 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2294,6 +2294,14 @@ void pushVerts(LLFace* face, U32 mask)
}
}
+void pushVerts(LLDrawable* drawable, U32 mask)
+{
+ for (S32 i = 0; i < drawable->getNumFaces(); ++i)
+ {
+ pushVerts(drawable->getFace(i), mask);
+ }
+}
+
void pushBufferVerts(LLVertexBuffer* buffer, U32 mask)
{
if (buffer)
@@ -2664,36 +2672,35 @@ void renderPhysicsShape(LLDrawable* drawable)
LLVOVolume* volume = drawable->getVOVolume();
if (volume)
{
+ F32 threshold = gSavedSettings.getF32("ObjectCostHighThreshold");
+ F32 cost = volume->getObjectCost();
+
+ LLColor4 low = gSavedSettings.getColor4("ObjectCostLowColor");
+ LLColor4 high = gSavedSettings.getColor4("ObjectCostHighColor");
+
+ LLColor4 color = lerp(low, high, cost/threshold);
+
+ U32 data_mask = LLVertexBuffer::MAP_VERTEX;
+
if (volume->isMesh())
- {
+ {
LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
const LLMeshDecomposition* decomp = gMeshRepo.getDecomposition(mesh_id);
if (decomp)
{
- if (volume->getObjectCost() == -1)
- {
- gObjectList.updateObjectCost(volume);
- }
-
gGL.pushMatrix();
glMultMatrixf((F32*) volume->getRelativeXform().mMatrix);
- static std::vector<LLColor4U> color;
-
+
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
for (U32 i = 0; i < decomp->mHull.size(); ++i)
- {
- if (color.size() <= i)
- {
- color.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 255));
- }
-
+ {
LLVertexBuffer* buff = decomp->mMesh[i];
- buff->setBuffer(LLVertexBuffer::MAP_VERTEX);
+ buff->setBuffer(data_mask);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- glColor3ub(color[i].mV[0], color[i].mV[1], color[i].mV[2]);
+ glColor3fv(color.mV);
buff->drawArrays(LLRender::TRIANGLES, 0, buff->getNumVerts());
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
@@ -2701,14 +2708,24 @@ void renderPhysicsShape(LLDrawable* drawable)
LLGLEnable blend(GL_BLEND);
gGL.setSceneBlendType(LLRender::BT_ALPHA);
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
- glColor4ub(color[i].mV[0], color[i].mV[1], color[i].mV[2], 64);
+ glColor4fv(color.mV);
buff->drawArrays(LLRender::TRIANGLES, 0, buff->getNumVerts());
}
}
gGL.popMatrix();
+
+ return;
}
}
+
+ //push faces
+ glColor3fv(color.mV);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+ pushVerts(drawable, data_mask);
+ glColor4fv(color.mV);
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ pushVerts(drawable, data_mask);
}
}