diff options
Diffstat (limited to 'indra/newview')
20 files changed, 291 insertions, 283 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl index 4261f943fb..5addbbb176 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl @@ -12,7 +12,6 @@ mat4 getObjectSkinnedTransform();  void calcAtmospherics(vec3 inPositionEye);  float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);  vec3 atmosAmbient(vec3 light);  vec3 atmosAffectDirectionalLight(float lightIntensity); @@ -23,11 +22,36 @@ varying vec3 vary_position;  varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_normal; -varying vec3 vary_light;  varying vec3 vary_fragcoord; +varying vec3 vary_pointlight_col;  uniform float near_clip; +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	//normalize light vector +	lv *= 1.0/d; +	 +	//distance attenuation +	float dist2 = d*d/(la*la); +	float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +	// spotlight coefficient. +	float spot = max(dot(-ln, lv), is_pointlight); +	da *= spot*spot; // GL_SPOT_EXPONENT=2 + +	//angular attenuation +	da *= calcDirectionalLight(n, lv); + +	return da;	 +} +  void main()  {  	gl_TexCoord[0] = gl_MultiTexCoord0; @@ -53,20 +77,20 @@ void main()  	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); -	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); -	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); -	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); -	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a); -	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a); -	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); -	col.rgb = scaleDownLight(col.rgb); +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); +  	// Add windlight lights -	col.rgb += atmosAmbient(vec3(0.)); -	 -	vary_light = gl_LightSource[0].position.xyz; +	col.rgb = atmosAmbient(vec3(0.));  	vary_ambient = col.rgb*gl_Color.rgb;  	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl index f377685045..77f1b2224c 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl @@ -57,11 +57,11 @@ void dofSampleNear(inout vec4 diff, inout float w, float cur_sc, vec2 tc)  	float sc = calc_cof(d); -	float wg = 1.0; +	float wg = 0.25;  	vec4 s = texture2DRect(diffuseRect, tc);  	// de-weight dull areas to make highlights 'pop' -	wg *= s.r+s.g+s.b; +	wg += s.r+s.g+s.b;  	diff += wg*s; @@ -77,11 +77,11 @@ void dofSample(inout vec4 diff, inout float w, float min_sc, float cur_depth, ve  	if (sc > min_sc //sampled pixel is more "out of focus" than current sample radius  	   || d < cur_depth) //sampled pixel is further away than current pixel  	{ -		float wg = 1.0; +		float wg = 0.25;  		vec4 s = texture2DRect(diffuseRect, tc);  		// de-weight dull areas to make highlights 'pop' -		wg *= s.r+s.g+s.b; +		wg += s.r+s.g+s.b;  		diff += wg*s; diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl new file mode 100644 index 0000000000..ab48d08bbb --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredNoDoFF.glsl @@ -0,0 +1,24 @@ +/**  + * @file postDeferredF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  +#version 120 + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect diffuseRect; +uniform sampler2D bloomMap; + +uniform vec2 screen_res; +varying vec2 vary_fragcoord; + +void main()  +{ +	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord.xy); +	 +	vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res); +	gl_FragColor = diff + bloom; +} diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 88ca60318b..6dfc1b952c 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -28,7 +28,6 @@ varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_light;  varying vec3 vary_pointlight_col;  uniform float shadow_bias; diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl index 1da3d95069..d227346163 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl @@ -11,7 +11,6 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);  void calcAtmospherics(vec3 inPositionEye);  float calcDirectionalLight(vec3 n, vec3 l); -float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);  mat4 getObjectSkinnedTransform();  vec3 atmosAmbient(vec3 light);  vec3 atmosAffectDirectionalLight(float lightIntensity); @@ -22,12 +21,37 @@ varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_light; +varying vec3 vary_pointlight_col;  uniform float near_clip;  uniform float shadow_offset;  uniform float shadow_bias; +float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight) +{ +	//get light vector +	vec3 lv = lp.xyz-v; +	 +	//get distance +	float d = length(lv); +	 +	//normalize light vector +	lv *= 1.0/d; +	 +	//distance attenuation +	float dist2 = d*d/(la*la); +	float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0); + +	// spotlight coefficient. +	float spot = max(dot(-ln, lv), is_pointlight); +	da *= spot*spot; // GL_SPOT_EXPONENT=2 + +	//angular attenuation +	da *= calcDirectionalLight(n, lv); + +	return da;	 +} +  void main()  {  	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; @@ -55,21 +79,21 @@ void main()  	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));  	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a); -	// Collect normal lights (need to be divided by two, as we later multiply by 2) -	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a); -	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a); -	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a); -	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a); -	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a); -	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a); -	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz); -	col.rgb = scaleDownLight(col.rgb); +	// Collect normal lights +	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a); +	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a); +	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a); +	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a); +	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a); +	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a); +	vary_pointlight_col = col.rgb*gl_Color.rgb; + +	col.rgb = vec3(0,0,0); +  	// Add windlight lights -	col.rgb += atmosAmbient(vec3(0.)); -	 -	vary_light = gl_LightSource[0].position.xyz; -	 +	col.rgb = atmosAmbient(vec3(0.)); +		  	vary_ambient = col.rgb*gl_Color.rgb;  	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl index ea09d5bb09..86f014df35 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl @@ -21,7 +21,6 @@ varying vec3 vary_ambient;  varying vec3 vary_directional;  varying vec3 vary_fragcoord;  varying vec3 vary_position; -varying vec3 vary_light;  varying vec3 vary_pointlight_col;  uniform float near_clip; @@ -86,8 +85,6 @@ void main()  	// Add windlight lights  	col.rgb = atmosAmbient(vec3(0.)); -	vary_light = gl_LightSource[0].position.xyz; -	  	vary_ambient = col.rgb*gl_Color.rgb;  	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a))); diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index e86663b748..058bdcc730 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -59,7 +59,6 @@ Disregard96DefaultDrawDistance	1	1  RenderTextureMemoryMultiple		1	1.0  SkyUseClassicClouds			1	1  RenderShaderLightingMaxLevel		1	3 -RenderDeferred				1	0  RenderDeferred				1	1  RenderDeferredSSAO			1	1  RenderShadowDetail			1	2 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index e715054c54..6bdb1e1787 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -62,6 +62,10 @@ Disregard128DefaultDrawDistance	1	1  Disregard96DefaultDrawDistance	1	1  SkyUseClassicClouds			1	1  WatchdogDisabled				1	1 +RenderDeferred				1	1 +RenderDeferredSSAO			1	1 +RenderShadowDetail			1	2 +  //  // Low Graphics Settings @@ -91,6 +95,10 @@ VertexShaderEnable			1	0  WindLightUseAtmosShaders	1	0  WLSkyDetail					1	48  SkyUseClassicClouds			1	0 +RenderDeferred				1	0 +RenderDeferredSSAO			1	0 +RenderShadowDetail			1	2 +  //  // Mid Graphics Settings @@ -118,6 +126,10 @@ RenderWaterReflections		1	0  VertexShaderEnable			1	1  WindLightUseAtmosShaders	1	0  WLSkyDetail					1	48 +RenderDeferred				1	0 +RenderDeferredSSAO			1	0 +RenderShadowDetail			1	2 +  //  // High Graphics Settings (purty) @@ -145,6 +157,10 @@ RenderWaterReflections		1	0  VertexShaderEnable			1	1  WindLightUseAtmosShaders	1	1  WLSkyDetail					1	48 +RenderDeferred				1	0 +RenderDeferredSSAO			1	0 +RenderShadowDetail			1	2 +  //  // Ultra graphics (REALLY PURTY!) @@ -172,6 +188,10 @@ RenderWaterReflections		1	1  VertexShaderEnable			1	1  WindLightUseAtmosShaders	1	1  WLSkyDetail					1	128 +RenderDeferred				1	0 +RenderDeferredSSAO			1	0 +RenderShadowDetail			1	2 +  //  // Class Unknown Hardware (unknown) diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 54689ea808..6396ca91ff 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -26,12 +26,6 @@  #include "llviewerprecompiledheaders.h" -#if defined(_DEBUG) -# if _MSC_VER >= 1400 // Visual C++ 2005 or later -#	define WINDOWS_CRT_MEM_CHECKS 1 -# endif -#endif -  #include "llappviewerwin32.h"  #include "llmemtype.h" diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 2cfd3b0a33..8b5a2ce781 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -107,10 +107,14 @@ S32 LLDrawPoolAlpha::getNumPostDeferredPasses()  	{ //skip depth buffer filling pass when rendering impostors  		return 1;  	} -	else +	else if (gSavedSettings.getBOOL("RenderDepthOfField"))  	{  		return 2;   	} +	else +	{ +		return 1; +	}  }  void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass)  diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp index ae0e1b7d46..e8da1aa42c 100644 --- a/indra/newview/llfloatermodelpreview.cpp +++ b/indra/newview/llfloatermodelpreview.cpp @@ -112,8 +112,6 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;  const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16;  const S32 PREVIEW_TEXTURE_HEIGHT = 300; -const F32 MAXIMUM_PIVOT_OFFSET = 64.0f; -  void drawBoxOutline(const LLVector3& pos, const LLVector3& size); @@ -1560,14 +1558,14 @@ bool LLModelLoader::doLoadModel()  						//(which means we have all the joints that are required for an avatar versus  						//a skinned asset attached to a node in a file that contains an entire skeleton,  						//but does not use the skeleton).						 -						 +						buildJointToNodeMappingFromScene( root );  						mPreview->critiqueRigForUploadApplicability( model->mSkinInfo.mJointNames );  						if ( !missingSkeletonOrScene )  						{  							//Set the joint translations on the avatar - if it's a full mapping  							//The joints are reset in the dtor -							if ( mPreview->getResetJointFlag() ) +							if ( mPreview->getRigWithSceneParity() )  							{	  								std::map<std::string, std::string> :: const_iterator masterJointIt = mJointMap.begin();  								std::map<std::string, std::string> :: const_iterator masterJointItEnd = mJointMap.end(); @@ -1772,12 +1770,6 @@ bool LLModelLoader::doLoadModel()  	processElement(scene); -	handlePivotPoint( root ); - -	buildJointToNodeMappingFromScene( root ); -	 -	mPreview->critiqueJointToNodeMappingFromScene(); -  	return true;  } @@ -1967,55 +1959,14 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode )  		}  	}  } -//----------------------------------------------------------------------------- -// handlePivotPoint() -//----------------------------------------------------------------------------- -void LLModelLoader::handlePivotPoint( daeElement* pRoot ) -{ -	//Import an optional pivot point - a pivot point is just a node in the visual scene named "AssetPivot" -	//If no assetpivot is found then the asset will use the SL default -	daeElement* pScene = pRoot->getDescendant("visual_scene"); -	if ( pScene ) -	{ -		daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren(); -		S32 childCount = children.getCount(); -		for (S32 i = 0; i < childCount; ++i) -		{ -			domNode* pNode = daeSafeCast<domNode>(children[i]); -			if ( pNode && isNodeAPivotPoint( pNode ) ) -			{ -				LLMatrix4 workingTransform; -				daeSIDResolver nodeResolver( pNode, "./translate" ); -				domTranslate* pTranslate = daeSafeCast<domTranslate>( nodeResolver.getElement() ); -				//Translation via SID was successful -				//todo#extract via element as well -				if ( pTranslate ) -				{ -					extractTranslation( pTranslate, workingTransform ); -					LLVector3 pivotTrans = workingTransform.getTranslation(); -					if ( pivotTrans[VX] > MAXIMUM_PIVOT_OFFSET || pivotTrans[VX] < -MAXIMUM_PIVOT_OFFSET ||  -						 pivotTrans[VY] > MAXIMUM_PIVOT_OFFSET || pivotTrans[VY] < -MAXIMUM_PIVOT_OFFSET ||  -						 pivotTrans[VZ] > MAXIMUM_PIVOT_OFFSET || pivotTrans[VZ] < -MAXIMUM_PIVOT_OFFSET )  -					{ -						llwarns<<"Asset Pivot Node contains an offset that is too large - values should be within (-"<<MAXIMUM_PIVOT_OFFSET<<","<<MAXIMUM_PIVOT_OFFSET<<")."<<llendl; -						mPreview->setHasPivot( false ); -					} -					else -					{ -						mPreview->setModelPivot( pivotTrans ); -						mPreview->setHasPivot( true );					 -					} -				}					 -			} -		} -	}  -}  //-----------------------------------------------------------------------------  // critiqueRigForUploadApplicability()  //-----------------------------------------------------------------------------  void LLModelPreview::critiqueRigForUploadApplicability( const std::vector<std::string> &jointListFromAsset )  { +	critiqueJointToNodeMappingFromScene(); +	  	//Determines the following use cases for a rig:  	//1. It is suitable for upload with skin weights & joint positions, or  	//2. It is suitable for upload as standard av with just skin weights @@ -2034,7 +1985,7 @@ void LLModelPreview::critiqueRigForUploadApplicability( const std::vector<std::s  		setLegacyRigValid( true );  	} -	if ( isJointPositionUploadOK ) +	if ( getRigWithSceneParity() && isJointPositionUploadOK )  	{  		setResetJointFlag( true );  	} @@ -2078,12 +2029,11 @@ void LLModelPreview::critiqueJointToNodeMappingFromScene( void  )  	if ( result )  	{		  		setResetJointFlag( true ); -		//llinfos<<"Full"<<llendl; +		setRigWithSceneParity( true );  	}  	else  	{  		setResetJointFlag( false ); -		//llinfos<<"Partial"<<llendl;  	}	  }  //----------------------------------------------------------------------------- @@ -2208,27 +2158,7 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode )  	return false;  } -//----------------------------------------------------------------------------- -// isNodeAPivotPoint() -//----------------------------------------------------------------------------- -bool LLModelLoader::isNodeAPivotPoint( domNode* pNode ) -{ -	bool result = false; -	 -	if ( pNode && pNode->getName() ) -	{ -		std::string name = pNode->getName(); -		if ( name == "AssetPivot" ) -		{ -			result = true; -		} -		else -		{ -			result = false; -		} -	}	 -	return result; -} +  //-----------------------------------------------------------------------------  // extractTranslation()  //----------------------------------------------------------------------------- @@ -2650,6 +2580,7 @@ LLModelPreview::LLModelPreview(S32 width, S32 height, LLFloater* fmp)  , mLegacyRigValid( false )  , mRigValidJointUpload( false )  , mResetJoints( false ) +, mRigParityWithScene( false )  , mLastJointUpdate( false )  {  	mNeedsUpdate = TRUE; @@ -2854,27 +2785,6 @@ void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost,  	childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost));	  } -void LLModelPreview::alterModelsPivot( void ) -{ -	for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter) -	{ -		if ( *iter ) -		{ -			(*iter)->offsetMesh( mModelPivot ); -		} -	} -	 -	for ( int i=0;i<LLModel::NUM_LODS;++i ) -	{ -		for (LLModelLoader::model_list::iterator iter = mModel[i].begin(); iter != mModel[i].end(); ++iter) -		{ -			if ( *iter ) -			{ -				(*iter)->offsetMesh( mModelPivot ); -			} -		} -	} -}  void LLModelPreview::rebuildUploadData()  { @@ -3645,21 +3555,19 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim  		glodGroupParameterf(mGroup, GLOD_OBJECT_SPACE_ERROR_THRESHOLD, lod_error_threshold);  		stop_gloderror(); -		glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, 0); -		stop_gloderror(); - -		glodAdaptGroup(mGroup); -		stop_gloderror(); - -		if (lod_mode == GLOD_TRIANGLE_BUDGET) -		{ //SH-632 Always adapt to 0 before adapting to actual desired amount, and always -			//add 1 to desired amount to avoid decimating below desired amount +		if (lod_mode != GLOD_TRIANGLE_BUDGET) +		{ 			 +			glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, 0); +		} +		else +		{ +			//SH-632: always add 1 to desired amount to avoid decimating below desired amount  			glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, triangle_count+1); -			stop_gloderror(); - -			glodAdaptGroup(mGroup); -			stop_gloderror();  		} +			 +		stop_gloderror(); +		glodAdaptGroup(mGroup); +		stop_gloderror();		  		for (U32 mdl_idx = 0; mdl_idx < mBaseModel.size(); ++mdl_idx)  		{ @@ -4975,11 +4883,6 @@ void LLFloaterModelPreview::onUpload(void* user_data)  	LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data; -	if ( mp && mp->mModelPreview->mHasPivot ) -	{ -		mp->mModelPreview->alterModelsPivot(); -	} -	  	mp->mModelPreview->rebuildUploadData();  	bool upload_skinweights = mp->childGetValue("upload_skin").asBoolean(); diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h index 7927edcd36..4d8b46807f 100644 --- a/indra/newview/llfloatermodelpreview.h +++ b/indra/newview/llfloatermodelpreview.h @@ -120,9 +120,6 @@ public:  	void extractTranslation( domTranslate* pTranslate, LLMatrix4& transform );  	void extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform ); -	void handlePivotPoint( daeElement* pRoot ); -	bool isNodeAPivotPoint( domNode* pNode ); -	  	void setLoadState(U32 state);  	void buildJointToNodeMappingFromScene( daeElement* pRoot ); @@ -298,7 +295,6 @@ public:  	void loadModelCallback(S32 lod);  	void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false);  	void generateNormals(); -	void alterModelsPivot( void );  	void clearMaterials();  	U32 calcResourceCost();  	void rebuildUploadData(); @@ -339,8 +335,10 @@ public:  	U32 getLoadState() { return mLoadState; }  	//setRestJointFlag: If an asset comes through that changes the joints, we want the reset to persist  	void setResetJointFlag( bool state ) { if ( !mResetJoints ) mResetJoints = state; } -	bool getResetJointFlag( void ) { return mResetJoints; } - +	const bool getResetJointFlag( void ) const { return mResetJoints; } +	void setRigWithSceneParity( bool state ) { mRigParityWithScene = state; } +	const bool getRigWithSceneParity( void ) const { return mRigParityWithScene; } +	  	LLVector3 getTranslationForJointOffset( std::string joint );   protected: @@ -370,6 +368,8 @@ public:  	bool		mLoading;  	U32			mLoadState;  	bool		mResetJoints; +	bool		mRigParityWithScene; +	  	std::map<std::string, bool> mViewOption;  	//GLOD object parameters (must rebuild object if these change) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 013fc43f99..ff4b812cb0 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -1372,27 +1372,7 @@ void LLMeshUploadThread::run()  		}  		//queue up models for hull generation -		LLModel* physics = NULL; - -		if (data.mModel[LLModel::LOD_PHYSICS].notNull()) -		{ -			physics = data.mModel[LLModel::LOD_PHYSICS]; -		} -		else if (data.mModel[LLModel::LOD_MEDIUM].notNull()) -		{ -			physics = data.mModel[LLModel::LOD_MEDIUM]; -		} -		else -		{ -			physics = data.mModel[LLModel::LOD_HIGH]; -		} - -		if (!physics) -		{ -			llerrs << "WTF?" << llendl; -		} - -		DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this); +		DecompRequest* request = new DecompRequest(data.mModel[LLModel::LOD_HIGH], data.mBaseModel, this);  		gMeshRepo.mDecompThread->submitRequest(request);  	} diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp index 23b0845f31..7f7366dd3d 100644 --- a/indra/newview/llviewercamera.cpp +++ b/indra/newview/llviewercamera.cpp @@ -756,6 +756,10 @@ LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent)  BOOL LLViewerCamera::cameraUnderWater() const  { +	if(!gAgent.getRegion()) +	{ +		return FALSE ; +	}  	return getOrigin().mV[VZ] < gAgent.getRegion()->getWaterHeight();  } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index a60d7e0793..e41773d273 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -825,7 +825,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		//}  		LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE; -		LLPipeline::updateRenderDeferred(); +		LLPipeline::refreshRenderDeferred();  		stop_glerror(); diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index 25cf63a367..e81ee72c05 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -137,6 +137,7 @@ LLGLSLShader			gDeferredGIProgram;  LLGLSLShader			gDeferredGIFinalProgram;  LLGLSLShader			gDeferredPostGIProgram;  LLGLSLShader			gDeferredPostProgram; +LLGLSLShader			gDeferredPostNoDoFProgram;  LLGLSLShader			gLuminanceGatherProgram; @@ -1246,6 +1247,16 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()  		success = gDeferredPostProgram.createShader(NULL, NULL);  	} +	if (success) +	{ +		gDeferredPostNoDoFProgram.mName = "Deferred Post Shader"; +		gDeferredPostNoDoFProgram.mShaderFiles.clear(); +		gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredV.glsl", GL_VERTEX_SHADER_ARB)); +		gDeferredPostNoDoFProgram.mShaderFiles.push_back(make_pair("deferred/postDeferredNoDoFF.glsl", GL_FRAGMENT_SHADER_ARB)); +		gDeferredPostNoDoFProgram.mShaderLevel = mVertexShaderLevel[SHADER_DEFERRED]; +		success = gDeferredPostNoDoFProgram.createShader(NULL, NULL); +	} +  	if (mVertexShaderLevel[SHADER_DEFERRED] > 1)  	{  		if (success) diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index f31d2d1836..72ac5e02ee 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -368,6 +368,7 @@ extern LLGLSLShader			gDeferredSoftenProgram;  extern LLGLSLShader			gDeferredShadowProgram;  extern LLGLSLShader			gDeferredPostGIProgram;  extern LLGLSLShader			gDeferredPostProgram; +extern LLGLSLShader			gDeferredPostNoDoFProgram;  extern LLGLSLShader			gDeferredAvatarShadowProgram;  extern LLGLSLShader			gDeferredAttachmentShadowProgram;  extern LLGLSLShader			gDeferredAlphaProgram; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 21fbe52ccd..f64eb89866 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -784,6 +784,21 @@ void LLPipeline::updateRenderDeferred()  	}  } +//static +void LLPipeline::refreshRenderDeferred() +{ +	if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES)) +	{ +		//turn the deferred rendering and glow off when draw physics shapes. +		sRenderDeferred = FALSE ; +		sRenderGlow = FALSE ; +	} +	else +	{ +		updateRenderDeferred() ; +	} +} +  void LLPipeline::releaseGLBuffers()  {  	assertInitialized(); @@ -6275,128 +6290,135 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)  	if (LLPipeline::sRenderDeferred && !LLViewerCamera::getInstance()->cameraUnderWater())  	{ +		bool dof_enabled = true; +  		LLGLSLShader* shader = &gDeferredPostProgram;  		if (LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_DEFERRED) > 2)  		{  			shader = &gDeferredGIFinalProgram; +			dof_enabled = false;  		} +		else if (LLToolMgr::getInstance()->inBuildMode() || !gSavedSettings.getBOOL("RenderDepthOfField")) +		{ //squish focal length when in build mode (or if DoF is disabled) so DoF doesn't make editing objects difficult +			shader = &gDeferredPostNoDoFProgram; +			dof_enabled = false; +		} +		  		LLGLDisable blend(GL_BLEND);  		bindDeferredShader(*shader); -		//depth of field focal plane calculations +		if (dof_enabled) +		{ +			//depth of field focal plane calculations -		static F32 current_distance = 16.f; -		static F32 start_distance = 16.f; -		static F32 transition_time = 1.f; +			static F32 current_distance = 16.f; +			static F32 start_distance = 16.f; +			static F32 transition_time = 1.f; -		LLVector3 focus_point; +			LLVector3 focus_point; -		LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject(); -		if (obj && obj->mDrawable && obj->isSelected()) -		{ -			S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace(); -			if (obj && obj->mDrawable) -			{ -				LLFace* face = obj->mDrawable->getFace(face_idx); -				if (face) +			LLViewerObject* obj = LLViewerMediaFocus::getInstance()->getFocusedObject(); +			if (obj && obj->mDrawable && obj->isSelected()) +			{ //focus on selected media object +				S32 face_idx = LLViewerMediaFocus::getInstance()->getFocusedFace(); +				if (obj && obj->mDrawable)  				{ -					focus_point = face->getPositionAgent(); +					LLFace* face = obj->mDrawable->getFace(face_idx); +					if (face) +					{ +						focus_point = face->getPositionAgent(); +					}  				}  			} -		} -		if (focus_point.isExactlyZero()) -		{ -			if (LLViewerJoystick::getInstance()->getOverrideCamera()) -			{ -				focus_point = gDebugRaycastIntersection; -			} -			else if (gAgentCamera.cameraMouselook()) -			{ -				gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, -											  NULL, -											  &focus_point); -			} -			else +			if (focus_point.isExactlyZero())  			{ -				LLViewerObject* obj = gAgentCamera.getFocusObject(); -				if (obj) -				{ -					focus_point = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal()); +				if (LLViewerJoystick::getInstance()->getOverrideCamera()) +				{ //focus on point under cursor +					focus_point = gDebugRaycastIntersection; +				} +				else if (gAgentCamera.cameraMouselook()) +				{ //focus on point under mouselook crosshairs +					gViewerWindow->cursorIntersect(-1, -1, 512.f, NULL, -1, FALSE, +												  NULL, +												  &focus_point);  				}  				else  				{ -					focus_point = gDebugRaycastIntersection; +					LLViewerObject* obj = gAgentCamera.getFocusObject(); +					if (obj) +					{ //focus on alt-zoom target +						focus_point = LLVector3(gAgentCamera.getFocusGlobal()-gAgent.getRegion()->getOriginGlobal()); +					} +					else +					{ //focus on your avatar +						focus_point = gAgent.getPositionAgent(); +					}  				}  			} -		} - -		LLVector3 eye = LLViewerCamera::getInstance()->getOrigin(); -		F32 target_distance = 16.f; -		if (!focus_point.isExactlyZero()) -		{ -			target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point-eye); -		} -		if (transition_time >= 1.f && -			fabsf(current_distance-target_distance)/current_distance > 0.01f) -		{ //large shift happened, interpolate smoothly to new target distance -			transition_time = 0.f; -			start_distance = current_distance; -		} -		else if (transition_time < 1.f) -		{ //currently in a transition, continue interpolating -			transition_time += 1.f/gSavedSettings.getF32("CameraFocusTransitionTime")*gFrameIntervalSeconds; -			transition_time = llmin(transition_time, 1.f); +			LLVector3 eye = LLViewerCamera::getInstance()->getOrigin(); +			F32 target_distance = 16.f; +			if (!focus_point.isExactlyZero()) +			{ +				target_distance = LLViewerCamera::getInstance()->getAtAxis() * (focus_point-eye); +			} -			F32 t = cosf(transition_time*F_PI+F_PI)*0.5f+0.5f; -			current_distance = start_distance + (target_distance-start_distance)*t; -		} -		else -		{ //small or no change, just snap to target distance -			current_distance = target_distance; -		} +			if (transition_time >= 1.f && +				fabsf(current_distance-target_distance)/current_distance > 0.01f) +			{ //large shift happened, interpolate smoothly to new target distance +				transition_time = 0.f; +				start_distance = current_distance; +			} +			else if (transition_time < 1.f) +			{ //currently in a transition, continue interpolating +				transition_time += 1.f/gSavedSettings.getF32("CameraFocusTransitionTime")*gFrameIntervalSeconds; +				transition_time = llmin(transition_time, 1.f); -		//convert to mm -		F32 subject_distance = current_distance*1000.f; -		F32 fnumber = gSavedSettings.getF32("CameraFNumber"); -		F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength"); +				F32 t = cosf(transition_time*F_PI+F_PI)*0.5f+0.5f; +				current_distance = start_distance + (target_distance-start_distance)*t; +			} +			else +			{ //small or no change, just snap to target distance +				current_distance = target_distance; +			} -		if (LLToolMgr::getInstance()->inBuildMode() || !gSavedSettings.getBOOL("RenderDepthOfField")) -		{ //squish focal length when in build mode (or if DoF is disabled) so DoF doesn't make editing objects difficult -			default_focal_length = 5.f; -		} +			//convert to mm +			F32 subject_distance = current_distance*1000.f; +			F32 fnumber = gSavedSettings.getF32("CameraFNumber"); +			F32 default_focal_length = gSavedSettings.getF32("CameraFocalLength"); -		F32 fov = LLViewerCamera::getInstance()->getView(); +			F32 fov = LLViewerCamera::getInstance()->getView(); -		const F32 default_fov = gSavedSettings.getF32("CameraFieldOfView") * F_PI/180.f; -		//const F32 default_aspect_ratio = gSavedSettings.getF32("CameraAspectRatio"); +			const F32 default_fov = gSavedSettings.getF32("CameraFieldOfView") * F_PI/180.f; +			//const F32 default_aspect_ratio = gSavedSettings.getF32("CameraAspectRatio"); -		//F32 aspect_ratio = (F32) mScreen.getWidth()/(F32)mScreen.getHeight(); +			//F32 aspect_ratio = (F32) mScreen.getWidth()/(F32)mScreen.getHeight(); -		F32 dv = 2.f*default_focal_length * tanf(default_fov/2.f); -		//F32 dh = 2.f*default_focal_length * tanf(default_fov*default_aspect_ratio/2.f); +			F32 dv = 2.f*default_focal_length * tanf(default_fov/2.f); +			//F32 dh = 2.f*default_focal_length * tanf(default_fov*default_aspect_ratio/2.f); -		F32 focal_length = dv/(2*tanf(fov/2.f)); +			F32 focal_length = dv/(2*tanf(fov/2.f)); -		//F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle); +			//F32 tan_pixel_angle = tanf(LLDrawable::sCurPixelAngle); -		// from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f)) -		// where	 N = fnumber -		//			 s2 = dot distance -		//			 s1 = subject distance -		//			 f = focal length -		//	 - -		F32 blur_constant = focal_length*focal_length/(fnumber*(subject_distance-focal_length)); -		blur_constant /= 1000.f; //convert to meters for shader -		F32 magnification = focal_length/(subject_distance-focal_length); - -		shader->uniform1f("focal_distance", -subject_distance/1000.f); -		shader->uniform1f("blur_constant", blur_constant); -		shader->uniform1f("tan_pixel_angle", tanf(1.f/LLDrawable::sCurPixelAngle)); -		shader->uniform1f("magnification", magnification); +			// from wikipedia -- c = |s2-s1|/s2 * f^2/(N(S1-f)) +			// where	 N = fnumber +			//			 s2 = dot distance +			//			 s1 = subject distance +			//			 f = focal length +			//	 + +			F32 blur_constant = focal_length*focal_length/(fnumber*(subject_distance-focal_length)); +			blur_constant /= 1000.f; //convert to meters for shader +			F32 magnification = focal_length/(subject_distance-focal_length); + +			shader->uniform1f("focal_distance", -subject_distance/1000.f); +			shader->uniform1f("blur_constant", blur_constant); +			shader->uniform1f("tan_pixel_angle", tanf(1.f/LLDrawable::sCurPixelAngle)); +			shader->uniform1f("magnification", magnification); +		}  		S32 channel = shader->enableTexture(LLViewerShaderMgr::DEFERRED_DIFFUSE, LLTexUnit::TT_RECT_TEXTURE);  		if (channel > -1) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 0cf3fde562..e9a250cd6d 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -356,6 +356,7 @@ public:  	static BOOL getRenderHighlights(void* data);  	static void updateRenderDeferred(); +	static void refreshRenderDeferred();  private:  	void unloadShaders(); diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml index 03af348a8d..92d57b20be 100644 --- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml +++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml @@ -449,12 +449,12 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se  			<slider  		   follows="left|top"  		   height="20" -		   increment="0.5" +		   increment="1"  		   layout="topleft"  		   left="204" -		   max_val="4" -		   initial_value="3" -		   min_val="2" +		   max_val="3" +		   initial_value="2" +		   min_val="0"  		   name="accuracy_slider"  		   show_text="false"  		   top="130" @@ -464,7 +464,8 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se  			top_pad="0"    			width="300"   			left_delta="6"  -			height="4">'                                             '                                             '</text> +			height="4">'   +      </text>  			<icon | 
