summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-09-10 14:08:12 -0500
committerDave Parks <davep@lindenlab.com>2010-09-10 14:08:12 -0500
commit3cda7606380109beb3f331b8b53d38914f8ba8f5 (patch)
tree337f4edadac1bbd9ef74021b2539f159f7637ba3 /indra/newview/llspatialpartition.cpp
parentd55576278b0fbde314b98de9dcd74e8afd65ee8c (diff)
Added test code for volume raycast octree and fixed a crash in render cost calculation when selecting trees/grass. Reviewed by jwolk.
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r--indra/newview/llspatialpartition.cpp47
1 files changed, 40 insertions, 7 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 425fa42339..2f0641489d 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -3035,11 +3035,11 @@ class LLRenderOctreeRaycast : public LLOctreeTriangleRayIntersect
{
public:
- LLRenderOctreeRaycast(const LLVector3& start, const LLVector3& end)
+
+ LLRenderOctreeRaycast(const LLVector4a& start, const LLVector4a& dir, F32* closest_t)
+ : LLOctreeTriangleRayIntersect(start, dir, NULL, closest_t, NULL, NULL, NULL, NULL)
{
- mStart.load3(start.mV);
- mEnd.load3(end.mV);
- mDir.setSub(mEnd, mStart);
+
}
void visit(const LLOctreeNode<LLVolumeTriangle>* branch)
@@ -3050,6 +3050,17 @@ public:
center.set(vl->mBounds[0].getF32ptr());
size.set(vl->mBounds[1].getF32ptr());
+ if (branch->getData().empty())
+ {
+ gGL.color3f(1.f,0.2f,0.f);
+ }
+ else
+ {
+ gGL.color3f(0.75f, 1.f, 0.f);
+ }
+
+ drawBoxOutline(center, size);
+
for (U32 i = 0; i < 2; i++)
{
LLGLDepthTest depth(GL_TRUE, GL_FALSE, i == 1 ? GL_LEQUAL : GL_GREATER);
@@ -3061,9 +3072,17 @@ public:
else
{
gGL.color4f(0,0.5f,0.5f, 0.25f);
+ if (!branch->getData().empty())
+ {
+ drawBoxOutline(center, size);
+ }
+ }
+
+ if (i == 1)
+ {
+ gGL.flush();
+ glLineWidth(3.f);
}
-
- drawBoxOutline(center, size);
gGL.begin(LLRender::TRIANGLES);
for (LLOctreeNode<LLVolumeTriangle>::const_element_iter iter = branch->getData().begin();
@@ -3077,6 +3096,12 @@ public:
gGL.vertex3fv(tri->mV[2]->getF32ptr());
}
gGL.end();
+
+ if (i == 1)
+ {
+ gGL.flush();
+ glLineWidth(1.f);
+ }
}
}
};
@@ -3110,7 +3135,15 @@ void renderRaycast(LLDrawable* drawablep)
start = vobj->agentPositionToVolume(gDebugRaycastStart);
end = vobj->agentPositionToVolume(gDebugRaycastEnd);
- LLRenderOctreeRaycast render(start, end);
+ LLVector4a starta, enda;
+ starta.load3(start.mV);
+ enda.load3(end.mV);
+ LLVector4a dir;
+ dir.setSub(enda, starta);
+
+ F32 t = 1.f;
+
+ LLRenderOctreeRaycast render(starta, dir, &t);
gGL.flush();
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
render.traverse(face.mOctree);