diff options
| author | Dave Parks <davep@lindenlab.com> | 2011-09-15 00:54:25 -0500 | 
|---|---|---|
| committer | Dave Parks <davep@lindenlab.com> | 2011-09-15 00:54:25 -0500 | 
| commit | 530981a2149a74e1dc003cea1bbc9dc392fcae60 (patch) | |
| tree | f629a2dbc004d23e0f9f056366290e397ec51caf /indra/newview/app_settings/shaders/class1 | |
| parent | 7c95af74f195c9ec4ebc0fc0264d98cd4a85be49 (diff) | |
SH-2243 work in progress -- no more deprecated built-in matrix state when using shaders.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
67 files changed, 592 insertions, 207 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index ec1a813790..c98b99b15a 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec2 texcoord0; @@ -51,9 +53,7 @@ void main()  	norm.z = dot(trans[2].xyz, normal);  	norm = normalize(norm); -	gl_Position = gl_ProjectionMatrix * pos; -	 -	//gl_Position = gl_ModelViewProjectionMatrix * position; +	gl_Position = projection_matrix * pos;  	gl_FogFragCoord = length(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 31db10ae85..9a19fb928b 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -22,7 +22,11 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -35,12 +39,12 @@ void calcAtmospherics(vec3 inPositionEye);  void main()  {  	//transform vertex -	vec3 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)).xyz; -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	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); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl index f07e5c124b..21a9e91bf5 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -41,5 +43,5 @@ void main()  	gl_FrontColor = diffuse_color;  	gl_TexCoord[0] = vec4(texcoord0,0,1); -	gl_Position = gl_ProjectionMatrix * pos; +	gl_Position = projection_matrix * pos;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 2c2b58d59b..9deb9a701e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -21,7 +21,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 projection_matrix; +uniform mat4 modelview_matrix;  attribute vec3 position;  attribute vec3 normal; @@ -86,14 +88,14 @@ void main()  	vec3 norm;  	mat4 trans = getObjectSkinnedTransform(); -	trans = gl_ModelViewMatrix * trans; +	trans = modelview_matrix * trans;  	pos = trans * vec4(position.xyz, 1.0);  	norm = position.xyz + normal.xyz; -	norm = normalize(( trans*vec4(norm, 1.0) ).xyz-pos.xyz); +	norm = normalize(( trans*vec4(norojrm, 1.0) ).xyz-pos.xyz); -	vec4 frag_pos = gl_ProjectionMatrix * pos; +	vec4 frag_pos = projection_matrix * pos;  	gl_Position = frag_pos;  	vary_position = pos.xyz; diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl index 7a2f34ca1d..51e7c0780d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaV.glsl @@ -23,6 +23,11 @@   * $/LicenseInfo$   */ +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec4 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -85,12 +90,12 @@ void main()  	//transform vertex  	vec4 vert = vec4(position.xyz, 1.0);  	vary_texture_index = position.w; -	vec4 pos = (gl_ModelViewMatrix * vert); -	gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	vec4 pos = (modelview_matrix * vert); +	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	float dp_directional_light = max(0.0, dot(norm, gl_LightSource[0].position.xyz));  	vary_position = pos.xyz + gl_LightSource[0].position.xyz * (1.0-dp_directional_light)*shadow_offset; @@ -126,7 +131,7 @@ void main()  	gl_FogFragCoord = pos.z; -	pos = gl_ModelViewProjectionMatrix * vert; +	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/attachmentShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl index e03615eebb..fc055e555d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/attachmentShadowV.glsl @@ -22,6 +22,10 @@   * $/LicenseInfo$   */ +uniform mat4 projection_matrix; +uniform mat4 modelview_matrix; +uniform mat4 texture_matrix0; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -31,16 +35,16 @@ mat4 getObjectSkinnedTransform();  void main()  {  	//transform vertex -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	gl_FrontColor = diffuse_color; -	vec4 p = gl_ProjectionMatrix * vec4(pos, 1.0); +	vec4 p = projection_matrix * vec4(pos, 1.0);  	p.z = max(p.z, -p.w+0.01);  	gl_Position = p;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl index e15727f6f7..df4de4f432 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec2 texcoord0; @@ -96,7 +98,7 @@ void main()  	norm.z = dot(trans[2].xyz, normal);  	norm = normalize(norm); -	vec4 frag_pos = gl_ProjectionMatrix * pos; +	vec4 frag_pos = projection_matrix * pos;  	gl_Position = frag_pos;  	vary_position = pos.xyz; diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl index 58efa47567..d5c20a22d9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarEyesV.glsl @@ -22,7 +22,10 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec3 normal; @@ -34,10 +37,10 @@ varying vec3 vary_normal;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); -	vary_normal = normalize(gl_NormalMatrix * normal); +	vary_normal = normalize(normal_matrix * normal);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl index 543e998def..6835b9c021 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarShadowV.glsl @@ -23,7 +23,7 @@   * $/LicenseInfo$   */ - +uniform mat4 projection_matrix;  mat4 getSkinnedTransform(); @@ -52,7 +52,7 @@ void main()  	norm.z = dot(trans[2].xyz, normal);  	norm = normalize(norm); -	pos = gl_ProjectionMatrix * pos; +	pos = projection_matrix * pos;  	post_pos = pos;  	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl index 66e9119e28..704845d310 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/avatarV.glsl @@ -23,6 +23,8 @@   * $/LicenseInfo$   */ +uniform mat4 projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec2 texcoord0; @@ -54,7 +56,7 @@ void main()  	vary_normal = norm; -	gl_Position = gl_ProjectionMatrix * pos; +	gl_Position = projection_matrix * pos;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl index 0168c40ae5..5339e38018 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/blurLightV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  varying vec2 vary_fragcoord; @@ -31,7 +33,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos;   	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl index 421299d4a7..cf93430217 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpSkinnedV.glsl @@ -22,6 +22,10 @@   * $/LicenseInfo$   */ +uniform mat4 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec3 normal; @@ -36,11 +40,11 @@ mat4 getObjectSkinnedTransform();  void main()  { -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; @@ -53,6 +57,6 @@ void main()  	vary_mat1 = vec3(t.y, b.y, n.y);  	vary_mat2 = vec3(t.z, b.z, n.z); -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_Position = projection_matrix*vec4(pos, 1.0);  	gl_FrontColor = 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 b724def93d..9ec31383ac 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/bumpV.glsl @@ -22,7 +22,11 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec3 normal; @@ -36,11 +40,11 @@ varying vec3 vary_mat2;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); -	vec3 n = normalize(gl_NormalMatrix * normal); -	vec3 b = normalize(gl_NormalMatrix * binormal); +	vec3 n = normalize(normal_matrix * normal); +	vec3 b = normalize(normal_matrix * binormal);  	vec3 t = cross(b, n);  	vary_mat0 = vec3(t.x, b.x, n.x); diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index 297b3904a6..67b5e7fb83 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0; @@ -60,7 +62,7 @@ void main()  {  	// World / view / projection -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_TexCoord[0] = vec4(texcoord0,0,1); diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl index ff9578e253..37864578ec 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseNoColorV.glsl @@ -1,10 +1,31 @@  /**    * @file diffuseNoColorV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ +  * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;   attribute vec3 position;  attribute vec3 normal; @@ -16,8 +37,8 @@ varying float vary_texture_index;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); -	vary_normal = normalize(gl_NormalMatrix * normal); +	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 02fb34af32..880a7ea0a2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseSkinnedV.glsl @@ -22,7 +22,9 @@   * $/LicenseInfo$   */ - +uniform mat4 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -35,11 +37,11 @@ mat4 getObjectSkinnedTransform();  void main()  { -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	vec4 norm = vec4(position.xyz, 1.0); @@ -51,5 +53,5 @@ void main()  	gl_FrontColor = diffuse_color; -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	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 553cfff52f..e158df13f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -22,7 +22,10 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;  attribute vec4 position;  attribute vec4 diffuse_color; @@ -35,11 +38,11 @@ varying float vary_texture_index;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	vary_texture_index = position.w; -	vary_normal = normalize(gl_NormalMatrix * normal); +	vary_normal = normalize(normal_matrix * normal);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl index 9841943fe6..fccf8554d2 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveV.glsl @@ -1,10 +1,31 @@  /**    * @file emissiveV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ +  * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix;  attribute vec4 position;  attribute float emissive; @@ -23,12 +44,12 @@ void main()  {  	//transform vertex  	vec4 vert = vec4(position.xyz, 1.0); -	vec4 pos = (gl_ModelViewMatrix * vert); +	vec4 pos = (modelview_matrix * vert);  	vary_texture_index = position.w; -	gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl index 93571058dc..2759165471 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightV.glsl @@ -22,7 +22,11 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec4 position;  attribute vec4 diffuse_color; @@ -41,12 +45,12 @@ void main()  {  	//transform vertex  	vec4 vert = vec4(position.xyz, 1.0); -	vec4 pos = (gl_ModelViewMatrix * vert); +	vec4 pos = (modelview_matrix * vert);  	vary_texture_index = position.w; -	gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl index 1a23be349e..2766691bd0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/giV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -35,7 +37,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos;   	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	 diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl index 28ba2c432d..645b0d793a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorV.glsl @@ -22,7 +22,10 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -30,8 +33,8 @@ attribute vec2 texcoord0;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl index 3f2e07cf08..dafc55a6ff 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceV.glsl @@ -23,6 +23,7 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -34,7 +35,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos;  	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	 diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl index 39e60b6cc8..1d54d7bede 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightV.glsl @@ -23,6 +23,7 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -31,7 +32,7 @@ varying vec4 vary_fragcoord;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	vary_fragcoord = pos;  	gl_Position = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl index afaf58020b..cab9817583 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl @@ -23,6 +23,8 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  varying vec4 vary_fragcoord; @@ -30,7 +32,7 @@ varying vec4 vary_fragcoord;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	vary_fragcoord = pos;  	gl_Position = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl index 74a9df64e0..b11f26fbae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  varying vec2 vary_fragcoord; @@ -35,7 +37,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos;	  	vary_tc = (pos.xy*0.5+0.5)*tc_scale;  	vary_fragcoord = (pos.xy*0.5+0.5)*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 a3751be1fb..61c6393648 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postgiV.glsl @@ -22,6 +22,8 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ + +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -32,7 +34,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos; 	  	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl index bbd7516337..f7bed00214 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowAlphaMaskV.glsl @@ -22,7 +22,10 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -32,12 +35,12 @@ varying vec4 post_pos;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);  	post_pos = pos;  	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl index 1ac3dbd5de..190cac9e2c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/shadowV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  varying vec4 post_pos; @@ -30,7 +32,7 @@ varying vec4 post_pos;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);  	post_pos = pos; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 23171fe940..e97d3e0828 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0; @@ -58,7 +60,7 @@ void main()  {  	// World / view / projection -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_TexCoord[0] = vec4(texcoord0,0,1);  	// Get relative position diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl index 4b6b3c242e..7d1e99b4aa 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightV.glsl @@ -23,6 +23,7 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -32,7 +33,7 @@ varying vec2 vary_fragcoord;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos;   	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; diff --git a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl index dbd2b5595a..1fcb05ef2c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/starsV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -31,7 +33,7 @@ attribute vec2 texcoord0;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl index d19e67b67d..10751304ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/sunLightV.glsl @@ -22,6 +22,8 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ + +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -32,7 +34,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_Position = pos;   	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	 diff --git a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl index 793106f2cf..7f84ef1cff 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/terrainV.glsl @@ -22,7 +22,11 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -48,12 +52,12 @@ vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -	vary_normal = normalize(gl_NormalMatrix * normal); +	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), gl_TextureMatrix[0], gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy; + 	gl_TexCoord[0].xy = texgen_object(vec4(position, 1.0), vec4(texcoord0,0,1), texture_matrix0, gl_ObjectPlaneS[0], gl_ObjectPlaneT[0]).xy;  	vec4 t = vec4(texcoord1,0,1); diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl index 42ce2f5226..c695d374ac 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeShadowV.glsl @@ -1,9 +1,30 @@  /**    * @file treeShadowV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ +  * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec2 texcoord0; @@ -13,11 +34,11 @@ varying vec4 post_pos;  void main()  {  	//transform vertex -	vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);  	post_pos = pos;  	gl_Position = vec4(pos.x, pos.y, pos.w*0.5, pos.w); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl index 2ec7398024..45bfc0ce09 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/treeV.glsl @@ -22,7 +22,10 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; +uniform mat3 normal_matrix;  attribute vec3 position;  attribute vec3 normal; @@ -33,10 +36,10 @@ varying vec3 vary_normal;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0);  -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); -	vary_normal = normalize(gl_NormalMatrix * normal); +	vary_normal = normalize(normal_matrix * normal);  	gl_FrontColor = vec4(1,1,1,1);  } diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl index 2f808b25db..ac51cb1741 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -50,7 +52,7 @@ void main()  {  	//transform vertex  	vec4 pos = vec4(position.xyz, 1.0); -	mat4 modelViewProj = gl_ModelViewProjectionMatrix; +	mat4 modelViewProj = modelview_projection_matrix;  	vec4 oPosition; @@ -69,7 +71,7 @@ void main()  	oPosition = vec4(position, 1.0);  	oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); -	vary_position = gl_ModelViewMatrix * oPosition; +	vary_position = modelview_matrix * oPosition;  	oPosition = modelViewProj * oPosition;  	refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); @@ -81,7 +83,7 @@ void main()  	//push position for further horizon effect.  	pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);  	pos.w = 1.0; -	pos = gl_ModelViewMatrix*pos; +	pos = modelview_matrix*pos;  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl index b5f6cb62d9..628489296f 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl @@ -23,13 +23,15 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0;  void main()   { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position, 1.0);  	gl_TexCoord[0].xy = texcoord0;  } diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl index e8fd7a796d..615ca6a0b4 100644 --- a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl +++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl @@ -23,6 +23,8 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0; @@ -30,7 +32,7 @@ uniform vec2 glowDelta;  void main()   { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1.0); +	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); diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 8facc1ca96..04b3033dd8 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -22,7 +22,15 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 texture_matrix2; +uniform mat4 texture_matrix3; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -51,17 +59,17 @@ vec4 texgen_object(vec4  vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1)  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -	vec4 pos = gl_ModelViewMatrix * position; -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec4 pos = modelview_matrix * position; +	vec3 norm = normalize(normal_matrix * normal);  	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color);  	gl_FrontColor = color; -	gl_TexCoord[0] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord0,0,1),gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]); -	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(texcoord1,0,1); -	gl_TexCoord[2] = texgen_object(vec4(position.xyz, 1.0),vec4(texcoord2,0,1),gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]); -	gl_TexCoord[3] = gl_TextureMatrix[3]*vec4(texcoord3,0,1); +	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);  } diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index 831a7de0ea..99433ada7b 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -46,7 +48,7 @@ float wave(vec2 v, float t, float f, vec2 d, float s)  void main()  {  	//transform vertex -	mat4 modelViewProj = gl_ModelViewProjectionMatrix; +	mat4 modelViewProj = modelview_projection_matrix;  	vec4 oPosition; @@ -77,7 +79,7 @@ void main()  	vec4 pos;  	pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z);  	pos.w = 1.0; -	pos = gl_ModelViewMatrix*pos; +	pos = modelview_matrix*pos;  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl index df67f76ad5..5bbc7deff0 100644 --- a/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/customalphaV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -30,7 +32,7 @@ attribute vec2 texcoord0;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_TexCoord[0] = vec4(texcoord0,0,1);  	gl_FrontColor = 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 2f64fdb7bc..cd3d090e52 100644 --- a/indra/newview/app_settings/shaders/class1/interface/debugV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/debugV.glsl @@ -23,10 +23,12 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl index f54876135e..bd5dd6046b 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineFXAAV.glsl @@ -1,17 +1,37 @@  /**    * @file glowcombineFXAAV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ +  * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  varying vec2 vary_tc;  void main()  { -	vec4 pos = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); +	vec4 pos = modelview_projection_matrix*vec4(position.xyz, 1.0);  	gl_Position = pos;  	vary_tc = pos.xy*0.5+0.5; diff --git a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl index 303535ee31..94edbe5ab1 100644 --- a/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/glowcombineV.glsl @@ -22,14 +22,16 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0;  attribute vec2 texcoord1;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_TexCoord[0] = vec4(texcoord0,0,1);  	gl_TexCoord[1] = vec4(texcoord1,0,1);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl index 1d312313a8..6bb5affd93 100644 --- a/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/highlightV.glsl @@ -22,14 +22,17 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl index 62fe4a2ce5..43dcd5dbe2 100644 --- a/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/occlusionV.glsl @@ -23,10 +23,12 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl index 7df45e90e6..615412c7a2 100644 --- a/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/onetexturenocolorV.glsl @@ -2,9 +2,28 @@   * @file onetexturenocolorV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec2 texcoord0; @@ -12,7 +31,7 @@ attribute vec2 texcoord0;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1); +	gl_Position = modelview_projection_matrix * vec4(position, 1);  	gl_TexCoord[0] = vec4(texcoord0,0,1);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl index be03d19290..45e6a9febc 100644 --- a/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/solidcolorV.glsl @@ -22,6 +22,8 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ + +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -29,7 +31,7 @@ attribute vec2 texcoord0;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_FrontColor = diffuse_color;  	gl_TexCoord[0] = vec4(texcoord0,0,1);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl index 085970f549..2b471d99e8 100644 --- a/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/splattexturerectV.glsl @@ -22,14 +22,16 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0;  attribute vec4 diffuse_color;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_TexCoord[0] = vec4(texcoord0,0,1);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl index 80c57e7766..2a36feaa21 100644 --- a/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/twotextureaddV.glsl @@ -23,6 +23,7 @@   * $/LicenseInfo$   */ +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec2 texcoord0; @@ -30,7 +31,7 @@ attribute vec2 texcoord1;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);  	gl_TexCoord[0] = vec4(texcoord0,0,1);  	gl_TexCoord[1] = vec4(texcoord1,0,1);  } diff --git a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl index faef21689e..a9e42a432f 100644 --- a/indra/newview/app_settings/shaders/class1/interface/uiV.glsl +++ b/indra/newview/app_settings/shaders/class1/interface/uiV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -31,8 +33,8 @@ attribute vec2 texcoord0;  void main()  { -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position, 1); -	gl_TexCoord[0] =  gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position, 1); +	gl_TexCoord[0] =  texture_matrix0 * vec4(texcoord0,0,1);  	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl index 7d38e07d65..dccc692593 100644 --- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl @@ -22,7 +22,10 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec2 texcoord0; @@ -31,7 +34,7 @@ attribute vec2 texcoord1;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); -	gl_TexCoord[1] = gl_TextureMatrix[1] * vec4(texcoord1,0,1); +	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);  } diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl index 78668711ac..e2a00e8440 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -1,10 +1,31 @@  /**    * @file emissiveSkinnedV.glsl   * - * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. - * $License$ + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA + * $/LicenseInfo$   */ +uniform mat4 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix;  attribute vec3 position;  attribute float emissive; @@ -16,18 +37,18 @@ mat4 getObjectSkinnedTransform();  void main()  {  	//transform vertex -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	calcAtmospherics(pos.xyz);  	gl_FrontColor = vec4(0,0,0,emissive); -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_Position = projection_matrix*vec4(pos, 1.0);  	gl_FogFragCoord = 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 05d7cc397f..dedf00f374 100644 --- a/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -1,10 +1,32 @@  /**   * @file emissiveV.glsl   * - * $LicenseInfo:firstyear=2007&license=viewerlgpl$ +  * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec4 position;  attribute float emissive;  attribute vec2 texcoord0; @@ -17,10 +39,10 @@ void main()  {  	//transform vertex  	vary_texture_index = position.w; -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); +	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));  	calcAtmospherics(pos.xyz);  	gl_FrontColor = vec4(0,0,0,emissive); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl index 57d98038e0..b9c1078c30 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl @@ -2,9 +2,31 @@   * @file fullbrightNoColorV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -   + +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec2 texcoord0;  attribute vec3 normal; @@ -15,9 +37,9 @@ void main()  {  	//transform vertex  	vec4 vert = vec4(position.xyz,1.0); -	vec4 pos = (gl_ModelViewMatrix * vert); -	gl_Position = gl_ModelViewProjectionMatrix*vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	vec4 pos = (modelview_matrix * vert); +	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index ebbcb2f719..546b7cad4a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -22,6 +22,10 @@   * $/LicenseInfo$   */ +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix;  attribute vec3 position;  attribute vec3 normal; @@ -35,7 +39,7 @@ void main()  {  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	vec4 norm = vec4(position.xyz, 1.0); @@ -45,14 +49,14 @@ void main()  	vec3 ref = reflect(pos.xyz, -norm.xyz); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); -	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); +	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);  	calcAtmospherics(pos.xyz);  	gl_FrontColor = diffuse_color; -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_Position = projection_matrix*vec4(pos, 1.0);  	gl_FogFragCoord = 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 e8126daee0..a9b086e215 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -22,7 +22,12 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -36,15 +41,15 @@ uniform vec4 origin;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	vec3 ref = reflect(pos.xyz, -norm); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); -	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); +	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0); -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); +	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));  	calcAtmospherics(pos.xyz);  	gl_FrontColor = diffuse_color; diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index 276f423eea..f0722a1e4d 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -22,6 +22,9 @@   * $/LicenseInfo$   */ +uniform mat4 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix;  attribute vec3 position;  attribute vec4 diffuse_color; @@ -33,18 +36,18 @@ mat4 getObjectSkinnedTransform();  void main()  {  	//transform vertex -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	calcAtmospherics(pos.xyz);  	gl_FrontColor = diffuse_color; -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_Position = projection_matrix*vec4(pos, 1.0);  	gl_FogFragCoord = 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 159e34f044..d8f223d403 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -22,7 +22,11 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec4 diffuse_color;  attribute vec2 texcoord0; @@ -32,9 +36,9 @@ void calcAtmospherics(vec3 inPositionEye);  void main()  {  	//transform vertex -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	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); diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl index f175e3e76d..69007610c6 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl @@ -22,7 +22,9 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat4 texture_matrix0; +uniform mat4 modelview_projection_matrix;  attribute vec3 position; @@ -31,6 +33,6 @@ attribute vec2 texcoord0;  void main()  {  	//transform vertex -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1);  } diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl index 555c59c37e..3771c2e795 100644 --- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -2,9 +2,32 @@   * @file previewV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec2 texcoord0; @@ -15,11 +38,11 @@ void calcAtmospherics(vec3 inPositionEye);  void main()  {  	//transform vertex -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	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); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl index f0bea5f3e7..7e5c8ca2d5 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -22,6 +22,11 @@   * $/LicenseInfo$   */ +uniform mat4 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 modelview_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -35,7 +40,7 @@ void main()  {  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	vec4 norm = vec4(position.xyz, 1.0); @@ -45,13 +50,13 @@ void main()  	vec3 ref = reflect(pos.xyz, -norm.xyz); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); -	gl_TexCoord[1] = gl_TextureMatrix[1]*vec4(ref,1.0); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); +	gl_TexCoord[1] = texture_matrix1*vec4(ref,1.0);  	calcAtmospherics(pos.xyz);  	vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));  	gl_FrontColor = color; -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	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 e8b6b71b3d..da47f8a58a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -22,7 +22,12 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -35,10 +40,10 @@ uniform vec4 origin;  void main()  {  	//transform vertex -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); +	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	calcAtmospherics(pos.xyz); @@ -46,7 +51,7 @@ void main()  	vec3 ref = reflect(pos.xyz, -norm); -	gl_TexCoord[0] = gl_TextureMatrix[0]*vec4(ref,1.0); +	gl_TexCoord[0] = texture_matrix0*vec4(ref,1.0);  	gl_FogFragCoord = 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 54c262885e..d1d8126cb4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -2,9 +2,32 @@   * @file simpleNoColorV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec2 texcoord0; @@ -15,11 +38,11 @@ void calcAtmospherics(vec3 inPositionEye);  void main()  {  	//transform vertex -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	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); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index 14c4a3aa8d..bf083a55c4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -22,6 +22,10 @@   * $/LicenseInfo$   */ +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -34,11 +38,11 @@ mat4 getObjectSkinnedTransform();  void main()  {  	//transform vertex -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1);  	mat4 mat = getObjectSkinnedTransform(); -	mat = gl_ModelViewMatrix * mat; +	mat = modelview_matrix * mat;  	vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz;  	vec4 norm = vec4(position.xyz, 1.0); @@ -51,7 +55,7 @@ void main()  	vec4 color = calcLighting(pos.xyz, norm.xyz, diffuse_color, vec4(0.));  	gl_FrontColor = color; -	gl_Position = gl_ProjectionMatrix*vec4(pos, 1.0); +	gl_Position = projection_matrix*vec4(pos, 1.0);  	gl_FogFragCoord = 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 bbc170b1af..87ece3972e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -22,7 +22,12 @@   * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  + +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix; +  attribute vec3 position;  attribute vec3 normal;  attribute vec4 diffuse_color; @@ -34,11 +39,11 @@ void calcAtmospherics(vec3 inPositionEye);  void main()  {  	//transform vertex -	vec4 pos = (gl_ModelViewMatrix * vec4(position.xyz, 1.0)); -	gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0,0,1); +	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); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	calcAtmospherics(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl index 1e9e7f4b0b..64ca63731b 100644 --- a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -2,10 +2,31 @@   * @file treeV.glsl   *   * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2007, Linden Research, Inc. + *  + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + *  + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU + * Lesser General Public License for more details. + *  + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA + *  + * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA   * $/LicenseInfo$   */ -  +uniform mat3 normal_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 modelview_projection_matrix;  attribute vec3 position;  attribute vec2 texcoord0; @@ -19,12 +40,12 @@ void main()  	//transform vertex  	vec4 vert = vec4(position.xyz,1.0); -	gl_Position = gl_ModelViewProjectionMatrix*vert; -	gl_TexCoord[0] = gl_TextureMatrix[0] * vec4(texcoord0, 0, 1); +	gl_Position = modelview_projection_matrix*vert; +	gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1); -	vec4 pos = (gl_ModelViewMatrix * vert); +	vec4 pos = (modelview_matrix * vert); -	vec3 norm = normalize(gl_NormalMatrix * normal); +	vec3 norm = normalize(normal_matrix * normal);  	calcAtmospherics(pos.xyz); | 
