diff options
author | Dave Parks <davep@lindenlab.com> | 2011-08-08 15:29:23 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2011-08-08 15:29:23 -0500 |
commit | 14f6bbadef2c39e58a3b54c0c6212949acf50e45 (patch) | |
tree | 295c3bd149b343cd334885133f101963219d7f39 /indra/newview/app_settings/shaders/class1/environment | |
parent | 333608e889827342c79d3eee2006b1a704985740 (diff) |
SH-2242 Work in progress migrating to glVertexAttrib everywhere
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/environment')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/terrainV.glsl | 23 | ||||
-rw-r--r-- | indra/newview/app_settings/shaders/class1/environment/waterV.glsl | 13 |
2 files changed, 22 insertions, 14 deletions
diff --git a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl index 8af981915b..d0d8aed67e 100644 --- a/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/terrainV.glsl @@ -5,6 +5,13 @@ * $/LicenseInfo$ */ +attribute vec3 position; +attribute vec3 normal; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; +attribute vec2 texcoord1; +attribute vec2 texcoord2; +attribute vec2 texcoord3; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); @@ -26,17 +33,17 @@ vec4 texgen_object(vec4 vpos, vec4 tc, mat4 mat, vec4 tp0, vec4 tp1) void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + gl_Position = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); - vec4 pos = gl_ModelViewMatrix * gl_Vertex; - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + vec4 pos = gl_ModelViewMatrix * position; + vec3 norm = normalize(gl_NormalMatrix * normal); - vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), gl_Color); + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), diffuse_color); gl_FrontColor = color; - gl_TexCoord[0] = texgen_object(gl_Vertex,gl_MultiTexCoord0,gl_TextureMatrix[0],gl_ObjectPlaneS[0],gl_ObjectPlaneT[0]); - gl_TexCoord[1] = gl_TextureMatrix[1]*gl_MultiTexCoord1; - gl_TexCoord[2] = texgen_object(gl_Vertex,gl_MultiTexCoord2,gl_TextureMatrix[2],gl_ObjectPlaneS[2],gl_ObjectPlaneT[2]); - gl_TexCoord[3] = gl_TextureMatrix[3]*gl_MultiTexCoord3; + 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); } diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index 831d6a761c..92d4759fe8 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -6,6 +6,7 @@ */ +attribute vec3 position; void calcAtmospherics(vec3 inPositionEye); @@ -27,7 +28,6 @@ float wave(vec2 v, float t, float f, vec2 d, float s) void main() { //transform vertex - vec4 position = gl_Vertex; mat4 modelViewProj = gl_ModelViewProjectionMatrix; vec4 oPosition; @@ -45,7 +45,7 @@ void main() d = clamp(ld/1536.0-0.5, 0.0, 1.0); d *= d; - oPosition = position; + oPosition = vec4(position, 1.0); oPosition.z = mix(oPosition.z, max(eyeVec.z*0.75, 0.0), d); oPosition = modelViewProj * oPosition; refCoord.xyz = oPosition.xyz + vec3(0,0,0.2); @@ -55,11 +55,12 @@ void main() v.x += (cos(v.x*0.08/*+time*0.01*/)+sin(v.y*0.02))*6.0; //push position for further horizon effect. - position.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); - position.w = 1.0; - position = position*gl_ModelViewMatrix; + vec4 pos; + pos.xyz = oEyeVec.xyz*(waterHeight/oEyeVec.z); + pos.w = 1.0; + pos = gl_ModelViewMatrix*pos; - calcAtmospherics((gl_ModelViewMatrix * gl_Vertex).xyz); + calcAtmospherics(pos.xyz); //pass wave parameters to pixel shader |