diff options
author | Dave Parks <davep@lindenlab.com> | 2013-05-29 18:48:09 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2013-05-29 18:48:09 -0500 |
commit | 743d1a777e5c2827d50051c3f5e0942a870a6ff9 (patch) | |
tree | 67f264a5c799003a0eaebcd5e729c315f53a42bc /indra/newview/llvovolume.cpp | |
parent | e6de3d6232a12ace8f669abd4ede4c6f586046df (diff) |
NORSPEC-198, NORSPEC-176, NORSPEC-106, NORSPEC-202 et al -- Material matrix testing based overhaul WIP
Reviewed by Graham
Diffstat (limited to 'indra/newview/llvovolume.cpp')
-rwxr-xr-x | indra/newview/llvovolume.cpp | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 3aef88ed94..367edd21c6 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4534,34 +4534,46 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLMaterial* mat = te->getMaterialParams().get(); - if (mat) + if (mat && LLPipeline::sRenderDeferred) { - if (te->getFullbright()) + U8 alpha_mode = mat->getDiffuseAlphaMode(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA && + (alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND || + te->getColor().mV[3] < 0.999f); + + if (is_alpha) + { //this face needs alpha blending, override alpha mode + alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + U32 mask = mat->getShaderMask(alpha_mode); + pool->addRiggedFace(facep, mask); + } + else if (mat) + { + bool fullbright = te->getFullbright(); + bool is_alpha = type == LLDrawPool::POOL_ALPHA; + U8 mode = mat->getDiffuseAlphaMode(); + bool can_be_shiny = mode == LLMaterial::DIFFUSE_ALPHA_MODE_NONE || + mode == LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE; + + if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK && te->getColor().mV[3] >= 0.999f) { - if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA); - } - else if (type == LLDrawPool::POOL_ALPHA) - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_ALPHA); - } - else - { - pool->addRiggedFace(facep, LLDrawPoolAvatar::RIGGED_FULLBRIGHT); - } + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE); + } + else if (is_alpha || (te->getColor().mV[3] < 0.999f)) + { + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_ALPHA : LLDrawPoolAvatar::RIGGED_ALPHA); } - else if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + else if (gPipeline.canUseVertexShaders() + && LLPipeline::sRenderBump + && te->getShiny() + && can_be_shiny) { - // This feels unclean, but is the only way to get alpha masked rigged stuff to show up - // with masking correctly in both deferred and non-deferred paths. NORSPEC-191 - // - pool->addRiggedFace(facep, LLPipeline::sRenderDeferred ? LLDrawPoolAvatar::RIGGED_MATERIAL_ALPHA_MASK : LLDrawPoolAvatar::RIGGED_ALPHA); + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT_SHINY : LLDrawPoolAvatar::RIGGED_SHINY); } else { - U32 mask = mat->getShaderMask(); - pool->addRiggedFace(facep, mask); + pool->addRiggedFace(facep, fullbright ? LLDrawPoolAvatar::RIGGED_FULLBRIGHT : LLDrawPoolAvatar::RIGGED_SIMPLE); } } else @@ -5321,14 +5333,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: { if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { - if (mat->getEnvironmentIntensity() > 0 || - te->getShiny() > 0) + if (te->getColor().mV[3] >= 0.999f) { material_pass = true; } else { - registerFace(group, facep, LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK); + registerFace(group, facep, LLRenderPass::PASS_ALPHA); } } else if (is_alpha) @@ -5394,7 +5405,13 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: } else if (mat) { - if (mat->getDiffuseAlphaMode() == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) + U8 mode = mat->getDiffuseAlphaMode(); + if (te->getColor().mV[3] < 0.999f) + { + mode = LLMaterial::DIFFUSE_ALPHA_MODE_BLEND; + } + + if (mode == LLMaterial::DIFFUSE_ALPHA_MODE_MASK) { registerFace(group, facep, fullbright ? LLRenderPass::PASS_FULLBRIGHT_ALPHA_MASK : LLRenderPass::PASS_ALPHA_MASK); } @@ -5533,7 +5550,7 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std:: llassert((mask & LLVertexBuffer::MAP_NORMAL) || fullbright); facep->setPoolType((fullbright) ? LLDrawPool::POOL_FULLBRIGHT : LLDrawPool::POOL_SIMPLE); - if (!force_simple && te->getBumpmap() && LLPipeline::sRenderBump) + if (!force_simple && te->getBumpmap() && !mat && LLPipeline::sRenderBump) { registerFace(group, facep, LLRenderPass::PASS_BUMP); } |