diff options
author | Dave Parks <davep@lindenlab.com> | 2013-03-28 12:15:32 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-03-28 12:15:32 -0500 |
commit | 5121dd1a533b1d589cf259e96fa6d0ba22b383ea (patch) | |
tree | 2a8e471f0c3b917bace1bbb14d57e43fce2eaddb /indra | |
parent | 74b5bfb98f0496a8e1519c4732bb5942e6fcc78a (diff) |
NORSPEC-62 Fix for fullbright checkbox not working with materials
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/shaders/class1/deferred/materialF.glsl | 4 | ||||
-rw-r--r-- | indra/newview/lldrawpool.h | 8 | ||||
-rw-r--r-- | indra/newview/lldrawpoolalpha.cpp | 34 | ||||
-rw-r--r-- | indra/newview/lldrawpoolalpha.h | 2 | ||||
-rw-r--r-- | indra/newview/lldrawpoolmaterials.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 79 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 15 |
7 files changed, 104 insertions, 46 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 5392466b25..fdaad550f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -26,7 +26,7 @@ #define DIFFUSE_ALPHA_MODE_IGNORE 0 #define DIFFUSE_ALPHA_MODE_BLEND 1 #define DIFFUSE_ALPHA_MODE_MASK 2 -#define DIFFUSE_ALPHA_MODE_GLOW 3 +#define DIFFUSE_ALPHA_MODE_EMISSIVE 3 #ifdef DEFINE_GL_FRAGCOLOR @@ -97,7 +97,7 @@ void main() vec4 final_color = col; -#if DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_GLOW +#if DIFFUSE_ALPHA_MODE != DIFFUSE_ALPHA_MODE_EMISSIVE final_color.a = 0; #endif diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h index 77067cc1ec..93656c34e4 100644 --- a/indra/newview/lldrawpool.h +++ b/indra/newview/lldrawpool.h @@ -137,19 +137,19 @@ public: PASS_MATERIAL, PASS_MATERIAL_ALPHA, PASS_MATERIAL_ALPHA_MASK, - PASS_MATERIAL_ALPHA_GLOW, + PASS_MATERIAL_ALPHA_EMISSIVE, PASS_SPECMAP, PASS_SPECMAP_BLEND, PASS_SPECMAP_MASK, - PASS_SPECMAP_GLOW, + PASS_SPECMAP_EMISSIVE, PASS_NORMMAP, PASS_NORMMAP_BLEND, PASS_NORMMAP_MASK, - PASS_NORMMAP_GLOW, + PASS_NORMMAP_EMISSIVE, PASS_NORMSPEC, PASS_NORMSPEC_BLEND, PASS_NORMSPEC_MASK, - PASS_NORMSPEC_GLOW, + PASS_NORMSPEC_EMISSIVE, PASS_GLOW, PASS_ALPHA, PASS_ALPHA_MASK, diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 33615eb075..24a7939d12 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -91,12 +91,31 @@ void LLDrawPoolAlpha::renderDeferred(S32 pass) LLFastTimer t(FTM_RENDER_GRASS); gDeferredDiffuseAlphaMaskProgram.bind(); gDeferredDiffuseAlphaMaskProgram.setMinimumAlpha(0.33f); - - //render alpha masked objects - LLRenderPass::pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); gDeferredDiffuseAlphaMaskProgram.unbind(); } +void LLDrawPoolAlpha::pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures) +{ + for (LLCullResult::drawinfo_iterator i = gPipeline.beginRenderMap(type); i != gPipeline.endRenderMap(type); ++i) + { + LLDrawInfo* pparams = *i; + if (pparams) + { + if (LLGLSLShader::sCurBoundShaderPtr) + { + LLGLSLShader::sCurBoundShaderPtr->setMinimumAlpha(pparams->mAlphaMaskCutoff); + } + else + { + gGL.setAlphaRejectSettings(LLRender::CF_GREATER, pparams->mAlphaMaskCutoff); + } + + pushBatch(*pparams, mask, texture, batch_textures); + } + } +} + S32 LLDrawPoolAlpha::getNumPostDeferredPasses() { @@ -150,7 +169,6 @@ void LLDrawPoolAlpha::beginPostDeferredPass(S32 pass) void LLDrawPoolAlpha::endPostDeferredPass(S32 pass) { - if (pass == 1) { gPipeline.mDeferredDepth.flush(); @@ -234,7 +252,7 @@ void LLDrawPoolAlpha::render(S32 pass) simple_shader->bind(); simple_shader->setMinimumAlpha(0.33f); - pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); } if (fullbright_shader) { @@ -247,16 +265,16 @@ void LLDrawPoolAlpha::render(S32 pass) fullbright_shader->uniform1f(LLShaderMgr::TEXTURE_GAMMA, 2.2f); } } - pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask() | LLVertexBuffer::MAP_TEXTURE_INDEX, TRUE, TRUE); //LLGLSLShader::bindNoShader(); } else { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.33f); //OK gPipeline.enableLightsFullbright(LLColor4(1,1,1,1)); - pushBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask()); + pushMaskBatches(LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); gPipeline.enableLightsDynamic(); - pushBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask()); + pushMaskBatches(LLRenderPass::PASS_ALPHA_MASK, getVertexDataMask(), TRUE, FALSE); gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); //OK } } diff --git a/indra/newview/lldrawpoolalpha.h b/indra/newview/lldrawpoolalpha.h index a4245e561d..46c17f3b99 100644 --- a/indra/newview/lldrawpoolalpha.h +++ b/indra/newview/lldrawpoolalpha.h @@ -70,6 +70,8 @@ public: void renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask, BOOL texture = TRUE); void renderAlpha(U32 mask); void renderAlphaHighlight(U32 mask); + void pushMaskBatches(U32 type, U32 mask, BOOL texture, BOOL batch_textures); + static BOOL sShowDebugAlpha; diff --git a/indra/newview/lldrawpoolmaterials.cpp b/indra/newview/lldrawpoolmaterials.cpp index b126dc3b4a..d6cca9abe2 100644 --- a/indra/newview/lldrawpoolmaterials.cpp +++ b/indra/newview/lldrawpoolmaterials.cpp @@ -95,19 +95,19 @@ void LLDrawPoolMaterials::renderDeferred(S32 pass) LLRenderPass::PASS_MATERIAL, //LLRenderPass::PASS_MATERIAL_ALPHA, LLRenderPass::PASS_MATERIAL_ALPHA_MASK, - LLRenderPass::PASS_MATERIAL_ALPHA_GLOW, + LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, LLRenderPass::PASS_SPECMAP, //LLRenderPass::PASS_SPECMAP_BLEND, LLRenderPass::PASS_SPECMAP_MASK, - LLRenderPass::PASS_SPECMAP_GLOW, + LLRenderPass::PASS_SPECMAP_EMISSIVE, LLRenderPass::PASS_NORMMAP, //LLRenderPass::PASS_NORMMAP_BLEND, LLRenderPass::PASS_NORMMAP_MASK, - LLRenderPass::PASS_NORMMAP_GLOW, + LLRenderPass::PASS_NORMMAP_EMISSIVE, LLRenderPass::PASS_NORMSPEC, //LLRenderPass::PASS_NORMSPEC_BLEND, LLRenderPass::PASS_NORMSPEC_MASK, - LLRenderPass::PASS_NORMSPEC_GLOW, + LLRenderPass::PASS_NORMSPEC_EMISSIVE, }; llassert(pass < sizeof(type_list)/sizeof(U32)); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f149c50884..becbbbc3a4 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4167,6 +4167,15 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, LLVector4 specColor(spec, spec, spec, spec); draw_info->mSpecColor = specColor; draw_info->mEnvIntensity = spec; + + if (type == LLRenderPass::PASS_GRASS) + { + draw_info->mAlphaMaskCutoff = 0.5f; + } + else + { + draw_info->mAlphaMaskCutoff = 0.33f; + } } if (type == LLRenderPass::PASS_ALPHA) @@ -5155,33 +5164,51 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: if (mat && LLPipeline::sRenderDeferred && !hud_group) { - U32 pass[] = + if (fullbright) { - LLRenderPass::PASS_MATERIAL, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA, - LLRenderPass::PASS_MATERIAL_ALPHA_MASK, - LLRenderPass::PASS_MATERIAL_ALPHA_GLOW, - LLRenderPass::PASS_SPECMAP, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND, - LLRenderPass::PASS_SPECMAP_MASK, - LLRenderPass::PASS_SPECMAP_GLOW, - LLRenderPass::PASS_NORMMAP, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND, - LLRenderPass::PASS_NORMMAP_MASK, - LLRenderPass::PASS_NORMMAP_GLOW, - LLRenderPass::PASS_NORMSPEC, - LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND, - LLRenderPass::PASS_NORMSPEC_MASK, - LLRenderPass::PASS_NORMSPEC_GLOW, - }; - - U32 mask = mat->getShaderMask(); - - llassert(mask < sizeof(pass)/sizeof(U32)); - - mask = llmin(mask, sizeof(pass)/sizeof(U32)-1); - - registerFace(group, facep, pass[mask]); + if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + } + else if (is_alpha) + { + registerFace(group, facep, LLRenderPass::PASS_ALPHA); + } + else + { + registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT); + } + } + else + { + U32 pass[] = + { + LLRenderPass::PASS_MATERIAL, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_MATERIAL_ALPHA, + LLRenderPass::PASS_MATERIAL_ALPHA_MASK, + LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE, + LLRenderPass::PASS_SPECMAP, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_SPECMAP_BLEND, + LLRenderPass::PASS_SPECMAP_MASK, + LLRenderPass::PASS_SPECMAP_EMISSIVE, + LLRenderPass::PASS_NORMMAP, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMMAP_BLEND, + LLRenderPass::PASS_NORMMAP_MASK, + LLRenderPass::PASS_NORMMAP_EMISSIVE, + LLRenderPass::PASS_NORMSPEC, + LLRenderPass::PASS_ALPHA, //LLRenderPass::PASS_NORMSPEC_BLEND, + LLRenderPass::PASS_NORMSPEC_MASK, + LLRenderPass::PASS_NORMSPEC_EMISSIVE, + }; + + U32 mask = mat->getShaderMask(); + + llassert(mask < sizeof(pass)/sizeof(U32)); + + mask = llmin(mask, sizeof(pass)/sizeof(U32)-1); + + registerFace(group, facep, pass[mask]); + } } else if (is_alpha) { diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c5fedab8c0..93ab8669b2 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -1643,8 +1643,19 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima case 1: alpha = true; // Material's alpha mode is set to blend. Toss it into the alpha draw pool. break; - default: - alpha = false; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool. + case 0: //alpha mode set to none, never go to alpha pool + case 3: //alpha mode set to emissive, never go to alpha pool + alpha = false; + break; + default: //alpha mode set to "mask", go to alpha pool if fullbright + if (te->getFullbright()) + { + alpha = true; + } + else + { + alpha = false; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool. + } break; } } |