Added shaders needed to display texture 'edit' overlay using the specular/normalmap texcoords.

This commit is contained in:
Shyotl
2013-11-05 23:51:09 -06:00
parent 6bbb24b974
commit 322ceceb60
4 changed files with 108 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
/**
* @file highlightV.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$
*/
uniform mat4 texture_matrix0;
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
ATTRIBUTE vec2 texcoord0;
ATTRIBUTE vec2 texcoord1;
ATTRIBUTE vec2 texcoord2;
VARYING vec2 vary_texcoord0;
void main()
{
//transform vertex
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_texcoord0 = (texture_matrix0 * vec4(texcoord1,0,1)).xy;
}

View File

@@ -0,0 +1,42 @@
/**
* @file highlightV.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$
*/
uniform mat4 texture_matrix0;
uniform mat4 modelview_projection_matrix;
ATTRIBUTE vec3 position;
ATTRIBUTE vec2 texcoord0;
ATTRIBUTE vec2 texcoord1;
ATTRIBUTE vec2 texcoord2;
VARYING vec2 vary_texcoord0;
void main()
{
//transform vertex
gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
vary_texcoord0 = (texture_matrix0 * vec4(texcoord2,0,1)).xy;
}

View File

@@ -165,7 +165,8 @@ LLGLSLShader gUnderWaterProgram(LLViewerShaderMgr::SHADER_WATER);
//interface shaders
LLGLSLShader gHighlightProgram(LLViewerShaderMgr::SHADER_INTERFACE); //Not in mShaderList
LLGLSLShader gHighlightNormalProgram(LLViewerShaderMgr::SHADER_INTERFACE);
LLGLSLShader gHighlightSpecularProgram(LLViewerShaderMgr::SHADER_INTERFACE);
//avatar shader handles
LLGLSLShader gAvatarProgram(LLViewerShaderMgr::SHADER_AVATAR);
LLGLSLShader gAvatarWaterProgram(LLViewerShaderMgr::SHADER_AVATAR);
@@ -2805,6 +2806,26 @@ BOOL LLViewerShaderMgr::loadShadersInterface()
success = gHighlightProgram.createShader(NULL, NULL);
}
if (success)
{
gHighlightNormalProgram.mName = "Highlight Normals Shader";
gHighlightNormalProgram.mShaderFiles.clear();
gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightNormV.glsl", GL_VERTEX_SHADER_ARB));
gHighlightNormalProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER_ARB));
gHighlightNormalProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
success = gHighlightNormalProgram.createShader(NULL, NULL);
}
if (success)
{
gHighlightSpecularProgram.mName = "Highlight Spec Shader";
gHighlightSpecularProgram.mShaderFiles.clear();
gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightSpecV.glsl", GL_VERTEX_SHADER_ARB));
gHighlightSpecularProgram.mShaderFiles.push_back(make_pair("interface/highlightF.glsl", GL_FRAGMENT_SHADER_ARB));
gHighlightSpecularProgram.mShaderLevel = mVertexShaderLevel[SHADER_INTERFACE];
success = gHighlightSpecularProgram.createShader(NULL, NULL);
}
if (success)
{
gUIProgram.mName = "UI Shader";

View File

@@ -273,6 +273,8 @@ extern LLGLSLShader gGlowExtractProgram;
//interface shaders
extern LLGLSLShader gHighlightProgram;
extern LLGLSLShader gHighlightNormalProgram;
extern LLGLSLShader gHighlightSpecularProgram;
// avatar shader handles
extern LLGLSLShader gAvatarProgram;