The alpha cutoff of partially damaged structures is clamped above 0.2. Now the damage effect is always visible on walls that have received any damage.

This commit is contained in:
Joonas Rikkonen
2018-01-12 15:43:34 +02:00
parent 10db837ef0
commit 87d987037f
@@ -146,7 +146,8 @@ namespace Barotrauma
{ {
if (damageEffect != null) if (damageEffect != null)
{ {
float newCutoff = Math.Min((sections[i].damage / prefab.Health), 0.65f); float newCutoff = sections[i].damage > 0 ?
MathHelper.Lerp(0.2f, 0.65f, sections[i].damage / prefab.Health) : 0.0f;
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor) if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
{ {
@@ -154,7 +155,6 @@ namespace Barotrauma
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f); damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
damageEffect.Parameters["inColor"].SetValue(color.ToVector4()); damageEffect.Parameters["inColor"].SetValue(color.ToVector4());
damageEffect.CurrentTechnique.Passes[0].Apply(); damageEffect.CurrentTechnique.Passes[0].Apply();
Submarine.DamageEffectCutoff = newCutoff; Submarine.DamageEffectCutoff = newCutoff;