mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- implemented shade level based depth fading for the true color renderer.
This commit is contained in:
parent
cd7bbe35a8
commit
e2f9e12efb
2 changed files with 10 additions and 6 deletions
|
@ -262,16 +262,17 @@ void PaletteManager::BindPalswap(int index)
|
||||||
if (uindex != lastsindex)
|
if (uindex != lastsindex)
|
||||||
{
|
{
|
||||||
lastsindex = uindex;
|
lastsindex = uindex;
|
||||||
if (palswaps[uindex].swaptexture == nullptr)
|
auto& ps = palswaps[uindex];
|
||||||
|
if (ps.swaptexture == nullptr)
|
||||||
{
|
{
|
||||||
auto p = GLInterface.NewTexture();
|
auto p = GLInterface.NewTexture();
|
||||||
p->CreateTexture(256, numshades, true, false);
|
p->CreateTexture(256, numshades, true, false);
|
||||||
p->LoadTexture((uint8_t*)palswaps[uindex].lookup);
|
p->LoadTexture((uint8_t*)ps.lookup);
|
||||||
p->SetSampler(Sampler2DNoFilter);
|
p->SetSampler(Sampler2DNoFilter);
|
||||||
palswaps[uindex].swaptexture = p;
|
ps.swaptexture = p;
|
||||||
}
|
}
|
||||||
inst->BindTexture(1, palswaps[uindex].swaptexture);
|
inst->BindTexture(1, ps.swaptexture);
|
||||||
inst->SetFadeColor(palswaps[index].fadeColor);
|
inst->SetFadeColor(ps.fadeColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,10 @@ void main()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
color.rgb *= detailColor.rgb;
|
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;
|
if (fullbright == 0.0) color.rgb *= v_color.rgb;
|
||||||
color.a *= v_color.a;
|
color.a *= v_color.a;
|
||||||
|
|
Loading…
Reference in a new issue