summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2010-09-19 23:07:15 -0500
committerDave Parks <davep@lindenlab.com>2010-09-19 23:07:15 -0500
commit90da6d6fdc33343be72252101aed1be641e822b5 (patch)
tree66f6045cdf869324d16a57af613ab8213fedab42 /indra/newview/llspatialpartition.cpp
parent3cda7606380109beb3f331b8b53d38914f8ba8f5 (diff)
Raycasting for rigged attachments now works for your own attachments while in edit mode.
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rw-r--r--indra/newview/llspatialpartition.cpp80
1 files changed, 49 insertions, 31 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 2f0641489d..191cdac981 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -3047,19 +3047,21 @@ public:
LLVolumeOctreeListener* vl = (LLVolumeOctreeListener*) branch->getListener(0);
LLVector3 center, size;
- center.set(vl->mBounds[0].getF32ptr());
- size.set(vl->mBounds[1].getF32ptr());
-
+
if (branch->getData().empty())
{
gGL.color3f(1.f,0.2f,0.f);
+ center.set(branch->getCenter().getF32ptr());
+ size.set(branch->getSize().getF32ptr());
}
else
{
gGL.color3f(0.75f, 1.f, 0.f);
+ center.set(vl->mBounds[0].getF32ptr());
+ size.set(vl->mBounds[1].getF32ptr());
}
-
- drawBoxOutline(center, size);
+
+ drawBoxOutline(center, size);
for (U32 i = 0; i < 2; i++)
{
@@ -3072,10 +3074,7 @@ public:
else
{
gGL.color4f(0,0.5f,0.5f, 0.25f);
- if (!branch->getData().empty())
- {
- drawBoxOutline(center, size);
- }
+ drawBoxOutline(center, size);
}
if (i == 1)
@@ -3121,34 +3120,53 @@ void renderRaycast(LLDrawable* drawablep)
LLVOVolume* vobj = drawablep->getVOVolume();
LLVolume* volume = vobj->getVolume();
- for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
+
+ if (drawablep->isState(LLDrawable::RIGGED))
+ {
+ volume = NULL;
+ }
+
+ if (volume)
{
- const LLVolumeFace& face = volume->getVolumeFace(i);
- if (!face.mOctree)
+ for (S32 i = 0; i < volume->getNumVolumeFaces(); ++i)
{
- ((LLVolumeFace*) &face)->createOctree();
- }
+ const LLVolumeFace& face = volume->getVolumeFace(i);
+ if (!face.mOctree)
+ {
+ ((LLVolumeFace*) &face)->createOctree();
+ }
- gGL.pushMatrix();
- glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix);
- LLVector3 start, end;
- start = vobj->agentPositionToVolume(gDebugRaycastStart);
- end = vobj->agentPositionToVolume(gDebugRaycastEnd);
+ gGL.pushMatrix();
+ glMultMatrixf((F32*) vobj->getRelativeXform().mMatrix);
- LLVector4a starta, enda;
- starta.load3(start.mV);
- enda.load3(end.mV);
- LLVector4a dir;
- dir.setSub(enda, starta);
+ LLVector3 start, end;
+ start = vobj->agentPositionToVolume(gDebugRaycastStart);
+ end = vobj->agentPositionToVolume(gDebugRaycastEnd);
- F32 t = 1.f;
+ LLVector4a starta, enda;
+ starta.load3(start.mV);
+ enda.load3(end.mV);
+ LLVector4a dir;
+ dir.setSub(enda, starta);
- LLRenderOctreeRaycast render(starta, dir, &t);
- gGL.flush();
- glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
- render.traverse(face.mOctree);
- gGL.popMatrix();
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ F32 t = 1.f;
+
+ LLRenderOctreeRaycast render(starta, dir, &t);
+ gGL.flush();
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ {
+ //render face positions
+ LLVertexBuffer::unbind();
+ glColor4f(0,1,1,0.5f);
+ glVertexPointer(3, GL_FLOAT, sizeof(LLVector4a), face.mPositions);
+ glDrawElements(GL_TRIANGLES, face.mNumIndices, GL_UNSIGNED_SHORT, face.mIndices);
+ }
+
+ render.traverse(face.mOctree);
+ gGL.popMatrix();
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
}
}
else if (drawablep->isAvatar())