diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-16 12:40:53 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-16 12:40:53 -0500 |
commit | da84f5552731e1ece3a463c4c385bb327f1048a1 (patch) | |
tree | dc10fc228a15b69f8b62631a68dbc67efe1f3395 /indra | |
parent | 4fea7dcb3ef35cae9e31ba467403d31ce9083905 (diff) |
SH-2243 work in progress -- don't use deprecated shader state
Diffstat (limited to 'indra')
225 files changed, 1465 insertions, 975 deletions
diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index db3d7becd9..889b436ac5 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -477,7 +477,7 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns) } else { - LL_DEBUGS("ShaderLoading") << log << LL_ENDL; + LL_INFOS("ShaderLoading") << log << LL_ENDL; } } } @@ -546,11 +546,39 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup("#version 120\n"); text[count++] = strdup("#define FXAA_GLSL_120 1\n"); text[count++] = strdup("#define FXAA_FAST_PIXEL_OFFSET 0\n"); + text[count++] = strdup("#define ATTRIBUTE attribute\n"); + text[count++] = strdup("#define VARYING varying\n"); } else - { //set version to 1.30 - text[count++] = strdup("#version 130\n"); + { + if (gGLManager.mGLVersion < 4.f) + { + //set version to 1.30 + text[count++] = strdup("#version 130\n"); + } + else + { //set version to 400 + text[count++] = strdup("#version 400\n"); + } + text[count++] = strdup("#define FXAA_GLSL_130 1\n"); + + text[count++] = strdup("#define ATTRIBUTE in\n"); + + if (type == GL_VERTEX_SHADER_ARB) + { //"varying" state is "out" in a vertex program, "in" in a fragment program + // ("varying" is deprecated after version 1.20) + text[count++] = strdup("#define VARYING out\n"); + } + else + { + text[count++] = strdup("#define VARYING in\n"); + } + + //backwards compatibility with legacy texture lookup syntax + text[count++] = strdup("#define textureCube texture\n"); + text[count++] = strdup("#define texture2DLod textureLod\n"); + text[count++] = strdup("#define shadow2D texture\n"); } //copy preprocessor definitions into buffer @@ -574,7 +602,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade . uniform sampler2D texN; - varying float vary_texture_index; + VARYING float vary_texture_index; vec4 diffuseLookup(vec2 texcoord) { @@ -600,7 +628,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade text[count++] = strdup(decl.c_str()); } - text[count++] = strdup("varying float vary_texture_index;\n"); + text[count++] = strdup("VARYING float vary_texture_index;\n"); text[count++] = strdup("vec4 diffuseLookup(vec2 texcoord)\n"); text[count++] = strdup("{\n"); @@ -716,6 +744,7 @@ GLhandleARB LLShaderMgr::loadShaderFile(const std::string& filename, S32 & shade if (i % 128 == 0) { //dump every 128 lines + LL_WARNS("ShaderLoading") << "\n" << ostr.str() << llendl; ostr = std::stringstream(); } diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl index dca96910f2..bc63d07d72 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl @@ -24,7 +24,7 @@ */ -attribute vec4 weight; +ATTRIBUTE vec4 weight; uniform vec4 matrixPalette[45]; diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index c98b99b15a..cf939e2df8 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -25,9 +25,13 @@ uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -35,7 +39,7 @@ void calcAtmospherics(vec3 inPositionEye); void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; vec3 norm; @@ -55,12 +59,12 @@ void main() gl_Position = projection_matrix * pos; - gl_FogFragCoord = length(pos.xyz); + fog_depth = length(pos.xyz); calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0)); - gl_FrontColor = color; + vertex_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 9a19fb928b..82db15c3ae 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -28,10 +28,13 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -41,7 +44,7 @@ void main() //transform vertex vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz; gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); @@ -50,7 +53,7 @@ void main() vec4 specular = vec4(1.0); vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); - gl_FrontColor = color; + vertex_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 6fef303723..43ed41a205 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -24,7 +24,7 @@ -attribute vec4 weight4; +ATTRIBUTE vec4 weight4; uniform mat4 matrixPalette[32]; diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl index 374808c091..a64f6ea55c 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarF.glsl @@ -23,11 +23,12 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; void main() { - gl_FragColor = vec4(gl_Color.rgb, texture2D(diffuseMap, gl_TexCoord[0].xy).a); + gl_FragColor = vec4(vertex_color.rgb, texture2D(diffuseMap, vary_texcoord0.xy).a); } diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl index 21a9e91bf5..78b5328c9a 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl @@ -25,9 +25,12 @@ uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; mat4 getSkinnedTransform(); @@ -41,7 +44,7 @@ void main() pos.z = dot(trans[2], pos_in); pos.w = 1.0; - gl_FrontColor = diffuse_color; - gl_TexCoord[0] = vec4(texcoord0,0,1); + vertex_color = diffuse_color; + vary_texcoord0 = texcoord0; gl_Position = projection_matrix * pos; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 19de0c0b39..23142a3516 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -38,11 +38,14 @@ uniform vec2 screen_res; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform mat4 inv_proj; @@ -66,9 +69,9 @@ void main() vec4 pos = vec4(vary_position, 1.0); - vec4 diff= diffuseLookup(gl_TexCoord[0].xy); + vec4 diff= diffuseLookup(vary_texcoord0.xy); - vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); + vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a); vec4 color = diff * col; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl index d4f56896cf..332bc9c262 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedF.glsl @@ -38,11 +38,13 @@ uniform vec2 screen_res; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; +VARYING vec2 vary_texcoord0; +VARYING vec4 vertex_color; uniform mat4 inv_proj; @@ -66,9 +68,9 @@ void main() vec4 pos = vec4(vary_position, 1.0); - vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy); + vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy); - vec4 col = vec4(vary_ambient + vary_directional.rgb, gl_Color.a); + vec4 col = vec4(vary_ambient + vary_directional.rgb, vertex_color.a); vec4 color = diff * col; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl index 5d1306bfc9..e8a2318f39 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaNonIndexedNoColorF.glsl @@ -1,7 +1,25 @@ /** * @file alphaNonIndexedNoColorF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ */ @@ -19,11 +37,12 @@ uniform vec2 screen_res; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; +VARYING vec2 vary_texcoord0; uniform mat4 inv_proj; @@ -47,7 +66,7 @@ void main() vec4 pos = vec4(vary_position, 1.0); - vec4 diff= texture2D(diffuseMap,gl_TexCoord[0].xy); + vec4 diff= texture2D(diffuseMap,vary_texcoord0.xy); vec4 col = vec4(vary_ambient + vary_directional.rgb, 1.0); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 9d2c009d2a..e5899872db 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -25,10 +25,10 @@ uniform mat4 projection_matrix; uniform mat4 modelview_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getObjectSkinnedTransform(); @@ -41,12 +41,15 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_position; -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_normal; -varying vec3 vary_fragcoord; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_position; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_normal; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_pointlight_col; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; uniform float near_clip; @@ -87,7 +90,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; vec3 norm; @@ -130,9 +133,9 @@ void main() col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); - gl_FrontColor = col; + vertex_color = col; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 490ac7c067..9920caf7f6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -28,10 +28,10 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -43,13 +43,16 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_light; -varying vec3 vary_pointlight_col; -varying float vary_texture_index; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_light; +VARYING vec3 vary_pointlight_col; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; uniform float near_clip; uniform float shadow_offset; @@ -98,7 +101,7 @@ void main() vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); @@ -132,9 +135,9 @@ void main() col.rgb = col.rgb*diffuse_color.rgb; - gl_FrontColor = col; + vertex_color = col; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl index 0c930848e5..40fa59b637 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowF.glsl @@ -26,10 +26,12 @@ uniform sampler2D diffuseMap; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { - //gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy).a); + //gl_FragColor = vec4(1,1,1,vertex_color.a * texture2D(diffuseMap, vary_texcoord0.xy).a); gl_FragColor = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl index fc055e555d..533babf3dc 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -26,23 +26,26 @@ uniform mat4 projection_matrix; uniform mat4 modelview_matrix; uniform mat4 texture_matrix0; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); mat = modelview_matrix * mat; vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; vec4 p = projection_matrix * vec4(pos, 1.0); p.z = max(p.z, -p.w+0.01); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index 16f2b889f8..12e88ca5dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -25,9 +25,9 @@ uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -41,11 +41,14 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_position; -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_position; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_pointlight_col; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; uniform float near_clip; @@ -86,7 +89,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; vec3 norm; @@ -132,9 +135,9 @@ void main() col.rgb = min(col.rgb, 1.0); - gl_FrontColor = col; + vertex_color = col; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; vary_fragcoord.xyz = frag_pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl index d5c20a22d9..01ffb862f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl @@ -27,20 +27,22 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vary_normal = normalize(normal_matrix * normal); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl index a006b81ef7..b1fc9da855 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarF.glsl @@ -27,11 +27,12 @@ uniform sampler2D diffuseMap; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec2 vary_texcoord0; void main() { - vec4 diff = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 diff = texture2D(diffuseMap, vary_texcoord0.xy); if (diff.a < 0.2) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl index ba3cc82b39..c9386062c6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowF.glsl @@ -27,7 +27,7 @@ uniform sampler2D diffuseMap; -varying vec4 post_pos; +VARYING vec4 post_pos; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 6835b9c021..525acbe4ea 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -27,15 +27,16 @@ uniform mat4 projection_matrix; mat4 getSkinnedTransform(); -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; -varying vec4 post_pos; +VARYING vec4 post_pos; +VARYING vec2 vary_texcoord0; void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; vec3 norm; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 704845d310..1bd8fee7c9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -25,19 +25,20 @@ uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; mat4 getSkinnedTransform(); -attribute vec4 weight; +ATTRIBUTE vec4 weight; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec2 vary_texcoord0; void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; vec3 norm; diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl index 3609cc054b..e0a25b505a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightF.glsl @@ -37,7 +37,7 @@ uniform vec2 delta; uniform vec3 kern[4]; uniform float kern_scale; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index 5339e38018..212f7e56ad 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl index 429a891f07..379420a8a0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpF.glsl @@ -28,22 +28,25 @@ uniform sampler2D diffuseMap; uniform sampler2D bumpMap; -varying vec3 vary_mat0; -varying vec3 vary_mat1; -varying vec3 vary_mat2; +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { - vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; - vec3 norm = texture2D(bumpMap, gl_TexCoord[0].xy).rgb * 2.0 - 1.0; + vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; + vec3 norm = texture2D(bumpMap, vary_texcoord0.xy).rgb * 2.0 - 1.0; vec3 tnorm = vec3(dot(norm,vary_mat0), dot(norm,vary_mat1), dot(norm,vary_mat2)); gl_FragData[0] = vec4(col, 0.0); - gl_FragData[1] = gl_Color.aaaa; // spec - //gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested + gl_FragData[1] = vertex_color.aaaa; // spec + //gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(tnorm); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl index cf93430217..6c205074b4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -26,21 +26,23 @@ uniform mat4 projection_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; -attribute vec2 texcoord2; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord2; -varying vec3 vary_mat0; -varying vec3 vary_mat1; -varying vec3 vary_mat2; +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; mat4 getObjectSkinnedTransform(); void main() { - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); @@ -58,5 +60,5 @@ void main() vary_mat2 = vec3(t.z, b.z, n.z); gl_Position = projection_matrix*vec4(pos, 1.0); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl index 9ec31383ac..c8d38bb8f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl @@ -27,21 +27,23 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; -attribute vec3 binormal; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 binormal; -varying vec3 vary_mat0; -varying vec3 vary_mat1; -varying vec3 vary_mat2; +VARYING vec3 vary_mat0; +VARYING vec3 vary_mat1; +VARYING vec3 vary_mat2; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 n = normalize(normal_matrix * normal); vec3 b = normalize(normal_matrix * binormal); @@ -51,5 +53,5 @@ void main() vary_mat1 = vec3(t.y, b.y, n.y); vary_mat2 = vec3(t.z, b.z, n.z); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index f4310dae95..127136a12c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -29,15 +29,20 @@ // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -varying vec4 vary_CloudColorSun; -varying vec4 vary_CloudColorAmbient; -varying float vary_CloudDensity; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; uniform sampler2D cloud_noise_texture; uniform vec4 cloud_pos_density1; uniform vec4 cloud_pos_density2; uniform vec4 gamma; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + /// Soft clips the light with a gamma correction vec3 scaleSoftClip(vec3 light) { //soft clip effect: @@ -50,14 +55,14 @@ vec3 scaleSoftClip(vec3 light) { void main() { // Set variables - vec2 uv1 = gl_TexCoord[0].xy; - vec2 uv2 = gl_TexCoord[1].xy; + vec2 uv1 = vary_texcoord0.xy; + vec2 uv2 = vary_texcoord1.xy; vec4 cloudColorSun = vary_CloudColorSun; vec4 cloudColorAmbient = vary_CloudColorAmbient; float cloudDensity = vary_CloudDensity; - vec2 uv3 = gl_TexCoord[2].xy; - vec2 uv4 = gl_TexCoord[3].xy; + vec2 uv3 = vary_texcoord2.xy; + vec2 uv4 = vary_texcoord3.xy; // Offset texture coords uv1 += cloud_pos_density1.xy; //large texture, visible density diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 67b5e7fb83..64e094e3c5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -25,17 +25,22 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky /////////////////////////////////////////////////////////////////////////////// // Output parameters -varying vec4 vary_CloudColorSun; -varying vec4 vary_CloudColorAmbient; -varying float vary_CloudDensity; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; + +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; // Inputs uniform vec3 camPosLocal; @@ -64,7 +69,7 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); @@ -163,17 +168,17 @@ void main() // Texture coords - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_TexCoord[0].xy -= 0.5; - gl_TexCoord[0].xy /= cloud_scale.x; - gl_TexCoord[0].xy += 0.5; + vary_texcoord0 = texcoord0; + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale.x; + vary_texcoord0.xy += 0.5; - gl_TexCoord[1] = gl_TexCoord[0]; - gl_TexCoord[1].x += lightnorm.x * 0.0125; - gl_TexCoord[1].y += lightnorm.z * 0.0125; + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; - gl_TexCoord[2] = gl_TexCoord[0] * 16.; - gl_TexCoord[3] = gl_TexCoord[1] * 16.; + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; // Combine these to minimize register use vary_CloudColorAmbient += oHazeColorBelowCloud; diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl index e1dc1de0af..51d67d2790 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskF.glsl @@ -29,11 +29,13 @@ uniform float maximum_alpha; uniform sampler2D diffuseMap; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { - vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 col = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; if (col.a < minimum_alpha || col.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl index f3ad6f92de..8868d33705 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskIndexedF.glsl @@ -23,14 +23,17 @@ * $/LicenseInfo$ */ -varying vec3 vary_normal; +VARYING vec3 vary_normal; uniform float minimum_alpha; uniform float maximum_alpha; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void main() { - vec4 col = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 col = diffuseLookup(vary_texcoord0.xy) * vertex_color; if (col.a < minimum_alpha || col.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl index dfc1b52c2e..2f46d43b9d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseAlphaMaskNoColorF.glsl @@ -1,7 +1,25 @@ /** * @file diffuseAlphaMaskNoColorF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ */ @@ -11,11 +29,12 @@ uniform float maximum_alpha; uniform sampler2D diffuseMap; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec2 vary_texcoord0; void main() { - vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); if (col.a < minimum_alpha || col.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl index 9c9a8b56c5..aaf89a22ef 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -27,14 +27,16 @@ uniform sampler2D diffuseMap; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { - vec3 col = gl_Color.rgb * texture2D(diffuseMap, gl_TexCoord[0].xy).rgb; + vec3 col = vertex_color.rgb * texture2D(diffuseMap, vary_texcoord0.xy).rgb; gl_FragData[0] = vec4(col, 0.0); - gl_FragData[1] = gl_Color.aaaa; // spec - //gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested + gl_FragData[1] = vertex_color.aaaa; // spec + //gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl index 4d996a099d..e08e52c7cf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseIndexedF.glsl @@ -23,15 +23,17 @@ * $/LicenseInfo$ */ -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { - vec3 col = gl_Color.rgb * diffuseLookup(gl_TexCoord[0].xy).rgb; + vec3 col = vertex_color.rgb * diffuseLookup(vary_texcoord0.xy).rgb; gl_FragData[0] = vec4(col, 0.0); - gl_FragData[1] = gl_Color.aaaa; // spec - //gl_FragData[1] = vec4(vec3(gl_Color.a), gl_Color.a+(1.0-gl_Color.a)*gl_Color.a); // spec - from former class3 - maybe better, but not so well tested + gl_FragData[1] = vertex_color.aaaa; // spec + //gl_FragData[1] = vec4(vec3(vertex_color.a), vertex_color.a+(1.0-vertex_color.a)*vertex_color.a); // spec - from former class3 - maybe better, but not so well tested vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl index 37864578ec..7ed41cbcb9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl @@ -27,18 +27,19 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; -varying vec3 vary_normal; -varying float vary_texture_index; +VARYING vec3 vary_normal; +VARYING float vary_texture_index; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vary_normal = normalize(normal_matrix * normal); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl index 880a7ea0a2..a74290bfcd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl @@ -26,18 +26,20 @@ uniform mat4 projection_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; mat4 getObjectSkinnedTransform(); void main() { - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); @@ -51,7 +53,7 @@ void main() vary_normal = norm.xyz; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; gl_Position = projection_matrix*vec4(pos, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl index e158df13f7..36000b86d6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -27,22 +27,24 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; -varying vec3 vary_normal; -varying float vary_texture_index; +VARYING vec3 vary_normal; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vary_texture_index = position.w; vary_normal = normalize(normal_matrix * normal); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index 5a9a6196f3..6cf563189a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -1,7 +1,25 @@ /** * @file emissiveF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ */ @@ -12,12 +30,14 @@ vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { float shadow = 1.0; - vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index fccf8554d2..b3558be678 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -27,9 +27,9 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute float emissive; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE float emissive; +ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -38,7 +38,10 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying float vary_texture_index; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void main() { @@ -49,11 +52,11 @@ void main() gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; calcAtmospherics(pos.xyz); - gl_FrontColor = vec4(0,0,0,emissive); + vertex_color = vec4(0,0,0,emissive); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index 6c506676af..f54827f720 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -27,6 +27,9 @@ #extension GL_ARB_texture_rectangle : enable +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -35,7 +38,7 @@ void main() { float shadow = 1.0; - vec4 color = diffuseLookup(gl_TexCoord[0].xy)*gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 2759165471..ef9f62da84 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -28,9 +28,9 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -39,7 +39,10 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying float vary_texture_index; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void main() { @@ -50,11 +53,11 @@ void main() gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl index bfb7760af8..72c5a93087 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giF.glsl @@ -38,7 +38,7 @@ uniform sampler2D depthGIMap; uniform sampler2D lightFunc; // Inputs -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl index 2766691bd0..e5d3bb8ea6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl @@ -25,12 +25,12 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; - -varying vec2 vary_fragcoord; +VARYING vec4 vertex_color; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; @@ -44,5 +44,5 @@ void main() vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index 7152e13946..e98f9aef87 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -31,9 +31,11 @@ uniform sampler2D diffuseMap; uniform sampler2D normalMap; uniform sampler2D specularMap; +VARYING vec2 vary_texcoord0; + void main() { - vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); if (col.a < minimum_alpha || col.a > maximum_alpha) { @@ -41,6 +43,6 @@ void main() } gl_FragData[0] = vec4(col.rgb, col.a * 0.005); - gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy); - gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0); + gl_FragData[1] = texture2D(specularMap, vary_texcoord0.xy); + gl_FragData[2] = vec4(texture2D(normalMap, vary_texcoord0.xy).xyz, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl index 645b0d793a..58e5dc0b56 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl @@ -26,15 +26,18 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index 4ba26fb0c6..4f13167c1c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -27,7 +27,7 @@ uniform sampler2DRect diffuseMap; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl index dafc55a6ff..f2dc60aa5d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl @@ -25,10 +25,11 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; +VARYING vec4 vertex_color; uniform vec2 screen_res; @@ -40,5 +41,5 @@ void main() vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 42212a978e..279a2fa78d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -45,7 +45,7 @@ uniform int light_count; uniform vec4 light[MAX_LIGHT_COUNT]; uniform vec4 light_col[MAX_LIGHT_COUNT]; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform float far_z; diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index 1d54d7bede..eefefa640d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index c42935d815..dff6360726 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -60,7 +60,7 @@ uniform vec3 color; uniform float falloff; uniform float size; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 8c34a554c2..0fc23fecb4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -43,7 +43,7 @@ uniform vec3 color; uniform float falloff; uniform float size; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index cab9817583..cb14e6d4e8 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index daef6a938c..64044590c9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -2096,8 +2096,8 @@ uniform float magnification; uniform mat4 inv_proj; -varying vec2 vary_fragcoord; -varying vec2 vary_tc; +VARYING vec2 vary_fragcoord; +VARYING vec2 vary_tc; float getDepth(vec2 pos_screen) diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl index f67615bdd5..16b61897d5 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -2083,8 +2083,8 @@ uniform vec2 rcp_screen_res; uniform vec4 rcp_frame_opt; uniform vec4 rcp_frame_opt2; uniform vec2 screen_res; -varying vec2 vary_fragcoord; -varying vec2 vary_tc; +VARYING vec2 vary_fragcoord; +VARYING vec2 vary_tc; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl index b519dbc4b0..a1986fca9a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFNoFXAAF.glsl @@ -29,7 +29,7 @@ uniform sampler2DRect diffuseRect; uniform sampler2D bloomMap; uniform vec2 screen_res; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl index 861bb9f735..84c23c97a0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoFXAAF.glsl @@ -41,7 +41,7 @@ uniform float magnification; uniform mat4 inv_proj; uniform vec2 screen_res; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; float getDepth(vec2 pos_screen) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index b11f26fbae..8edf5b2723 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -25,10 +25,10 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; -varying vec2 vary_tc; +VARYING vec2 vary_fragcoord; +VARYING vec2 vary_tc; uniform vec2 tc_scale; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl index 99257daca4..a172f49d87 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiF.glsl @@ -38,7 +38,7 @@ uniform int kern_length; uniform float kern_scale; uniform vec3 blur_quad; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl index 61c6393648..0d5c8e7287 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl @@ -25,10 +25,10 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl index 615317febf..c63a627971 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskF.glsl @@ -28,11 +28,13 @@ uniform float maximum_alpha; uniform sampler2D diffuseMap; -varying vec4 post_pos; +VARYING vec4 post_pos; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { - float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a; + float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a * vertex_color.a; if (alpha < minimum_alpha || alpha > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index f7bed00214..6a3cba771b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -26,11 +26,13 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; -varying vec4 post_pos; +VARYING vec4 post_pos; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { @@ -41,6 +43,6 @@ void main() gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_FrontColor = diffuse_color; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl index 541f08d5fe..ee0ea84e6f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowF.glsl @@ -25,7 +25,7 @@ -varying vec4 post_pos; +VARYING vec4 post_pos; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index 190cac9e2c..8b46e81f90 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec4 post_pos; +VARYING vec4 post_pos; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 59c0a994cd..26c7165e06 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -29,7 +29,7 @@ // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -varying vec4 vary_HazeColor; +VARYING vec4 vary_HazeColor; uniform sampler2D cloud_noise_texture; uniform vec4 gamma; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index e97d3e0828..721de18e0b 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -25,15 +25,16 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky /////////////////////////////////////////////////////////////////////////////// // Output parameters -varying vec4 vary_HazeColor; +VARYING vec4 vary_HazeColor; +VARYING vec2 vary_texcoord0; // Inputs uniform vec3 camPosLocal; @@ -61,7 +62,7 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 8116b7cdbf..fa1d2cc7a7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -64,7 +64,7 @@ uniform vec3 env_mat[3]; uniform mat3 ssao_effect_mat; uniform vec3 sun_dir; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index 7d1e99b4aa..c6031fc45a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -25,11 +25,11 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; uniform vec2 screen_res; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { //transform vertex diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index e69fa074c4..20970fc4ba 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -54,7 +54,7 @@ uniform vec3 color; uniform float falloff; uniform float size; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl index 4ab59d4d66..8eb4be7177 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsF.glsl @@ -23,13 +23,14 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; void main() { - vec4 col = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 col = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy); gl_FragData[0] = col; gl_FragData[1] = vec4(0,0,0,0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl index 1fcb05ef2c..8bc5b06379 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -26,14 +26,17 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_FrontColor = diffuse_color; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl index 4a69192fc3..797648202d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightSSAOF.glsl @@ -41,7 +41,7 @@ uniform float ssao_max_radius; uniform float ssao_factor; uniform float ssao_factor_inv; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index 10751304ae..473d6df8fa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl index c6578ea177..effa994a48 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainF.glsl @@ -31,20 +31,22 @@ uniform sampler2D detail_2; uniform sampler2D detail_3; uniform sampler2D alpha_ramp; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; void main() { /// Note: This should duplicate the blending functionality currently used for the terrain rendering. - vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy); - vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy); - vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy); - vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy); + vec4 color0 = texture2D(detail_0, vary_texcoord0.xy); + vec4 color1 = texture2D(detail_1, vary_texcoord0.xy); + vec4 color2 = texture2D(detail_2, vary_texcoord0.xy); + vec4 color3 = texture2D(detail_3, vary_texcoord0.xy); - float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a; - float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a; - float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; + float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a; + float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a; + float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); gl_FragData[0] = vec4(outColor.rgb, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index 7f84ef1cff..5effee4e4e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -27,13 +27,19 @@ uniform mat3 normal_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; -attribute vec2 texcoord1; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; -varying vec3 vary_normal; +VARYING vec3 vary_normal; + +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; + +uniform vec4 object_plane_s; +uniform vec4 object_plane_t; vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) { @@ -57,11 +63,11 @@ void main() vary_normal = normalize(normal_matrix * normal); // Transform and pass tex coords - gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; + vary_texcoord0.xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy; vec4 t = vec4(texcoord1,0,1); - gl_TexCoord[0].zw = t.xy; - gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0); - gl_TexCoord[1].zw = t.xy-vec2(1.0, 0.0); + vary_texcoord0.zw = t.xy; + vary_texcoord1.xy = t.xy-vec2(2.0, 0.0); + vary_texcoord1.zw = t.xy-vec2(1.0, 0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl index a6406bdc12..b0ef348cd1 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeF.glsl @@ -27,20 +27,22 @@ uniform sampler2D diffuseMap; -varying vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec3 vary_normal; +VARYING vec2 vary_texcoord0; uniform float minimum_alpha; uniform float maximum_alpha; void main() { - vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); if (col.a < minimum_alpha || col.a > maximum_alpha) { discard; } - gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, 0.0); + gl_FragData[0] = vec4(vertex_color.rgb*col.rgb, 0.0); gl_FragData[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl index 9f0b902c96..22ebaa9be6 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowF.glsl @@ -1,7 +1,25 @@ /** * @file treeShadowF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ */ @@ -10,11 +28,12 @@ uniform float maximum_alpha; uniform sampler2D diffuseMap; -varying vec4 post_pos; +VARYING vec4 post_pos; +VARYING vec2 vary_texcoord0; void main() { - float alpha = texture2D(diffuseMap, gl_TexCoord[0].xy).a; + float alpha = texture2D(diffuseMap, vary_texcoord0.xy).a; if (alpha < minimum_alpha || alpha > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl index c695d374ac..e472a75304 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl @@ -26,10 +26,11 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; -varying vec4 post_pos; +VARYING vec4 post_pos; +VARYING vec2 vary_texcoord0; void main() { @@ -40,5 +41,5 @@ void main() gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 45bfc0ce09..3b6571a24a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl @@ -27,19 +27,21 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; uniform mat3 normal_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; -varying vec3 vary_normal; +VARYING vec3 vary_normal; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vary_normal = normalize(normal_matrix * normal); - gl_FrontColor = vec4(1,1,1,1); + vertex_color = vec4(1,1,1,1); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index c3e7371c8e..d10548cbef 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -58,10 +58,10 @@ uniform vec2 screen_res; uniform mat4 norm_mat; //region space to screen space //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; -varying vec4 vary_position; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; +VARYING vec4 vary_position; void main() { diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index ac51cb1741..9734acf005 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -26,7 +26,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; void calcAtmospherics(vec3 inPositionEye); @@ -37,11 +37,11 @@ uniform float time; uniform vec3 eyeVec; uniform float waterHeight; -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; -varying vec4 vary_position; +VARYING vec4 vary_position; float wave(vec2 v, float t, float f, vec2 d, float s) { diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl index c5ca9f4804..a34e76d25a 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl @@ -34,9 +34,11 @@ uniform vec3 lumWeights; uniform vec3 warmthWeights; uniform float warmthAmount; +VARYING vec2 vary_texcoord0; + void main() { - vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy); + vec4 col = texture2DRect(diffuseMap, vary_texcoord0.xy); /// CALCULATING LUMINANCE (Using NTSC lum weights) /// http://en.wikipedia.org/wiki/Luma_%28video%29 float lum = smoothstep(minLuminance, minLuminance+1.0, dot(col.rgb, lumWeights ) ); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl index c2cc8ed567..cbf4dc4bea 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractMSF.glsl @@ -35,9 +35,11 @@ uniform vec3 lumWeights; uniform vec3 warmthWeights; uniform float warmthAmount; +VARYING vec2 vary_texcoord0; + void main() { - ivec2 itc = ivec2(gl_TexCoord[0].xy); + ivec2 itc = ivec2(vary_texcoord0.xy); vec4 fcol = vec4(0,0,0,0); for (int i = 0; i < samples; i++) diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl index 628489296f..1396dc6973 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl @@ -25,13 +25,14 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +VARYING vec2 vary_texcoord0; void main() { gl_Position = modelview_projection_matrix * vec4(position, 1.0); - gl_TexCoord[0].xy = texcoord0; + vary_texcoord0.xy = texcoord0; } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl index 75cff75ea9..3d17a20fbb 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl @@ -28,6 +28,11 @@ uniform sampler2D diffuseMap; uniform float glowStrength; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; +VARYING vec4 vary_texcoord2; +VARYING vec4 vary_texcoord3; + void main() { @@ -38,14 +43,14 @@ void main() kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0; kern[4] = 1.0; kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25; - col += kern[0] * texture2D(diffuseMap, gl_TexCoord[0].xy); - col += kern[1] * texture2D(diffuseMap, gl_TexCoord[1].xy); - col += kern[2] * texture2D(diffuseMap, gl_TexCoord[2].xy); - col += kern[3] * texture2D(diffuseMap, gl_TexCoord[3].xy); - col += kern[4] * texture2D(diffuseMap, gl_TexCoord[0].zw); - col += kern[5] * texture2D(diffuseMap, gl_TexCoord[1].zw); - col += kern[6] * texture2D(diffuseMap, gl_TexCoord[2].zw); - col += kern[7] * texture2D(diffuseMap, gl_TexCoord[3].zw); + col += kern[0] * texture2D(diffuseMap, vary_texcoord0.xy); + col += kern[1] * texture2D(diffuseMap, vary_texcoord1.xy); + col += kern[2] * texture2D(diffuseMap, vary_texcoord2.xy); + col += kern[3] * texture2D(diffuseMap, vary_texcoord3.xy); + col += kern[4] * texture2D(diffuseMap, vary_texcoord0.zw); + col += kern[5] * texture2D(diffuseMap, vary_texcoord1.zw); + col += kern[6] * texture2D(diffuseMap, vary_texcoord2.zw); + col += kern[7] * texture2D(diffuseMap, vary_texcoord3.zw); gl_FragColor = vec4(col.rgb * glowStrength, col.a); } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl index 615ca6a0b4..cdb2281578 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl @@ -25,21 +25,26 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; uniform vec2 glowDelta; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; +VARYING vec4 vary_texcoord2; +VARYING vec4 vary_texcoord3; + void main() { gl_Position = modelview_projection_matrix * vec4(position, 1.0); - gl_TexCoord[0].xy = texcoord0 + glowDelta*(-3.5); - gl_TexCoord[1].xy = texcoord0 + glowDelta*(-2.5); - gl_TexCoord[2].xy = texcoord0 + glowDelta*(-1.5); - gl_TexCoord[3].xy = texcoord0 + glowDelta*(-0.5); - gl_TexCoord[0].zw = texcoord0 + glowDelta*(0.5); - gl_TexCoord[1].zw = texcoord0 + glowDelta*(1.5); - gl_TexCoord[2].zw = texcoord0 + glowDelta*(2.5); - gl_TexCoord[3].zw = texcoord0 + glowDelta*(3.5); + vary_texcoord0.xy = texcoord0 + glowDelta*(-3.5); + vary_texcoord1.xy = texcoord0 + glowDelta*(-2.5); + vary_texcoord2.xy = texcoord0 + glowDelta*(-1.5); + vary_texcoord3.xy = texcoord0 + glowDelta*(-0.5); + vary_texcoord0.zw = texcoord0 + glowDelta*(0.5); + vary_texcoord1.zw = texcoord0 + glowDelta*(1.5); + vary_texcoord2.zw = texcoord0 + glowDelta*(2.5); + vary_texcoord3.zw = texcoord0 + glowDelta*(3.5); } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl index c61d5a2a08..5d72390d2d 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainF.glsl @@ -29,13 +29,18 @@ uniform sampler2D detail0; uniform sampler2D detail1; uniform sampler2D alphaRamp; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + void main() { - float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a; - vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb, - texture2D(detail0, gl_TexCoord[0].xy).rgb, + float a = texture2D(alphaRamp, vary_texcoord1.xy).a; + vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb, + texture2D(detail0, vary_texcoord0.xy).rgb, a); gl_FragColor.rgb = color; - gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a; + gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.xy).a; } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 04b3033dd8..d4a62db684 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -31,14 +31,22 @@ uniform mat4 texture_matrix3; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; -attribute vec2 texcoord1; -attribute vec2 texcoord2; -attribute vec2 texcoord3; +uniform vec4 object_plane_t; +uniform vec4 object_plane_s; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; +ATTRIBUTE vec2 texcoord2; +ATTRIBUTE vec2 texcoord3; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -61,15 +69,15 @@ void main() //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vec4 pos = modelview_matrix * position; + vec4 pos = modelview_matrix * vec4(position, 1.0); vec3 norm = normalize(normal_matrix * normal); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color); - gl_FrontColor = color; + vertex_color = color; - gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]); - gl_TexCoord[1] = texture_matrix1*vec4(texcoord1,0,1); - gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]); - gl_TexCoord[3] = texture_matrix3*vec4(texcoord3,0,1); + vary_texcoord0 = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),texture_matrix0,object_plane_s,object_plane_t).xy; + vary_texcoord1 = (texture_matrix1*vec4(texcoord1,0,1)).xy; + vary_texcoord2 = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),texture_matrix2,object_plane_s,object_plane_t).xy; + vary_texcoord3 = (texture_matrix3*vec4(texcoord3,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl index 711b42b95e..307b87e086 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainWaterF.glsl @@ -31,13 +31,18 @@ uniform sampler2D detail0; uniform sampler2D detail1; uniform sampler2D alphaRamp; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; + void main() { - float a = texture2D(alphaRamp, gl_TexCoord[1].xy).a; - vec3 color = mix(texture2D(detail1, gl_TexCoord[2].xy).rgb, - texture2D(detail0, gl_TexCoord[0].xy).rgb, + float a = texture2D(alphaRamp, vary_texcoord1.xy).a; + vec3 color = mix(texture2D(detail1, vary_texcoord2.xy).rgb, + texture2D(detail0, vary_texcoord0.xy).rgb, a); gl_FragColor.rgb = color; - gl_FragColor.a = texture2D(alphaRamp, gl_TexCoord[3].xy).a; + gl_FragColor.a = texture2D(alphaRamp, vary_texcoord3.xy).a; } diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl index 72e8e739b3..48eea0bdda 100644 --- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl @@ -33,9 +33,9 @@ uniform float refScale; uniform vec4 waterFogColor; //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; void main() { diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 4d555b566a..1bb04ceb34 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -50,9 +50,9 @@ uniform float blurMultiplier; uniform vec4 fogCol; //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; void main() { diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index d44690d1fb..e4db326bed 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -24,15 +24,16 @@ */ +VARYING float fog_depth; vec4 applyWaterFog(vec4 color) { // GL_EXP2 Fog - //float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord); + //float fog = exp(-gl_Fog.density * gl_Fog.density * fog_depth * fog_depth); // GL_EXP Fog - // float fog = exp(-gl_Fog.density * gl_FogFragCoord); + // float fog = exp(-gl_Fog.density * fog_depth); // GL_LINEAR Fog - float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale; + float fog = (gl_Fog.end - fog_depth) * gl_Fog.scale; fog = clamp(fog, 0.0, 1.0); color.rgb = mix(gl_Fog.color.rgb, color.rgb, fog); return color; diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index 99433ada7b..f66ba1d2d9 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -26,7 +26,7 @@ uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; void calcAtmospherics(vec3 inPositionEye); @@ -36,9 +36,9 @@ uniform float time; uniform vec3 eyeVec; uniform float waterHeight; -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; float wave(vec2 v, float t, float f, vec2 d, float s) { diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl index 27c63fdc8b..66f3e1ae11 100644 --- a/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/customalphaF.glsl @@ -27,9 +27,12 @@ uniform sampler2D diffuseMap; uniform float custom_alpha; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void main() { - vec4 color = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy); color.a *= custom_alpha; gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl index 5bbc7deff0..890474d6d8 100644 --- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl @@ -25,15 +25,17 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_FrontColor = diffuse_color; + vary_texcoord0 = texcoord0; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl index cd3d090e52..f4d704577a 100644 --- a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl @@ -25,7 +25,7 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; void main() { diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl index b8963e1dec..caff5fc324 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineF.glsl @@ -28,8 +28,11 @@ uniform sampler2D glowMap; uniform sampler2DRect screenMap; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; + void main() { - gl_FragColor = texture2D(glowMap, gl_TexCoord[0].xy) + - texture2DRect(screenMap, gl_TexCoord[1].xy); + gl_FragColor = texture2D(glowMap, vary_texcoord0.xy) + + texture2DRect(screenMap, vary_texcoord1.xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl index 6639f88047..3e972f0cb4 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAF.glsl @@ -1,7 +1,25 @@ /** * @file glowcombineFXAAF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ */ @@ -11,7 +29,7 @@ uniform sampler2D glowMap; uniform sampler2DRect screenMap; uniform vec2 screen_res; -varying vec2 vary_tc; +VARYING vec2 vary_tc; void main() { diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl index bd5dd6046b..058f3b1b82 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_tc; +VARYING vec2 vary_tc; void main() { diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl index 94edbe5ab1..f7970b7f78 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl @@ -25,14 +25,17 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec2 texcoord1; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; + +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; void main() { gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_TexCoord[1] = vec4(texcoord1,0,1); + vary_texcoord0 = texcoord0; + vary_texcoord1 = texcoord1; } diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl index 3a48205101..1d37b97bf1 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightF.glsl @@ -27,7 +27,9 @@ uniform vec4 color; uniform sampler2D diffuseMap; +VARYING vec2 vary_texcoord0; + void main() { - gl_FragColor = color*texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = color*texture2D(diffuseMap, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl index 6bb5affd93..9bf7b60eb7 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl @@ -26,13 +26,15 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; + +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl index 43dcd5dbe2..c26fa08ddc 100644 --- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl @@ -25,7 +25,7 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; void main() { diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl index a5442c9bf4..d860106305 100644 --- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorF.glsl @@ -1,13 +1,33 @@ /** * @file onetexturenocolorF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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 sampler2D tex0; +VARYING vec2 vary_texcoord0; + void main() { - gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy); + gl_FragColor = texture2D(tex0, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl index 615412c7a2..6b9986c8d7 100644 --- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl @@ -25,13 +25,14 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +VARYING vec2 vary_texcoord0; void main() { gl_Position = modelview_projection_matrix * vec4(position, 1); - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; } diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl index b1d2b949ac..a25c9a08fb 100644 --- a/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorF.glsl @@ -25,9 +25,12 @@ uniform sampler2D tex0; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void main() { - float alpha = texture2D(tex0, gl_TexCoord[0].xy).a * gl_Color.a; + float alpha = texture2D(tex0, vary_texcoord0.xy).a * vertex_color.a; - gl_FragColor = vec4(gl_Color.rgb, alpha); + gl_FragColor = vec4(vertex_color.rgb, alpha); } diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl index 45e6a9febc..c58f9dfdaf 100644 --- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl @@ -25,14 +25,17 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_FrontColor = diffuse_color; - gl_TexCoord[0] = vec4(texcoord0,0,1); + vertex_color = diffuse_color; + vary_texcoord0 = texcoord0; } diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl index c263f4dc6a..9a295ce9f2 100644 --- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectF.glsl @@ -27,7 +27,10 @@ uniform sampler2DRect screenMap; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void main() { - gl_FragColor = texture2DRect(screenMap, gl_TexCoord[0].xy) * gl_Color; + gl_FragColor = texture2DRect(screenMap, vary_texcoord0.xy) * vertex_color; } diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl index 2b471d99e8..641d670c26 100644 --- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl @@ -25,14 +25,17 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec4 diffuse_color; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec4 diffuse_color; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_FrontColor = diffuse_color; + vary_texcoord0 = texcoord0; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl index 3408cc44f8..3ded949943 100644 --- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddF.glsl @@ -26,7 +26,10 @@ uniform sampler2D tex0; uniform sampler2D tex1; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; + void main() { - gl_FragColor = texture2D(tex0, gl_TexCoord[0].xy)+texture2D(tex1, gl_TexCoord[1].xy); + gl_FragColor = texture2D(tex0, vary_texcoord0.xy)+texture2D(tex1, vary_texcoord1.xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl index 2a36feaa21..3c2f297f7f 100644 --- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl @@ -25,14 +25,17 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec2 texcoord1; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; + +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; void main() { gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_TexCoord[1] = vec4(texcoord1,0,1); + vary_texcoord0 = texcoord0; + vary_texcoord1 = texcoord1; } diff --git a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl index 7694056b08..2602e489c8 100644 --- a/indra/newview/app_settings/shaders/class1/interface/uiF.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/uiF.glsl @@ -25,7 +25,10 @@ uniform sampler2D diffuseMap; +VARYING vec2 vary_texcoord0; +VARYING vec4 vertex_color; + void main() { - gl_FragColor = gl_Color*texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = vertex_color*texture2D(diffuseMap, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl index a9e42a432f..220dafef25 100644 --- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl @@ -26,15 +26,17 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void main() { gl_Position = modelview_projection_matrix * vec4(position, 1); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_FrontColor = diffuse_color; + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl index 5cb3eb05a7..0a687d7a33 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl @@ -23,13 +23,14 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; void default_lighting() { - vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl index f3ba8b73a8..7ba6e9dec9 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightF.glsl @@ -28,8 +28,10 @@ uniform sampler2D diffuseMap; +VARYING vec2 vary_texcoord0; + void fullbright_lighting() { - gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl index b4c8a9abce..00c08d59ef 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyF.glsl @@ -29,7 +29,9 @@ uniform sampler2D diffuseMap; uniform samplerCube environmentMap; +VARYING vec2 vary_texcoord0; + void fullbright_shiny_lighting() { - gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl index 925d6fbcfd..2140b2f612 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightShinyWaterF.glsl @@ -28,7 +28,9 @@ uniform sampler2D diffuseMap; uniform samplerCube environmentMap; +VARYING vec2 vary_texcoord0; + void fullbright_shiny_lighting_water() { - gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl index 71238f7d31..ab6b561f08 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl @@ -28,8 +28,10 @@ uniform sampler2D diffuseMap; +VARYING vec2 vary_texcoord0; + void fullbright_lighting_water() { - gl_FragColor = texture2D(diffuseMap, gl_TexCoord[0].xy); + gl_FragColor = texture2D(diffuseMap, vary_texcoord0.xy); } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl index 7c9b7c218f..183582e41f 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl @@ -24,14 +24,15 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; uniform samplerCube environmentMap; void shiny_lighting() { - vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl index ca1af8fc79..9c9f7ca658 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl @@ -24,14 +24,15 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; uniform samplerCube environmentMap; void shiny_lighting_water() { - vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl index da76a977b6..1a041c26ca 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightWaterF.glsl @@ -23,13 +23,14 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; void default_lighting_water() { - vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); + vec4 color = vertex_color * texture2D(diffuseMap, vary_texcoord0.xy); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl index 11031a8829..53c0e77b48 100644 --- a/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/bumpF.glsl @@ -26,10 +26,13 @@ uniform sampler2D texture0; uniform sampler2D texture1; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; + void main() { - float tex0 = texture2D(texture0, gl_TexCoord[0].xy).a; - float tex1 = texture2D(texture1, gl_TexCoord[1].xy).a; + float tex0 = texture2D(texture0, vary_texcoord0.xy).a; + float tex1 = texture2D(texture1, vary_texcoord1.xy).a; gl_FragColor = vec4(tex0+(1.0-tex1)-0.5); } diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl index dccc692593..09ec6ff792 100644 --- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl @@ -27,14 +27,17 @@ uniform mat4 texture_matrix0; uniform mat4 texture_matrix1; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec2 texcoord1; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; + +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; void main() { //transform vertex gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_TexCoord[1] = texture_matrix1 * vec4(texcoord1,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1 * vec4(texcoord1,0,1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index e2a00e8440..bf4c45f18f 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -27,9 +27,13 @@ uniform mat4 projection_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; -attribute vec3 position; -attribute float emissive; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE float emissive; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -37,7 +41,7 @@ mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); @@ -46,9 +50,9 @@ void main() calcAtmospherics(pos.xyz); - gl_FrontColor = vec4(0,0,0,emissive); + vertex_color = vec4(0,0,0,emissive); gl_Position = projection_matrix*vec4(pos, 1.0); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl index dedf00f374..0e05beac67 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -27,25 +27,29 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute float emissive; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE float emissive; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; void calcAtmospherics(vec3 inPositionEye); -varying float vary_texture_index; +VARYING float vary_texture_index; +VARYING float fog_depth; void main() { //transform vertex vary_texture_index = position.w; gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); calcAtmospherics(pos.xyz); - gl_FrontColor = vec4(0,0,0,emissive); + vertex_color = vec4(0,0,0,emissive); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl index b9c1078c30..f73760bfd4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl @@ -27,9 +27,13 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec3 normal; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 normal; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void calcAtmospherics(vec3 inPositionEye); @@ -39,11 +43,11 @@ void main() vec4 vert = vec4(position.xyz,1.0); vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; calcAtmospherics(pos.xyz); - gl_FrontColor = vec4(1,1,1,1); + vertex_color = vec4(1,1,1,1); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index 546b7cad4a..69cd858b4d 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -27,10 +27,15 @@ uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; +VARYING float fog_depth; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -49,14 +54,14 @@ void main() vec3 ref = reflect(pos.xyz, -norm.xyz); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz; calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; gl_Position = projection_matrix*vec4(pos, 1.0); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl index a9b086e215..a8e640018d 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -29,10 +29,15 @@ uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; +VARYING float fog_depth; void calcAtmospherics(vec3 inPositionEye); @@ -46,13 +51,13 @@ void main() vec3 norm = normalize(normal_matrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz; vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index f0722a1e4d..4de24fd46b 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -26,17 +26,21 @@ uniform mat4 projection_matrix; uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; + void main() { //transform vertex - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); @@ -45,9 +49,9 @@ void main() calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; gl_Position = projection_matrix*vec4(pos, 1.0); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl index d8f223d403..7286e5e2f4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -27,9 +27,13 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void calcAtmospherics(vec3 inPositionEye); @@ -38,13 +42,13 @@ void main() //transform vertex vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl index d09db8e6a3..e5bf5bf2d3 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl @@ -28,9 +28,11 @@ uniform float maximum_alpha; uniform sampler2D diffuseMap; +VARYING vec2 vary_texcoord0; + void main() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl index 69007610c6..e90dbb115a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl @@ -27,12 +27,14 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; + +VARYING vec2 vary_texcoord0; void main() { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; } diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 3771c2e795..282686a9b0 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -28,9 +28,13 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -40,14 +44,14 @@ void main() //transform vertex vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); - gl_FrontColor = color; + vertex_color = color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl index 7e5c8ca2d5..591d6fc5c9 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -27,10 +27,14 @@ uniform mat4 texture_matrix0; uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -50,13 +54,13 @@ void main() vec3 ref = reflect(pos.xyz, -norm.xyz); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz; calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.)); - gl_FrontColor = color; + vertex_color = color; gl_Position = projection_matrix*vec4(pos, 1.0); } diff --git a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl index da47f8a58a..86a78b190c 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -28,10 +28,14 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec3 vary_texcoord0; +VARYING float fog_depth; void calcAtmospherics(vec3 inPositionEye); @@ -47,12 +51,12 @@ void main() calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = texture_matrix0*vec4(ref,1.0); + vary_texcoord0 = (texture_matrix0*vec4(ref,1.0)).xyz; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl index d1d8126cb4..45a493e4f2 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -28,9 +28,13 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -40,14 +44,14 @@ void main() //transform vertex vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); - gl_FrontColor = color; + vertex_color = color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index bf083a55c4..aea0e25e60 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -26,10 +26,14 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -38,7 +42,7 @@ mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); @@ -53,9 +57,9 @@ void main() calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.)); - gl_FrontColor = color; + vertex_color = color; gl_Position = projection_matrix*vec4(pos, 1.0); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl index 87ece3972e..4b6b219751 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -28,10 +28,14 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -41,14 +45,14 @@ void main() //transform vertex vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - gl_FrontColor = color; + vertex_color = color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl index 64ca63731b..250d99a9c7 100644 --- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -28,20 +28,24 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec3 normal; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 normal; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; + void main() { //transform vertex vec4 vert = vec4(position.xyz,1.0); gl_Position = modelview_projection_matrix*vert; - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; vec4 pos = (modelview_matrix * vert); @@ -50,7 +54,7 @@ void main() calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); - gl_FrontColor = color; + vertex_color = color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl index dbacf28637..2e41360150 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsF.glsl @@ -25,7 +25,7 @@ -varying vec3 vary_PositionEye; +VARYING vec3 vary_PositionEye; vec3 getPositionEye() { diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index e051ac9851..42f8646f2d 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -25,7 +25,7 @@ -varying vec3 vary_PositionEye; +VARYING vec3 vary_PositionEye; vec3 getPositionEye() diff --git a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl index 43e19909d4..04d3e2aa1f 100644 --- a/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class2/avatar/eyeballV.glsl @@ -28,10 +28,14 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -41,7 +45,7 @@ void main() //transform vertex vec3 pos = (modelview_matrix * vec4(position.xyz, 1.0)).xyz; gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); @@ -51,8 +55,8 @@ void main() vec4 specular = vec4(1.0); vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); - gl_FrontColor = color; - gl_FogFragCoord = pos.z; + vertex_color = color; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 839606cdcb..4fffb9e97f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -27,6 +27,9 @@ #extension GL_ARB_texture_rectangle : enable +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + uniform sampler2DRectShadow shadowMap0; uniform sampler2DRectShadow shadowMap1; uniform sampler2DRectShadow shadowMap2; @@ -41,11 +44,11 @@ uniform vec2 shadow_res; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; uniform float shadow_bias; @@ -122,9 +125,9 @@ void main() } } - vec4 diff = diffuseLookup(gl_TexCoord[0].xy); + vec4 diff = diffuseLookup(vary_texcoord0.xy); - vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); + vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a); vec4 color = diff * col; color.rgb = atmosLighting(color.rgb); @@ -133,7 +136,7 @@ void main() color.rgb += diff.rgb * vary_pointlight_col.rgb; - //gl_FragColor = gl_Color; + //gl_FragColor = vertex_color; gl_FragColor = color; //gl_FragColor.r = 0.0; //gl_FragColor = vec4(1,shadow,1,1); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl index 84e49a5f8f..30aa82473a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedF.glsl @@ -42,11 +42,13 @@ uniform vec2 shadow_res; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; +VARYING vec2 vary_texcoord0; +VARYING vec4 vertex_color; uniform float shadow_bias; @@ -123,9 +125,9 @@ void main() } } - vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy); + vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy); - vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, gl_Color.a); + vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, vertex_color.a); vec4 color = diff * col; color.rgb = atmosLighting(color.rgb); @@ -134,7 +136,7 @@ void main() color.rgb += diff.rgb * vary_pointlight_col.rgb; - //gl_FragColor = gl_Color; + //gl_FragColor = vertex_color; gl_FragColor = color; //gl_FragColor.r = 0.0; //gl_FragColor = vec4(1,shadow,1,1); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl index 294a000ab5..9370b484b8 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaNonIndexedNoColorF.glsl @@ -1,7 +1,25 @@ /** * @file alphaNonIndexedNoColorF.glsl * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $LicenseInfo:firstyear=2005&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2005, 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$ */ @@ -24,11 +42,12 @@ uniform vec2 shadow_res; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; +VARYING vec2 vary_texcoord0; uniform float shadow_bias; @@ -105,7 +124,7 @@ void main() } } - vec4 diff = texture2D(diffuseMap,gl_TexCoord[0].xy); + vec4 diff = texture2D(diffuseMap,vary_texcoord0.xy); vec4 col = vec4(vary_ambient + vary_directional.rgb*shadow, 1.0); vec4 color = diff * col; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index c3148d5fdf..ad353eb624 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -27,10 +27,10 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -42,11 +42,15 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; uniform float near_clip; uniform float shadow_offset; @@ -89,7 +93,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; mat4 mat = getObjectSkinnedTransform(); @@ -134,9 +138,9 @@ void main() col.rgb = min(col.rgb*diffuse_color.rgb, 1.0); - gl_FrontColor = col; + vertex_color = col; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; pos.xyz = (modelview_projection_matrix * vec4(position.xyz, 1.0)).xyz; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index 8d55616e67..268e4127a2 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -28,10 +28,10 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -43,12 +43,15 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_position; -varying vec3 vary_pointlight_col; -varying float vary_texture_index; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_position; +VARYING vec3 vary_pointlight_col; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; uniform float near_clip; uniform float shadow_offset; @@ -97,7 +100,7 @@ void main() vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; vec3 norm = normalize(normal_matrix * normal); @@ -130,9 +133,9 @@ void main() col.rgb = col.rgb*diffuse_color.rgb; - gl_FrontColor = col; + vertex_color = col; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; pos = modelview_projection_matrix * vert; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); diff --git a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl index 0273f3c121..091a865160 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/avatarAlphaV.glsl @@ -25,9 +25,9 @@ uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -41,11 +41,14 @@ vec3 atmosAffectDirectionalLight(float lightIntensity); vec3 scaleDownLight(vec3 light); vec3 scaleUpLight(vec3 light); -varying vec3 vary_position; -varying vec3 vary_ambient; -varying vec3 vary_directional; -varying vec3 vary_fragcoord; -varying vec3 vary_pointlight_col; +VARYING vec3 vary_position; +VARYING vec3 vary_ambient; +VARYING vec3 vary_directional; +VARYING vec3 vary_fragcoord; +VARYING vec3 vary_pointlight_col; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; uniform float near_clip; uniform float shadow_offset; @@ -88,7 +91,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; vec3 norm; @@ -134,9 +137,9 @@ void main() col.rgb = min(col.rgb, 1.0); - gl_FrontColor = col; + vertex_color = col; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; vary_fragcoord.xyz = pos.xyz + vec3(0,0,near_clip); } diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl index d9eafb6eba..4fc6c00caf 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeF.glsl @@ -30,7 +30,7 @@ uniform sampler2DRect depthMap; uniform sampler2DRect normalMap; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform float depth_cutoff; uniform float norm_cutoff; diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl index a84fdd5dc1..11a7cf846d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeMSF.glsl @@ -31,7 +31,7 @@ uniform sampler2DMS depthMap; uniform sampler2DMS normalMap; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform float depth_cutoff; uniform float norm_cutoff; diff --git a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl index 1f5470db3c..69c6acc07a 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/edgeV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 4c92d72f44..d1f2db6188 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -59,7 +59,7 @@ uniform float size; uniform vec3 color; uniform float falloff; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl index 1afa9a9fb4..74f78cfc06 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightMSF.glsl @@ -28,6 +28,8 @@ #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable +VARYING vec4 vertex_color; + uniform sampler2DMS diffuseRect; uniform sampler2DMS specularRect; uniform sampler2DMS depthMap; @@ -54,9 +56,9 @@ uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; -varying vec4 vary_light; +VARYING vec4 vary_light; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; @@ -160,7 +162,7 @@ void main() { proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = vertex_color.a+1.0; float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); if (dist_atten > 0.0) { @@ -189,7 +191,7 @@ void main() vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -206,7 +208,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -239,7 +241,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; + col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 22f52032a5..e9f1a3d3a5 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -67,7 +67,7 @@ uniform vec2 screen_res; uniform vec3 sun_dir; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl index 1244294451..6b979b13ed 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightMSF.glsl @@ -66,8 +66,8 @@ uniform mat3 ssao_effect_mat; uniform mat4 inv_proj; uniform vec2 screen_res; -varying vec4 vary_light; -varying vec2 vary_fragcoord; +VARYING vec4 vary_light; +VARYING vec2 vary_fragcoord; vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl index 424299269f..c840d72784 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightV.glsl @@ -25,11 +25,11 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; uniform vec2 screen_res; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl index 25270f4939..19a1d1f165 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl @@ -27,6 +27,8 @@ #extension GL_ARB_texture_rectangle : enable +VARYING vec4 vertex_color; + uniform sampler2DRect diffuseRect; uniform sampler2DRect specularRect; uniform sampler2DRect depthMap; @@ -53,9 +55,9 @@ uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; -varying vec4 vary_light; +VARYING vec4 vary_light; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; @@ -114,7 +116,7 @@ void main() proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = vertex_color.a+1.0; float dist_atten = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); lv = proj_origin-pos.xyz; @@ -140,7 +142,7 @@ void main() vec4 plcol = texture2DLod(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -163,7 +165,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -192,7 +194,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLod(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; + col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl index 4962e73e39..85fea56411 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightMSF.glsl @@ -28,6 +28,8 @@ #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_texture_multisample : enable +VARYING vec4 vertex_color; + uniform sampler2DMS diffuseRect; uniform sampler2DMS specularRect; uniform sampler2DMS depthMap; @@ -54,9 +56,9 @@ uniform float sun_wash; uniform int proj_shadow_idx; uniform float shadow_fade; -varying vec4 vary_light; +VARYING vec4 vary_light; -varying vec4 vary_fragcoord; +VARYING vec4 vary_fragcoord; uniform vec2 screen_res; uniform mat4 inv_proj; @@ -161,7 +163,7 @@ void main() { proj_tc.xyz /= proj_tc.w; - float fa = gl_Color.a+1.0; + float fa = vertex_color.a+1.0; float dist_atten = min(1.0-(dist2-1.0*(1.0-fa))/fa, 1.0); if (dist_atten > 0.0) { @@ -190,7 +192,7 @@ void main() vec4 plcol = texture2DLodDiffuse(projectionMap, proj_tc.xy, lod); - vec3 lcol = gl_Color.rgb * plcol.rgb * plcol.a; + vec3 lcol = vertex_color.rgb * plcol.rgb * plcol.a; lit = da * dist_atten * noise; @@ -207,7 +209,7 @@ void main() amb_da = min(amb_da, 1.0-lit); - col += amb_da*gl_Color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; + col += amb_da*vertex_color.rgb*diff_tex.rgb*amb_plcol.rgb*amb_plcol.a; } @@ -240,7 +242,7 @@ void main() stc.y > 0.0) { vec4 scol = texture2DLodSpecular(projectionMap, stc.xy, proj_lod-spec.a*proj_lod); - col += dist_atten*scol.rgb*gl_Color.rgb*scol.a*spec.rgb*shadow; + col += dist_atten*scol.rgb*vertex_color.rgb*scol.a*spec.rgb*shadow; } } } diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl index 146fac56e9..bb742adb62 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl @@ -47,7 +47,7 @@ uniform float ssao_max_radius; uniform float ssao_factor; uniform float ssao_factor_inv; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -97,15 +97,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) stc.xyz /= stc.w; stc.z += spot_shadow_bias*scl; - float cs = shadow2D(shadowMap, stc.xyz).x; + float cs = shadow2D(shadowMap, stc.xyz); float shadow = cs; vec2 off = 1.5/proj_shadow_res; - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs); return shadow/5.0; diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl index ac4fe52655..4933eb00b7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightMSF.glsl @@ -48,8 +48,8 @@ uniform float ssao_max_radius; uniform float ssao_factor; uniform float ssao_factor_inv; -varying vec2 vary_fragcoord; -varying vec4 vary_light; +VARYING vec2 vary_fragcoord; +VARYING vec4 vary_light; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -98,15 +98,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) stc.xyz /= stc.w; stc.z += spot_shadow_bias*scl; - float cs = shadow2D(shadowMap, stc.xyz).x; + float cs = shadow2D(shadowMap, stc.xyz); float shadow = cs; vec2 off = 1.5/proj_shadow_res; - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs); return shadow/5.0; diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl index 60741771d6..042bb5f96c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl @@ -46,7 +46,7 @@ uniform float ssao_max_radius; uniform float ssao_factor; uniform float ssao_factor_inv; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec3 sun_dir; uniform mat4 inv_proj; @@ -148,15 +148,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) stc.xyz /= stc.w; stc.z += spot_shadow_bias*scl; - float cs = shadow2D(shadowMap, stc.xyz).x; + float cs = shadow2D(shadowMap, stc.xyz); float shadow = cs; vec2 off = 1.5/proj_shadow_res; - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs); return shadow/5.0; diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl index 0fd7b7525d..e138ae5841 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOMSF.glsl @@ -47,8 +47,8 @@ uniform float ssao_max_radius; uniform float ssao_factor; uniform float ssao_factor_inv; -varying vec2 vary_fragcoord; -varying vec4 vary_light; +VARYING vec2 vary_fragcoord; +VARYING vec4 vary_light; uniform mat4 inv_proj; uniform vec2 screen_res; @@ -149,15 +149,15 @@ float pcfShadow(sampler2DShadow shadowMap, vec4 stc, float scl) stc.xyz /= stc.w; stc.z += spot_shadow_bias*scl; - float cs = shadow2D(shadowMap, stc.xyz).x; + float cs = shadow2D(shadowMap, stc.xyz); float shadow = cs; vec2 off = 1.5/proj_shadow_res; - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)).x, cs); - shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)).x, cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(off.x, -off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, off.y, 0.0)), cs); + shadow += max(shadow2D(shadowMap, stc.xyz+vec3(-off.x, -off.y, 0.0)), cs); return shadow/5.0; diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl index 60ba2d7ad4..bc5eb5181d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl index 35411db04b..01fe4a4e14 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurF.glsl @@ -23,29 +23,5 @@ * $/LicenseInfo$ */ +//NOT USED!!! - -uniform sampler2DRect RenderTexture; -uniform float bloomStrength; - -varying vec4 gl_TexCoord[gl_MaxTextureCoords]; -void main(void) -{ - float blurWeights[7]; - blurWeights[0] = 0.05; - blurWeights[1] = 0.1; - blurWeights[2] = 0.2; - blurWeights[3] = 0.3; - blurWeights[4] = 0.2; - blurWeights[5] = 0.1; - blurWeights[6] = 0.05; - - vec3 color = vec3(0,0,0); - for (int i = 0; i < 7; i++){ - color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i]; - } - - color *= bloomStrength; - - gl_FragColor = vec4(color, 1.0); -} diff --git a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl index 4fd4b101ff..b92e9b3f03 100644 --- a/indra/newview/app_settings/shaders/class2/effects/blurV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/blurV.glsl @@ -23,36 +23,5 @@ * $/LicenseInfo$ */ -uniform mat4 modelview_projection_matrix; + // NOT USED!! -attribute vec3 position; -attribute vec2 texcoord0; - -uniform vec2 texelSize; -uniform vec2 blurDirection; -uniform float blurWidth; - -void main(void) -{ - // Transform vertex - gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - - vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth); - vec2 s = vec4(texcoord0,0,1).st - (blurDelta * 3.0); - - // for (int i = 0; i < 7; i++) { - // gl_TexCoord[i].st = s + (i * blurDelta); - // } - - // MANUALLY UNROLL - gl_TexCoord[0].st = s; - gl_TexCoord[1].st = s + blurDelta; - gl_TexCoord[2].st = s + (2. * blurDelta); - gl_TexCoord[3].st = s + (3. * blurDelta); - gl_TexCoord[4].st = s + (4. * blurDelta); - gl_TexCoord[5].st = s + (5. * blurDelta); - gl_TexCoord[6].st = s + (6. * blurDelta); - - // gl_TexCoord[0].st = s; - // gl_TexCoord[1].st = blurDelta; -} diff --git a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl index 42ab8d40e8..8d673237b8 100644 --- a/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/colorFilterF.glsl @@ -36,7 +36,7 @@ const float gamma = 2.0; void main(void) { - vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); + vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st)); /// Modulate brightness color *= brightness; diff --git a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl index d3c93ab05f..f03a6076c0 100644 --- a/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/drawQuadV.glsl @@ -25,15 +25,15 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec2 texcoord1; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; void main(void) { //transform vertex gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_TexCoord[1] = vec4(texcoord1,0,1); + vary_texcoord0 = texcoord0; + vary_texcoord1 = texcoord1; } diff --git a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl index 9187c8ec31..06b83e3f5f 100644 --- a/indra/newview/app_settings/shaders/class2/effects/extractF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/extractF.glsl @@ -33,7 +33,7 @@ uniform vec3 lumWeights; void main(void) { /// Get scene color - vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); + vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st)); /// Extract luminance and scale up by night vision brightness float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights)); diff --git a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl index 76b675a9bd..3050fa63cc 100644 --- a/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/nightVisionF.glsl @@ -30,6 +30,9 @@ uniform sampler2D NoiseTexture; uniform float brightMult; uniform float noiseStrength; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; + float luminance(vec3 color) { /// CALCULATING LUMINANCE (Using NTSC lum weights) @@ -40,7 +43,7 @@ float luminance(vec3 color) void main(void) { /// Get scene color - vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); + vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st)); /// Extract luminance and scale up by night vision brightness float lum = luminance(color) * brightMult; @@ -50,7 +53,7 @@ void main(void) vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12); /// Add noise - float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r; + float noiseValue = texture2D(NoiseTexture, vary_texcoord1.st).r; noiseValue = (noiseValue - 0.5) * noiseStrength; /// Older NVG colors (more muted) diff --git a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl index abf1be6645..74e9559185 100644 --- a/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl +++ b/indra/newview/app_settings/shaders/class2/effects/simpleF.glsl @@ -27,8 +27,10 @@ uniform sampler2DRect RenderTexture; +VARYING vec2 vary_texcoord0; + void main(void) { - vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); + vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st)); gl_FragColor = vec4(1.0 - color, 1.0); } diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl index df08fce0da..6b9c629644 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainF.glsl @@ -24,6 +24,9 @@ */ +VARYING vec4 vertex_color; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; uniform sampler2D detail_0; uniform sampler2D detail_1; @@ -40,18 +43,18 @@ void main() /// Note: This should duplicate the blending functionality currently used for the terrain rendering. /// TODO Confirm tex coords and bind them appropriately in vert shader. - vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy); - vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy); - vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy); - vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy); + vec4 color0 = texture2D(detail_0, vary_texcoord0.xy); + vec4 color1 = texture2D(detail_1, vary_texcoord0.xy); + vec4 color2 = texture2D(detail_2, vary_texcoord0.xy); + vec4 color3 = texture2D(detail_3, vary_texcoord0.xy); - float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a; - float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a; - float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; + float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a; + float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a; + float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); /// Add WL Components - outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb); + outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); gl_FragColor = vec4(scaleSoftClip(outColor.rgb), 1.0); } diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl index 69f4d4ae45..f183b885d1 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainV.glsl @@ -28,12 +28,18 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; -attribute vec2 texcoord1; +uniform vec4 object_plane_t; +uniform vec4 object_plane_s; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec2 texcoord1; + +VARYING vec4 vertex_color; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; void calcAtmospherics(vec3 inPositionEye); @@ -68,15 +74,15 @@ void main() vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0)); - gl_FrontColor = color; + vertex_color = color; // Transform and pass tex coords - gl_TexCoord[0].xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; + vary_texcoord0.xy = texgen_object(vec4(position.xyz, 1.0), vec4(texcoord0,0,1), texture_matrix0, object_plane_s, object_plane_t).xy; vec4 t = vec4(texcoord1,0,1); - gl_TexCoord[0].zw = t.xy; - gl_TexCoord[1].xy = t.xy-vec2(2.0, 0.0); - gl_TexCoord[1].zw = t.xy-vec2(1.0, 0.0); + vary_texcoord0.zw = t.xy; + vary_texcoord1.xy = t.xy-vec2(2.0, 0.0); + vary_texcoord1.zw = t.xy-vec2(1.0, 0.0); } diff --git a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl index 90468b45a2..9f1c4797c9 100644 --- a/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/terrainWaterF.glsl @@ -23,7 +23,9 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec4 vary_texcoord0; +VARYING vec4 vary_texcoord1; uniform sampler2D detail_0; uniform sampler2D detail_1; @@ -40,18 +42,18 @@ void main() /// Note: This should duplicate the blending functionality currently used for the terrain rendering. /// TODO Confirm tex coords and bind them appropriately in vert shader. - vec4 color0 = texture2D(detail_0, gl_TexCoord[0].xy); - vec4 color1 = texture2D(detail_1, gl_TexCoord[0].xy); - vec4 color2 = texture2D(detail_2, gl_TexCoord[0].xy); - vec4 color3 = texture2D(detail_3, gl_TexCoord[0].xy); + vec4 color0 = texture2D(detail_0, vary_texcoord0.xy); + vec4 color1 = texture2D(detail_1, vary_texcoord0.xy); + vec4 color2 = texture2D(detail_2, vary_texcoord0.xy); + vec4 color3 = texture2D(detail_3, vary_texcoord0.xy); - float alpha1 = texture2D(alpha_ramp, gl_TexCoord[0].zw).a; - float alpha2 = texture2D(alpha_ramp,gl_TexCoord[1].xy).a; - float alphaFinal = texture2D(alpha_ramp, gl_TexCoord[1].zw).a; + float alpha1 = texture2D(alpha_ramp, vary_texcoord0.zw).a; + float alpha2 = texture2D(alpha_ramp,vary_texcoord1.xy).a; + float alphaFinal = texture2D(alpha_ramp, vary_texcoord1.zw).a; vec4 outColor = mix( mix(color3, color2, alpha2), mix(color1, color0, alpha1), alphaFinal ); /// Add WL Components - outColor.rgb = atmosLighting(outColor.rgb * gl_Color.rgb); + outColor.rgb = atmosLighting(outColor.rgb * vertex_color.rgb); outColor = applyWaterFog(outColor); gl_FragColor = outColor; diff --git a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl index f947aa4be1..e4b6402a8c 100644 --- a/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/underWaterF.glsl @@ -48,9 +48,9 @@ uniform float waterFogKS; uniform vec2 screenRes; //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; vec4 applyWaterFog(vec4 color, vec3 viewVec) { diff --git a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl index dc543b2231..0de77e6fe0 100644 --- a/indra/newview/app_settings/shaders/class2/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class2/environment/waterF.glsl @@ -47,9 +47,9 @@ uniform float blurMultiplier; //bigWave is (refCoord.w, view.w); -varying vec4 refCoord; -varying vec4 littleWave; -varying vec4 view; +VARYING vec4 refCoord; +VARYING vec4 littleWave; +VARYING vec4 view; void main() { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl index 4c05329065..ea17e42fab 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskF.glsl @@ -30,9 +30,12 @@ uniform float maximum_alpha; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void default_lighting() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl index 0de909353e..155d0756be 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightAlphaMaskNonIndexedF.glsl @@ -33,9 +33,12 @@ uniform sampler2D diffuseMap; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void default_lighting() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl index d12d88f1c5..43970015c5 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightF.glsl @@ -23,14 +23,15 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); void default_lighting() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl index 8c7713c08d..c6583a54df 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightAlphaMaskF.glsl @@ -29,9 +29,12 @@ uniform float maximum_alpha; vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void fullbright_lighting() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl index f03b1fdc74..ba2e8608f1 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightF.glsl @@ -23,14 +23,15 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); void fullbright_lighting() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl index 89468b9665..76f468d914 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedAlphaMaskF.glsl @@ -31,9 +31,12 @@ vec3 fullbrightScaleSoftClip(vec3 light); uniform sampler2D diffuseMap; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void fullbright_lighting() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl index a909ff608a..e88bf7f0ab 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightNonIndexedF.glsl @@ -23,7 +23,8 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec3 fullbrightAtmosTransport(vec3 light); vec3 fullbrightScaleSoftClip(vec3 light); @@ -32,7 +33,7 @@ uniform sampler2D diffuseMap; void fullbright_lighting() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl index d2bc912edb..045fc5276d 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyF.glsl @@ -23,7 +23,9 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; @@ -32,17 +34,17 @@ vec3 fullbrightScaleSoftClip(vec3 light); void fullbright_shiny_lighting() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = diffuseLookup(vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = fullbrightShinyAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl index af73168c13..93b14ad692 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyNonIndexedF.glsl @@ -23,7 +23,9 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; uniform sampler2D diffuseMap; @@ -33,17 +35,17 @@ vec3 fullbrightScaleSoftClip(vec3 light); void fullbright_shiny_lighting() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = fullbrightShinyAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl index e9dab85095..ffc91d9ee1 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterF.glsl @@ -23,7 +23,9 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; @@ -33,15 +35,15 @@ vec4 applyWaterFog(vec4 color); void fullbright_shiny_lighting_water() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = diffuseLookup(vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = fullbrightShinyAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl index e0a7986705..3f582d3228 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightShinyWaterNonIndexedF.glsl @@ -23,7 +23,9 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; uniform sampler2D diffuseMap; @@ -34,15 +36,15 @@ vec4 applyWaterFog(vec4 color); void fullbright_shiny_lighting_water() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = fullbrightShinyAtmosTransport(color.rgb); color.rgb = fullbrightScaleSoftClip(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl index e5998b77a9..fb2b642022 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterAlphaMaskF.glsl @@ -31,9 +31,12 @@ vec4 diffuseLookup(vec2 texcoord); vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void fullbright_lighting_water() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl index 20ff3712af..258cad3cfe 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterF.glsl @@ -23,7 +23,8 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec4 diffuseLookup(vec2 texcoord); @@ -32,7 +33,7 @@ vec4 applyWaterFog(vec4 color); void fullbright_lighting_water() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl index 3fdd110f7d..3f2802cbb8 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedAlphaMaskF.glsl @@ -31,9 +31,12 @@ uniform sampler2D diffuseMap; vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void fullbright_lighting_water() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl index 01b89019b1..23700fa1b0 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightFullbrightWaterNonIndexedF.glsl @@ -24,6 +24,8 @@ */ +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; @@ -32,7 +34,7 @@ vec4 applyWaterFog(vec4 color); void fullbright_lighting_water() { - vec4 color = texture2D(diffuseMap, gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap, vary_texcoord0.xy) * vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl index d419c2d116..09f02b9288 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightNonIndexedF.glsl @@ -23,7 +23,8 @@ * $/LicenseInfo$ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; @@ -32,7 +33,7 @@ vec3 scaleSoftClip(vec3 light); void default_lighting() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl index ba4cd949d6..66a2462b88 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyF.glsl @@ -24,7 +24,9 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; @@ -34,16 +36,16 @@ vec4 applyWaterFog(vec4 color); void shiny_lighting() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = diffuseLookup(vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = atmosLighting(color.rgb); color.rgb = scaleSoftClip(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl index 3b30ebf6f1..477408f5af 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyNonIndexedF.glsl @@ -23,8 +23,9 @@ * $/LicenseInfo$ */ - - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; uniform sampler2D diffuseMap; @@ -35,16 +36,16 @@ vec4 applyWaterFog(vec4 color); void shiny_lighting() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = atmosLighting(color.rgb); color.rgb = scaleSoftClip(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = color; } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl index c451e68763..6df8641b47 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterF.glsl @@ -24,7 +24,9 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform samplerCube environmentMap; @@ -33,14 +35,14 @@ vec4 applyWaterFog(vec4 color); void shiny_lighting_water() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = diffuseLookup(vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = atmosLighting(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl index eeb997fb5f..fce717d93a 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightShinyWaterNonIndexedF.glsl @@ -24,7 +24,9 @@ */ - +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; uniform sampler2D diffuseMap; uniform samplerCube environmentMap; @@ -34,14 +36,14 @@ vec4 applyWaterFog(vec4 color); void shiny_lighting_water() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); - color.rgb *= gl_Color.rgb; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy); + color.rgb *= vertex_color.rgb; - vec3 envColor = textureCube(environmentMap, gl_TexCoord[1].xyz).rgb; - color.rgb = mix(color.rgb, envColor.rgb, gl_Color.a); + vec3 envColor = textureCube(environmentMap, vary_texcoord1.xyz).rgb; + color.rgb = mix(color.rgb, envColor.rgb, vertex_color.a); color.rgb = atmosLighting(color.rgb); - color.a = max(color.a, gl_Color.a); + color.a = max(color.a, vertex_color.a); gl_FragColor = applyWaterFog(color); } diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl index 072dcaa6b6..4658b46a38 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskF.glsl @@ -29,9 +29,12 @@ uniform float maximum_alpha; vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void default_lighting_water() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl index 2df34da4b4..0db9253cd1 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterAlphaMaskNonIndexedF.glsl @@ -31,9 +31,12 @@ uniform sampler2D diffuseMap; vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; + void default_lighting_water() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl index ae7be4d231..a691d4f54a 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterF.glsl @@ -24,13 +24,15 @@ */ +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec3 atmosLighting(vec3 light); vec4 applyWaterFog(vec4 color); void default_lighting_water() { - vec4 color = diffuseLookup(gl_TexCoord[0].xy) * gl_Color; + vec4 color = diffuseLookup(vary_texcoord0.xy) * vertex_color; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl index 5a86dad827..6f5d6cd1c8 100644 --- a/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl +++ b/indra/newview/app_settings/shaders/class2/lighting/lightWaterNonIndexedF.glsl @@ -24,6 +24,8 @@ */ +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; @@ -32,7 +34,7 @@ vec4 applyWaterFog(vec4 color); void default_lighting_water() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color; color.rgb = atmosLighting(color.rgb); diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl index b9eff87a13..ef97e4f781 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightShinyV.glsl @@ -34,12 +34,17 @@ void calcAtmospherics(vec3 inPositionEye); uniform vec4 origin; -varying float vary_texture_index; +VARYING float vary_texture_index; -attribute vec4 position; -attribute vec3 normal; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec4 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; +VARYING float fog_depth; void main() { @@ -52,12 +57,12 @@ void main() vec3 norm = normalize(normal_matrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz; calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl index b7f7af7885..2fd22cee9d 100644 --- a/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/fullbrightV.glsl @@ -27,15 +27,18 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec2 texcoord0; -attribute vec3 normal; -attribute vec4 diffuse_color; +ATTRIBUTE vec4 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; void calcAtmospherics(vec3 inPositionEye); -varying float vary_texture_index; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void main() { @@ -44,11 +47,11 @@ void main() vary_texture_index = position.w; vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; calcAtmospherics(pos.xyz); - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl index 4511c4bc91..472ff219e5 100644 --- a/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/shinyV.glsl @@ -29,16 +29,21 @@ uniform mat4 texture_matrix1; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec2 texcoord0; -attribute vec3 normal; -attribute vec4 diffuse_color; +ATTRIBUTE vec4 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING vec3 vary_texcoord1; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -varying float vary_texture_index; +VARYING float vary_texture_index; +VARYING float fog_depth; uniform vec4 origin; @@ -53,12 +58,12 @@ void main() vec3 norm = normalize(normal_matrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); - gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy; + vary_texcoord1 = (texture_matrix1*vec4(ref,1.0)).xyz; calcAtmospherics(pos.xyz); - gl_FrontColor = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); + vertex_color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.0)); - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl index 5f78495ae3..6799e43b9a 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleNonIndexedV.glsl @@ -28,10 +28,14 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; -attribute vec3 normal; -attribute vec4 diffuse_color; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -42,7 +46,7 @@ void main() vec4 vert = vec4(position.xyz,1.0); gl_Position = modelview_projection_matrix*vert; - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; vec4 pos = (modelview_matrix * vert); @@ -51,7 +55,7 @@ void main() calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - gl_FrontColor = color; + vertex_color = color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl index 91ee5e016e..144336417e 100644 --- a/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class2/objects/simpleV.glsl @@ -28,15 +28,18 @@ uniform mat4 texture_matrix0; uniform mat4 modelview_matrix; uniform mat4 modelview_projection_matrix; -attribute vec4 position; -attribute vec2 texcoord0; -attribute vec3 normal; -attribute vec4 diffuse_color; +ATTRIBUTE vec4 position; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec4 diffuse_color; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); -varying float vary_texture_index; +VARYING float vary_texture_index; +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; +VARYING float fog_depth; void main() { @@ -45,7 +48,7 @@ void main() vary_texture_index = position.w; vec4 pos = (modelview_matrix * vert); gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); - gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1); + vary_texcoord0 = (texture_matrix0 * vec4(texcoord0, 0, 1)).xy; @@ -54,7 +57,7 @@ void main() calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); - gl_FrontColor = color; + vertex_color = color; - gl_FogFragCoord = pos.z; + fog_depth = pos.z; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl index be990c1757..6a83be1426 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl @@ -25,7 +25,7 @@ -// varying param funcs +// VARYING param funcs void setSunlitColor(vec3 v); void setAmblitColor(vec3 v); void setAdditiveColor(vec3 v); @@ -34,8 +34,8 @@ void setPositionEye(vec3 v); vec3 getAdditiveColor(); -//varying vec4 vary_CloudUVs; -//varying float vary_CloudDensity; +//VARYING vec4 vary_CloudUVs; +//VARYING float vary_CloudDensity; // Inputs uniform vec4 morphFactor; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl index a98c04b259..08814b49d8 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsF.glsl @@ -25,12 +25,12 @@ -varying vec3 vary_PositionEye; +VARYING vec3 vary_PositionEye; -varying vec3 vary_SunlitColor; -varying vec3 vary_AmblitColor; -varying vec3 vary_AdditiveColor; -varying vec3 vary_AtmosAttenuation; +VARYING vec3 vary_SunlitColor; +VARYING vec3 vary_AmblitColor; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; vec3 getPositionEye() { diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl index 7c3cb88b3c..514f009add 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsVarsV.glsl @@ -25,12 +25,12 @@ -varying vec3 vary_PositionEye; +VARYING vec3 vary_PositionEye; -varying vec3 vary_SunlitColor; -varying vec3 vary_AmblitColor; -varying vec3 vary_AdditiveColor; -varying vec3 vary_AtmosAttenuation; +VARYING vec3 vary_SunlitColor; +VARYING vec3 vary_AmblitColor; +VARYING vec3 vary_AdditiveColor; +VARYING vec3 vary_AtmosAttenuation; vec3 getPositionEye() { diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl index b90cec119b..ea60d1df6c 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsF.glsl @@ -29,9 +29,13 @@ // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -varying vec4 vary_CloudColorSun; -varying vec4 vary_CloudColorAmbient; -varying float vary_CloudDensity; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; uniform sampler2D cloud_noise_texture; uniform vec4 cloud_pos_density1; @@ -50,14 +54,14 @@ vec3 scaleSoftClip(vec3 light) { void main() { // Set variables - vec2 uv1 = gl_TexCoord[0].xy; - vec2 uv2 = gl_TexCoord[1].xy; + vec2 uv1 = vary_texcoord0.xy; + vec2 uv2 = vary_texcoord1.xy; vec4 cloudColorSun = vary_CloudColorSun; vec4 cloudColorAmbient = vary_CloudColorAmbient; float cloudDensity = vary_CloudDensity; - vec2 uv3 = gl_TexCoord[2].xy; - vec2 uv4 = gl_TexCoord[3].xy; + vec2 uv3 = vary_texcoord2.xy; + vec2 uv4 = vary_texcoord3.xy; // Offset texture coords uv1 += cloud_pos_density1.xy; //large texture, visible density diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 67b5e7fb83..c5bb52169c 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -25,17 +25,21 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; ////////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky /////////////////////////////////////////////////////////////////////////////// // Output parameters -varying vec4 vary_CloudColorSun; -varying vec4 vary_CloudColorAmbient; -varying float vary_CloudDensity; +VARYING vec4 vary_CloudColorSun; +VARYING vec4 vary_CloudColorAmbient; +VARYING float vary_CloudDensity; +VARYING vec2 vary_texcoord0; +VARYING vec2 vary_texcoord1; +VARYING vec2 vary_texcoord2; +VARYING vec2 vary_texcoord3; // Inputs uniform vec3 camPosLocal; @@ -64,7 +68,7 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); @@ -163,17 +167,17 @@ void main() // Texture coords - gl_TexCoord[0] = vec4(texcoord0,0,1); - gl_TexCoord[0].xy -= 0.5; - gl_TexCoord[0].xy /= cloud_scale.x; - gl_TexCoord[0].xy += 0.5; + vary_texcoord0 = texcoord0; + vary_texcoord0.xy -= 0.5; + vary_texcoord0.xy /= cloud_scale.x; + vary_texcoord0.xy += 0.5; - gl_TexCoord[1] = gl_TexCoord[0]; - gl_TexCoord[1].x += lightnorm.x * 0.0125; - gl_TexCoord[1].y += lightnorm.z * 0.0125; + vary_texcoord1 = vary_texcoord0; + vary_texcoord1.x += lightnorm.x * 0.0125; + vary_texcoord1.y += lightnorm.z * 0.0125; - gl_TexCoord[2] = gl_TexCoord[0] * 16.; - gl_TexCoord[3] = gl_TexCoord[1] * 16.; + vary_texcoord2 = vary_texcoord0 * 16.; + vary_texcoord3 = vary_texcoord1 * 16.; // Combine these to minimize register use vary_CloudColorAmbient += oHazeColorBelowCloud; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl index ac569e8257..5c9ee5fd63 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyF.glsl @@ -29,7 +29,7 @@ // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -varying vec4 vary_HazeColor; +VARYING vec4 vary_HazeColor; uniform sampler2D cloud_noise_texture; uniform vec4 gamma; diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 50fdba64c2..b768cc9cf3 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -25,15 +25,16 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; // SKY //////////////////////////////////////////////////////////////////////// // The vertex shader for creating the atmospheric sky /////////////////////////////////////////////////////////////////////////////// // Output parameters -varying vec4 vary_HazeColor; +VARYING vec4 vary_HazeColor; +VARYING vec2 vary_texcoord0; // Inputs uniform vec3 camPosLocal; @@ -61,7 +62,7 @@ void main() // World / view / projection gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; // Get relative position vec3 P = position.xyz - camPosLocal.xyz + vec3(0,50,0); diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index c10635c898..9a14d496e9 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -25,10 +25,13 @@ uniform mat4 projection_matrix; -attribute vec3 position; -attribute vec3 normal; -attribute vec2 texcoord0; -attribute vec4 clothing; +ATTRIBUTE vec3 position; +ATTRIBUTE vec3 normal; +ATTRIBUTE vec2 texcoord0; +ATTRIBUTE vec4 clothing; + +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -43,7 +46,7 @@ const vec4 gPiConstants = vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); void main() { - gl_TexCoord[0] = vec4(texcoord0,0,1); + vary_texcoord0 = texcoord0; vec4 pos; mat4 trans = getSkinnedTransform(); @@ -123,11 +126,11 @@ void main() calcAtmospherics(pos.xyz); vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0)); - gl_FrontColor = color; + vertex_color = color; gl_Position = projection_matrix * pos; - gl_TexCoord[2] = vec4(pos.xyz, 1.0); + vary_texcoord2 = vec4(pos.xyz, 1.0); } diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl index 616ea5fe9e..eb9256b41b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleF.glsl @@ -35,7 +35,7 @@ uniform int kern_length; uniform float kern_scale; uniform vec3 blur_quad; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform mat4 inv_proj; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl index 5e75aec171..380d5207c3 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl index 95913a502c..ba1d29b044 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giF.glsl @@ -42,7 +42,7 @@ uniform sampler2D depthGIMap; uniform sampler2D lightFunc; // Inputs -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl index 7c55fcc286..e3d5fdcf10 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalF.glsl @@ -32,7 +32,7 @@ uniform sampler2D bloomMap; uniform sampler2DRect edgeMap; uniform vec2 screen_res; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() diff --git a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl index 969b6e2f1c..60eca06d35 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl @@ -25,10 +25,10 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl index 2766691bd0..8272dbf31b 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl @@ -25,12 +25,13 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec4 diffuse_color; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; +ATTRIBUTE vec2 texcoord0; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; +VARYING vec4 vertex_color; uniform vec2 screen_res; @@ -44,5 +45,5 @@ void main() vec4 tex = vec4(texcoord0,0,1); tex.w = 1.0; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl index 13517a26ba..7c290fc993 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceF.glsl @@ -30,7 +30,7 @@ uniform sampler2DRect lightMap; uniform sampler2DRect diffuseRect; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { float i = texture2DRect(lightMap, vary_fragcoord.xy).r; diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl index d0205fa824..062875e72f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl @@ -25,12 +25,13 @@ uniform mat4 modelview_projection_matrix; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; +VARYING vec4 vertex_color; uniform vec2 screen_res; -attribute vec3 position; -attribute vec4 diffuse_color; +ATTRIBUTE vec3 position; +ATTRIBUTE vec4 diffuse_color; void main() { @@ -40,5 +41,5 @@ void main() vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res; - gl_FrontColor = diffuse_color; + vertex_color = diffuse_color; } diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl index 0364da6258..662f5fb6be 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredF.glsl @@ -53,7 +53,7 @@ uniform float gi_luminance; uniform vec4 sunlight_color; uniform vec2 screen_res; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl index 2d7fa22edc..0049d8ea78 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl index 009b5cc743..ecab3baeee 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiF.glsl @@ -40,7 +40,7 @@ uniform float kern_scale; uniform float gi_edge_weight; uniform float gi_blur_brightness; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; void main() { diff --git a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl index e9c6f3e27b..6d590c8051 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl @@ -25,9 +25,9 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; +ATTRIBUTE vec3 position; -varying vec2 vary_fragcoord; +VARYING vec2 vary_fragcoord; uniform vec2 screen_res; void main() diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 1c02adea89..664cec64c3 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -65,8 +65,8 @@ uniform sampler2DRect depthMap; uniform mat4 inv_proj; uniform vec2 screen_res; -varying vec4 vary_light; -varying vec2 vary_fragcoord; +VARYING vec4 vary_light; +VARYING vec2 vary_fragcoord; vec3 vary_PositionEye; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl index 8e405de9a3..682508aaf3 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl @@ -25,13 +25,13 @@ uniform mat4 modelview_projection_matrix; -attribute vec3 position; -attribute vec2 texcoord0; +ATTRIBUTE vec3 position; +ATTRIBUTE vec2 texcoord0; uniform vec2 screen_res; -varying vec4 vary_light; -varying vec2 vary_fragcoord; +VARYING vec4 vary_light; +VARYING vec2 vary_fragcoord; void main() { //transform vertex diff --git a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl index 56a149523e..80e08e8270 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/treeF.glsl @@ -24,15 +24,17 @@ */ +VARYING vec4 vertex_color; +VARYING vec2 vary_texcoord0; uniform sampler2D diffuseMap; -varying vec3 vary_normal; +VARYING vec3 vary_normal; void main() { - vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); - gl_FragData[0] = vec4(gl_Color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005); + vec4 col = texture2D(diffuseMap, vary_texcoord0.xy); + gl_FragData[0] = vec4(vertex_color.rgb*col.rgb, col.a <= 0.5 ? 0.0 : 0.005); gl_FragData[1] = vec4(0,0,0,0); vec3 nvn = normalize(vary_normal); gl_FragData[2] = vec4(nvn.xy * 0.5 + 0.5, nvn.z, 0.0); diff --git a/indra/newview/lldrawpoolterrain.cpp b/indra/newview/lldrawpoolterrain.cpp index 3ba4a89686..cac8439eb8 100644 --- a/indra/newview/lldrawpoolterrain.cpp +++ b/indra/newview/lldrawpoolterrain.cpp @@ -316,13 +316,12 @@ void LLDrawPoolTerrain::renderFullShader() gGL.getTexUnit(detail0)->bind(detail_texture0p); gGL.getTexUnit(0)->activate(); - glEnable(GL_TEXTURE_GEN_S); - glEnable(GL_TEXTURE_GEN_T); - glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); - glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); + LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr; + llassert(shader); + + shader->uniform4fv("object_plane_s", 1, tp0.mV); + shader->uniform4fv("object_plane_t", 1, tp1.mV); - glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV); - glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV); gGL.matrixMode(LLRender::MM_TEXTURE); gGL.loadIdentity(); gGL.matrixMode(LLRender::MM_MODELVIEW); |