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/class3 | |
| parent | 333608e889827342c79d3eee2006b1a704985740 (diff) | |
SH-2242 Work in progress migrating to glVertexAttrib everywhere
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
9 files changed, 46 insertions, 40 deletions
| diff --git a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl index 3d970d252c..f65dfff42f 100644 --- a/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl +++ b/indra/newview/app_settings/shaders/class3/avatar/avatarV.glsl @@ -5,38 +5,39 @@   * $/LicenseInfo$   */ - +attribute vec3 position; +attribute vec3 normal; +attribute vec2 texcoord0; +attribute vec4 clothing;   vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  mat4 getSkinnedTransform();  void calcAtmospherics(vec3 inPositionEye); -attribute vec4 clothing; //4 - -attribute vec4 gWindDir;		//7 -attribute vec4 gSinWaveParams; //3 -attribute vec4 gGravity;		//5 +uniform vec4 gWindDir;		 +uniform vec4 gSinWaveParams;  +uniform vec4 gGravity;		  const vec4 gMinMaxConstants = vec4(1.0, 0.166666, 0.0083143, .00018542);	 // #minimax-generated coefficients  const vec4 gPiConstants	= vec4(0.159154943, 6.28318530, 3.141592653, 1.5707963); //	# {1/2PI, 2PI, PI, PI/2}  void main()  { -	gl_TexCoord[0] = gl_MultiTexCoord0; +	gl_TexCoord[0] = vec4(texcoord0,0,1);  	vec4 pos;  	mat4 trans = getSkinnedTransform();  	vec3 norm; -	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);  	//wind  	vec4 windEffect;  	windEffect = vec4(dot(norm, gWindDir.xyz));	 -	pos.x = dot(trans[2].xyz, gl_Vertex.xyz); +	pos.x = dot(trans[2].xyz, position.xyz);  	windEffect.xyz = pos.x * vec3(0.015, 0.015, 0.015)  						+ windEffect.xyz;  	windEffect.w = windEffect.w * 2.0 + 1.0;				// move wind offset value to [-1, 3] @@ -83,7 +84,7 @@ void main()  	sinWave.xyz = max(sinWave.xyz, vec3(-1.0, -1.0, -1.0));	// clamp to underlying body shape  	offsetPos = clothing * sinWave.x;						// multiply wind effect times clothing displacement  	temp2 = gWindDir*sinWave.z + vec4(norm,0);				// calculate normal offset due to wind oscillation -	offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+gl_Vertex;	// add to offset vertex position, and zero out effect from w +	offsetPos = vec4(1.0,1.0,1.0,0.0)*offsetPos+vec4(position.xyz, 1.0);	// add to offset vertex position, and zero out effect from w  	norm += temp2.xyz*2.0;									// add sin wave effect on normals (exaggerated)  	//add "backlighting" effect @@ -101,7 +102,7 @@ void main()  	calcAtmospherics(pos.xyz); -	vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.0));			 +	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.0));			  	gl_FrontColor = color;   	gl_Position = gl_ProjectionMatrix * pos; diff --git a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl index eebe930666..b769e1ee1d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giDownsampleV.glsl @@ -5,7 +5,7 @@   * $/LicenseInfo$   */ - +attribute vec3 position;  varying vec2 vary_fragcoord;  uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	vec4 pos = gl_ModelViewProjectionMatrix * 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/class3/deferred/giFinalV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl index 7e20d71529..057d36ed22 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giFinalV.glsl @@ -5,6 +5,7 @@   * $/LicenseInfo$   */ +attribute vec3 position;  varying vec2 vary_fragcoord; @@ -13,7 +14,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	vec4 pos = gl_ModelViewProjectionMatrix * 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/class3/deferred/giV.glsl b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl index e86f2896da..d97d7ea82d 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/giV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/giV.glsl @@ -5,6 +5,9 @@   * $/LicenseInfo$   */ +attribute vec3 position; +attribute vec4 diffuse_color; +attribute vec2 texcoord0;  varying vec2 vary_fragcoord; @@ -14,11 +17,12 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = pos;  +	  	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	 -	vec4 tex = gl_MultiTexCoord0; +	vec4 tex = vec4(texcoord0,0,1);  	tex.w = 1.0; -	gl_FrontColor = gl_Color; +	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl index 9afeac6ddf..5bdb69fb6f 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/luminanceV.glsl @@ -5,18 +5,20 @@   * $/LicenseInfo$   */ - -  varying vec2 vary_fragcoord;  uniform vec2 screen_res; +attribute vec3 position; +attribute vec4 diffuse_color; +  void main()  {  	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = pos;  +	  	vary_fragcoord = (pos.xy * 0.5 + 0.5)*screen_res;	 -	gl_FrontColor = gl_Color; +	gl_FrontColor = diffuse_color;  } diff --git a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl index 876f65ee3a..2581098609 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postDeferredV.glsl @@ -5,7 +5,7 @@   * $/LicenseInfo$   */ - +attribute vec3 position;  varying vec2 vary_fragcoord;  uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	vec4 pos = gl_ModelViewProjectionMatrix * 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/class3/deferred/postgiV.glsl b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl index eebe930666..ed6fd1ee80 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/postgiV.glsl @@ -5,7 +5,7 @@   * $/LicenseInfo$   */ - +attribute vec3 position;  varying vec2 vary_fragcoord;  uniform vec2 screen_res; @@ -13,7 +13,7 @@ uniform vec2 screen_res;  void main()  {  	//transform vertex -	gl_Position = ftransform();  -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex; +	vec4 pos = gl_ModelViewProjectionMatrix * 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/class3/deferred/softenLightV.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl index 745cc01992..9872c9f366 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightV.glsl @@ -6,6 +6,8 @@   */ +attribute vec3 position; +attribute vec2 texcoord0;  uniform vec2 screen_res; @@ -14,13 +16,10 @@ varying vec2 vary_fragcoord;  void main()  {  	//transform vertex -	gl_Position = ftransform();  +	vec4 pos = gl_ModelViewProjectionMatrix * vec4(position.xyz, 1.0); +	gl_Position = pos; 	 -	vec4 pos = gl_ModelViewProjectionMatrix * gl_Vertex;  	vary_fragcoord = (pos.xy*0.5+0.5)*screen_res; -	vec4 tex = gl_MultiTexCoord0; -	tex.w = 1.0; -	 -	vary_light = gl_MultiTexCoord0; +	vary_light = vec4(texcoord0,0,1);  } diff --git a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl index 24bbc0a1a1..9144b8361f 100644 --- a/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl +++ b/indra/newview/app_settings/shaders/class3/lighting/sumLightsV.glsl @@ -6,7 +6,6 @@   */ -  float calcDirectionalLight(vec3 n, vec3 l);  float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight); | 
