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/avatar | |
parent | 333608e889827342c79d3eee2006b1a704985740 (diff) |
SH-2242 Work in progress migrating to glVertexAttrib everywhere
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/avatar')
4 files changed, 34 insertions, 24 deletions
diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl index d9f29ced4f..81b632e7fa 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarSkinV.glsl @@ -6,8 +6,7 @@ */ - -attribute vec4 weight; //1 +attribute vec4 weight; uniform vec4 matrixPalette[45]; diff --git a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl index 2796222c68..ec7359d565 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/avatarV.glsl @@ -5,7 +5,9 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol); mat4 getSkinnedTransform(); @@ -13,31 +15,33 @@ void calcAtmospherics(vec3 inPositionEye); void main() { - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_TexCoord[0] = vec4(texcoord0,0,1); vec4 pos; vec3 norm; + vec4 pos_in = vec4(position.xyz, 1.0); + mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - norm.x = dot(trans[0].xyz, gl_Normal); - norm.y = dot(trans[1].xyz, gl_Normal); - norm.z = dot(trans[2].xyz, gl_Normal); + norm.x = dot(trans[0].xyz, normal); + norm.y = dot(trans[1].xyz, normal); + norm.z = dot(trans[2].xyz, normal); norm = normalize(norm); gl_Position = gl_ProjectionMatrix * pos; - //gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; + //gl_Position = gl_ModelViewProjectionMatrix * position; gl_FogFragCoord = length(pos.xyz); calcAtmospherics(pos.xyz); - vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0,0,0,0)); + vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0,0,0,0)); gl_FrontColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl index 2eb814bd91..0b075feef5 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/eyeballV.glsl @@ -6,6 +6,10 @@ */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec3 normal; +attribute vec2 texcoord0; vec4 calcLightingSpecular(vec3 pos, vec3 norm, vec4 color, inout vec4 specularColor, vec4 baseCol); void calcAtmospherics(vec3 inPositionEye); @@ -13,16 +17,17 @@ void calcAtmospherics(vec3 inPositionEye); void main() { //transform vertex - gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; - gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; + 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 = (gl_ModelViewMatrix * gl_Vertex).xyz; - vec3 norm = normalize(gl_NormalMatrix * gl_Normal); + + vec3 norm = normalize(gl_NormalMatrix * normal); calcAtmospherics(pos.xyz); vec4 specular = vec4(1.0); - vec4 color = calcLightingSpecular(pos, norm, gl_Color, specular, vec4(0.0)); + vec4 color = calcLightingSpecular(pos, norm, diffuse_color, specular, vec4(0.0)); gl_FrontColor = color; } diff --git a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl index 86b189b282..dcc891b16f 100644 --- a/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/pickAvatarV.glsl @@ -5,21 +5,23 @@ * $/LicenseInfo$ */ - +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0; mat4 getSkinnedTransform(); void main() { vec4 pos; - + vec4 pos_in = vec4(position, 1.0); mat4 trans = getSkinnedTransform(); - pos.x = dot(trans[0], gl_Vertex); - pos.y = dot(trans[1], gl_Vertex); - pos.z = dot(trans[2], gl_Vertex); + pos.x = dot(trans[0], pos_in); + pos.y = dot(trans[1], pos_in); + pos.z = dot(trans[2], pos_in); pos.w = 1.0; - gl_FrontColor = gl_Color; - gl_TexCoord[0] = gl_MultiTexCoord0; + gl_FrontColor = diffuse_color; + gl_TexCoord[0] = vec4(texcoord0,0,1); gl_Position = gl_ProjectionMatrix * pos; } |