diff --git a/source/glbackend/gl_palmanager.cpp b/source/glbackend/gl_palmanager.cpp index fbb286476..a6afd32d0 100644 --- a/source/glbackend/gl_palmanager.cpp +++ b/source/glbackend/gl_palmanager.cpp @@ -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); } } diff --git a/wadsrc/static/demolition/shaders/glsl/polymost.fp b/wadsrc/static/demolition/shaders/glsl/polymost.fp index 18bd37048..ae4fb1a2d 100644 --- a/wadsrc/static/demolition/shaders/glsl/polymost.fp +++ b/wadsrc/static/demolition/shaders/glsl/polymost.fp @@ -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;