diff options
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl | 8 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/objects/impostorF.glsl | 26 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/objects/impostorV.glsl | 16 | ||||
| -rw-r--r-- | indra/newview/lldrawpoolavatar.cpp | 11 | ||||
| -rw-r--r-- | indra/newview/llviewershadermgr.cpp | 15 | ||||
| -rw-r--r-- | indra/newview/llviewershadermgr.h | 1 | 
6 files changed, 77 insertions, 0 deletions
| diff --git a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl index fa811f0d55..75f594ed8f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/impostorF.glsl @@ -5,6 +5,8 @@   * $/LicenseInfo$   */ +uniform float minimum_alpha;
 +uniform float maximum_alpha;
  uniform sampler2D diffuseMap; @@ -14,6 +16,12 @@ uniform sampler2D specularMap;  void main()   {  	vec4 col = texture2D(diffuseMap, gl_TexCoord[0].xy); + +	if (col.a < minimum_alpha || col.a > maximum_alpha)
 +	{
 +		discard;
 +	}
 +  	gl_FragData[0] = vec4(col.rgb, col.a * 0.005);  	gl_FragData[1] = texture2D(specularMap, gl_TexCoord[0].xy);  	gl_FragData[2] = vec4(texture2D(normalMap, gl_TexCoord[0].xy).xyz, 0.0); diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl new file mode 100644 index 0000000000..7257132f06 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/impostorF.glsl @@ -0,0 +1,26 @@ +/**  + * @file impostorF.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  +uniform float minimum_alpha;
 +uniform float maximum_alpha;
 +
 +vec3 fullbrightAtmosTransport(vec3 light);
 +vec3 fullbrightScaleSoftClip(vec3 light);
 +
 +uniform sampler2D diffuseMap;
 +
 +void main()
 +{
 +	vec4 color = texture2D(diffuseMap,gl_TexCoord[0].xy) * gl_Color;
 +	
 +	if (color.a < minimum_alpha || color.a > maximum_alpha)
 +	{
 +		discard;
 +	}
 +
 +	gl_FragColor = color;
 +}
 diff --git a/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl new file mode 100644 index 0000000000..724b86a1b7 --- /dev/null +++ b/indra/newview/app_settings/shaders/class1/objects/impostorV.glsl @@ -0,0 +1,16 @@ +/** + * @file impostorV.glsl + * + * $LicenseInfo:firstyear=2007&license=viewerlgpl$ + * $/LicenseInfo$ + */ +  +  +void main() +{ +	//transform vertex +	gl_Position = ftransform(); +	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0; +	 +	gl_FrontColor = gl_Color; +} diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index a99f0200ce..082448d95c 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -573,6 +573,12 @@ void LLDrawPoolAvatar::beginImpostor()  		LLVOAvatar::sNumVisibleAvatars = 0;  	} +	if (LLGLSLShader::sNoFixedFunction) +	{ +		gImpostorProgram.bind(); +		gImpostorProgram.setAlphaRange(0.01f, 1.f); +	} +  	gPipeline.enableLightsFullbright(LLColor4(1,1,1,1));  	sDiffuseChannel = 0; @@ -584,6 +590,10 @@ void LLDrawPoolAvatar::beginImpostor()  void LLDrawPoolAvatar::endImpostor()  { +	if (LLGLSLShader::sNoFixedFunction) +	{ +		gImpostorProgram.unbind(); +	}  	gPipeline.enableLightsDynamic();  	if (LLGLSLShader::sNoFixedFunction)  	{ @@ -640,6 +650,7 @@ void LLDrawPoolAvatar::beginDeferredImpostor()  	sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);  	sVertexProgram->bind(); +	sVertexProgram->setAlphaRange(0.01f, 1.f);  }  void LLDrawPoolAvatar::endDeferredImpostor() diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp index f07b21e3c3..ab193c7d85 100644 --- a/indra/newview/llviewershadermgr.cpp +++ b/indra/newview/llviewershadermgr.cpp @@ -131,6 +131,7 @@ LLGLSLShader		gAvatarProgram;  LLGLSLShader		gAvatarWaterProgram;  LLGLSLShader		gAvatarEyeballProgram;  LLGLSLShader		gAvatarPickProgram; +LLGLSLShader		gImpostorProgram;  // WindLight shader handles  LLGLSLShader			gWLSkyProgram; @@ -199,6 +200,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :  	mShaderList.push_back(&gWaterProgram);  	mShaderList.push_back(&gAvatarEyeballProgram);   	mShaderList.push_back(&gObjectSimpleProgram); +	mShaderList.push_back(&gImpostorProgram);  	mShaderList.push_back(&gObjectFullbrightNoColorProgram);  	mShaderList.push_back(&gObjectFullbrightNoColorWaterProgram);  	mShaderList.push_back(&gObjectSimpleAlphaMaskProgram); @@ -674,6 +676,7 @@ void LLViewerShaderMgr::unloadShaders()  	gObjectFullbrightNoColorProgram.unload();  	gObjectFullbrightNoColorWaterProgram.unload();  	gObjectSimpleProgram.unload(); +	gImpostorProgram.unload();  	gObjectSimpleAlphaMaskProgram.unload();  	gObjectBumpProgram.unload();  	gObjectSimpleWaterProgram.unload(); @@ -1764,6 +1767,7 @@ BOOL LLViewerShaderMgr::loadShadersObject()  		gObjectFullbrightNoColorProgram.unload();  		gObjectFullbrightNoColorWaterProgram.unload();  		gObjectSimpleProgram.unload(); +		gImpostorProgram.unload();  		gObjectSimpleAlphaMaskProgram.unload();  		gObjectBumpProgram.unload();  		gObjectSimpleWaterProgram.unload(); @@ -2104,6 +2108,17 @@ BOOL LLViewerShaderMgr::loadShadersObject()  	if (success)  	{ +		gImpostorProgram.mName = "Impostor Shader"; +		gImpostorProgram.mFeatures.disableTextureIndex = true; +		gImpostorProgram.mShaderFiles.clear(); +		gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorV.glsl", GL_VERTEX_SHADER_ARB)); +		gImpostorProgram.mShaderFiles.push_back(make_pair("objects/impostorF.glsl", GL_FRAGMENT_SHADER_ARB)); +		gImpostorProgram.mShaderLevel = mVertexShaderLevel[SHADER_OBJECT]; +		success = gImpostorProgram.createShader(NULL, NULL); +	} + +	if (success) +	{  		gObjectSimpleProgram.mName = "Simple Shader";  		gObjectSimpleProgram.mFeatures.calculatesLighting = true;  		gObjectSimpleProgram.mFeatures.calculatesAtmospherics = true; diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h index 1b658c45ba..270c05b669 100644 --- a/indra/newview/llviewershadermgr.h +++ b/indra/newview/llviewershadermgr.h @@ -347,6 +347,7 @@ extern LLGLSLShader			gAvatarProgram;  extern LLGLSLShader			gAvatarWaterProgram;  extern LLGLSLShader			gAvatarEyeballProgram;  extern LLGLSLShader			gAvatarPickProgram; +extern LLGLSLShader			gImpostorProgram;  // WindLight shader handles  extern LLGLSLShader			gWLSkyProgram; | 
