summaryrefslogtreecommitdiff
path: root/indra/newview/pipeline.cpp
diff options
context:
space:
mode:
authorDon Kjer <don@lindenlab.com>2007-07-20 20:38:05 +0000
committerDon Kjer <don@lindenlab.com>2007-07-20 20:38:05 +0000
commitd373dcc7cbed5fdea72c6b71a5594e4e85549b43 (patch)
tree140e20f48db5dc4d7842f05ef2c24ef9e6fc3238 /indra/newview/pipeline.cpp
parentc78f99b0b3b4b9ac99a69b63315e821d89a89a3b (diff)
svn merge -r 64548:64837 svn+ssh://svn/svn/linden/branches/maintenance into release
* WARNING *: maintenance r64837 is not the last rev to use in the next merge. use r65269
Diffstat (limited to 'indra/newview/pipeline.cpp')
-rw-r--r--indra/newview/pipeline.cpp265
1 files changed, 219 insertions, 46 deletions
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index d4d5cfc624..2858854a9a 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -143,10 +143,14 @@ U32 nhpo2(U32 v)
S32 LLPipeline::sCompiles = 0;
BOOL LLPipeline::sShowHUDAttachments = TRUE;
-BOOL LLPipeline::sRenderPhysicalBeacons = FALSE;
+BOOL LLPipeline::sRenderPhysicalBeacons = TRUE;
BOOL LLPipeline::sRenderScriptedBeacons = FALSE;
+BOOL LLPipeline::sRenderScriptedTouchBeacons = TRUE;
BOOL LLPipeline::sRenderParticleBeacons = FALSE;
BOOL LLPipeline::sRenderSoundBeacons = FALSE;
+BOOL LLPipeline::sRenderBeacons = FALSE;
+BOOL LLPipeline::sRenderHighlight = TRUE;
+BOOL LLPipeline::sRenderProcessBeacons = FALSE;
BOOL LLPipeline::sUseOcclusion = FALSE;
BOOL LLPipeline::sSkipUpdate = FALSE;
BOOL LLPipeline::sDynamicReflections = FALSE;
@@ -356,14 +360,22 @@ void LLPipeline::releaseGLBuffers()
if (mCubeFrameBuffer)
{
+#if !defined(__sparc)
glDeleteFramebuffersEXT(1, &mCubeFrameBuffer);
glDeleteRenderbuffersEXT(1, &mCubeDepth);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
mCubeDepth = mCubeFrameBuffer = 0;
}
if (mFramebuffer[0])
{
+#if !defined(__sparc)
glDeleteFramebuffersEXT(2, mFramebuffer);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
mFramebuffer[0] = mFramebuffer[1] = 0;
}
}
@@ -1469,7 +1481,44 @@ void renderScriptedBeacons(LLDrawable* drawablep)
&& !vobj->getParent()
&& vobj->flagScripted())
{
- gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ if (gPipeline.sRenderBeacons)
+ {
+ gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ }
+
+ if (gPipeline.sRenderHighlight)
+ {
+ S32 face_id;
+ for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++)
+ {
+ gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) );
+ }
+ }
+ }
+}
+
+void renderScriptedTouchBeacons(LLDrawable* drawablep)
+{
+ LLViewerObject *vobj = drawablep->getVObj();
+ if (vobj
+ && !vobj->isAvatar()
+ && !vobj->getParent()
+ && vobj->flagScripted()
+ && vobj->flagHandleTouch())
+ {
+ if (gPipeline.sRenderBeacons)
+ {
+ gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 0.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ }
+
+ if (gPipeline.sRenderHighlight)
+ {
+ S32 face_id;
+ for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++)
+ {
+ gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) );
+ }
+ }
}
}
@@ -1481,7 +1530,19 @@ void renderPhysicalBeacons(LLDrawable* drawablep)
&& !vobj->getParent()
&& vobj->usePhysics())
{
- gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ if (gPipeline.sRenderBeacons)
+ {
+ gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(0.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ }
+
+ if (gPipeline.sRenderHighlight)
+ {
+ S32 face_id;
+ for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++)
+ {
+ gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) );
+ }
+ }
}
}
@@ -1492,20 +1553,13 @@ void renderParticleBeacons(LLDrawable* drawablep)
if (vobj
&& vobj->isParticleSource())
{
- LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);
- gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
- }
-}
+ if (gPipeline.sRenderBeacons)
+ {
+ LLColor4 light_blue(0.5f, 0.5f, 1.f, 0.5f);
+ gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", light_blue, LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ }
-void LLPipeline::highlightPhysical(LLDrawable* drawablep)
-{
- LLMemType mt(LLMemType::MTYPE_PIPELINE);
- LLViewerObject *vobj;
- vobj = drawablep->getVObj();
- if (vobj && !vobj->isAvatar())
- {
- if (!vobj->isAvatar() &&
- (vobj->usePhysics() || vobj->flagHandleTouch()))
+ if (gPipeline.sRenderHighlight)
{
S32 face_id;
for (face_id = 0; face_id < drawablep->getNumFaces(); face_id++)
@@ -1679,42 +1733,49 @@ void LLPipeline::postSort(LLCamera& camera)
std::sort(mAlphaGroups.begin(), mAlphaGroups.end(), LLSpatialGroup::CompareDepthGreater());
std::sort(mAlphaGroupsPostWater.begin(), mAlphaGroupsPostWater.end(), LLSpatialGroup::CompareDepthGreater());
- if (sRenderScriptedBeacons)
+ // only render if the flag is set. The flag is only set if the right key is pressed, we are in edit mode or the toggle is set in the menus
+ if (sRenderProcessBeacons)
{
- // Only show the beacon on the root object.
- forAllVisibleDrawables(renderScriptedBeacons);
- }
-
- if (sRenderPhysicalBeacons)
- {
- // Only show the beacon on the root object.
- forAllVisibleDrawables(renderPhysicalBeacons);
- }
+ if (sRenderScriptedTouchBeacons)
+ {
+ // Only show the beacon on the root object.
+ forAllVisibleDrawables(renderScriptedTouchBeacons);
+ }
+ else
+ if (sRenderScriptedBeacons)
+ {
+ // Only show the beacon on the root object.
+ forAllVisibleDrawables(renderScriptedBeacons);
+ }
- if (sRenderParticleBeacons)
- {
- forAllVisibleDrawables(renderParticleBeacons);
- }
+ if (sRenderPhysicalBeacons)
+ {
+ // Only show the beacon on the root object.
+ forAllVisibleDrawables(renderPhysicalBeacons);
+ }
- // Draw physical objects in red.
- if (gHUDManager->getShowPhysical())
- {
- forAllVisibleDrawables(highlightPhysical);
- }
+ if (sRenderParticleBeacons)
+ {
+ forAllVisibleDrawables(renderParticleBeacons);
+ }
- // If god mode, also show audio cues
- if (sRenderSoundBeacons && gAudiop)
- {
- // Update all of our audio sources, clean up dead ones.
- LLAudioEngine::source_map::iterator iter;
- for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter)
+ // If god mode, also show audio cues
+ if (sRenderSoundBeacons && gAudiop)
{
- LLAudioSource *sourcep = iter->second;
+ // Update all of our audio sources, clean up dead ones.
+ LLAudioEngine::source_map::iterator iter;
+ for (iter = gAudiop->mAllSources.begin(); iter != gAudiop->mAllSources.end(); ++iter)
+ {
+ LLAudioSource *sourcep = iter->second;
- LLVector3d pos_global = sourcep->getPositionGlobal();
- LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global);
- //pos += LLVector3(0.f, 0.f, 0.2f);
- gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ LLVector3d pos_global = sourcep->getPositionGlobal();
+ LLVector3 pos = gAgent.getPosAgentFromGlobal(pos_global);
+ if (gPipeline.sRenderBeacons)
+ {
+ //pos += LLVector3(0.f, 0.f, 0.2f);
+ gObjectList.addDebugBeacon(pos, "", LLColor4(1.f, 1.f, 0.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth"));
+ }
+ }
}
}
@@ -3428,6 +3489,12 @@ BOOL LLPipeline::toggleRenderDebugFeatureControl(void* data)
}
// static
+void LLPipeline::setRenderScriptedBeacons(BOOL val)
+{
+ sRenderScriptedBeacons = val;
+}
+
+// static
void LLPipeline::toggleRenderScriptedBeacons(void*)
{
sRenderScriptedBeacons = !sRenderScriptedBeacons;
@@ -3440,6 +3507,30 @@ BOOL LLPipeline::getRenderScriptedBeacons(void*)
}
// static
+void LLPipeline::setRenderScriptedTouchBeacons(BOOL val)
+{
+ sRenderScriptedTouchBeacons = val;
+}
+
+// static
+void LLPipeline::toggleRenderScriptedTouchBeacons(void*)
+{
+ sRenderScriptedTouchBeacons = !sRenderScriptedTouchBeacons;
+}
+
+// static
+BOOL LLPipeline::getRenderScriptedTouchBeacons(void*)
+{
+ return sRenderScriptedTouchBeacons;
+}
+
+// static
+void LLPipeline::setRenderPhysicalBeacons(BOOL val)
+{
+ sRenderPhysicalBeacons = val;
+}
+
+// static
void LLPipeline::toggleRenderPhysicalBeacons(void*)
{
sRenderPhysicalBeacons = !sRenderPhysicalBeacons;
@@ -3452,6 +3543,12 @@ BOOL LLPipeline::getRenderPhysicalBeacons(void*)
}
// static
+void LLPipeline::setRenderParticleBeacons(BOOL val)
+{
+ sRenderParticleBeacons = val;
+}
+
+// static
void LLPipeline::toggleRenderParticleBeacons(void*)
{
sRenderParticleBeacons = !sRenderParticleBeacons;
@@ -3464,6 +3561,12 @@ BOOL LLPipeline::getRenderParticleBeacons(void*)
}
// static
+void LLPipeline::setRenderSoundBeacons(BOOL val)
+{
+ sRenderSoundBeacons = val;
+}
+
+// static
void LLPipeline::toggleRenderSoundBeacons(void*)
{
sRenderSoundBeacons = !sRenderSoundBeacons;
@@ -3475,6 +3578,48 @@ BOOL LLPipeline::getRenderSoundBeacons(void*)
return sRenderSoundBeacons;
}
+// static
+void LLPipeline::setRenderBeacons(BOOL val)
+{
+ sRenderBeacons = val;
+}
+
+// static
+void LLPipeline::toggleRenderBeacons(void*)
+{
+ sRenderBeacons = !sRenderBeacons;
+}
+
+// static
+BOOL LLPipeline::getRenderBeacons(void*)
+{
+ return sRenderBeacons;
+}
+
+// static
+void LLPipeline::setRenderHighlights(BOOL val)
+{
+ sRenderHighlight = val;
+}
+
+// static
+void LLPipeline::toggleRenderHighlights(void*)
+{
+ sRenderHighlight = !sRenderHighlight;
+}
+
+// static
+BOOL LLPipeline::getRenderHighlights(void*)
+{
+ return sRenderHighlight;
+}
+
+// static
+BOOL LLPipeline::getProcessBeacons(void* data)
+{
+ return sRenderProcessBeacons;
+}
+
LLViewerObject* LLPipeline::pickObject(const LLVector3 &start, const LLVector3 &end, LLVector3 &collision)
{
LLDrawable* drawable = mObjectPartition[PARTITION_VOLUME]->pickDrawable(start, end, collision);
@@ -3613,8 +3758,12 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam,
BOOL reattach = FALSE;
if (mCubeFrameBuffer == 0)
{
+#if !defined(__sparc)
glGenFramebuffersEXT(1, &mCubeFrameBuffer);
glGenRenderbuffersEXT(1, &mCubeDepth);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
reattach = TRUE;
}
@@ -3685,6 +3834,7 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam,
if (reattach)
{
+#if !defined(__sparc)
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, mCubeDepth);
GLint res_x, res_y;
glGetRenderbufferParameterivEXT(GL_RENDERBUFFER_EXT, GL_RENDERBUFFER_WIDTH_EXT, &res_x);
@@ -3696,15 +3846,22 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam,
}
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, 0);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
}
for (S32 i = 0; i < 6; i++)
{
+#if !defined(__sparc)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mCubeFrameBuffer);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
cube_face[i], cube_map->getGLName(), 0);
glFramebufferRenderbufferEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT,
GL_RENDERBUFFER_EXT, mCubeDepth);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90.f, 1.f, 0.1f, 1024.f);
@@ -3724,7 +3881,11 @@ void LLPipeline::generateReflectionMap(LLCubeMap* cube_map, LLCamera& cube_cam,
gPipeline.renderGeom(cube_cam);
}
+#if !defined(__sparc)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
cube_cam.setOrigin(origin);
gPipeline.resetDrawOrders();
@@ -3933,10 +4094,14 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res,
LLGLDisable blend(GL_BLEND);
LLGLDisable cull(GL_CULL_FACE);
+#if !defined(__sparc)
if (mFramebuffer[0] == 0)
{
glGenFramebuffersEXT(2, mFramebuffer);
}
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
@@ -3959,11 +4124,15 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res,
for (S32 i = 0; i < kernel; i++)
{
+#if !defined(__sparc)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, mFramebuffer[i%2]);
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,
GL_COLOR_ATTACHMENT0_EXT,
GL_TEXTURE_2D,
i%2 == 0 ? buffer : dest, 0);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
glBindTexture(GL_TEXTURE_2D, i == 0 ? source :
i%2==0 ? dest :
@@ -3990,7 +4159,11 @@ void LLPipeline::renderBloom(GLuint source, GLuint dest, GLuint buffer, U32 res,
}
+#if !defined(__sparc)
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
+#else
+#error Can we generalize this without a CPU architecture test?
+#endif
gGlowProgram.unbind();
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);