- implemented shade level based depth fading for the true color renderer.

This commit is contained in:
Christoph Oelckers 2019-10-19 16:35:06 +02:00
parent cd7bbe35a8
commit e2f9e12efb
2 changed files with 10 additions and 6 deletions

View File

@ -262,16 +262,17 @@ void PaletteManager::BindPalswap(int index)
if (uindex != lastsindex)
{
lastsindex = uindex;
if (palswaps[uindex].swaptexture == nullptr)
auto& ps = palswaps[uindex];
if (ps.swaptexture == nullptr)
{
auto p = GLInterface.NewTexture();
p->CreateTexture(256, numshades, true, false);
p->LoadTexture((uint8_t*)palswaps[uindex].lookup);
p->LoadTexture((uint8_t*)ps.lookup);
p->SetSampler(Sampler2DNoFilter);
palswaps[uindex].swaptexture = p;
ps.swaptexture = p;
}
inst->BindTexture(1, palswaps[uindex].swaptexture);
inst->SetFadeColor(palswaps[index].fadeColor);
inst->BindTexture(1, ps.swaptexture);
inst->SetFadeColor(ps.fadeColor);
}
}

View File

@ -183,7 +183,10 @@ void main()
else
{
color.rgb *= detailColor.rgb;
// todo: For True Color, calculate a shade value from the table and apply that to the color directly.
shade = clamp(shade / (u_numShades-2), 0.0, 1.0);
// Apply the shade as a linear depth fade ramp.
color.rgb = mix(color.rgb, u_fogColor.rgb, shade);
}
if (fullbright == 0.0) color.rgb *= v_color.rgb;
color.a *= v_color.a;