Commit 48f8a6cf authored by NiranV's avatar NiranV

Fixed: Fixed Rigged Alpha not being fogged underwater, ported from Alchemy as...

Fixed: Fixed Rigged Alpha not being fogged underwater, ported from Alchemy as per Drake's recommendation.
parent bcbff3ca
......@@ -297,7 +297,15 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
{
sSkipOpaque = TRUE;
sShaderLevel = mShaderLevel;
sVertexProgram = &gDeferredAvatarAlphaProgram;
if (LLPipeline::sUnderWaterRender)
{
sVertexProgram = &gDeferredAvatarAlphaWaterProgram;
}
else
{
sVertexProgram = &gDeferredAvatarAlphaProgram;
}
sRenderingSkinned = TRUE;
gPipeline.bindDeferredShader(*sVertexProgram);
......@@ -309,7 +317,15 @@ void LLDrawPoolAvatar::beginPostDeferredAlpha()
void LLDrawPoolAvatar::beginDeferredRiggedAlpha()
{
sVertexProgram = &gDeferredSkinnedAlphaProgram;
if (LLPipeline::sUnderWaterRender)
{
sVertexProgram = &gDeferredSkinnedAlphaWaterProgram;
}
else
{
sVertexProgram = &gDeferredSkinnedAlphaProgram;
}
gPipeline.bindDeferredShader(*sVertexProgram);
sDiffuseChannel = sVertexProgram->enableTexture(LLViewerShaderMgr::DIFFUSE_MAP);
gPipeline.enableLightsDynamic();
......
......@@ -197,6 +197,7 @@ LLGLSLShader gDeferredNonIndexedDiffuseAlphaMaskNoColorProgram;
LLGLSLShader gDeferredSkinnedDiffuseProgram;
LLGLSLShader gDeferredSkinnedBumpProgram;
LLGLSLShader gDeferredSkinnedAlphaProgram;
LLGLSLShader gDeferredSkinnedAlphaWaterProgram;
LLGLSLShader gDeferredBumpProgram;
LLGLSLShader gDeferredTerrainProgram;
LLGLSLShader gDeferredTerrainWaterProgram;
......@@ -204,6 +205,7 @@ LLGLSLShader gDeferredTreeProgram;
LLGLSLShader gDeferredTreeShadowProgram;
LLGLSLShader gDeferredAvatarProgram;
LLGLSLShader gDeferredAvatarAlphaProgram;
LLGLSLShader gDeferredAvatarAlphaWaterProgram;
LLGLSLShader gDeferredLightProgram;
LLGLSLShader gDeferredMultiLightProgram[16];
LLGLSLShader gDeferredSpotLightProgram;
......@@ -348,6 +350,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredAlphaImpostorProgram);
mShaderList.push_back(&gDeferredAlphaWaterProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaProgram);
mShaderList.push_back(&gDeferredSkinnedAlphaWaterProgram);
mShaderList.push_back(&gDeferredFullbrightProgram);
mShaderList.push_back(&gDeferredFullbrightAlphaMaskProgram);
mShaderList.push_back(&gDeferredFullbrightWaterProgram);
......@@ -361,6 +364,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
mShaderList.push_back(&gDeferredUnderWaterProgram);
mShaderList.push_back(&gDeferredTerrainWaterProgram);
mShaderList.push_back(&gDeferredAvatarAlphaProgram);
mShaderList.push_back(&gDeferredAvatarAlphaWaterProgram);
mShaderList.push_back(&gDeferredWLSkyProgram);
mShaderList.push_back(&gDeferredWLCloudProgram);
mShaderList.push_back(&gDeferredWLMoonProgram);
......@@ -838,6 +842,7 @@ void LLViewerShaderMgr::unloadShaders()
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
gDeferredSkinnedAlphaProgram.unload();
gDeferredSkinnedAlphaWaterProgram.unload();
gTransformPositionProgram.unload();
gTransformTexCoordProgram.unload();
......@@ -1240,6 +1245,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedDiffuseProgram.unload();
gDeferredSkinnedBumpProgram.unload();
gDeferredSkinnedAlphaProgram.unload();
gDeferredSkinnedAlphaWaterProgram.unload();
gDeferredBumpProgram.unload();
gDeferredImpostorProgram.unload();
gDeferredTerrainProgram.unload();
......@@ -1267,6 +1273,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAttachmentAlphaMaskShadowProgram.unload();
gDeferredAvatarProgram.unload();
gDeferredAvatarAlphaProgram.unload();
gDeferredAvatarAlphaWaterProgram.unload();
gDeferredAlphaProgram.unload();
gDeferredAlphaWaterProgram.unload();
gDeferredFullbrightProgram.unload();
......@@ -1494,6 +1501,63 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredSkinnedAlphaProgram.mFeatures.hasLighting = true;
}
if (success)
{
gDeferredSkinnedAlphaWaterProgram.mName = "Deferred Skinned Underwater Alpha Shader";
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasObjectSkinning = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.calculatesLighting = false;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasLighting = false;
gDeferredSkinnedAlphaWaterProgram.mFeatures.isAlphaLighting = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.disableTextureIndex = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasSrgb = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.encodesNormal = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasAtmospherics = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasTransport = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasGamma = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasWaterFog = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasShadows = true;
gDeferredSkinnedAlphaWaterProgram.mShaderFiles.clear();
gDeferredSkinnedAlphaWaterProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER));
gDeferredSkinnedAlphaWaterProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER));
gDeferredSkinnedAlphaWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredSkinnedAlphaWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
gDeferredSkinnedAlphaWaterProgram.clearPermutations();
gDeferredSkinnedAlphaWaterProgram.addPermutation("USE_DIFFUSE_TEX", "1");
gDeferredSkinnedAlphaWaterProgram.addPermutation("WATER_FOG", "1");
gDeferredSkinnedAlphaWaterProgram.addPermutation("HAS_SKIN", "1");
gDeferredSkinnedAlphaWaterProgram.addPermutation("USE_VERTEX_COLOR", "1");
if (use_sun_shadow)
{
gDeferredSkinnedAlphaWaterProgram.addPermutation("HAS_SHADOW", "1");
}
if (ambient_kill)
{
gDeferredSkinnedAlphaWaterProgram.addPermutation("AMBIENT_KILL", "1");
}
if (sunlight_kill)
{
gDeferredSkinnedAlphaWaterProgram.addPermutation("SUNLIGHT_KILL", "1");
}
if (local_light_kill)
{
gDeferredSkinnedAlphaWaterProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
}
success = gDeferredSkinnedAlphaWaterProgram.createShader(NULL, NULL);
llassert(success);
// Hack to include uniforms for lighting without linking in lighting file
gDeferredSkinnedAlphaWaterProgram.mFeatures.calculatesLighting = true;
gDeferredSkinnedAlphaWaterProgram.mFeatures.hasLighting = true;
}
if (success)
{
gDeferredBumpProgram.mName = "Deferred Bump Shader";
......@@ -2586,7 +2650,7 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
if (success)
{
gDeferredAvatarAlphaProgram.mName = "Avatar Alpha Shader";
gDeferredAvatarAlphaProgram.mName = "Deferred Avatar Alpha Shader";
gDeferredAvatarAlphaProgram.mFeatures.hasSkinning = true;
gDeferredAvatarAlphaProgram.mFeatures.calculatesLighting = false;
gDeferredAvatarAlphaProgram.mFeatures.hasLighting = false;
......@@ -2636,6 +2700,62 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
gDeferredAvatarAlphaProgram.mFeatures.hasLighting = true;
}
if (success)
{
gDeferredAvatarAlphaWaterProgram.mName = "Deferred Avatar Underwater Alpha Shader";
gDeferredAvatarAlphaWaterProgram.mFeatures.hasSkinning = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.calculatesLighting = false;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasLighting = false;
gDeferredAvatarAlphaWaterProgram.mFeatures.isAlphaLighting = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.disableTextureIndex = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasSrgb = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.encodesNormal = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.calculatesAtmospherics = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasAtmospherics = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasTransport = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasGamma = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasWaterFog = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.isDeferred = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasShadows = true;
gDeferredAvatarAlphaWaterProgram.mShaderFiles.clear();
gDeferredAvatarAlphaWaterProgram.mShaderFiles.push_back(make_pair("deferred/alphaV.glsl", GL_VERTEX_SHADER));
gDeferredAvatarAlphaWaterProgram.mShaderFiles.push_back(make_pair("deferred/alphaF.glsl", GL_FRAGMENT_SHADER));
gDeferredAvatarAlphaWaterProgram.clearPermutations();
gDeferredAvatarAlphaWaterProgram.addPermutation("USE_DIFFUSE_TEX", "1");
gDeferredAvatarAlphaWaterProgram.addPermutation("IS_AVATAR_SKIN", "1");
gDeferredAvatarAlphaWaterProgram.addPermutation("WATER_FOG", "1");
if (use_sun_shadow)
{
gDeferredAvatarAlphaWaterProgram.addPermutation("HAS_SHADOW", "1");
}
if (ambient_kill)
{
gDeferredAvatarAlphaWaterProgram.addPermutation("AMBIENT_KILL", "1");
}
if (sunlight_kill)
{
gDeferredAvatarAlphaWaterProgram.addPermutation("SUNLIGHT_KILL", "1");
}
if (local_light_kill)
{
gDeferredAvatarAlphaWaterProgram.addPermutation("LOCAL_LIGHT_KILL", "1");
}
gDeferredAvatarAlphaWaterProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
gDeferredAvatarAlphaWaterProgram.mShaderGroup = LLGLSLShader::SG_WATER;
success = gDeferredAvatarAlphaWaterProgram.createShader(NULL, NULL);
llassert(success);
gDeferredAvatarAlphaWaterProgram.mFeatures.calculatesLighting = true;
gDeferredAvatarAlphaWaterProgram.mFeatures.hasLighting = true;
}
if (success)
{
gDeferredPostGammaCorrectProgram.mName = "Deferred Gamma Correction Post Process";
......
......@@ -303,6 +303,7 @@ extern LLGLSLShader gDeferredNonIndexedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedDiffuseProgram;
extern LLGLSLShader gDeferredSkinnedBumpProgram;
extern LLGLSLShader gDeferredSkinnedAlphaProgram;
extern LLGLSLShader gDeferredSkinnedAlphaWaterProgram;
extern LLGLSLShader gDeferredBumpProgram;
extern LLGLSLShader gDeferredTerrainProgram;
extern LLGLSLShader gDeferredTerrainWaterProgram;
......@@ -343,6 +344,7 @@ extern LLGLSLShader gDeferredFullbrightAlphaMaskWaterProgram;
extern LLGLSLShader gDeferredEmissiveProgram;
extern LLGLSLShader gDeferredAvatarEyesProgram;
extern LLGLSLShader gDeferredAvatarAlphaProgram;
extern LLGLSLShader gDeferredAvatarAlphaWaterProgram;
extern LLGLSLShader gDeferredWLSkyProgram;
extern LLGLSLShader gDeferredWLCloudProgram;
extern LLGLSLShader gDeferredWLSunProgram;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment