diff options
| author | Steven Bennetts <steve@lindenlab.com> | 2008-03-25 22:50:26 +0000 | 
|---|---|---|
| committer | Steven Bennetts <steve@lindenlab.com> | 2008-03-25 22:50:26 +0000 | 
| commit | 6fcf38217e8772b2f90c7a8e7ce6b60071f6d20c (patch) | |
| tree | a8e35fe195cc86c616daf9d8a21571e04bc2bc35 /indra/newview | |
| parent | 11a3589665aae1a2423e258e40eba45c117627d5 (diff) | |
merge release@82858 maint-render-2-merge@83010 -> release
QAR-389
Diffstat (limited to 'indra/newview')
38 files changed, 1034 insertions, 291 deletions
| diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9cc61b4827..16b278c01c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5632,7 +5632,7 @@          <key>Type</key>              <string>Boolean</string>          <key>Value</key> -            <integer>0</integer> +            <integer>1</integer>          </map>      <key>RenderUseFarClip</key>          <map> @@ -9600,5 +9600,60 @@  		<key>Value</key>  			<integer>1</integer>  		</map> +    <key>RenderDeferred</key> +		<map> +		<key>Comment</key> +			<string>Use deferred rendering pipeline.</string> +		<key>Persist</key> +			<integer>1</integer> +		<key>Type</key> +			<string>Boolean</string> +		<key>Value</key> +			<integer>0</integer> +		</map> +    <key>RenderFSAASamples</key> +		<map> +		<key>Comment</key> +			<string>Number of samples to use for FSAA (0 = no AA).</string> +		<key>Persist</key> +			<integer>1</integer> +		<key>Type</key> +			<string>U32</string> +		<key>Value</key> +			<integer>0</integer> +		</map> +    <key>RenderTextureMemoryMultiple</key> +		<map> +		<key>Comment</key> +			<string>Multiple of texture memory value to use (should fit: 0 < value <= 1.0)</string> +		<key>Persist</key> +			<integer>1</integer> +		<key>Type</key> +			<string>F32</string> +		<key>Value</key> +			<real>1.0</real> +		</map> +    <key>Disregard128DefaultDrawDistance</key> +		<map> +		<key>Comment</key> +			<string>Whether to use the auto default to 128 draw distance</string> +		<key>Persist</key> +			<integer>1</integer> +		<key>Type</key> +			<string>Boolean</string> +		<key>Value</key> +			<real>1</real> +		</map> +    <key>Disregard96DefaultDrawDistance</key> +		<map> +		<key>Comment</key> +			<string>Whether to use the auto default to 96 draw distance</string> +		<key>Persist</key> +			<integer>1</integer> +		<key>Type</key> +			<string>Boolean</string> +		<key>Value</key> +			<real>1</real> +		</map>      </map>  </llsd> diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl new file mode 100644 index 0000000000..14e6361f83 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseF.glsl @@ -0,0 +1,16 @@ +/**  + * @file diffuseF.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +uniform sampler2D diffuseMap; + +varying vec3 vary_normal; + +void main()  +{ +	gl_FragColor = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); +	gl_FragColor.rgb = vary_normal*0.5+0.5; +} diff --git a/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl new file mode 100644 index 0000000000..8e9069368a --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/deferred/diffuseV.glsl @@ -0,0 +1,22 @@ +/**  + * @file diffuseV.glsl + * + * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. + * $License$ + */ + +varying vec3 vary_normal; +varying vec3 vary_position; + +void main() +{ +	//transform vertex +	gl_Position = ftransform();  +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	vary_position = (gl_ModelViewMatrix * gl_Vertex).xyz; +	 +	vary_normal = normalize(gl_NormalMatrix * gl_Normal); + +	gl_FrontColor = gl_Color; +} diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl index 1c14381df9..7b9e4ff828 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl @@ -86,7 +86,7 @@ void main()  	color.rgb = mix(mix(fogCol.rgb, fb.rgb, fogCol.a), refcol.rgb, df);  	color.rgb += spec * specular; -	color.rgb = atmosTransport(color.rgb); +	color.rgb = applyWaterFog(color);//atmosTransport(color.rgb);  	color.rgb = scaleSoftClip(color.rgb);  	color.a = spec * sunAngle2; diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index 59e44fa871..7ee41998e2 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -8,11 +8,11 @@  vec4 applyWaterFog(vec4 color)  {  	// GL_EXP2 Fog -	float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord); +	//float fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);  	// GL_EXP Fog  	// float fog = exp(-gl_Fog.density * gl_FogFragCoord);  	// GL_LINEAR Fog -	// float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale; +	float fog = (gl_Fog.end - gl_FogFragCoord) * gl_Fog.scale;  	fog = clamp(fog, 0.0, 1.0);  	color.rgb = mix(gl_Fog.color.rgb, color.rgb, fog);  	return color; diff --git a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl index d332798103..48ac87ef07 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterV.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterV.glsl @@ -63,9 +63,8 @@ void main()  	//pass wave parameters to pixel shader  	vec2 bigWave =  (v.xy) * vec2(0.04,0.04)  + d1 * time * 0.055;  	//get two normal map (detail map) texture coordinates -	littleWave.xy = (v.xy) * vec2(0.6, 1.2)   + d2 * time * 0.05; -	// littleWave.zw = (v.xy) * vec2(0.07, 0.15) - d1 * time * 0.043; -	littleWave.zw = (v.xy) * vec2(0.3, 0.6) + d1 * time * 0.1; +	littleWave.xy = (v.xy) * vec2(0.45, 0.9)   + d2 * time * 0.13; +	littleWave.zw = (v.xy) * vec2(0.1, 0.2) + d1 * time * 0.1;  	view.w = bigWave.y;  	refCoord.w = bigWave.x; diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl index 9ab986be6d..071489bca8 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightF.glsl @@ -9,7 +9,7 @@ uniform sampler2D diffuseMap;  void default_lighting()   { -	color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); +	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);  	gl_FragColor = color;  } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl index c6f7f8b81b..89785c45cb 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyF.glsl @@ -11,7 +11,7 @@ uniform samplerCube environmentMap;  void shiny_lighting()   { -	color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); +	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);  	gl_FragColor = color;  } diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl index 75f61ccdf1..7ac3c359bf 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightShinyWaterF.glsl @@ -11,7 +11,7 @@ uniform samplerCube environmentMap;  void shiny_lighting_water()   { -	color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy); +	vec4 color = gl_Color * texture2D(diffuseMap, gl_TexCoord[0].xy);  	gl_FragColor = color;  } diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 898751d3f1..2fcec67c0e 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -51,6 +51,7 @@ WindLightUseAtmosShaders	1	1  WLSkyDetail					1	128  Disregard128DefaultDrawDistance	1	1  Disregard96DefaultDrawDistance	1	1 +RenderTextureMemoryMultiple		1	1.0  //  // Low Graphics Settings diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt index d7921ffb59..40aa05d0c6 100644 --- a/indra/newview/featuretable_linux.txt +++ b/indra/newview/featuretable_linux.txt @@ -51,6 +51,7 @@ WindLightUseAtmosShaders	1	1  WLSkyDetail					1	128  Disregard128DefaultDrawDistance	1	1  Disregard96DefaultDrawDistance	1	1 +RenderTextureMemoryMultiple		1	1.0  //  // Low Graphics Settings diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 9645ff8abf..c17ca7fcad 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -23,33 +23,36 @@ version 15  // NOTE: All settings are set to the MIN of applied values, including 'all'!  //  list all -RenderAnisotropic			1	0 -RenderAvatarCloth			0	0 -RenderAvatarLODFactor		1	1.0 -RenderAvatarVP				1	0 -RenderCubeMap				1	1 -RenderFarClip				1	256 -RenderFlexTimeFactor		1	1.0 -RenderFogRatio				1	4.0 -RenderGamma					1	0 -RenderGlowResolutionPow		1	9 -RenderLightingDetail		1	1 -RenderMaxPartCount			1	8192 -RenderNightBrightness		1	1.0 -RenderObjectBump			1	1 -RenderReflectionDetail		1	3 -RenderTerrainDetail			1	1 -RenderTerrainLODFactor		1	2.0 -RenderTreeLODFactor			1	1.0 -RenderUseImpostors			1	1 -RenderVBOEnable				1	1 -RenderVolumeLODFactor		1	2.0 -RenderWaterReflections		1	1 -UseOcclusion				1	1 -VertexShaderEnable			1	1 -WindLightUseAtmosShaders	1	1 -WLSkyDetail					1	128 -RenderUseCleverUI			1	1 +RenderAnisotropic				1	0 +RenderAvatarCloth				0	0 +RenderAvatarLODFactor			1	1.0 +RenderAvatarVP					1	0 +RenderCubeMap					1	1 +RenderFarClip					1	256 +RenderFlexTimeFactor			1	1.0 +RenderFogRatio					1	4.0 +RenderGamma						1	0 +RenderGlowResolutionPow			1	9 +RenderLightingDetail			1	1 +RenderMaxPartCount				1	8192 +RenderNightBrightness			1	1.0 +RenderObjectBump				1	1 +RenderReflectionDetail			1	3 +RenderTerrainDetail				1	1 +RenderTerrainLODFactor			1	2.0 +RenderTreeLODFactor				1	1.0 +RenderUseImpostors				1	1 +RenderVBOEnable					1	1 +RenderVolumeLODFactor			1	2.0 +RenderWaterReflections			1	1 +UseOcclusion					1	1 +VertexShaderEnable				1	1 +WindLightUseAtmosShaders		1	1 +WLSkyDetail						1	128 +RenderUseCleverUI				1	1 +Disregard128DefaultDrawDistance	1	1 +Disregard96DefaultDrawDistance	1	1 +RenderTextureMemoryMultiple		1	0.5  Disregard128DefaultDrawDistance	1	1  Disregard96DefaultDrawDistance	1	1 @@ -337,6 +340,8 @@ VertexShaderEnable			0	0  WindLightUseAtmosShaders	0	0  Disregard96DefaultDrawDistance	1	0 +list NVIDIA_GeForce_8600 +RenderTextureMemoryMultiple			1	0.375	  /// tweaked ATI to 96 Draw distance diff --git a/indra/newview/featuretable_solaris.txt b/indra/newview/featuretable_solaris.txt index 7dd7c22cdf..2a514eaab1 100644 --- a/indra/newview/featuretable_solaris.txt +++ b/indra/newview/featuretable_solaris.txt @@ -34,6 +34,7 @@ RenderParticleCount	1	4096  RenderRippleWater	1	1  RenderTerrainDetail	1	2  VertexShaderEnable	1	1 +RenderTextureMemoryMultiple		1	1.0  //  // Class 0 Hardware (Unknown or just old) diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 070d45a5bb..1b7d6b809e 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -17,8 +17,7 @@  ##   on some hardware.  Disabling this option may cause BETTER PERFORMANCE but  ##   may also cause CRASHES and hangs on some unstable combinations of drivers  ##   and hardware. -## NOTE: This is 'off' for WindLight to help testing.  Hopefully it's not -##   really needed any more anyway. +## NOTE: This is now disabled by default.  #export LL_GL_BASICEXT=x  ## - Avoids *all* optional OpenGL extensions.  This is the safest and least- diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0e2d28400d..0a611c9bfa 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3171,27 +3171,6 @@ void LLAppViewer::idle()  	//////////////////////////////////////  	// -	// Update images, using the image stats generated during object update/culling -	// -	// Can put objects onto the retextured list. -	// -	gFrameStats.start(LLFrameStats::IMAGE_UPDATE); - -	{ -		LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); -		 -		LLViewerImage::updateClass(gCamera->getVelocityStat()->getMean(), -									gCamera->getAngularVelocityStat()->getMean()); - -		gBumpImageList.updateImages();  // must be called before gImageList version so that it's textures are thrown out first. - -		const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame) -		gImageList.updateImages(max_image_decode_time); -		stop_glerror(); -	} - -	////////////////////////////////////// -	//  	// Sort and cull in the new renderer are moved to pipeline.cpp  	// Here, particles are updated and drawables are moved.  	// diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index ca2f5ebb86..4dfe725731 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -59,6 +59,7 @@ static float sTime;  BOOL LLDrawPoolWater::sSkipScreenCopy = FALSE;  BOOL LLDrawPoolWater::sNeedsReflectionUpdate = TRUE; +BOOL LLDrawPoolWater::sNeedsDistortionUpdate = TRUE;  LLColor4 LLDrawPoolWater::sWaterFogColor = LLColor4(0.2f, 0.5f, 0.5f, 0.f);  LLVector3 LLDrawPoolWater::sLightDir; @@ -546,6 +547,7 @@ void LLDrawPoolWater::shade()  			if (water->getUseTexture())  			{ +				sNeedsDistortionUpdate = TRUE;  				face->renderIndexed();  			}  			else @@ -557,6 +559,7 @@ void LLDrawPoolWater::shade()  				}  				else  				{ +					sNeedsDistortionUpdate = TRUE;  					face->renderIndexed();  				}  			} diff --git a/indra/newview/lldrawpoolwater.h b/indra/newview/lldrawpoolwater.h index d9b91db85c..a1b09a5e49 100644 --- a/indra/newview/lldrawpoolwater.h +++ b/indra/newview/lldrawpoolwater.h @@ -50,6 +50,7 @@ protected:  public:  	static BOOL sSkipScreenCopy;  	static BOOL sNeedsReflectionUpdate; +	static BOOL sNeedsDistortionUpdate;  	static LLVector3 sLightDir;  	static LLColor4 sWaterFogColor; diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index c1194fa99e..f0ac46b7d6 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -113,10 +113,6 @@ static struct ft_display_info ft_display_table[] =  	{ LLFastTimer::FTM_PIPELINE,			"     Pipeline",	&LLColor4::magenta4, 0 },  	{ LLFastTimer::FTM_CLEANUP,				"  Cleanup",		&LLColor4::cyan3, 0 },  	{ LLFastTimer::FTM_AUDIO_UPDATE,		"  Audio Update",	&LLColor4::yellow3, 0 }, -	{ LLFastTimer::FTM_IMAGE_UPDATE,		"  Image Update",	&LLColor4::yellow4, 1 }, -	{ LLFastTimer::FTM_IMAGE_CREATE,		"   Image CreateGL",&LLColor4::yellow5, 0 }, -	{ LLFastTimer::FTM_IMAGE_DECODE,		"   Image Decode",	&LLColor4::yellow6, 0 }, -	{ LLFastTimer::FTM_IMAGE_MARK_DIRTY,	"   Dirty Textures",&LLColor4::red1, 0 },  	{ LLFastTimer::FTM_VFILE_WAIT,			"  VFile Wait",		&LLColor4::cyan6, 0 },  //	{ LLFastTimer::FTM_IDLE_CB,				"  Callbacks",		&LLColor4::pink1, 0 },  	{ LLFastTimer::FTM_RENDER,				" Render",			&green0, 1 }, @@ -146,6 +142,10 @@ static struct ft_display_info ft_display_table[] =      { LLFastTimer::FTM_CULL_REBOUND,		"   Rebound",		&LLColor4::blue3, 0 },  	{ LLFastTimer::FTM_FRUSTUM_CULL,		"   Frustum Cull",	&LLColor4::blue4, 0 },  	{ LLFastTimer::FTM_OCCLUSION_READBACK,	"   Occlusion Read", &LLColor4::red2, 0 }, +	{ LLFastTimer::FTM_IMAGE_UPDATE,		"  Image Update",	&LLColor4::yellow4, 1 }, +	{ LLFastTimer::FTM_IMAGE_CREATE,		"   Image CreateGL",&LLColor4::yellow5, 0 }, +	{ LLFastTimer::FTM_IMAGE_DECODE,		"   Image Decode",	&LLColor4::yellow6, 0 }, +	{ LLFastTimer::FTM_IMAGE_MARK_DIRTY,	"   Dirty Textures",&LLColor4::red1, 0 },  	{ LLFastTimer::FTM_STATESORT,			"  State Sort",	&LLColor4::orange1, 1 },  	{ LLFastTimer::FTM_STATESORT_DRAWABLE,	"   Drawable",		&LLColor4::orange2, 0 },  	{ LLFastTimer::FTM_STATESORT_POSTSORT,	"   Post Sort",	&LLColor4::orange3, 0 }, diff --git a/indra/newview/llfloaterhardwaresettings.cpp b/indra/newview/llfloaterhardwaresettings.cpp index 00dcf67453..a3c3acd3bb 100644 --- a/indra/newview/llfloaterhardwaresettings.cpp +++ b/indra/newview/llfloaterhardwaresettings.cpp @@ -77,11 +77,13 @@ void LLFloaterHardwareSettings::refresh()  	mUseVBO = gSavedSettings.getBOOL("RenderVBOEnable");  	mUseAniso = gSavedSettings.getBOOL("RenderAnisotropic"); +	mFSAASamples = gSavedSettings.getU32("RenderFSAASamples");  	mGamma = gSavedSettings.getF32("RenderGamma");  	mVideoCardMem = gSavedSettings.getS32("TextureMemory");  	mFogRatio = gSavedSettings.getF32("RenderFogRatio");  	mProbeHardwareOnStartup = gSavedSettings.getBOOL("ProbeHardwareOnStartup"); +	childSetValue("fsaa", (LLSD::Integer) mFSAASamples);  	refreshEnabledState();  } @@ -175,9 +177,25 @@ void LLFloaterHardwareSettings::apply()  	// Anisotropic rendering  	BOOL old_anisotropic = LLImageGL::sGlobalUseAnisotropic;  	LLImageGL::sGlobalUseAnisotropic = childGetValue("ani"); -	if (old_anisotropic != LLImageGL::sGlobalUseAnisotropic) + +	U32 fsaa = (U32) childGetValue("fsaa").asInteger(); +	U32 old_fsaa = gSavedSettings.getU32("RenderFSAASamples"); + +	BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED); + +	if (old_fsaa != fsaa) +	{ +		gSavedSettings.setU32("RenderFSAASamples", fsaa); +		LLWindow* window = gViewerWindow->getWindow(); +		LLCoordScreen size; +		window->getSize(&size); +		gViewerWindow->changeDisplaySettings(window->getFullscreen(),  +														size, +														gSavedSettings.getBOOL("DisableVerticalSync"), +														logged_in); +	} +	else if (old_anisotropic != LLImageGL::sGlobalUseAnisotropic)  	{ -		BOOL logged_in = (LLStartUp::getStartupState() >= STATE_STARTED);  		gViewerWindow->restartDisplay(logged_in);  	} @@ -189,6 +207,7 @@ void LLFloaterHardwareSettings::cancel()  {  	gSavedSettings.setBOOL("RenderVBOEnable", mUseVBO);  	gSavedSettings.setBOOL("RenderAnisotropic", mUseAniso); +	gSavedSettings.setU32("RenderFSAASamples", mFSAASamples);  	gSavedSettings.setF32("RenderGamma", mGamma);  	gSavedSettings.setS32("TextureMemory", mVideoCardMem);  	gSavedSettings.setF32("RenderFogRatio", mFogRatio); diff --git a/indra/newview/llfloaterhardwaresettings.h b/indra/newview/llfloaterhardwaresettings.h index 0f5f2fee05..2012a0aa2f 100644 --- a/indra/newview/llfloaterhardwaresettings.h +++ b/indra/newview/llfloaterhardwaresettings.h @@ -88,6 +88,7 @@ protected:  	BOOL mUseVBO;  	BOOL mUseAniso; +	U32 mFSAASamples;  	F32 mGamma;  	S32 mVideoCardMem;  	F32 mFogRatio; diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index d9694a7b3f..1af6683218 100644 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -75,10 +75,14 @@  ///----------------------------------------------------------------------------  /// Local function declarations, constants, enums, and typedefs  ///---------------------------------------------------------------------------- +S32 LLFloaterSnapshot::sUIWinHeightLong = 526 ; +S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 230 ; +S32 LLFloaterSnapshot::sUIWinWidth = 215 ;  LLSnapshotFloaterView* gSnapshotFloaterView = NULL;  LLFloaterSnapshot* LLFloaterSnapshot::sInstance = NULL; +  const F32 SNAPSHOT_TIME_DELAY = 1.f;  F32 SHINE_TIME = 0.5f; @@ -88,7 +92,7 @@ F32 FALL_TIME = 0.6f;  S32 BORDER_WIDTH = 6;  const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte -#define MAX_TEXTURE_SIZE 512 //max upload texture size 512 * 512 +const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512  ///----------------------------------------------------------------------------  /// Class LLSnapshotLivePreview   ///---------------------------------------------------------------------------- @@ -120,19 +124,30 @@ public:  	ESnapshotType getSnapshotType() const { return mSnapshotType; }  	BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; }  	BOOL isSnapshotActive() { return mSnapshotActive; } +	LLImageGL* getThumbnailImage() const { return mThumbnailImage ; } +	S32  getThumbnailWidth() const { return mThumbnailWidth ; } +	S32  getThumbnailHeight() const { return mThumbnailHeight ; } +	BOOL getThumbnailLock() const { return mThumbnailUpdateLock ; } +	BOOL getThumbnailUpToDate() const { return mThumbnailUpToDate ;}  	LLImageGL* getCurrentImage();  	F32 getImageAspect(); +	F32 getAspect() ;  	LLRect getImageRect();  	BOOL isImageScaled();  	void setSnapshotType(ESnapshotType type) { mSnapshotType = type; }  	void setSnapshotQuality(S32 quality);  	void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; } -	void updateSnapshot(BOOL new_snapshot); +	void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE);  	LLFloaterPostcard* savePostcard();  	void saveTexture();  	BOOL saveLocal(); +	BOOL setThumbnailImageSize() ; +	void generateThumbnailImage(BOOL force_update = FALSE) ; +	void resetThumbnailImage() { mThumbnailImage = NULL ; } +	void drawPreviewRect(S32 offset_x, S32 offset_y) ; +  	static void onIdle( void* snapshot_preview );  protected: @@ -144,6 +159,14 @@ protected:  	BOOL						mImageScaled[2];  	S32                         mMaxImageSize ; +	//thumbnail image +	LLPointer<LLImageGL>		mThumbnailImage ; +	S32                         mThumbnailWidth ; +	S32                         mThumbnailHeight ; +	LLRect                      mPreviewRect ; +	BOOL                        mThumbnailUpdateLock ; +	BOOL                        mThumbnailUpToDate ; +  	S32							mCurImageIndex;  	LLPointer<LLImageRaw>		mRawImage;  	LLPointer<LLImageRaw>		mRawImageEncoded; @@ -170,12 +193,12 @@ public:  };  std::set<LLSnapshotLivePreview*> LLSnapshotLivePreview::sList; -  LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :   	LLView("snapshot_live_preview", rect, FALSE),   	mColor(1.f, 0.f, 0.f, 0.5f),   	mCurImageIndex(0),  	mRawImage(NULL), +	mThumbnailImage(NULL) ,  	mRawImageEncoded(NULL),  	mJPEGImage(NULL),  	mShineCountdown(0), @@ -204,6 +227,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :  	mMaxImageSize = MAX_IMAGE_SIZE ;  	mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ; +	mThumbnailUpdateLock = FALSE ; +	mThumbnailUpToDate   = FALSE ;  }  LLSnapshotLivePreview::~LLSnapshotLivePreview() @@ -234,13 +259,8 @@ LLImageGL* LLSnapshotLivePreview::getCurrentImage()  	return mViewerImage[mCurImageIndex];  } -F32 LLSnapshotLivePreview::getImageAspect() +F32 LLSnapshotLivePreview::getAspect()  { -	if (!mViewerImage[mCurImageIndex]) -	{ -		return 0.f; -	} -  	F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);  	F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight()); @@ -254,6 +274,16 @@ F32 LLSnapshotLivePreview::getImageAspect()  	}  } +F32 LLSnapshotLivePreview::getImageAspect() +{ +	if (!mViewerImage[mCurImageIndex]) +	{ +		return 0.f; +	} + +	return getAspect() ;	 +} +  LLRect LLSnapshotLivePreview::getImageRect()  {  	return mImageRect[mCurImageIndex]; @@ -264,7 +294,7 @@ BOOL LLSnapshotLivePreview::isImageScaled()  	return mImageScaled[mCurImageIndex];  } -void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot)  +void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail)   {   	if (mSnapshotUpToDate)  	{ @@ -272,15 +302,9 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot)  		mCurImageIndex = (mCurImageIndex + 1) % 2;   		mWidth[mCurImageIndex] = mWidth[old_image_index];  		mHeight[mCurImageIndex] = mHeight[old_image_index]; -		mFallAnimTimer.start(); -	} -	mSnapshotUpToDate = FALSE;  -	mShineAnimTimer.stop(); -	if (new_snapshot) -	{ -		mSnapshotDelayTimer.start(); -		mSnapshotDelayTimer.setTimerExpirySec(SNAPSHOT_TIME_DELAY); +		mFallAnimTimer.start();		  	} +	mSnapshotUpToDate = FALSE; 		  	LLRect& rect = mImageRect[mCurImageIndex];  	rect.set(0, getRect().getHeight(), getRect().getWidth(), 0); @@ -305,6 +329,21 @@ void LLSnapshotLivePreview::updateSnapshot(BOOL new_snapshot)  			rect.mRight -= (getRect().getWidth() - new_width) / 2;  		}  	} + +	mShineAnimTimer.stop(); +	if (new_snapshot) +	{ +		mSnapshotDelayTimer.start(); +		mSnapshotDelayTimer.setTimerExpirySec(SNAPSHOT_TIME_DELAY); +	} +	else if(new_thumbnail) +	{ +		mThumbnailUpToDate = FALSE ; +	} +	else +	{ +		setThumbnailImageSize() ; +	}  }  void LLSnapshotLivePreview::setSnapshotQuality(S32 quality) @@ -326,6 +365,45 @@ LLString LLSnapshotLivePreview::getWidgetTag() const  	return LL_SNAPSHOT_LIVE_PREVIEW_TAG;  } +void LLSnapshotLivePreview::drawPreviewRect(S32 offset_x, S32 offset_y) +{ +	F32 line_width ;  +	glGetFloatv(GL_LINE_WIDTH, &line_width) ; +	glLineWidth(2.0f * line_width) ; +	LLColor4 color(0.0f, 0.0f, 0.0f, 1.0f) ; +	gl_rect_2d( mPreviewRect.mLeft + offset_x, mPreviewRect.mTop + offset_y, +		        mPreviewRect.mRight + offset_x, mPreviewRect.mBottom + offset_y, color, FALSE ) ; +	glLineWidth(line_width) ; + +	//draw four alpha rectangles to cover areas outside of the snapshot image +	if(!mKeepAspectRatio) +	{ +		LLColor4 alpha_color(0.5f, 0.5f, 0.5f, 0.8f) ; +		S32 dwl = 0, dwr = 0 ; +		if(mThumbnailWidth > mPreviewRect.getWidth()) +		{ +			dwl = (mThumbnailWidth - mPreviewRect.getWidth()) >> 1 ; +			dwr = mThumbnailWidth - mPreviewRect.getWidth() - dwl ; + +			gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y, +		        mPreviewRect.mLeft + offset_x, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ; +			gl_rect_2d( mPreviewRect.mRight + offset_x, mPreviewRect.mTop + offset_y, +		        mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y, alpha_color, TRUE ) ; +		} + +		if(mThumbnailHeight > mPreviewRect.getHeight()) +		{ +			S32 dh = (mThumbnailHeight - mPreviewRect.getHeight()) >> 1 ; +			gl_rect_2d(mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mBottom + offset_y , +		        mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mBottom + offset_y - dh, alpha_color, TRUE ) ; + +			dh = mThumbnailHeight - mPreviewRect.getHeight() - dh ; +			gl_rect_2d( mPreviewRect.mLeft + offset_x - dwl, mPreviewRect.mTop + offset_y + dh, +		        mPreviewRect.mRight + offset_x + dwr, mPreviewRect.mTop + offset_y, alpha_color, TRUE ) ; +		} +	} +} +  void LLSnapshotLivePreview::draw()  {  	if(getVisible())  @@ -519,14 +597,137 @@ void LLSnapshotLivePreview::reshape(S32 width, S32 height, BOOL called_from_pare  	LLView::reshape(width, height, called_from_parent);  	if (old_rect.getWidth() != width || old_rect.getHeight() != height)  	{ -		updateSnapshot(getSnapshotUpToDate()); +		updateSnapshot(FALSE, TRUE); +	} +} + +BOOL LLSnapshotLivePreview::setThumbnailImageSize() +{ +	if(mWidth[mCurImageIndex] < 10 || mHeight[mCurImageIndex] < 10) +	{ +		return FALSE ; +	} +	S32 window_width = gViewerWindow->getWindowDisplayWidth() ; +	S32 window_height = gViewerWindow->getWindowDisplayHeight() ; + +	F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height); + +	// UI size for thumbnail +	S32 max_width = LLFloaterSnapshot::getUIWinWidth() - 20; +	S32 max_height = 90; + +	if (window_aspect_ratio > (F32)max_width / max_height) +	{ +		// image too wide, shrink to width +		mThumbnailWidth = max_width; +		mThumbnailHeight = llround((F32)max_width / window_aspect_ratio); +	} +	else +	{ +		// image too tall, shrink to height +		mThumbnailHeight = max_height; +		mThumbnailWidth = llround((F32)max_height * window_aspect_ratio); +	} +	 +	if(mThumbnailWidth > window_width || mThumbnailHeight > window_height) +	{ +		return FALSE ;//if the window is too small, ignore thumbnail updating. +	} + +	S32 left = 0 , top = mThumbnailHeight, right = mThumbnailWidth, bottom = 0 ; +	if(!mKeepAspectRatio) +	{ +		F32 ratio_x = (F32)mWidth[mCurImageIndex] / window_width ; +		F32 ratio_y = (F32)mHeight[mCurImageIndex] / window_height ; + +		//if(mWidth[mCurImageIndex] > window_width || +		//	mHeight[mCurImageIndex] > window_height ) +		{ +			if(ratio_x > ratio_y) +			{ +				top = (S32)(top * ratio_y / ratio_x) ; +			} +			else +			{ +				right = (S32)(right * ratio_x / ratio_y) ; +			}			 +		} +		//else +		//{ +		//	right = (S32)(right * ratio_x) ; +		//	top = (S32)(top * ratio_y) ; +		//} +		left = (S32)((mThumbnailWidth - right) * 0.5f) ; +		bottom = (S32)((mThumbnailHeight - top) * 0.5f) ; +		top += bottom ; +		right += left ; +	} +	mPreviewRect.set(left - 1, top + 1, right + 1, bottom - 1) ; + +	return TRUE ; +} + +void LLSnapshotLivePreview::generateThumbnailImage(BOOL force_update) +{	 +	if(mThumbnailUpdateLock) //in the process of updating +	{ +		return ; +	} +	if(mThumbnailUpToDate && !force_update)//already updated +	{ +		return ; +	} +	if(mWidth[mCurImageIndex] < 10 || mHeight[mCurImageIndex] < 10) +	{ +		return ; +	} + +	////lock updating +	mThumbnailUpdateLock = TRUE ; + +	if(!setThumbnailImageSize()) +	{ +		mThumbnailUpdateLock = FALSE ; +		mThumbnailUpToDate = TRUE ; +		return ; +	} + +	if(mThumbnailImage) +	{ +		resetThumbnailImage() ; +	}		 + +	LLPointer<LLImageRaw> raw = NULL ; +	S32 w , h ; +	w = get_nearest_power_two(mThumbnailWidth, 512) * 2 ; +	h = get_nearest_power_two(mThumbnailHeight, 512) * 2 ; + +	{ +		raw = new LLImageRaw ; +		if(!gViewerWindow->thumbnailSnapshot(raw, +								w, h, +								gSavedSettings.getBOOL("RenderUIInSnapshot"), +								FALSE, +								mSnapshotBufferType) )								 +		{ +			raw = NULL ; +		} +	} + +	if(raw) +	{ +		mThumbnailImage = new LLImageGL(raw, FALSE); 		 +		mThumbnailUpToDate = TRUE ;  	} + +	//unlock updating +	mThumbnailUpdateLock = FALSE ;		  }  //static   void LLSnapshotLivePreview::onIdle( void* snapshot_preview )  { -	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview; +	LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)snapshot_preview;	  	LLVector3 new_camera_pos = gCamera->getOrigin();  	LLQuaternion new_camera_rot = gCamera->getQuaternion(); @@ -637,6 +838,7 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview )  			previewp->mViewerImage[previewp->mCurImageIndex]->setClamp(TRUE, TRUE);  			previewp->mSnapshotUpToDate = TRUE; +			previewp->generateThumbnailImage(TRUE) ;  			previewp->mPosTakenGlobal = gAgent.getCameraPositionGlobal();  			previewp->mShineCountdown = 4; // wait a few frames to avoid animation glitch due to readback this frame @@ -647,6 +849,10 @@ void LLSnapshotLivePreview::onIdle( void* snapshot_preview )  		previewp->mSnapshotDelayTimer.stop();  		previewp->mSnapshotActive = FALSE;  	} +	if(!previewp->getThumbnailUpToDate()) +	{ +		previewp->generateThumbnailImage() ; +	}  }  void LLSnapshotLivePreview::setSize(S32 w, S32 h) @@ -759,7 +965,8 @@ public:  	static void onCommitLayerTypes(LLUICtrl* ctrl, void*data);  	static void onCommitSnapshotType(LLUICtrl* ctrl, void* data);  	static void onCommitCustomResolution(LLUICtrl *ctrl, void* data); -	static void checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value); +	static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ; +	static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);  	static LLSnapshotLivePreview* getPreviewView(LLFloaterSnapshot *floater);  	static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname); @@ -773,7 +980,7 @@ private:  	static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater);  	static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater);  	static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname); -	static void checkAutoSnapshot(LLSnapshotLivePreview* floater); +	static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE);  	static void checkAspectRatio(LLFloaterSnapshot *view, S32 index) ;  public: @@ -840,7 +1047,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  {  	LLSnapshotLivePreview* previewp = getPreviewView(floaterp); -	S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : -230 ; +	S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ;  	LLComboBox* combo;  	if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution @@ -869,7 +1076,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  		floaterp->getParent()->setMouseOpaque(TRUE);  		// shrink to smaller layout -		floaterp->reshape(floaterp->getRect().getWidth(), 526 + delta_height); +		floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);  		// can see and interact with fullscreen preview now  		if (previewp) @@ -902,7 +1109,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)  	else // turning off freeze frame mode  	{  		floaterp->getParent()->setMouseOpaque(FALSE); -		floaterp->reshape(floaterp->getRect().getWidth(), 526 + delta_height); +		floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);  		if (previewp)  		{  			previewp->setVisible(FALSE); @@ -1051,11 +1258,11 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)  }  // static -void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp) +void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail)  {  	if (previewp)  	{		 -		previewp->updateSnapshot(gSavedSettings.getBOOL("AutoSnapshot")); +		previewp->updateSnapshot(gSavedSettings.getBOOL("AutoSnapshot"), update_thumbnail);  	}  } @@ -1143,16 +1350,13 @@ void LLFloaterSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data)  void LLFloaterSnapshot::Impl::onClickMore(void* data)  { -	//floater->childSetVisible("more_btn", FALSE); -	//floater->childSetVisible("less_btn", TRUE); -  	gSavedSettings.setBOOL( "AdvanceSnapshot", TRUE );  	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;		  	if (view)  	{ -		view->translate( 0, -230 ); -		view->reshape(view->getRect().getWidth(), 526); +		view->translate( 0, view->getUIWinHeightShort() - view->getUIWinHeightLong() ); +		view->reshape(view->getRect().getWidth(), view->getUIWinHeightLong());  		updateControls(view) ;  		updateLayout(view) ; @@ -1160,40 +1364,24 @@ void LLFloaterSnapshot::Impl::onClickMore(void* data)  }  void LLFloaterSnapshot::Impl::onClickLess(void* data)  { -	//floater->childSetVisible("less_btn", FALSE); -	//floater->childSetVisible("more_btn", TRUE); -  	gSavedSettings.setBOOL( "AdvanceSnapshot", FALSE );  	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;		  	if (view)  	{ -		view->translate( 0, 230 ); -		view->reshape(view->getRect().getWidth(), 294); +		view->translate( 0, view->getUIWinHeightLong() - view->getUIWinHeightShort() ); +		view->reshape(view->getRect().getWidth(), view->getUIWinHeightShort());  		updateControls(view) ;  		updateLayout(view) ; + +		if(getPreviewView(view)) +		{ +			getPreviewView(view)->setThumbnailImageSize() ; +		}  	}  } -//void LLFloaterSnapshot::Impl::onClickAdvanceSnap(LLUICtrl *ctrl, void* data) -//{ -//	LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl; -//	gSavedSettings.setBOOL( "AdvanceSnapshot", check->get() ); -//	 -//	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;		 -//	if (view) -//	{ -//		S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : -230 ; -// -//		view->translate( 0, delta_height ? 230 : -230 ); -//		view->reshape(view->getRect().getWidth(), 526 + delta_height); -// -//		updateControls(view) ; -//		updateLayout(view) ; -//	} -//} -  // static  void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data)  { @@ -1203,7 +1391,7 @@ void LLFloaterSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data)  	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;  	if (view)  	{ -		checkAutoSnapshot(getPreviewView(view)); +		checkAutoSnapshot(getPreviewView(view), TRUE);  	}  } @@ -1216,7 +1404,7 @@ void LLFloaterSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data)  	LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;  	if (view)  	{ -		checkAutoSnapshot(getPreviewView(view)); +		checkAutoSnapshot(getPreviewView(view), TRUE);  	}  } @@ -1244,23 +1432,14 @@ void LLFloaterSnapshot::Impl::onClickKeepAspectCheck(LLUICtrl* ctrl, void* data)  			S32 w, h ;  			previewp->getSize(w, h) ; -			checkImageSize(previewp, w, h, TRUE, previewp->getMaxImageSize()) ; -			previewp->setSize(w, h) ; - -			//update textbox -			LLSpinCtrl *sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_width") ; -			if(sctrl) +			if(checkImageSize(previewp, w, h, TRUE, previewp->getMaxImageSize()))  			{ -				sctrl->setValue(w) ; +				resetSnapshotSizeOnUI(view, w, h) ;  			} -			sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_height") ; -			if(sctrl) -			{ -				sctrl->setValue(h) ; -			} +			previewp->setSize(w, h) ; -			checkAutoSnapshot(previewp); +			checkAutoSnapshot(previewp, TRUE);  		}  	}  } @@ -1276,7 +1455,7 @@ void LLFloaterSnapshot::Impl::onCommitQuality(LLUICtrl* ctrl, void* data)  	{  		previewp->setSnapshotQuality(quality_val);  	} -	checkAutoSnapshot(previewp); +	checkAutoSnapshot(previewp, TRUE);  }  // static @@ -1300,6 +1479,12 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde  {  	LLSnapshotLivePreview *previewp = getPreviewView(view) ; +	if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == getTypeIndex(view)) +	{ +		previewp->mKeepAspectRatio = FALSE ; +		return ; +	} +  	if(!index) //current window size  	{  		sAspectRatioCheckOff = TRUE ; @@ -1385,13 +1570,17 @@ void LLFloaterSnapshot::Impl::onCommitResolution(LLUICtrl* ctrl, void* data)  		checkAspectRatio(view, width) ;  		previewp->getSize(width, height); -		checkImageSize(previewp, width, height, TRUE, previewp->getMaxImageSize()) ; +	 +		if(checkImageSize(previewp, width, height, TRUE, previewp->getMaxImageSize())) +		{ +			resetSnapshotSizeOnUI(view, width, height) ; +		}  		previewp->setSize(width, height);  		view->childSetValue("snapshot_width", width);  		view->childSetValue("snapshot_height", height);  		// hide old preview as the aspect ratio could be wrong -		checkAutoSnapshot(previewp); +		checkAutoSnapshot(previewp, FALSE);  	}  } @@ -1409,7 +1598,7 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)  		{  			previewp->setSnapshotBufferType((LLViewerWindow::ESnapshotType)combobox->getCurrentIndex());  		} -		checkAutoSnapshot(previewp); +		checkAutoSnapshot(previewp, TRUE);  	}  } @@ -1440,8 +1629,11 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s  //static -void LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value) +BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)  { +	S32 w = width ; +	S32 h = height ; +  	//if texture, ignore aspect ratio setting, round image size to power of 2.  	if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == gSavedSettings.getS32("LastSnapshotType"))  	{ @@ -1457,15 +1649,12 @@ void LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3  		//round to nearest power of 2  		width = get_nearest_power_two(width, MAX_TEXTURE_SIZE) ;  		height = get_nearest_power_two(height, MAX_TEXTURE_SIZE) ; - -		return ;  	} - -	if(previewp && previewp->mKeepAspectRatio) +	else if(previewp && previewp->mKeepAspectRatio)  	{  		if(gViewerWindow->getWindowDisplayWidth() < 1 || gViewerWindow->getWindowDisplayHeight() < 1)  		{ -			return ; +			return FALSE ;  		}  		//aspect ratio of the current window @@ -1499,7 +1688,27 @@ void LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S3  	else  	{  	} -	return ; + +	return (w != width || h != height) ; +} + +//static +void LLFloaterSnapshot::Impl::resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) +{ +	LLSpinCtrl *sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_width") ; +	if(sctrl) +	{ +		sctrl->setValue(width) ; +	} + +	sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_height") ; +	if(sctrl) +	{ +		sctrl->setValue(height) ; +	} + +	gSavedSettings.setS32("LastSnapshotWidth", width); +	gSavedSettings.setS32("LastSnapshotHeight", height);  }  //static @@ -1522,35 +1731,14 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat  			if (w != curw || h != curh)  			{ -				S32 width = w ; -				S32 height = h ; -				  				previewp->setMaxImageSize((S32)((LLSpinCtrl *)ctrl)->getMaxValue()) ; -				checkImageSize(previewp, width, height, width != curw, previewp->getMaxImageSize()) ; - -				if(width != w || height != h) +				if(checkImageSize(previewp, w, h, w != curw, previewp->getMaxImageSize()))  				{ -					LLSpinCtrl *sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_width") ; -					if(sctrl) -					{ -						sctrl->setValue(width) ; -					} - -					sctrl = LLViewerUICtrlFactory::getSpinnerByName(view, "snapshot_height") ; -					if(sctrl) -					{ -						sctrl->setValue(height) ; -					} - -					w = width ; -					h = height ; - -					gSavedSettings.setS32("LastSnapshotWidth", w); -					gSavedSettings.setS32("LastSnapshotHeight", h); +					resetSnapshotSizeOnUI(view, w, h) ;  				}  				previewp->setSize(w,h); -				checkAutoSnapshot(previewp); +				checkAutoSnapshot(previewp, FALSE);  				comboSetCustom(view, "postcard_size_combo");  				comboSetCustom(view, "texture_size_combo");  				comboSetCustom(view, "local_size_combo"); @@ -1664,7 +1852,7 @@ void LLFloaterSnapshot::draw()  {  	LLSnapshotLivePreview* previewp = impl.getPreviewView(this); -	if (previewp && previewp->isSnapshotActive()) +	if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock()))  	{  		// don't render snapshot window in snapshot, even if "show ui" is turned on  		return; @@ -1720,7 +1908,7 @@ void LLFloaterSnapshot::draw()  	LLFloater::draw();  	// draw snapshot thumbnail if not in fullscreen preview mode -	if (/*!gSavedSettings.getBOOL("UseFreezeFrame") &&*/ previewp && previewp->getCurrentImage() && previewp->getSnapshotUpToDate()) +	/*if (previewp && previewp->getCurrentImage() && previewp->getSnapshotUpToDate())  	{  		F32 aspect = previewp->getImageAspect();  		// UI size for thumbnail @@ -1757,6 +1945,21 @@ void LLFloaterSnapshot::draw()  		glMatrixMode(GL_TEXTURE);  		glPopMatrix();  		glMatrixMode(GL_MODELVIEW); +	}*/ +	if (previewp) +	{		 +		if(previewp->getThumbnailImage()) +		{ +			S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ; +			S32 offset_y = getRect().getHeight() - 205 + (90 - previewp->getThumbnailHeight()) / 2 ; + +			glMatrixMode(GL_MODELVIEW); +			gl_draw_scaled_image(offset_x, offset_y,  +					previewp->getThumbnailWidth(), previewp->getThumbnailHeight(),  +					previewp->getThumbnailImage(), LLColor4::white);	 + +			previewp->drawPreviewRect(offset_x, offset_y) ; +		}  	}  } diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index cf1e6bd8f8..fecc3f0fd5 100644 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -50,14 +50,20 @@ public:  	static void show(void*);  	static void hide(void*); -  	static void update(); -	 + +	static S32  getUIWinHeightLong()  {return sUIWinHeightLong ;} +	static S32  getUIWinHeightShort() {return sUIWinHeightShort ;} +	static S32  getUIWinWidth()       {return sUIWinWidth ;} +  private:  	class Impl;  	Impl& impl;  	static LLFloaterSnapshot* sInstance; +	static S32    sUIWinHeightLong ; +	static S32    sUIWinHeightShort ; +	static S32    sUIWinWidth ;  };  class LLSnapshotFloaterView : public LLFloaterView diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp index 0468ae5a1a..e04a62167c 100644 --- a/indra/newview/llhudtext.cpp +++ b/indra/newview/llhudtext.cpp @@ -76,6 +76,7 @@ const F32 LOD_2_SCREEN_COVERAGE = 0.40f;  std::set<LLPointer<LLHUDText> > LLHUDText::sTextObjects;  std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleTextObjects;  std::vector<LLPointer<LLHUDText> > LLHUDText::sVisibleHUDTextObjects; +BOOL LLHUDText::sDisplayText = TRUE ;  bool lltextobject_further_away::operator()(const LLPointer<LLHUDText>& lhs, const LLPointer<LLHUDText>& rhs) const  { @@ -120,7 +121,7 @@ LLHUDText::~LLHUDText()  void LLHUDText::render()  { -	if (!mOnHUDAttachment) +	if (!mOnHUDAttachment && sDisplayText)  	{  		LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);  		renderText(FALSE); diff --git a/indra/newview/llhudtext.h b/indra/newview/llhudtext.h index 75dc43cd6a..bb96c356bb 100644 --- a/indra/newview/llhudtext.h +++ b/indra/newview/llhudtext.h @@ -124,6 +124,7 @@ public:  	static void renderAllHUD();  	static void addPickable(std::set<LLViewerObject*> &pick_list);  	static void reshape(); +	static void setDisplayText(BOOL flag) { sDisplayText = flag ; }  protected:  	LLHUDText(const U8 type); @@ -170,6 +171,7 @@ private:  	S32				mLOD;  	BOOL			mHidden; +	static BOOL    sDisplayText ;  	static std::set<LLPointer<LLHUDText> > sTextObjects;  	static std::vector<LLPointer<LLHUDText> > sVisibleTextObjects;  	static std::vector<LLPointer<LLHUDText> > sVisibleHUDTextObjects; diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 237826cb7a..89f2e6239a 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -61,6 +61,7 @@  #include "llvoavatar.h"  #include "llvoiceremotectrl.h"  #include "llwebbrowserctrl.h" +#include "llselectmgr.h"  //  // Globals @@ -325,6 +326,7 @@ void LLOverlayBar::onClickMouselook(void*)  //static  void LLOverlayBar::onClickStandUp(void*)  { +	gSelectMgr->deselectAllForStandingUp();  	gAgent.setControlFlags(AGENT_CONTROL_STAND_UP);  } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index f6556ffbd5..f468ce97ac 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -3343,6 +3343,36 @@ void LLSelectMgr::deselectAll()  	updatePointAt();  } +void LLSelectMgr::deselectAllForStandingUp() +{ +	/* +	This function is similar deselectAll() except for the first if statement +	which was removed. This is needed as a workaround for DEV-2854 +	*/ + +	// Zap the angular velocity, as the sim will set it to zero +	for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); +		 iter != mSelectedObjects->end(); iter++ ) +	{ +		LLViewerObject *objectp = (*iter)->getObject(); +		objectp->setAngularVelocity( 0,0,0 ); +		objectp->setVelocity( 0,0,0 ); +	} + +	sendListToRegions( +		"ObjectDeselect", +		packAgentAndSessionID, +		packObjectLocalID, +		NULL, +		SEND_INDIVIDUALS); + +	removeAll(); +	 +	mLastSentSelectionCenterGlobal.clearVec(); + +	updatePointAt(); +} +  void LLSelectMgr::deselectUnused()  {  	// no more outstanding references to this selection diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h index 68c1d4d9f8..570bcef79a 100644 --- a/indra/newview/llselectmgr.h +++ b/indra/newview/llselectmgr.h @@ -419,6 +419,7 @@ public:  	// Send deselect messages to simulator, then clear the list  	void deselectAll(); +	void deselectAllForStandingUp();  	// deselect only if nothing else currently referencing the selection  	void deselectUnused(); diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index 008eaccdc4..acd64220d9 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -474,7 +474,7 @@ void LLTextureFetchWorker::setDesiredDiscard(S32 discard, S32 size)  		mDesiredDiscard = discard;  		mDesiredSize = size;  	} -	else if (size > mDesiredSize) +	else if (size > mDesiredSize || size == 0)  	{  		mDesiredSize = size;  		prioritize = true; @@ -571,7 +571,8 @@ bool LLTextureFetchWorker::doWork(S32 param)  			U32 cache_priority = mWorkPriority;  			S32 offset = mFormattedImage.notNull() ? mFormattedImage->getDataSize() : 0;  			S32 size = mDesiredSize - offset; -			if (size <= 0) + +			if(mDesiredSize != 0 && size <= 0)  			{  				mState = CACHE_POST;  				return false; @@ -1304,6 +1305,13 @@ bool LLTextureFetch::createRequest(const LLUUID& id, const LLHost& host, F32 pri  		// we really do get it.)  		desired_size = worker->mFileSize;  	} +	else if ((discard == 0) && worker == NULL) +	{ +		// if we want the entire image, but we don't know its size, then send +		// a sentinel value of zero to request the entire contents of the cache. +		// patch supplied by resident Sheet Spotter for VWR-2404 +		desired_size = 0; +	}  	else if (w*h*c > 0)  	{  		// If the requester knows the dimentions of the image, diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index 7733ef5ae1..0df04fccfa 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -470,6 +470,7 @@ void settings_setup_listeners()  	gSavedSettings.getControl("RenderUseImpostors")->getSignal()->connect(boost::bind(&handleRenderUseImpostorsChanged, _1));  	gSavedSettings.getControl("RenderUseCleverUI")->getSignal()->connect(boost::bind(&handleRenderUseCleverUIChanged, _1));  	gSavedSettings.getControl("RenderResolutionDivisor")->getSignal()->connect(boost::bind(&handleRenderResolutionDivisorChanged, _1)); +	gSavedSettings.getControl("RenderDeferred")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1));  	gSavedSettings.getControl("AvatarCompositeLimit")->getSignal()->connect(boost::bind(&handleCompositeLimitChanged, _1));  	gSavedSettings.getControl("TextureMemory")->getSignal()->connect(boost::bind(&handleVideoMemoryChanged, _1));  	gSavedSettings.getControl("ChatFontSize")->getSignal()->connect(boost::bind(&handleChatFontSizeChanged, _1)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index a75544d528..41a936ca49 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -75,6 +75,7 @@  #include "llcubemap.h"  #include "llviewerregion.h"  #include "lldrawpoolwater.h" +#include "lldrawpoolbump.h"  #include "llwlparammanager.h"  #include "llwaterparammanager.h"  #include "llpostprocess.h" @@ -82,6 +83,7 @@  extern LLPointer<LLImageGL> gStartImageGL;  extern BOOL gDisplaySwapBuffers; +  LLPointer<LLImageGL> gDisconnectedImagep = NULL;  // used to toggle renderer back on after teleport @@ -509,7 +511,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  		gFrameStats.start(LLFrameStats::UPDATE_CULL);  		S32 water_clip = 0; -		if (LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) > 1) +		if ((LLShaderMgr::getVertexShaderLevel(LLShaderMgr::SHADER_ENVIRONMENT) > 1) && +			 gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER))  		{  			if (gCamera->cameraUnderWater())  			{ @@ -571,7 +574,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  				glh::matrix4f proj = glh_get_current_projection();  				glh::matrix4f mod = glh_get_current_modelview(); -				glViewport(0,0,128,256); +				glViewport(0,0,512,512); +				LLVOAvatar::updateFreezeCounter() ;  				LLVOAvatar::updateImpostors();  				glh_set_current_projection(proj);  				glh_set_current_modelview(mod); @@ -590,6 +594,28 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  			gPipeline.generateWaterReflection(*gCamera);  		} +		////////////////////////////////////// +		// +		// Update images, using the image stats generated during object update/culling +		// +		// Can put objects onto the retextured list. +		// +		// Doing this here gives hardware occlusion queries extra time to complete +		gFrameStats.start(LLFrameStats::IMAGE_UPDATE); + +		{ +			LLFastTimer t(LLFastTimer::FTM_IMAGE_UPDATE); +			 +			LLViewerImage::updateClass(gCamera->getVelocityStat()->getMean(), +										gCamera->getAngularVelocityStat()->getMean()); + +			gBumpImageList.updateImages();  // must be called before gImageList version so that it's textures are thrown out first. + +			const F32 max_image_decode_time = llmin(0.005f, 0.005f*10.f*gFrameIntervalSeconds); // 50 ms/second decode time (no more than 5ms/frame) +			gImageList.updateImages(max_image_decode_time); +			stop_glerror(); +		} +  		///////////////////////////////////  		//  		// StateSort @@ -692,8 +718,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)  			}  			stop_glerror();  		} -	 -		render_hud_attachments();  		if (to_texture)  		{ @@ -764,13 +788,13 @@ void render_hud_attachments()  		gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP);  		gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_SIMPLE);  		gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_VOLUME); -		gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_GLOW);  		gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_ALPHA);  		gPipeline.stateSort(hud_cam, result);  		gPipeline.renderGeom(hud_cam); +		render_hud_elements();  		//restore type mask  		gPipeline.setRenderTypeMask(mask);  		if (has_ui) @@ -874,6 +898,9 @@ void render_ui_and_swap()  		{  			gPipeline.renderBloom(gSnapshot);  		} + +		render_hud_elements(); +		render_hud_attachments();  	}  	LLGLSDefault gls_default; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ac52b8d05f..77cfd63847 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1359,6 +1359,9 @@ void init_debug_rendering_menu(LLMenuGL* menu)  	sub_menu->append(new LLMenuItemCheckGL("Texture Priority",	&LLPipeline::toggleRenderDebug, NULL,  													&LLPipeline::toggleRenderDebugControl,  													(void*)LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY)); +	sub_menu->append(new LLMenuItemCheckGL("Avatar Rendering Cost",	&LLPipeline::toggleRenderDebug, NULL, +													&LLPipeline::toggleRenderDebugControl, +													(void*)LLPipeline::RENDER_DEBUG_SHAME));  	sub_menu->append(new LLMenuItemCheckGL("Texture Area (sqrt(A))",&LLPipeline::toggleRenderDebug, NULL,  													&LLPipeline::toggleRenderDebugControl,  													(void*)LLPipeline::RENDER_DEBUG_TEXTURE_AREA)); diff --git a/indra/newview/llviewerpartsource.cpp b/indra/newview/llviewerpartsource.cpp index d81b688abf..db356064d4 100644 --- a/indra/newview/llviewerpartsource.cpp +++ b/indra/newview/llviewerpartsource.cpp @@ -84,7 +84,10 @@ LLUUID LLViewerPartSource::getImageUUID() const  }  void LLViewerPartSource::setStart()  { -	mDelay = 99 ; +	//cancel delaying to start a new added particle source, because some particle source just emits for a short time. +	//however, canceling this might cause overall particle emmitting fluctuate for a while because the new added source jumps to  +	//the current particle emmitting settings instantly. -->bao +	mDelay = 0 ; //99  }  LLViewerPartSourceScript::LLViewerPartSourceScript(LLViewerObject *source_objp) : @@ -263,7 +266,7 @@ void LLViewerPartSourceScript::update(const F32 dt)  		}  		if(mDelay) -		{ +		{			  			limited_rate = llmax(limited_rate, 0.01f * mDelay--) ;  		} diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 900fd6fc8b..d48e3cc4f3 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1522,7 +1522,8 @@ LLViewerWindow::LLViewerWindow(  		gNoRender,  		gSavedSettings.getBOOL("DisableVerticalSync"),  		!gNoRender, -		ignore_pixel_depth); +		ignore_pixel_depth, +		gSavedSettings.getU32("RenderFSAASamples"));  #if LL_WINDOWS  	if (!LLWinDebug::setupExceptionHandler())  	{ @@ -4242,14 +4243,145 @@ void LLViewerWindow::playSnapshotAnimAndSound()  	send_sound_trigger(LLUUID(gSavedSettings.getString("UISndSnapshot")), 1.0f);  } +BOOL LLViewerWindow::thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) +{ +	if ((!gWorldPointer) || (!raw) || preview_width < 10 || preview_height < 10) +	{ +		return FALSE; +	} + +	if(gResizeScreenTexture) //the window is resizing +	{ +		return FALSE ; +	} + +	setCursor(UI_CURSOR_WAIT); + +	// Hide all the UI widgets first and draw a frame +	BOOL prev_draw_ui = gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI); + +	if ( prev_draw_ui != show_ui) +	{ +		LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI); +	} + +	BOOL hide_hud = !gSavedSettings.getBOOL("RenderHUDInSnapshot") && LLPipeline::sShowHUDAttachments; +	if (hide_hud) +	{ +		LLPipeline::sShowHUDAttachments = FALSE; +	} + +	S32 render_name = gSavedSettings.getS32("RenderName"); +	gSavedSettings.setS32("RenderName", 0); +	LLVOAvatar::updateFreezeCounter(1) ; //pause avatar updating for one frame +	 +	S32 w = preview_width ; +	S32 h = preview_height ;	 +	LLVector2 display_scale = mDisplayScale ; +	mDisplayScale.setVec((F32)w / mWindowRect.getWidth(), (F32)h / mWindowRect.getHeight()) ; +	LLRect window_rect = mWindowRect; +	mWindowRect.set(0, h, w, 0); +	 +	gDisplaySwapBuffers = FALSE;	 +	glClearColor(0.f, 0.f, 0.f, 0.f); +	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +	setup3DRender(); +	setupViewport(); + +	LLFontGL::setFontDisplay(FALSE) ; +	LLHUDText::setDisplayText(FALSE) ; +	if (type == SNAPSHOT_TYPE_OBJECT_ID) +	{ +		gPickTransparent = FALSE; +		gObjectList.renderObjectsForSelect(*gCamera, FALSE, FALSE); +	} +	else +	{ +		display(do_rebuild, 1.0f, 0, TRUE); +		render_ui_and_swap(); +	} + +	S32 glformat, gltype, glpixel_length ; +	if(SNAPSHOT_TYPE_DEPTH == type) +	{ +		glpixel_length = 4 ; +		glformat = GL_DEPTH_COMPONENT ;  +		gltype = GL_FLOAT ; +	} +	else +	{ +		glpixel_length = 3 ; +		glformat = GL_RGB ; +		gltype = GL_UNSIGNED_BYTE ; +	} + +	raw->resize(w, h, glpixel_length);	 +	glReadPixels(0, 0, w, h, glformat, gltype, raw->getData()); + +	if(SNAPSHOT_TYPE_DEPTH == type) +	{ +		F32 depth_conversion_factor_1 = (gCamera->getFar() + gCamera->getNear()) / (2.f * gCamera->getFar() * gCamera->getNear()); +		F32 depth_conversion_factor_2 = (gCamera->getFar() - gCamera->getNear()) / (2.f * gCamera->getFar() * gCamera->getNear()); + +		//calculate the depth  +		for (S32 y = 0 ; y < h ; y++) +		{ +			for(S32 x = 0 ; x < w ; x++) +			{ +				S32 i = (w * y + x) << 2 ; +				 +				F32 depth_float_i = *(F32*)(raw->getData() + i); +				 +				F32 linear_depth_float = 1.f / (depth_conversion_factor_1 - (depth_float_i * depth_conversion_factor_2)); +				U8 depth_byte = F32_to_U8(linear_depth_float, gCamera->getNear(), gCamera->getFar()); +				*(raw->getData() + i + 0) = depth_byte; +				*(raw->getData() + i + 1) = depth_byte; +				*(raw->getData() + i + 2) = depth_byte; +				*(raw->getData() + i + 3) = 255; +			} +		}		 +	} + +	LLFontGL::setFontDisplay(TRUE) ; +	LLHUDText::setDisplayText(TRUE) ; +	mDisplayScale.setVec(display_scale) ; +	mWindowRect = window_rect;	 +	setup3DRender(); +	setupViewport(); +	gDisplaySwapBuffers = FALSE; + +	// POST SNAPSHOT +	if (!gPipeline.hasRenderDebugFeatureMask(LLPipeline::RENDER_DEBUG_FEATURE_UI)) +	{ +		LLPipeline::toggleRenderDebugFeature((void*)LLPipeline::RENDER_DEBUG_FEATURE_UI); +	} + +	if (hide_hud) +	{ +		LLPipeline::sShowHUDAttachments = TRUE; +	} + +	setCursor(UI_CURSOR_ARROW); + +	if (do_rebuild) +	{ +		// If we had to do a rebuild, that means that the lists of drawables to be rendered +		// was empty before we started. +		// Need to reset these, otherwise we call state sort on it again when render gets called the next time +		// and we stand a good chance of crashing on rebuild because the render drawable arrays have multiple copies of +		// objects on them. +		gPipeline.resetDrawOrders(); +	} +	 +	gSavedSettings.setS32("RenderName", render_name);	 +	 +	return TRUE; +}  // Saves the image from the screen to the specified filename and path.  BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height,   								 BOOL keep_window_aspect, BOOL is_texture, BOOL show_ui, BOOL do_rebuild, ESnapshotType type, S32 max_size)  { -	//F32 image_aspect_ratio = ((F32)image_width) / ((F32)image_height); -	//F32 window_aspect_ratio = ((F32)getWindowWidth()) / ((F32)getWindowHeight()); -  	if ((!gWorldPointer) ||  		(!raw))  	{ @@ -4282,43 +4414,30 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei  	// from window  	S32 snapshot_width = mWindowRect.getWidth();  	S32 snapshot_height =  mWindowRect.getHeight(); +	// SNAPSHOT +	S32 window_width = mWindowRect.getWidth(); +	S32 window_height = mWindowRect.getHeight();	 +	LLRect window_rect = mWindowRect; +	BOOL use_fbo = FALSE; +  	F32 scale_factor = 1.0f ; -	if (keep_window_aspect || is_texture) //map the entire window to snapshot -	{ -	} -	else //scale or crop +	if(!keep_window_aspect) //image cropping  	{ -		if(snapshot_width > image_width) //crop -		{ -			snapshot_width = image_width ; -		} -		if(snapshot_height > image_height)//crop -		{ -			snapshot_height = image_height ; -		} - -		//if (image_aspect_ratio > window_aspect_ratio) +		//if(snapshot_width > image_width && snapshot_height > image_height) //crop  		//{ -		//	snapshot_height  = llround((F32)snapshot_width / image_aspect_ratio); -		//} -		//else if (image_aspect_ratio < window_aspect_ratio) -		//{ -		//	snapshot_width = llround((F32)snapshot_height  * image_aspect_ratio); +		//	snapshot_width = image_width ; +		//	snapshot_height = image_height ;  		//} +		//else //crop and enlarge +		{ +			F32 ratio = llmin( (F32)window_width / image_width , (F32)window_height / image_height) ; +			snapshot_width = (S32)(ratio * image_width) ; +			snapshot_height = (S32)(ratio * image_height) ; +			scale_factor = llmax(1.0f, 1.0f / ratio) ; +		}  	}  	LLRenderTarget target; -	 -	scale_factor = llmax(1.f, (F32)image_width / snapshot_width, (F32)image_height / snapshot_height);  -	 -	// SNAPSHOT -	S32 window_width = mWindowRect.getWidth(); -	S32 window_height = mWindowRect.getHeight(); -	 -	LLRect window_rect = mWindowRect; - -	BOOL use_fbo = FALSE; -	  	if (gGLManager.mHasFramebufferObject &&   		(image_width > window_width ||  		image_height > window_height) && @@ -4339,9 +4458,7 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei  			window_height = snapshot_height;  			scale_factor = 1.f;  			mWindowRect.set(0, 0, snapshot_width, snapshot_height); -			target.bindTarget(); - -			 +			target.bindTarget();			  		}  	} @@ -4954,6 +5071,8 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,  		return TRUE;	// a lie..., because we'll get to it later  	} +	U32 fsaa = gSavedSettings.getU32("RenderFSAASamples"); +	U32 old_fsaa = mWindow->getFSAASamples();  	// going from windowed to windowed  	if (!old_fullscreen && !fullscreen)  	{ @@ -4962,7 +5081,11 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,  		{  			mWindow->setSize(size);  		} -		return TRUE; + +		if (fsaa == old_fsaa) +		{ +			return TRUE; +		}  	}  	// Close floaters that don't handle settings change @@ -4988,10 +5111,13 @@ BOOL LLViewerWindow::changeDisplaySettings(BOOL fullscreen, LLCoordScreen size,  		gSavedSettings.setS32("WindowY", old_pos.mY);  	} +	mWindow->setFSAASamples(fsaa); +  	result_first_try = mWindow->switchContext(fullscreen, size, disable_vsync);  	if (!result_first_try)  	{  		// try to switch back +		mWindow->setFSAASamples(old_fsaa);  		result_second_try = mWindow->switchContext(old_fullscreen, old_size, disable_vsync);  		if (!result_second_try) diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 09ad3fc270..ef3b5146e2 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -219,6 +219,7 @@ public:  	BOOL			saveSnapshot(const LLString&  filename, S32 image_width, S32 image_height, BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR);  	BOOL			rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_height, BOOL keep_window_aspect = TRUE, BOOL is_texture = FALSE,  								BOOL show_ui = TRUE, BOOL do_rebuild = FALSE, ESnapshotType type = SNAPSHOT_TYPE_COLOR, S32 max_size = MAX_IMAGE_SIZE ); +	BOOL            thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ;  	BOOL		    saveImageNumbered(LLImageRaw *raw, const LLString& extension = LLString());  	void			playSnapshotAnimAndSound(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 575f9c424c..68c5eec9a4 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -138,6 +138,7 @@ LLVOAvatarSkeletonInfo* LLVOAvatar::sSkeletonInfo = NULL;  LLVOAvatarInfo* 		LLVOAvatar::sAvatarInfo = NULL;  BOOL gDebugAvatarRotation = FALSE; +S32 LLVOAvatar::sFreezeCounter = 0 ;  //extern BOOL gVelocityInterpolate; @@ -2378,7 +2379,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  {  	LLMemType mt(LLMemType::MTYPE_AVATAR);  	LLFastTimer t(LLFastTimer::FTM_AVATAR_UPDATE); -	 +  	if (isDead())  	{  		llinfos << "Warning!  Idle on dead avatar" << llendl; @@ -2606,7 +2607,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  			F32 old_angle = mImpostorAngle.mV[i];  			F32 angle_diff = fabsf(cur_angle-old_angle); -			if (angle_diff > 3.14159f/16.f) +			if (angle_diff > 3.14159f/512.f*distance)  			{  				mNeedsImpostorUpdate = TRUE;  			} @@ -3069,6 +3070,8 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)  		sNumVisibleChatBubbles--;  	} +	shame(); +  	//--------------------------------------------------------------------  	// draw tractor beam when editing objects  	//-------------------------------------------------------------------- @@ -3166,6 +3169,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)  {  	LLMemType mt(LLMemType::MTYPE_AVATAR);  	// update screen joint size +  	if (mScreenp)  	{  		F32 aspect = gCamera->getAspect(); @@ -3235,10 +3239,15 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)  	// the rest should only be done occasionally for far away avatars  	//-------------------------------------------------------------------- -	if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate) +	if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter)  	{  		F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); -		if (visible && mPixelArea <= impostor_area) +		if (gMuteListp && gMuteListp->isMuted(getID())) +		{ +			mUpdatePeriod = 16; +			visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE; +		} +		else if (visible && mPixelArea <= impostor_area)  		{  			mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mPixelArea), 2, 8); @@ -3897,7 +3906,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass)  			{  				mEyeLashLOD.updateGeometry();  				mHeadLOD.updateGeometry(); -				mHairLOD.updateGeometry(); +				mHairLOD.updateGeometry();				  			}  			mNeedsSkin = FALSE; @@ -4119,8 +4128,13 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color)  	}  	LLVector3 pos(getRenderPosition()+mImpostorOffset); -	LLVector3 left = gCamera->getLeftAxis()*mImpostorDim.mV[0]; -	LLVector3 up = gCamera->getUpAxis()*mImpostorDim.mV[1]; +	LLVector3 at = (pos-gCamera->getOrigin()); +	at.normVec(); +	LLVector3 left = gCamera->getUpAxis() % at; +	LLVector3 up = at%left; + +	left *= mImpostorDim.mV[0]; +	up *= mImpostorDim.mV[1];  	LLGLEnable test(GL_ALPHA_TEST);  	glAlphaFunc(GL_GREATER, 0.f); @@ -5650,6 +5664,8 @@ BOOL LLVOAvatar::updateJointLODs()  	F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE));  	F32 avatar_num_min_factor = clamp_rescale(sLODFactor, 0.f, 1.f, 0.25f, 0.6f);  	F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor); +	F32 area_scale = 0.16f; +  	{  		if (mIsSelf)  		{ @@ -5659,7 +5675,7 @@ BOOL LLVOAvatar::updateJointLODs()  			}  			else  			{ -				mAdjustedPixelArea = mPixelArea; +				mAdjustedPixelArea = mPixelArea*area_scale;  			}  		}  		else if (mIsDummy) @@ -5669,7 +5685,7 @@ BOOL LLVOAvatar::updateJointLODs()  		else  		{  			// reported avatar pixel area is dependent on avatar render load, based on number of visible avatars -			mAdjustedPixelArea = (F32)mPixelArea * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor; +			mAdjustedPixelArea = (F32)mPixelArea * area_scale * lod_factor * lod_factor * avatar_num_factor * avatar_num_factor;  		}  		// now select meshes to render based on adjusted pixel area @@ -9440,6 +9456,23 @@ LLHost LLVOAvatar::getObjectHost() const  	}  } +//static +void LLVOAvatar::updateFreezeCounter(S32 counter) +{ +	if(counter) +	{ +		sFreezeCounter = counter ; +	} +	else if(sFreezeCounter > 0) +	{ +		sFreezeCounter-- ; +	} +	else +	{ +		sFreezeCounter = 0 ; +	} +} +  BOOL LLVOAvatar::updateLOD()  {  	BOOL res = updateJointLODs(); @@ -9493,7 +9526,7 @@ BOOL LLVOAvatar::isImpostor() const  BOOL LLVOAvatar::needsImpostorUpdate() const  { -	return mNeedsImpostorUpdate; +	return mNeedsImpostorUpdate ;  }  const LLVector3& LLVOAvatar::getImpostorOffset() const @@ -9524,8 +9557,141 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di  	LLVector3 at = gCamera->getOrigin()-(getRenderPosition()+mImpostorOffset);  	distance = at.normVec(); -	angle.mV[0] = acosf(at.mV[0]); -	angle.mV[1] = acosf(at.mV[1]); -	angle.mV[2] = acosf(at.mV[2]); +	F32 da = 1.f - (at*gCamera->getAtAxis()); +	angle.mV[0] = gCamera->getYaw()*da; +	angle.mV[1] = gCamera->getPitch()*da; +	angle.mV[2] = da; +} + +U32 calc_shame(LLVOVolume* volume, std::set<LLUUID> &textures) +{ +	if (!volume) +	{ +		return 0; +	} + +	U32 shame = 0; + +	U32 invisi = 0; +	U32 shiny = 0; +	U32 glow = 0; +	U32 alpha = 0; +	U32 flexi = 0; +	U32 animtex = 0; +	U32 particles = 0; +	U32 scale = 0; +	U32 bump = 0; +	U32 planar = 0; +	 +	if (volume->isFlexible()) +	{ +		flexi = 1; +	} +	if (volume->isParticleSource()) +	{ +		particles = 1; +	} + +	const LLVector3& sc = volume->getScale(); +	scale += (U32) sc.mV[0] + (U32) sc.mV[1] + (U32) sc.mV[2]; + +	LLDrawable* drawablep = volume->mDrawable; + +	if (volume->isSculpted()) +	{ +		LLSculptParams *sculpt_params = (LLSculptParams *) volume->getParameterEntry(LLNetworkData::PARAMS_SCULPT); +		LLUUID sculpt_id = sculpt_params->getSculptTexture(); +		textures.insert(sculpt_id); +	} + +	for (S32 i = 0; i < drawablep->getNumFaces(); ++i) +	{ +		LLFace* face = drawablep->getFace(i); +		const LLTextureEntry* te = face->getTextureEntry(); +		LLViewerImage* img = face->getTexture(); + +		textures.insert(img->getID()); + +		if (face->getPoolType() == LLDrawPool::POOL_ALPHA) +		{ +			alpha++; +		} +		else if (img->getPrimaryFormat() == GL_ALPHA) +		{ +			invisi = 1; +		} + +		if (te->getBumpmap()) +		{ +			bump = 1; +		} +		if (te->getShiny()) +		{ +			shiny = 1; +		} +		if (te->getGlow() > 0.f) +		{ +			glow = 1; +		} +		if (face->mTextureMatrix != NULL) +		{ +			animtex++; +		} +		if (te->getTexGen()) +		{ +			planar++; +		} +	} + +	shame += invisi + shiny + glow + alpha*4 + flexi*8 + animtex*4 + particles*16+bump*4+scale+planar; + +	for (U32 i = 0; i < drawablep->getChildCount(); ++i) +	{ +		shame += calc_shame(drawablep->getChild(i)->getVOVolume(), textures); +	} + +	return shame;  } +void LLVOAvatar::shame() +{ +	if (!gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_SHAME)) +	{ +		return; +	} + +	U32 shame = 1; + +	std::set<LLUUID> textures; + +	attachment_map_t::const_iterator iter; +	for (iter = mAttachmentPoints.begin();  +		iter != mAttachmentPoints.end(); +		++iter) +	{ +		LLViewerJointAttachment* attachment = iter->second; +		LLViewerObject* object = attachment->getObject(); +		if (object && !object->isHUDAttachment()) +		{ +			LLDrawable* drawable = object->mDrawable; +			if (drawable) +			{ +				shame += 10; +				LLVOVolume* volume = drawable->getVOVolume(); +				if (volume) +				{ +					shame += calc_shame(volume, textures); +				} +			} +		} +	}	 + +	shame += textures.size() * 5; + +	setDebugText(llformat("%d", shame)); +	F32 green = 1.f-llclamp(((F32) shame-1024.f)/1024.f, 0.f, 1.f); +	F32 red = llmin((F32) shame/1024.f, 1.f); +	mText->setColor(LLColor4(red,green,0,1)); +} + + diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index ae0656f3ea..a6731c3e31 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -984,6 +984,7 @@ protected:  	LLHost			getObjectHost() const;  	S32				getLocalDiscardLevel( S32 index); +	void			shame();  //generate shame metric  //Ventrella  	//-----------------------------------------------------------------------------------------------  	// the Voice Visualizer is responsible for detecting the user's voice signal, and when the @@ -993,7 +994,11 @@ protected:  	LLVoiceVisualizer * mVoiceVisualizer;  	int					mCurrentGesticulationLevel;  //End Ventrella -	 + +private: +	static  S32 sFreezeCounter ; +public: +	static void updateFreezeCounter(S32 counter = 0 ) ;  };  #endif // LL_VO_AVATAR_H diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index f42ec51b5d..448bda1857 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -99,7 +99,7 @@  #include "llwlparammanager.h"  #include "llwaterparammanager.h"  #include "llspatialpartition.h" - +#include "llmutelist.h"  #ifdef _DEBUG  // Debug indices is disabled for now for debug performance - djs 4/24/02 @@ -1252,6 +1252,10 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl  		mScreen.flush();  		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);  	} +	else if (LLPipeline::sUseOcclusion > 1) +	{ +		glFlush(); +	}  }  void LLPipeline::markNotCulled(LLSpatialGroup* group, LLCamera& camera) @@ -1339,6 +1343,7 @@ void LLPipeline::doOcclusion(LLCamera& camera)  	}  	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE); +	glFlush();  }  BOOL LLPipeline::updateDrawableGeom(LLDrawable* drawablep, BOOL priority) @@ -2124,8 +2129,6 @@ void render_hud_elements()  	LLFastTimer t(LLFastTimer::FTM_RENDER_UI);  	gPipeline.disableLights();		 -	gPipeline.renderDebug(); -  	LLGLDisable fog(GL_FOG);  	LLGLSUIDefault gls_ui; @@ -2289,15 +2292,6 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)  	LLVertexBuffer::startRender(); -	for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) -	{ -		LLDrawPool *poolp = *iter; -		if (hasRenderType(poolp->getType())) -		{ -			poolp->prerender(); -		} -	} -  	//by bao  	//fake vertex buffer updating  	//to guaranttee at least updating one VBO buffer every frame @@ -2314,7 +2308,8 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)  	glMatrixMode(GL_MODELVIEW);  	LLGLSPipeline gls_pipeline; -	 +	LLGLEnable multisample(GL_MULTISAMPLE_ARB); +  	LLGLState gls_color_material(GL_COLOR_MATERIAL, mLightingDetail < 2);  	// Toggle backface culling for debugging @@ -2346,8 +2341,22 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)  	{  		gObjectList.renderObjectsForSelect(camera);  	} +	else if (gSavedSettings.getBOOL("RenderDeferred")) +	{ +		renderGeomDeferred(); +	}  	else  	{ +		for (pool_set_t::iterator iter = mPools.begin(); iter != mPools.end(); ++iter) +		{ +			LLDrawPool *poolp = *iter; +			if (hasRenderType(poolp->getType())) +			{ +				poolp->prerender(); +			} +		} + +  		LLFastTimer t(LLFastTimer::FTM_POOLS);  		calcNearbyLights(camera);  		setupHWLights(NULL); @@ -2456,7 +2465,7 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)  	// have touch-handlers.  	mHighlightFaces.clear(); -	render_hud_elements(); +	renderDebug();  	LLVertexBuffer::stopRender();  	LLVertexBuffer::unbind(); @@ -2479,6 +2488,19 @@ void LLPipeline::renderGeom(LLCamera& camera, BOOL forceVBOUpdate)  #endif  } +void LLPipeline::renderGeomDeferred() +{ +	glEnableClientState(GL_TEXTURE_COORD_ARRAY); +	glEnableClientState(GL_NORMAL_ARRAY); +	glEnableClientState(GL_COLOR_ARRAY); +	gDeferredDiffuseProgram.bind(); +	gPipeline.renderObjects(LLRenderPass::PASS_SIMPLE, LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD | LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_NORMAL, TRUE); +	gDeferredDiffuseProgram.unbind(); +	glDisableClientState(GL_COLOR_ARRAY); +	glDisableClientState(GL_NORMAL_ARRAY); +	glDisableClientState(GL_TEXTURE_COORD_ARRAY); +} +  void LLPipeline::addTrianglesDrawn(S32 count)  {  	assertInitialized(); @@ -4814,6 +4836,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot)  		mScreen.bindTexture(); +		LLGLEnable multisample(GL_MULTISAMPLE_ARB);  		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);  		glDisable(GL_TEXTURE_RECTANGLE_ARB); @@ -4948,13 +4971,12 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)  				mRenderTypeMask = tmp;  			} -			if (LLDrawPoolWater::sNeedsReflectionUpdate) +			if (LLDrawPoolWater::sNeedsDistortionUpdate)  			{  				mRenderTypeMask &=	~((1<<LLPipeline::RENDER_TYPE_WATER) |  									  (1<<LLPipeline::RENDER_TYPE_GROUND) |  									  (1<<LLPipeline::RENDER_TYPE_SKY) | -									  (1<<LLPipeline::RENDER_TYPE_CLOUDS) | -									  (1<<LLPipeline::RENDER_TYPE_WL_SKY));	 +									  (1<<LLPipeline::RENDER_TYPE_CLOUDS));	  				if (gSavedSettings.getBOOL("RenderWaterReflections"))  				{ //mask out selected geometry based on reflection detail @@ -5034,7 +5056,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)  			LLPipeline::sUnderWaterRender = FALSE;  			mWaterDis.flush();  		} -		last_update = LLDrawPoolWater::sNeedsReflectionUpdate; +		last_update = LLDrawPoolWater::sNeedsReflectionUpdate && LLDrawPoolWater::sNeedsDistortionUpdate;  		glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);  		LLPipeline::sReflectionRender = FALSE; @@ -5048,6 +5070,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)  		gViewerWindow->setupViewport();  		mRenderTypeMask = type_mask;  		LLDrawPoolWater::sNeedsReflectionUpdate = FALSE; +		LLDrawPoolWater::sNeedsDistortionUpdate = FALSE;  		gCamera->setUserClipPlane(LLPlane(-pnorm, -pd));  		LLPipeline::sUseOcclusion = occlusion;  	} @@ -5075,10 +5098,6 @@ LLCubeMap* LLPipeline::findReflectionMap(const LLVector3& location)  void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture)  { -#if !LL_RELEASE_FOR_DOWNLOAD -	LLGLState::checkClientArrays(mask); -#endif -  	for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i)  	{  		LLSpatialGroup* group = *i; @@ -5105,22 +5124,23 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	assertInitialized(); -	if (!avatar->mImpostor.isComplete()) +	U32 mask; +	BOOL muted = gMuteListp && gMuteListp->isMuted(avatar->getID()); + +	if (muted)  	{ -		avatar->mImpostor.allocate(128,256,GL_RGBA,TRUE); -		avatar->mImpostor.bindTexture(); -		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); -		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); -		LLImageGL::unbindTexture(0, GL_TEXTURE_2D); +		mask  = 1 << LLPipeline::RENDER_TYPE_AVATAR;  	} - -	U32 mask = (1<<LLPipeline::RENDER_TYPE_VOLUME) | +	else +	{ +		mask  = (1<<LLPipeline::RENDER_TYPE_VOLUME) |  				(1<<LLPipeline::RENDER_TYPE_AVATAR) |  				(1<<LLPipeline::RENDER_TYPE_BUMP) |  				(1<<LLPipeline::RENDER_TYPE_GRASS) |  				(1<<LLPipeline::RENDER_TYPE_SIMPLE) |  				(1<<LLPipeline::RENDER_TYPE_ALPHA) |   				(1<<LLPipeline::RENDER_TYPE_INVISIBLE); +	}  	mask = mask & gPipeline.getRenderTypeMask();  	U32 saved_mask = gPipeline.mRenderTypeMask; @@ -5148,24 +5168,6 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	stateSort(*gCamera, result); -	glClearColor(0.0f,0.0f,0.0f,0.0f); -	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); -	glStencilMask(0xFFFFFFFF); -	glClearStencil(0); - -	{ -		LLGLEnable scissor(GL_SCISSOR_TEST); -		glScissor(0, 0, 128, 256); -		avatar->mImpostor.bindTarget(); -		avatar->mImpostor.getViewport(gGLViewport); -		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); -	} -	 -	LLGLEnable stencil(GL_STENCIL_TEST); - -	glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF); -	glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); -  	const LLVector3* ext = avatar->mDrawable->getSpatialExtents();  	LLVector3 pos(avatar->getRenderPosition()+avatar->getImpostorOffset()); @@ -5190,9 +5192,13 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	glMatrixMode(GL_PROJECTION);  	glPushMatrix(); -	glh::matrix4f ortho = gl_ortho(-tdim.mV[0], tdim.mV[0], -tdim.mV[1], tdim.mV[1], 1.0, 256.0); -	glh_set_current_projection(ortho); -	glLoadMatrixf(ortho.m); +	//glh::matrix4f ortho = gl_ortho(-tdim.mV[0], tdim.mV[0], -tdim.mV[1], tdim.mV[1], 1.0, 256.0); +	F32 distance = (pos-camera.getOrigin()).magVec(); +	F32 fov = atanf(tdim.mV[1]/distance)*2.f*RAD_TO_DEG; +	F32 aspect = tdim.mV[0]/tdim.mV[1]; //128.f/256.f; +	glh::matrix4f persp = gl_perspective(fov, aspect, 1.f, 256.f); +	glh_set_current_projection(persp); +	glLoadMatrixf(persp.m);  	glMatrixMode(GL_MODELVIEW);  	glPushMatrix(); @@ -5204,24 +5210,68 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  	glLoadMatrixf(mat.m);  	glh_set_current_modelview(mat); +	glClearColor(0.0f,0.0f,0.0f,0.0f); +	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); +	glStencilMask(0xFFFFFFFF); +	glClearStencil(0); + +	// get the number of pixels per angle +	F32 pa = gViewerWindow->getWindowDisplayHeight()/(RAD_TO_DEG*gCamera->getView()); + +	//get resolution based on angle width and height of impostor (double desired resolution to prevent aliasing) +	U32 resY = llmin(nhpo2((U32) (fov*pa)), (U32) 512); +	U32 resX = llmin(nhpo2((U32) (atanf(tdim.mV[0]/distance)*2.f*RAD_TO_DEG*pa)), (U32) 512); + +	if (!avatar->mImpostor.isComplete() || resX != avatar->mImpostor.getWidth() || +		resY != avatar->mImpostor.getHeight()) +	{ +		avatar->mImpostor.allocate(resX,resY,GL_RGBA,TRUE); +		avatar->mImpostor.bindTexture(); +		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); +		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); +		LLImageGL::unbindTexture(0, GL_TEXTURE_2D); +	} + +	{ +		LLGLEnable scissor(GL_SCISSOR_TEST); +		glScissor(0, 0, resX, resY); +		avatar->mImpostor.bindTarget(); +		avatar->mImpostor.getViewport(gGLViewport); +		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); +	} +	 +	LLGLEnable stencil(GL_STENCIL_TEST); + +	glStencilFunc(GL_ALWAYS, 1, 0xFFFFFFFF); +	glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE); +  	renderGeom(camera);  	glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);  	glStencilFunc(GL_EQUAL, 1, 0xFFFFFF);  	{ -		glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);  		LLVector3 left = camera.getLeftAxis()*tdim.mV[0]*2.f;  		LLVector3 up = camera.getUpAxis()*tdim.mV[1]*2.f; -		LLGLEnable blend(GL_BLEND); +		LLGLEnable blend(muted ? 0 : GL_BLEND); + +		if (muted) +		{ +			glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); +		} +		else +		{ +			glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE); +		} +		  		gGL.blendFunc(GL_ONE, GL_ONE);  		LLImageGL::unbindTexture(0, GL_TEXTURE_2D);  		LLGLDepthTest depth(GL_FALSE, GL_FALSE);  		gGL.start(); -		gGL.color4ub(0,0,0,1); +		gGL.color4ub(64,64,64,1);  		gGL.begin(GL_QUADS);  		gGL.vertex3fv((pos+left-up).mV);  		gGL.vertex3fv((pos-left-up).mV); @@ -5230,9 +5280,11 @@ void LLPipeline::generateImpostor(LLVOAvatar* avatar)  		gGL.end();  		gGL.stop(); +  		gGL.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);  	} +  	avatar->mImpostor.flush();  	avatar->setImpostorDim(tdim); diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index 2054492b72..9c64ccdbe3 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -72,6 +72,7 @@ void glh_set_current_modelview(glh::matrix4f& mat);  glh::matrix4f glh_get_current_projection();  void glh_set_current_projection(glh::matrix4f& mat);  glh::matrix4f gl_ortho(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat znear, GLfloat zfar); +glh::matrix4f gl_perspective(GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloat zFar);  class LLPipeline  { @@ -179,6 +180,8 @@ public:  	void grabReferences(LLCullResult& result);  	void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE); +	void renderGeomDeferred(); +  	void processImagery(LLCamera& camera);  	void generateWaterReflection(LLCamera& camera);  	void renderHighlights(); @@ -328,6 +331,7 @@ public:  		RENDER_DEBUG_TEXTURE_ANIM		= 0x080000,  		RENDER_DEBUG_LIGHTS				= 0x100000,  		RENDER_DEBUG_BATCH_SIZE			= 0x200000, +		RENDER_DEBUG_SHAME				= 0x400000,  	};  	LLPointer<LLViewerImage>	mAlphaSizzleImagep; | 
