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/objects | |
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/objects')
16 files changed, 242 insertions, 70 deletions
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); |