diff options
author | Dave Parks <davep@lindenlab.com> | 2011-09-15 00:55:11 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-09-15 00:55:11 -0500 |
commit | f72a24bf3a5bf7ecb826ef5e6d7f17dbb92d5db2 (patch) | |
tree | a4a070ba8b95645089dcd55a848baec41b625cbc /indra/newview/app_settings/shaders/class1/objects | |
parent | 758b936deaa0e6ea397c49afa5024315415eeb93 (diff) | |
parent | 530981a2149a74e1dc003cea1bbc9dc392fcae60 (diff) |
merge
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/objects')
17 files changed, 452 insertions, 74 deletions
diff --git a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl index c50ed86315..dccc692593 100644 --- a/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/bumpV.glsl @@ -22,13 +22,19 @@ * 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; +attribute vec2 texcoord1; void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix*gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - gl_TexCoord[1] = gl_TextureMatrix[1] * gl_MultiTexCoord1; - gl_FrontColor = gl_Color; + 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 new file mode 100644 index 0000000000..e2a00e8440 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl @@ -0,0 +1,54 @@ +/** + * @file emissiveSkinnedV.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 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; + +attribute vec3 position; +attribute float emissive; +attribute vec2 texcoord0; + +void calcAtmospherics(vec3 inPositionEye); +mat4 getObjectSkinnedTransform(); + +void main() +{ + //transform vertex + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + + mat4 mat = getObjectSkinnedTransform(); + + 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 = 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 new file mode 100644 index 0000000000..dedf00f374 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/emissiveV.glsl @@ -0,0 +1,51 @@ +/** + * @file emissiveV.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 vec4 position; +attribute float emissive; +attribute vec2 texcoord0; + +void calcAtmospherics(vec3 inPositionEye); + +varying float vary_texture_index; + +void main() +{ + //transform vertex + vary_texture_index = position.w; + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + + vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); + calcAtmospherics(pos.xyz); + + gl_FrontColor = vec4(0,0,0,emissive); + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl new file mode 100644 index 0000000000..b9c1078c30 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightNoColorV.glsl @@ -0,0 +1,49 @@ +/** + * @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; + +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + vec4 pos = (modelview_matrix * vert); + gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0); + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + + calcAtmospherics(pos.xyz); + + gl_FrontColor = vec4(1,1,1,1); + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl index e1a7f263f7..546b7cad4a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinySkinnedV.glsl @@ -22,7 +22,15 @@ * $/LicenseInfo$ */ +uniform mat4 texture_matrix0; +uniform mat4 texture_matrix1; +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -31,24 +39,24 @@ void main() { mat4 mat = getObjectSkinnedTransform(); - mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + mat = modelview_matrix * mat; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); vec3 ref = reflect(pos.xyz, -norm.xyz); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - 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 = gl_Color; + 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 36b00dfbc1..a9b086e215 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightShinyV.glsl @@ -22,8 +22,17 @@ * 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; +attribute vec3 normal; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -32,18 +41,18 @@ uniform vec4 origin; void main() { //transform vertex - gl_Position = ftransform(); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(normal_matrix * normal); vec3 ref = reflect(pos.xyz, -norm); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - 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 = (modelview_matrix * vec4(position.xyz, 1.0)); calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl index b540054c56..f0722a1e4d 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightSkinnedV.glsl @@ -22,7 +22,13 @@ * $/LicenseInfo$ */ +uniform mat4 projection_matrix; +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); mat4 getObjectSkinnedTransform(); @@ -30,23 +36,18 @@ mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); - mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + mat = modelview_matrix * mat; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; - norm.xyz = (mat*norm).xyz; - norm.xyz = normalize(norm.xyz-pos.xyz); - calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + 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 22f731ffde..d8f223d403 100644 --- a/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/fullbrightV.glsl @@ -22,22 +22,29 @@ * 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; void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + 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); - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); + calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; gl_FogFragCoord = pos.z; } diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl index 92c09ce937..d09db8e6a3 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl @@ -26,14 +26,11 @@ uniform float minimum_alpha; uniform float maximum_alpha; -vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); - uniform sampler2D diffuseMap; void main() { - vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color; + vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy); if (color.a < minimum_alpha || color.a > maximum_alpha) { diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl index eea51eba45..69007610c6 100644 --- a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl @@ -22,13 +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 = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - gl_FrontColor = gl_Color; + 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 new file mode 100644 index 0000000000..3771c2e795 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl @@ -0,0 +1,53 @@ +/** + * @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; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + + vec3 norm = normalize(normal_matrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl index f5fd4ededd..7e5c8ca2d5 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinySimpleSkinnedV.glsl @@ -22,7 +22,15 @@ * $/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; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -32,23 +40,23 @@ void main() { mat4 mat = getObjectSkinnedTransform(); - mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + mat = modelview_matrix * mat; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); vec3 ref = reflect(pos.xyz, -norm.xyz); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - 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, gl_Color, vec4(0.)); + 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 13a58f0d4a..da47f8a58a 100644 --- a/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/shinyV.glsl @@ -22,8 +22,16 @@ * 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; +attribute vec2 texcoord0; void calcAtmospherics(vec3 inPositionEye); @@ -32,18 +40,18 @@ uniform vec4 origin; void main() { //transform vertex - gl_Position = ftransform(); + vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec3 norm = normalize(normal_matrix * normal); calcAtmospherics(pos.xyz); - gl_FrontColor = gl_Color; + gl_FrontColor = diffuse_color; 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 new file mode 100644 index 0000000000..d1d8126cb4 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/simpleNoColorV.glsl @@ -0,0 +1,53 @@ +/** + * @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; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0)); + gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); + + vec3 norm = normalize(normal_matrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} diff --git a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl index ad171f7b43..bf083a55c4 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleSkinnedV.glsl @@ -22,7 +22,14 @@ * $/LicenseInfo$ */ +uniform mat4 texture_matrix0; +uniform mat4 modelview_matrix; +uniform mat4 projection_matrix; +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -31,24 +38,24 @@ mat4 getObjectSkinnedTransform(); void main() { //transform vertex - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0,0,1); mat4 mat = getObjectSkinnedTransform(); - mat = gl_ModelViewMatrix * mat; - vec3 pos = (mat*gl_Vertex).xyz; + mat = modelview_matrix * mat; + vec3 pos = (mat*vec4(position.xyz, 1.0)).xyz; - vec4 norm = gl_Vertex; - norm.xyz += gl_Normal.xyz; + vec4 norm = vec4(position.xyz, 1.0); + norm.xyz += normal.xyz; norm.xyz = (mat*norm).xyz; norm.xyz = normalize(norm.xyz-pos.xyz); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm.xyz, gl_Color, vec4(0.)); + 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 dc1794e132..87ece3972e 100644 --- a/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl +++ b/indra/newview/app_settings/shaders/class1/objects/simpleV.glsl @@ -22,8 +22,16 @@ * 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; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -31,16 +39,15 @@ void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = ftransform(); - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; - - vec4 pos = (gl_ModelViewMatrix * gl_Vertex); - - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + 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(normal_matrix * normal); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.)); + vec4 color = calcLighting(pos.xyz, norm, diffuse_color, vec4(0.)); gl_FrontColor = color; gl_FogFragCoord = pos.z; diff --git a/indra/newview/app_settings/shaders/class1/objects/treeV.glsl b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl new file mode 100644 index 0000000000..64ca63731b --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/treeV.glsl @@ -0,0 +1,56 @@ +/** + * @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; +attribute vec3 normal; + +vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); +void calcAtmospherics(vec3 inPositionEye); + +void main() +{ + //transform vertex + vec4 vert = vec4(position.xyz,1.0); + + gl_Position = modelview_projection_matrix*vert; + gl_TexCoord[0] = texture_matrix0 * vec4(texcoord0, 0, 1); + + vec4 pos = (modelview_matrix * vert); + + vec3 norm = normalize(normal_matrix * normal); + + calcAtmospherics(pos.xyz); + + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.)); + gl_FrontColor = color; + + gl_FogFragCoord = pos.z; +} |