diff options
| author | Graham Madarasz <graham@lindenlab.com> | 2013-05-14 15:27:53 -0700 | 
|---|---|---|
| committer | Graham Madarasz <graham@lindenlab.com> | 2013-05-14 15:27:53 -0700 | 
| commit | 5dc7012f43238ce216469bfc4f6ec7e5dc476894 (patch) | |
| tree | 9c571e0cadb7b26e9b6db8bdf6e46e7b196fb271 | |
| parent | a37bff8bf1add5afe154b25156d7ebe38ff9af31 (diff) | |
| parent | be712ba6b56bc087c947203290d172275aa975d9 (diff) | |
Merge
4 files changed, 36 insertions, 14 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl index 2745d5fd95..43ed41a205 100755 --- a/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl +++ b/indra/newview/app_settings/shaders/class1/avatar/objectSkinV.glsl @@ -26,7 +26,7 @@  ATTRIBUTE vec4 weight4;   -uniform mat4 matrixPalette[64]; +uniform mat4 matrixPalette[32];  mat4 getObjectSkinnedTransform()  { diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index a4eaac8483..599477ad9e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -121,7 +121,7 @@ vec3 calcDirectionalLight(vec3 n, vec3 l)  } -vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare)  {  	//get light vector  	vec3 lv = lp.xyz-v; @@ -169,7 +169,13 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe  			if (nh > 0.0)  			{  				float scol = fres*texture2D(lightFunc, vec2(nh, spec.a)).r*gt/(nh*da); -				col += lit*scol*light_col.rgb*spec.rgb; +				vec3 speccol = lit*scol*light_col.rgb*spec.rgb; +				col += speccol; + +				float cur_glare = max(speccol.r, speccol.g); +				cur_glare = max(cur_glare, speccol.b); +				glare = max(glare, speccol.r); +				glare += max(cur_glare, 0.0);  				//col += spec.rgb;  			}  		} @@ -442,7 +448,7 @@ void main()  #endif  #if HAS_SPECULAR_MAP -	vec4 spec = texture2D(specularMap, vary_texcoord2.xy); +	vec4 spec = texture2D(specularMap, vary_texcoord2.xy)*specular_color;  #else  	vec4 spec = specular_color;  #endif @@ -472,7 +478,7 @@ void main()  	vec4 final_specular = spec;  #if HAS_SPECULAR_MAP  	//final_color.rgb *= 1 - spec.a * env_intensity; -	final_specular.rgb *= specular_color.rgb; +	//final_specular.rgb *= specular_color.rgb;  	vec4 final_normal = vec4(encode_normal(normalize(tnorm)), spec.a * env_intensity, 0.0);  	final_specular.a = specular_color.a * norm.a; @@ -577,6 +583,8 @@ void main()  	col.rgb *= diffuse.rgb; +			float glare = 0.0; +  			if (spec.a > 0.0) // specular reflection  			{  				// the old infinite-sky shiny reflection @@ -588,6 +596,10 @@ void main()  				// add the two types of shiny together  				vec3 spec_contrib = dumbshiny * spec.rgb;  				bloom = dot(spec_contrib, spec_contrib) / 6; + +				glare = max(spec_contrib.r, spec_contrib.g); +				glare = max(glare, spec_contrib.b); +  				col += spec_contrib;  			} @@ -595,8 +607,15 @@ void main()  			{  				//add environmentmap  				vec3 env_vec = env_mat * refnormpersp; -				col = mix(col.rgb, pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2,  +				vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(2.2)) * 2.2; + +				col = mix(col.rgb, refcol,   					max(envIntensity-diffuse.a*2.0, 0.0)); +				 +				float cur_glare = max(refcol.r, refcol.g); +				cur_glare = max(cur_glare, refcol.b); +				cur_glare *= envIntensity*4.0; +				glare += cur_glare;  			}  			col = atmosLighting(col); @@ -604,18 +623,19 @@ void main()  		vec3 npos = normalize(-pos.xyz); - #define LIGHT_LOOP(i) col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z); + #define LIGHT_LOOP(i) col.rgb = col.rgb + calcPointLightOrSpotLight(light_diffuse[i].rgb, npos, diffuse.rgb, final_specular, pos.xyz, norm.xyz, light_position[i], light_direction[i].xyz, light_attenuation[i].x, light_attenuation[i].y, light_attenuation[i].z, glare); -		LIGHT_LOOP(1) +		/*LIGHT_LOOP(1)  		LIGHT_LOOP(2)  		LIGHT_LOOP(3)  		LIGHT_LOOP(4)  		LIGHT_LOOP(5)  		LIGHT_LOOP(6) -		LIGHT_LOOP(7) +		LIGHT_LOOP(7)*/  	frag_color.rgb = col.rgb; -	frag_color.a = diffcol.a*vertex_color.a; +	glare = min(glare, 1.0); +	frag_color.a = max(diffcol.a*vertex_color.a, glare);  #else  	frag_data[0] = final_color; diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index d5de5d30b0..bfb66fce22 100755 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -442,7 +442,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)  				LLMaterial* mat = NULL; -				if (deferred_render && !LLPipeline::sUnderWaterRender) +				if (!params.mFullbright && deferred_render && !LLPipeline::sUnderWaterRender)  				{  					mat = params.mMaterial;  				} diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index 69f10cd4df..b4ebee064e 100755 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -1587,9 +1587,11 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)  		{  			if (sShaderLevel > 0)  			{ //upload matrix palette to shader -				LLMatrix4 mat[64]; +				LLMatrix4 mat[32]; -				for (U32 i = 0; i < skin->mJointNames.size(); ++i) +				U32 count = llmin((U32) skin->mJointNames.size(), (U32) 32); + +				for (U32 i = 0; i < count; ++i)  				{  					LLJoint* joint = avatar->getJoint(skin->mJointNames[i]);  					if (joint) @@ -1602,7 +1604,7 @@ void LLDrawPoolAvatar::renderRigged(LLVOAvatar* avatar, U32 type, bool glow)  				stop_glerror();  				LLDrawPoolAvatar::sVertexProgram->uniformMatrix4fv("matrixPalette",  -					skin->mJointNames.size(), +					count,  					FALSE,  					(GLfloat*) mat[0].mMatrix); | 
