diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl | 42 | ||||
-rw-r--r-- | indra/newview/lldrawpoolterrain.cpp | 8 | ||||
-rw-r--r-- | indra/newview/lldrawpoolterrain.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.cpp | 38 | ||||
-rw-r--r-- | indra/newview/llviewershadermgr.h | 4 |
5 files changed, 89 insertions, 5 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl new file mode 100644 index 0000000000..1adeb9237c --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/highlightF.glsl @@ -0,0 +1,42 @@ +/** + * @file highlightF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifdef DEFINE_GL_FRAGCOLOR +out vec4 frag_data[3]; +#else +#define frag_data gl_FragData +#endif + +uniform vec4 color; +uniform sampler2D diffuseMap; + +VARYING vec2 vary_texcoord0; + +void main() +{ + frag_data[0] = color*texture2D(diffuseMap, vary_texcoord0.xy)); + frag_data[1] = vec4(0.0); + frag_data[2] = vec4(0.0, 1.0, 0.0, 1.0); +} diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index b716a76543..3eefcef7aa 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -207,7 +207,7 @@ void LLDrawPoolTerrain::render(S32 pass) // Special-case for land ownership feedback if (gSavedSettings.getBOOL("ShowParcelOwners")) { - hilightParcelOwners(); + hilightParcelOwners(false); } } @@ -241,7 +241,7 @@ void LLDrawPoolTerrain::renderDeferred(S32 pass) // Special-case for land ownership feedback if (gSavedSettings.getBOOL("ShowParcelOwners")) { - hilightParcelOwners(); + hilightParcelOwners(true); } } @@ -432,13 +432,13 @@ void LLDrawPoolTerrain::renderFullShader() gGL.matrixMode(LLRender::MM_MODELVIEW); } -void LLDrawPoolTerrain::hilightParcelOwners() +void LLDrawPoolTerrain::hilightParcelOwners(bool deferred) { if (mVertexShaderLevel > 1) { //use fullbright shader for highlighting LLGLSLShader* old_shader = sShader; sShader->unbind(); - sShader = &gHighlightProgram; + sShader = deferred ? &gDeferredHighlightProgram : &gHighlightProgram; sShader->bind(); gGL.diffuseColor4f(1, 1, 1, 1); LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL); diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 55f75e2644..484820491a 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -87,7 +87,7 @@ protected: void drawLoop(); private: - void hilightParcelOwners(); + void hilightParcelOwners(bool deferred); }; #endif // LL_LLDRAWPOOLSIMPLE_H diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 2468aeffa2..b3d561edd5 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -161,6 +161,10 @@ LLGLSLShader gHighlightProgram; LLGLSLShader gHighlightNormalProgram; LLGLSLShader gHighlightSpecularProgram; +LLGLSLShader gDeferredHighlightProgram; +LLGLSLShader gDeferredHighlightNormalProgram; +LLGLSLShader gDeferredHighlightSpecularProgram; + LLGLSLShader gPathfindingProgram; LLGLSLShader gPathfindingNoNormalsProgram; @@ -1171,6 +1175,10 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() gDeferredSkinnedFullbrightShinyProgram.unload(); gDeferredSkinnedFullbrightProgram.unload(); + gDeferredHighlightProgram.unload(); + gDeferredHighlightNormalProgram.unload(); + gDeferredHighlightSpecularProgram.unload(); + gNormalMapGenProgram.unload(); for (U32 i = 0; i < LLMaterial::SHADER_COUNT*2; ++i) { @@ -1182,6 +1190,36 @@ BOOL LLViewerShaderMgr::loadShadersDeferred() BOOL success = TRUE; + if (success) + { + gDeferredHighlightProgram.mName = "Deferred Highlight Shader"; + gDeferredHighlightProgram.mShaderFiles.clear(); + gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("interface/highlightV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredHighlightProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredHighlightProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gDeferredHighlightProgram.createShader(NULL, NULL); + } + + if (success) + { + gDeferredHighlightNormalProgram.mName = "Deferred Highlight Normals Shader"; + gDeferredHighlightNormalProgram.mShaderFiles.clear(); + gDeferredHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredHighlightNormalProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredHighlightNormalProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gHighlightNormalProgram.createShader(NULL, NULL); + } + + if (success) + { + gDeferredHighlightSpecularProgram.mName = "Deferred Highlight Spec Shader"; + gDeferredHighlightSpecularProgram.mShaderFiles.clear(); + gDeferredHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER_ARB)); + gDeferredHighlightSpecularProgram.mShaderFiles.push_back(make_pair("deferred/highlightF.glsl", GL_FRAGMENT_SHADER_ARB)); + gDeferredHighlightSpecularProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE]; + success = gDeferredHighlightSpecularProgram.createShader(NULL, NULL); + } + if (success) { gDeferredDiffuseProgram.mName = "Deferred Diffuse Shader"; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 9ba7d7f742..9edaa97e57 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -264,6 +264,10 @@ extern LLGLSLShader gHighlightProgram; extern LLGLSLShader gHighlightNormalProgram; extern LLGLSLShader gHighlightSpecularProgram; +extern LLGLSLShader gDeferredHighlightProgram; +extern LLGLSLShader gDeferredHighlightNormalProgram; +extern LLGLSLShader gDeferredHighlightSpecularProgram; + extern LLGLSLShader gPathfindingProgram; extern LLGLSLShader gPathfindingNoNormalsProgram; |