NORSPEC-162 Fix for objects with materials set ignoring "tranparency %" value.
parent
df6bb7ace2
commit
18e3985120
|
|
@ -186,12 +186,19 @@ bool LLMaterial::operator != (const LLMaterial& rhs) const
|
|||
}
|
||||
|
||||
|
||||
U32 LLMaterial::getShaderMask()
|
||||
U32 LLMaterial::getShaderMask(U32 alpha_mode)
|
||||
{ //NEVER incorporate this value into the message system -- this function will vary depending on viewer implementation
|
||||
U32 ret = 0;
|
||||
|
||||
//two least significant bits are "diffuse alpha mode"
|
||||
ret = getDiffuseAlphaMode();
|
||||
if (alpha_mode != DIFFUSE_ALPHA_MODE_DEFAULT)
|
||||
{
|
||||
ret = alpha_mode;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = getDiffuseAlphaMode();
|
||||
}
|
||||
|
||||
llassert(ret < SHADER_COUNT);
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,8 @@ public:
|
|||
DIFFUSE_ALPHA_MODE_NONE = 0,
|
||||
DIFFUSE_ALPHA_MODE_BLEND = 1,
|
||||
DIFFUSE_ALPHA_MODE_MASK = 2,
|
||||
DIFFUSE_ALPHA_MODE_EMISSIVE = 3
|
||||
DIFFUSE_ALPHA_MODE_EMISSIVE = 3,
|
||||
DIFFUSE_ALPHA_MODE_DEFAULT = 4,
|
||||
} eDiffuseAlphaMode;
|
||||
|
||||
typedef enum
|
||||
|
|
@ -100,7 +101,7 @@ public:
|
|||
bool operator == (const LLMaterial& rhs) const;
|
||||
bool operator != (const LLMaterial& rhs) const;
|
||||
|
||||
U32 getShaderMask();
|
||||
U32 getShaderMask(U32 alpha_mode = DIFFUSE_ALPHA_MODE_DEFAULT);
|
||||
|
||||
protected:
|
||||
LLUUID mNormalID;
|
||||
|
|
|
|||
|
|
@ -481,7 +481,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask)
|
|||
|
||||
if (!params.mFullbright && deferred_render && mat)
|
||||
{
|
||||
U32 mask = mat->getShaderMask();
|
||||
U32 mask = params.mShaderMask;
|
||||
|
||||
llassert(mask < LLMaterial::SHADER_COUNT);
|
||||
target_shader = &(gDeferredMaterialProgram[mask]);
|
||||
|
|
|
|||
|
|
@ -4634,6 +4634,7 @@ LLDrawInfo::LLDrawInfo(U16 start, U16 end, U32 count, U32 offset,
|
|||
mDistance(0.f),
|
||||
mDrawMode(LLRender::TRIANGLES),
|
||||
mMaterial(NULL),
|
||||
mShaderMask(0),
|
||||
mSpecColor(1.0f, 1.0f, 1.0f, 0.5f),
|
||||
mEnvIntensity(0.0f),
|
||||
mAlphaMaskCutoff(0.5f),
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@ public:
|
|||
LL_ALIGN_16(LLFace* mFace); //associated face
|
||||
F32 mDistance;
|
||||
U32 mDrawMode;
|
||||
|
||||
LLMaterialPtr mMaterial; // If this is null, the following parameters are unused.
|
||||
U32 mShaderMask;
|
||||
LLPointer<LLViewerTexture> mSpecularMap;
|
||||
const LLMatrix4* mSpecularMapMatrix;
|
||||
LLPointer<LLViewerTexture> mNormalMap;
|
||||
|
|
|
|||
|
|
@ -4088,6 +4088,21 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
|
||||
bool batchable = false;
|
||||
|
||||
U32 shader_mask = 0xFFFFFFFF; //no shader
|
||||
|
||||
if (mat)
|
||||
{
|
||||
if (type == LLRenderPass::PASS_ALPHA)
|
||||
{
|
||||
shader_mask = mat->getShaderMask(LLMaterial::DIFFUSE_ALPHA_MODE_BLEND);
|
||||
}
|
||||
else
|
||||
{
|
||||
shader_mask = mat->getShaderMask();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (index < 255 && idx >= 0)
|
||||
{
|
||||
if (mat || draw_vec[idx]->mMaterial)
|
||||
|
|
@ -4124,7 +4139,8 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
draw_vec[idx]->mBump == bump &&
|
||||
draw_vec[idx]->mTextureMatrix == tex_mat &&
|
||||
draw_vec[idx]->mModelMatrix == model_mat &&
|
||||
draw_vec[idx]->mMaterial == mat)
|
||||
draw_vec[idx]->mMaterial == mat &&
|
||||
draw_vec[idx]->mShaderMask == shader_mask)
|
||||
{
|
||||
draw_vec[idx]->mCount += facep->getIndicesCount();
|
||||
draw_vec[idx]->mEnd += facep->getGeomCount();
|
||||
|
|
@ -4152,10 +4168,11 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep,
|
|||
draw_vec.push_back(draw_info);
|
||||
draw_info->mTextureMatrix = tex_mat;
|
||||
draw_info->mModelMatrix = model_mat;
|
||||
if (mat && LLPipeline::sRenderBump && LLPipeline::sRenderDeferred)
|
||||
if (mat)
|
||||
{
|
||||
// We have a material. Update our draw info accordingly.
|
||||
draw_info->mMaterial = mat;
|
||||
draw_info->mShaderMask = shader_mask;
|
||||
LLVector4 specColor;
|
||||
specColor.mV[0] = mat->getSpecularLightColor().mV[0] * (1.f / 255.f);
|
||||
specColor.mV[1] = mat->getSpecularLightColor().mV[1] * (1.f / 255.f);
|
||||
|
|
@ -5280,6 +5297,10 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, std::
|
|||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_SIMPLE);
|
||||
}
|
||||
else if (te->getColor().mV[3] < 0.999f)
|
||||
{
|
||||
registerFace(group, facep, LLRenderPass::PASS_ALPHA);
|
||||
}
|
||||
else
|
||||
{
|
||||
U32 pass[] =
|
||||
|
|
|
|||
|
|
@ -1660,7 +1660,8 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool alpha = te->getColor().mV[3] < 0.999f;
|
||||
bool color_alpha = te->getColor().mV[3] < 0.999f;
|
||||
bool alpha = color_alpha;
|
||||
if (imagep)
|
||||
{
|
||||
alpha = alpha || (imagep->getComponents() == 4 && imagep->getType() != LLViewerTexture::MEDIA_TEXTURE) || (imagep->getComponents() == 2);
|
||||
|
|
@ -1675,10 +1676,10 @@ U32 LLPipeline::getPoolTypeFromTE(const LLTextureEntry* te, LLViewerTexture* ima
|
|||
break;
|
||||
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;
|
||||
alpha = color_alpha;
|
||||
break;
|
||||
default: //alpha mode set to "mask", go to alpha pool if fullbright
|
||||
alpha = false; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool.
|
||||
alpha = color_alpha; // Material's alpha mode is set to none, mask, or emissive. Toss it into the opaque material draw pool.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue