Additive blending fixes:

- Consider blend mode when comparing materials
- Enable additive blending even when opacity = 1
ver1_5_1
Chris Laurel 2007-04-23 16:28:07 +00:00
parent 9d3fecdb11
commit 35696e1dcd
2 changed files with 17 additions and 3 deletions

View File

@ -246,6 +246,14 @@ operator<(const Mesh::Material& m0, const Mesh::Material& m1)
else if (m0.opacity > m1.opacity)
return false;
// Reverse sense of comparison here--additive blending is 1, normal
// blending is 0, and we'd prefer to render additively blended submeshes
// last.
if (m0.blend > m1.blend)
return true;
else if (m0.blend < m1.blend)
return false;
if (m0.diffuse < m1.diffuse)
return true;
else if (m1.diffuse < m0.diffuse)

View File

@ -217,7 +217,9 @@ FixedFunctionRenderContext::makeCurrent(const Mesh::Material& m)
}
Mesh::BlendMode newBlendMode = Mesh::InvalidBlend;
if (m.opacity != 1.0f || (t != NULL && t->hasAlpha()))
if (m.opacity != 1.0f ||
m.blend == Mesh::AdditiveBlend ||
(t != NULL && t->hasAlpha()))
{
newBlendMode = m.blend;
}
@ -657,7 +659,9 @@ GLSL_RenderContext::makeCurrent(const Mesh::Material& m)
}
Mesh::BlendMode newBlendMode = Mesh::InvalidBlend;
if (m.opacity != 1.0f || (baseTex != NULL && baseTex->hasAlpha()))
if (m.opacity != 1.0f ||
m.blend == Mesh::AdditiveBlend ||
(baseTex != NULL && baseTex->hasAlpha()))
{
newBlendMode = m.blend;
}
@ -807,7 +811,9 @@ GLSLUnlit_RenderContext::makeCurrent(const Mesh::Material& m)
}
Mesh::BlendMode newBlendMode = Mesh::InvalidBlend;
if (m.opacity != 1.0f || (baseTex != NULL && baseTex->hasAlpha()))
if (m.opacity != 1.0f ||
m.blend == Mesh::AdditiveBlend ||
(baseTex != NULL && baseTex->hasAlpha()))
{
newBlendMode = m.blend;
}