diff options
author | Dave Parks <davep@lindenlab.com> | 2022-12-06 16:15:27 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-12-06 16:15:27 -0600 |
commit | e9e37aa2ad2315611f262b2b090fe9672f6fee04 (patch) | |
tree | 04a9424f6a937e132c6f22acfd0516c2015cda0b /indra | |
parent | 03da83f23513fdca2073203eddafeef3662e4be1 (diff) |
SL-18784 Refactor physics shape display to not require its own render target. Remove "Hover Glow Objects" to free up a superfluous render target.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 2 | ||||
-rw-r--r-- | indra/newview/lldynamictexture.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.cpp | 178 | ||||
-rw-r--r-- | indra/newview/llspatialpartition.h | 2 | ||||
-rw-r--r-- | indra/newview/lltoolpie.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llviewerdisplay.cpp | 12 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 277 | ||||
-rw-r--r-- | indra/newview/pipeline.h | 12 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 10 |
9 files changed, 127 insertions, 406 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index cdfb7ab71b..7a0a3428b3 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9558,7 +9558,7 @@ <key>RenderHoverGlowEnable</key> <map> <key>Comment</key> - <string>Show glow effect when hovering on interactive objects.</string> + <string>DEPRECATED --- Show glow effect when hovering on interactive objects.</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp index 361a7666fa..d1f9e7a943 100644 --- a/indra/newview/lldynamictexture.cpp +++ b/indra/newview/lldynamictexture.cpp @@ -118,35 +118,10 @@ BOOL LLViewerDynamicTexture::render() //----------------------------------------------------------------------------- void LLViewerDynamicTexture::preRender(BOOL clear_depth) { - gPipeline.allocatePhysicsBuffer(); - if (!gNonInteractive) - { - llassert(mFullWidth <= static_cast<S32>(gPipeline.mPhysicsDisplay.getWidth())); - llassert(mFullHeight <= static_cast<S32>(gPipeline.mPhysicsDisplay.getHeight())); - } - - if (gPipeline.mPhysicsDisplay.isComplete() && !gGLManager.mIsAMD) - { //using offscreen render target, just use the bottom left corner - mOrigin.set(0, 0); - } - else - { // force rendering to on-screen portion of frame buffer - LLCoordScreen window_pos; - gViewerWindow->getWindow()->getPosition( &window_pos ); - mOrigin.set(0, gViewerWindow->getWindowHeightRaw() - mFullHeight); // top left corner - - if (window_pos.mX < 0) - { - mOrigin.mX = -window_pos.mX; - } - if (window_pos.mY < 0) - { - mOrigin.mY += window_pos.mY; - mOrigin.mY = llmax(mOrigin.mY, 0) ; - } - } + //use the bottom left corner + mOrigin.set(0, 0); - gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); + gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); // Set up camera LLViewerCamera* camera = LLViewerCamera::getInstance(); mCamera.setOrigin(*camera); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 7d1bc7fc48..113cd98164 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -2328,7 +2328,7 @@ S32 get_physics_detail(const LLVolumeParams& volume_params, const LLVector3& sca return detail; } -void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLColor4& line_color) +void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color) { LLUUID mesh_id = volume->getVolume()->getParams().getSculptID(); LLModel::Decomposition* decomp = gMeshRepo.getDecomposition(mesh_id); @@ -2340,13 +2340,8 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo { if (!decomp->mBaseHullMesh.empty()) { - gGL.diffuseColor4fv(color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.diffuseColor4fv(line_color.mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mBaseHullMesh.mPositions); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } else { @@ -2363,19 +2358,13 @@ void renderMeshBaseHull(LLVOVolume* volume, U32 data_mask, LLColor4& color, LLCo } } -void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color, const LLColor4& line_color) +void render_hull(LLModel::PhysicsMesh& mesh, const LLColor4& color) { - gGL.diffuseColor4fv(color.mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - glLineWidth(3.f); - gGL.diffuseColor4fv(line_color.mV); + gGL.diffuseColor4fv(color.mV); LLVertexBuffer::drawArrays(LLRender::TRIANGLES, mesh.mPositions); - glLineWidth(1.f); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } -void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) +void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume, bool wireframe) { U8 physics_type = volume->getPhysicsShapeType(); @@ -2405,7 +2394,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) color = lerp( mid, high, 2.f * ( normalizedCost - 0.5f ) ); } - LLColor4 line_color = color*0.5f; + if (wireframe) + { + color = color * 0.5f; + } U32 data_mask = LLVertexBuffer::MAP_VERTEX; @@ -2425,9 +2417,6 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) gGL.pushMatrix(); gGL.multMatrix((F32*) volume->getRelativeXform().mMatrix); - LLGLEnable(GL_POLYGON_OFFSET_LINE); - glPolygonOffset(3.f, 3.f); - if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::USER_MESH) { LLUUID mesh_id = volume->getVolume()->getParams().getSculptID(); @@ -2448,23 +2437,19 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) for (U32 i = 0; i < decomp->mMesh.size(); ++i) { - render_hull(decomp->mMesh[i], color, line_color); + render_hull(decomp->mMesh[i], color); } } else if (!decomp->mPhysicsShapeMesh.empty()) { //decomp has physics mesh, render that mesh - gGL.diffuseColor4fv(color.mV); - LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions); - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - gGL.diffuseColor4fv(line_color.mV); + gGL.diffuseColor4fv(color.mV); + LLVertexBuffer::drawArrays(LLRender::TRIANGLES, decomp->mPhysicsShapeMesh.mPositions); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); } else { //no mesh or decomposition, render base hull - renderMeshBaseHull(volume, data_mask, color, line_color); + renderMeshBaseHull(volume, data_mask, color); if (decomp->mPhysicsShapeMesh.empty()) { @@ -2484,7 +2469,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) { if (volume->isMesh()) { - renderMeshBaseHull(volume, data_mask, color, line_color); + renderMeshBaseHull(volume, data_mask, color); } else { @@ -2580,20 +2565,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) if (phys_volume->mHullPoints) { //render hull - - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - gGL.diffuseColor4fv(line_color.mV); - LLVertexBuffer::unbind(); + gGL.diffuseColor4fv(color.mV); - llassert(LLGLSLShader::sCurBoundShader != 0); - - LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); - - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + LLVertexBuffer::unbind(); LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices); - } else { @@ -2606,41 +2581,50 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::BOX) { - LLVector3 center = physics_spec.getCenter(); - LLVector3 scale = physics_spec.getScale(); - LLVector3 vscale = volume->getScale()*2.f; - scale.set(scale[0]/vscale[0], scale[1]/vscale[1], scale[2]/vscale[2]); - - gGL.diffuseColor4fv(color.mV); - drawBox(center, scale); + if (!wireframe) + { + LLVector3 center = physics_spec.getCenter(); + LLVector3 scale = physics_spec.getScale(); + LLVector3 vscale = volume->getScale() * 2.f; + scale.set(scale[0] / vscale[0], scale[1] / vscale[1], scale[2] / vscale[2]); + + gGL.diffuseColor4fv(color.mV); + drawBox(center, scale); + } } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::SPHERE) { - LLVolumeParams volume_params; - volume_params.setType( LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE ); - volume_params.setBeginAndEndS( 0.f, 1.f ); - volume_params.setBeginAndEndT( 0.f, 1.f ); - volume_params.setRatio ( 1, 1 ); - volume_params.setShear ( 0, 0 ); - LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); - - gGL.diffuseColor4fv(color.mV); - pushVerts(sphere); - LLPrimitive::sVolumeManager->unrefVolume(sphere); + if (!wireframe) + { + LLVolumeParams volume_params; + volume_params.setType(LL_PCODE_PROFILE_CIRCLE_HALF, LL_PCODE_PATH_CIRCLE); + volume_params.setBeginAndEndS(0.f, 1.f); + volume_params.setBeginAndEndT(0.f, 1.f); + volume_params.setRatio(1, 1); + volume_params.setShear(0, 0); + LLVolume* sphere = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); + + gGL.diffuseColor4fv(color.mV); + pushVerts(sphere); + LLPrimitive::sVolumeManager->unrefVolume(sphere); + } } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::CYLINDER) { - LLVolumeParams volume_params; - volume_params.setType( LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE ); - volume_params.setBeginAndEndS( 0.f, 1.f ); - volume_params.setBeginAndEndT( 0.f, 1.f ); - volume_params.setRatio ( 1, 1 ); - volume_params.setShear ( 0, 0 ); - LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); - - gGL.diffuseColor4fv(color.mV); - pushVerts(cylinder); - LLPrimitive::sVolumeManager->unrefVolume(cylinder); + if (!wireframe) + { + LLVolumeParams volume_params; + volume_params.setType(LL_PCODE_PROFILE_CIRCLE, LL_PCODE_PATH_LINE); + volume_params.setBeginAndEndS(0.f, 1.f); + volume_params.setBeginAndEndT(0.f, 1.f); + volume_params.setRatio(1, 1); + volume_params.setShear(0, 0); + LLVolume* cylinder = LLPrimitive::sVolumeManager->refVolume(volume_params, 3); + + gGL.diffuseColor4fv(color.mV); + pushVerts(cylinder); + LLPrimitive::sVolumeManager->unrefVolume(cylinder); + } } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_MESH) { @@ -2648,14 +2632,10 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) S32 detail = get_physics_detail(volume_params, volume->getScale()); LLVolume* phys_volume = LLPrimitive::sVolumeManager->refVolume(volume_params, detail); - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - - gGL.diffuseColor4fv(line_color.mV); - pushVerts(phys_volume); - - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + + gGL.diffuseColor4fv(color.mV); pushVerts(phys_volume); + LLPrimitive::sVolumeManager->unrefVolume(phys_volume); } else if (type == LLPhysicsShapeBuilderUtil::PhysicsShapeSpecification::PRIM_CONVEX) @@ -2667,21 +2647,15 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) if (phys_volume->mHullPoints && phys_volume->mHullIndices) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + llassert(LLGLSLShader::sCurBoundShader != 0); LLVertexBuffer::unbind(); glVertexPointer(3, GL_FLOAT, 16, phys_volume->mHullPoints); - gGL.diffuseColor4fv(line_color.mV); - gGL.syncMatrices(); - { - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); - } - - gGL.diffuseColor4fv(color.mV); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - { - glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); - } + + gGL.diffuseColor4fv(color.mV); + + gGL.syncMatrices(); + glDrawElements(GL_TRIANGLES, phys_volume->mNumHullIndices, GL_UNSIGNED_SHORT, phys_volume->mHullIndices); } else { @@ -2703,7 +2677,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume) gGL.popMatrix(); } -void renderPhysicsShapes(LLSpatialGroup* group) +void renderPhysicsShapes(LLSpatialGroup* group, bool wireframe) { for (OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { @@ -2721,7 +2695,7 @@ void renderPhysicsShapes(LLSpatialGroup* group) { gGL.pushMatrix(); gGL.multMatrix((F32*)bridge->mDrawable->getRenderMatrix().mMatrix); - bridge->renderPhysicsShapes(); + bridge->renderPhysicsShapes(wireframe); gGL.popMatrix(); } } @@ -2735,16 +2709,17 @@ void renderPhysicsShapes(LLSpatialGroup* group) gGL.pushMatrix(); LLVector3 trans = drawable->getRegion()->getOriginAgent(); gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); - renderPhysicsShape(drawable, volume); + renderPhysicsShape(drawable, volume, wireframe); gGL.popMatrix(); } else { - renderPhysicsShape(drawable, volume); + renderPhysicsShape(drawable, volume, wireframe); } } else { +#if 0 LLViewerObject* object = drawable->getVObj(); if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) { @@ -2762,10 +2737,10 @@ void renderPhysicsShapes(LLSpatialGroup* group) glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - gGL.diffuseColor3f(0.2f, 0.5f, 0.3f); + gGL.diffuseColor4f(0.2f, 0.5f, 0.3f, 0.5f); buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); - gGL.diffuseColor3f(0.2f, 1.f, 0.3f); + gGL.diffuseColor4f(0.2f, 1.f, 0.3f, 0.75f); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); } @@ -2773,6 +2748,7 @@ void renderPhysicsShapes(LLSpatialGroup* group) } gGL.popMatrix(); } +#endif } } } @@ -3573,7 +3549,9 @@ class LLOctreeRenderPhysicsShapes : public OctreeTraveler { public: LLCamera* mCamera; - LLOctreeRenderPhysicsShapes(LLCamera* camera): mCamera(camera) {} + bool mWireframe; + + LLOctreeRenderPhysicsShapes(LLCamera* camera, bool wireframe): mCamera(camera), mWireframe(wireframe) {} virtual void traverse(const OctreeNode* node) { @@ -3594,7 +3572,7 @@ public: group->rebuildGeom(); group->rebuildMesh(); - renderPhysicsShapes(group); + renderPhysicsShapes(group, mWireframe); } } @@ -3727,7 +3705,7 @@ public: }; -void LLSpatialPartition::renderPhysicsShapes() +void LLSpatialPartition::renderPhysicsShapes(bool wireframe) { LLSpatialBridge* bridge = asBridge(); LLCamera* camera = LLViewerCamera::getInstance(); @@ -3739,11 +3717,9 @@ void LLSpatialPartition::renderPhysicsShapes() gGL.flush(); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); - glLineWidth(3.f); - LLOctreeRenderPhysicsShapes render_physics(camera); + LLOctreeRenderPhysicsShapes render_physics(camera, wireframe); render_physics.traverse(mOctree); gGL.flush(); - glLineWidth(1.f); } void LLSpatialPartition::renderDebug() diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 42ae1a2a15..020a010405 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -434,7 +434,7 @@ public: LLSpatialBridge* asBridge() { return mBridge; } BOOL isBridge() { return asBridge() != NULL; } - void renderPhysicsShapes(); + void renderPhysicsShapes(bool depth_only); void renderDebug(); void renderIntersectingBBoxes(LLCamera* camera); void restoreGL(); diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 5fb83bf08e..80ba54ab6c 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -823,15 +823,6 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask) LLViewerMediaFocus::getInstance()->clearHover(); } - static LLCachedControl<bool> enable_highlight( - gSavedSettings, "RenderHoverGlowEnable", false); - LLDrawable* drawable = NULL; - if (enable_highlight && show_highlight && object) - { - drawable = object->mDrawable; - } - gPipeline.setHighlightObject(drawable); - return TRUE; } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 40857b732c..1b2f07515a 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -742,18 +742,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) glClear(GL_DEPTH_BUFFER_BIT); // | GL_STENCIL_BUFFER_BIT); } - LLGLState::checkStates(); - - //if (!for_snapshot) - { - LL_PROFILE_ZONE_NAMED_CATEGORY_DISPLAY("display - 3") - LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); - gPipeline.generateHighlight(*LLViewerCamera::getInstance()); - gPipeline.renderPhysicsDisplay(); - } - - LLGLState::checkStates(); - ////////////////////////////////////// // // Update images, using the image stats generated during object update/culling diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index d0ebc7645c..0ca9d2d12b 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -725,17 +725,6 @@ void LLPipeline::resizeScreenTexture() } } -void LLPipeline::allocatePhysicsBuffer() -{ - GLuint resX = gViewerWindow->getWorldViewWidthRaw(); - GLuint resY = gViewerWindow->getWorldViewHeightRaw(); - - if (mPhysicsDisplay.getWidth() != resX || mPhysicsDisplay.getHeight() != resY) - { - mPhysicsDisplay.allocate(resX, resY, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_TEXTURE, FALSE); - } -} - bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY) { LL_PROFILE_ZONE_SCOPED_CATEGORY_DISPLAY; @@ -1143,7 +1132,6 @@ void LLPipeline::releaseGLBuffers() mWaterRef.release(); mWaterDis.release(); mBake.release(); - mHighlight.release(); for (U32 i = 0; i < 3; i++) { @@ -1178,7 +1166,6 @@ void LLPipeline::releaseScreenBuffers() mRT->uiScreen.release(); mRT->screen.release(); mRT->fxaaBuffer.release(); - mPhysicsDisplay.release(); mRT->deferredScreen.release(); mRT->deferredDepth.release(); mRT->deferredLight.release(); @@ -1229,8 +1216,6 @@ void LLPipeline::createGLBuffers() // Use FBO for bake tex mBake.allocate(512, 512, GL_RGBA, TRUE, FALSE, LLTexUnit::TT_TEXTURE, true); // SL-12781 Build > Upload > Model; 3D Preview - mHighlight.allocate(256,256,GL_RGBA, FALSE, FALSE); - stop_glerror(); GLuint resX = gViewerWindow->getWorldViewWidthRaw(); @@ -1762,14 +1747,6 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) } } - HighlightItem item(drawablep); - mHighlightSet.erase(item); - - if (mHighlightObject == drawablep) - { - mHighlightObject = NULL; - } - for (U32 i = 0; i < 2; ++i) { if (mShadowSpotLight[i] == drawablep) @@ -4105,107 +4082,6 @@ void LLPipeline::renderHighlights() LLGLEnable color_mat(GL_COLOR_MATERIAL); disableLights(); - if (!hasRenderType(LLPipeline::RENDER_TYPE_HUD) && !mHighlightSet.empty()) - { //draw blurry highlight image over screen - LLGLEnable blend(GL_BLEND); - LLGLDepthTest depth(GL_TRUE, GL_FALSE, GL_ALWAYS); - LLGLDisable test(GL_ALPHA_TEST); - - //LLGLEnable stencil(GL_STENCIL_TEST); - gGL.flush(); - // stencil ops are deprecated - //glStencilMask(0xFFFFFFFF); - //glClearStencil(1); - //glClear(GL_STENCIL_BUFFER_BIT); - - //glStencilFunc(GL_ALWAYS, 0, 0xFFFFFFFF); - //glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); - - gGL.setColorMask(false, false); - - gHighlightProgram.bind(); - - for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ++iter) - { - renderHighlight(iter->mItem->getVObj(), 1.f); - } - gGL.setColorMask(true, false); - - //glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP); // deprecated - //glStencilFunc(GL_NOTEQUAL, 0, 0xFFFFFFFF); - - //gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - - gGL.pushMatrix(); - gGL.loadIdentity(); - gGL.matrixMode(LLRender::MM_PROJECTION); - gGL.pushMatrix(); - gGL.loadIdentity(); - - gGL.getTexUnit(0)->bind(&mHighlight); - - LLVector2 tc1; - LLVector2 tc2; - - tc1.setVec(0,0); - tc2.setVec(2,2); - - gGL.begin(LLRender::TRIANGLES); - - F32 scale = RenderHighlightBrightness; - LLColor4 color = RenderHighlightColor; - F32 thickness = RenderHighlightThickness; - - for (S32 pass = 0; pass < 2; ++pass) - { - if (pass == 0) - { - gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); - } - else - { - gGL.setSceneBlendType(LLRender::BT_ALPHA); - } - - for (S32 i = 0; i < 8; ++i) - { - for (S32 j = 0; j < 8; ++j) - { - LLVector2 tc(i-4+0.5f, j-4+0.5f); - - F32 dist = 1.f-(tc.length()/sqrtf(32.f)); - dist *= scale/64.f; - - tc *= thickness; - tc.mV[0] = (tc.mV[0])/mHighlight.getWidth(); - tc.mV[1] = (tc.mV[1])/mHighlight.getHeight(); - - gGL.color4f(color.mV[0], - color.mV[1], - color.mV[2], - color.mV[3]*dist); - - gGL.texCoord2f(tc.mV[0]+tc1.mV[0], tc.mV[1]+tc2.mV[1]); - gGL.vertex2f(-1,3); - - gGL.texCoord2f(tc.mV[0]+tc1.mV[0], tc.mV[1]+tc1.mV[1]); - gGL.vertex2f(-1,-1); - - gGL.texCoord2f(tc.mV[0]+tc2.mV[0], tc.mV[1]+tc1.mV[1]); - gGL.vertex2f(3,-1); - } - } - } - - gGL.end(); - - gGL.popMatrix(); - gGL.matrixMode(LLRender::MM_MODELVIEW); - gGL.popMatrix(); - - //gGL.setSceneBlendType(LLRender::BT_ALPHA); - } - if ((LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0)) { gHighlightProgram.bind(); @@ -4886,40 +4762,56 @@ void LLPipeline::renderPhysicsDisplay() return; } - allocatePhysicsBuffer(); + gGL.flush(); + gDebugProgram.bind(); - gGL.flush(); - mPhysicsDisplay.bindTarget(); - glClearColor(0,0,0,1); - gGL.setColorMask(true, true); - mPhysicsDisplay.clear(); - glClearColor(0,0,0,0); + LLGLEnable(GL_POLYGON_OFFSET_LINE); + glPolygonOffset(3.f, 3.f); + glLineWidth(3.f); + LLGLEnable blend(GL_BLEND); + gGL.setSceneBlendType(LLRender::BT_ALPHA); - gGL.setColorMask(true, false); + for (int pass = 0; pass < 3; ++pass) + { + // pass 0 - depth write enabled, color write disabled, fill + // pass 1 - depth write disabled, color write enabled, fill + // pass 2 - depth write disabled, color write enabled, wireframe + gGL.setColorMask(pass >= 1, false); + LLGLDepthTest depth(GL_TRUE, pass == 0); - gDebugProgram.bind(); + bool wireframe = (pass == 2); - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) - { - LLViewerRegion* region = *iter; - for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) - { - LLSpatialPartition* part = region->getSpatialPartition(i); - if (part) - { - if (hasRenderType(part->mDrawableType)) - { - part->renderPhysicsShapes(); - } - } - } - } + if (wireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + } - gGL.flush(); + for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); + iter != LLWorld::getInstance()->getRegionList().end(); ++iter) + { + LLViewerRegion* region = *iter; + for (U32 i = 0; i < LLViewerRegion::NUM_PARTITIONS; i++) + { + LLSpatialPartition* part = region->getSpatialPartition(i); + if (part) + { + if (hasRenderType(part->mDrawableType)) + { + part->renderPhysicsShapes(wireframe); + } + } + } + } + gGL.flush(); + if (wireframe) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + } + } + glLineWidth(1.f); gDebugProgram.unbind(); - mPhysicsDisplay.flush(); + } extern std::set<LLSpatialGroup*> visible_selected_groups; @@ -8230,33 +8122,7 @@ void LLPipeline::renderFinalize() if (hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) { - gSplatTextureRectProgram.bind(); - - gGL.setColorMask(true, false); - - LLVector2 tc1(0, 0); - LLVector2 tc2((F32) gViewerWindow->getWorldViewWidthRaw() * 2, - (F32) gViewerWindow->getWorldViewHeightRaw() * 2); - - LLGLEnable blend(GL_BLEND); - gGL.color4f(1, 1, 1, 0.75f); - - gGL.getTexUnit(0)->bind(&mPhysicsDisplay); - - gGL.begin(LLRender::TRIANGLES); - gGL.texCoord2f(tc1.mV[0], tc1.mV[1]); - gGL.vertex2f(-1, -1); - - gGL.texCoord2f(tc1.mV[0], tc2.mV[1]); - gGL.vertex2f(-1, 3); - - gGL.texCoord2f(tc2.mV[0], tc1.mV[1]); - gGL.vertex2f(3, -1); - - gGL.end(); - gGL.flush(); - - gSplatTextureRectProgram.unbind(); + renderPhysicsDisplay(); } /*if (LLRenderTarget::sUseFBO && !gCubeSnapshot) @@ -9913,61 +9779,6 @@ void LLPipeline::renderHighlight(const LLViewerObject* obj, F32 fade) } } -void LLPipeline::generateHighlight(LLCamera& camera) -{ - //render highlighted object as white into offscreen render target - if (mHighlightObject.notNull()) - { - mHighlightSet.insert(HighlightItem(mHighlightObject)); - } - llassert(!gCubeSnapshot); - - if (!mHighlightSet.empty()) - { - F32 transition = gFrameIntervalSeconds.value()/RenderHighlightFadeTime; - - LLGLDisable test(GL_ALPHA_TEST); - LLGLDepthTest depth(GL_FALSE); - mHighlight.bindTarget(); - disableLights(); - gGL.setColorMask(true, true); - mHighlight.clear(); - - gHighlightProgram.bind(); - - gGL.getTexUnit(0)->bind(LLViewerFetchedTexture::sWhiteImagep); - for (std::set<HighlightItem>::iterator iter = mHighlightSet.begin(); iter != mHighlightSet.end(); ) - { - std::set<HighlightItem>::iterator cur_iter = iter++; - - if (cur_iter->mItem.isNull()) - { - mHighlightSet.erase(cur_iter); - continue; - } - - if (cur_iter->mItem == mHighlightObject) - { - cur_iter->incrFade(transition); - } - else - { - cur_iter->incrFade(-transition); - if (cur_iter->mFade <= 0.f) - { - mHighlightSet.erase(cur_iter); - continue; - } - } - - renderHighlight(cur_iter->mItem->getVObj(), cur_iter->mFade); - } - - mHighlight.flush(); - gGL.setColorMask(true, false); - gViewerWindow->setup3DViewport(); - } -} LLRenderTarget* LLPipeline::getSunShadowTarget(U32 i) { diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 0fbc5cf960..32e46a8db0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -133,8 +133,6 @@ public: bool allocateScreenBuffer(U32 resX, U32 resY, U32 samples); bool allocateShadowBuffer(U32 resX, U32 resY); - void allocatePhysicsBuffer(); - void resetVertexBuffers(LLDrawable* drawable); void generateImpostor(LLVOAvatar* avatar, bool preview_avatar = false); void bindScreenToTexture(); @@ -319,11 +317,8 @@ public: LLRenderTarget* getSunShadowTarget(U32 i); LLRenderTarget* getSpotShadowTarget(U32 i); - void generateHighlight(LLCamera& camera); void renderHighlight(const LLViewerObject* obj, F32 fade); - void setHighlightObject(LLDrawable* obj) { mHighlightObject = obj; } - - + void renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera& camera, LLCullResult& result, bool use_shader, bool use_occlusion, U32 target_width); void renderHighlights(); void renderDebug(); @@ -692,8 +687,6 @@ public: LLRenderTarget mSpotShadow[2]; LLRenderTarget mSpotShadowOcclusion[2]; - LLRenderTarget mHighlight; - LLRenderTarget mPhysicsDisplay; LLRenderTarget mPbrBrdfLut; LLCullResult mSky; @@ -859,9 +852,6 @@ protected: } }; - std::set<HighlightItem> mHighlightSet; - LLPointer<LLDrawable> mHighlightObject; - ////////////////////////////////////////////////// // // Draw pools are responsible for storing all rendered data, diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index cb1dec6c61..a3c365e60c 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3247,16 +3247,6 @@ function="World.EnvPreset" function="Advanced.HandleAttachedLightParticles" parameter="RenderAttachedParticles" /> </menu_item_check> - <menu_item_check - label="Hover Glow Objects" - name="Hover Glow Objects"> - <menu_item_check.on_check - function="CheckControl" - parameter="RenderHoverGlowEnable" /> - <menu_item_check.on_click - function="ToggleControl" - parameter="RenderHoverGlowEnable" /> - </menu_item_check> <menu_item_call enabled="true" label="Rebuild Reflection Probes" |