Truecolor sky: Draw opaque black background on transparent texels

Fixes HOM effect
This commit is contained in:
Cacodemon345 2024-09-12 00:25:52 +06:00 committed by Christoph Oelckers
parent ce24849adf
commit 38290b6615
4 changed files with 38 additions and 2 deletions

View file

@ -306,7 +306,8 @@ void FImageSource::EndPrecaching()
void FImageSource::RegisterForPrecache(FImageSource *img, bool requiretruecolor)
{
img->CollectForPrecache(precacheInfo, requiretruecolor);
if (img)
img->CollectForPrecache(precacheInfo, requiretruecolor);
}
//==========================================================================

View file

@ -1146,7 +1146,10 @@ void FTextureAnimator::UpdateAnimations (uint64_t mstime)
if (updated)
{
fire->texture->CleanHardwareData();
delete fire->texture->GetSoftwareTexture();
if (fire->texture->GetSoftwareTexture())
delete fire->texture->GetSoftwareTexture();
fire->texture->SetSoftwareTexture(nullptr);
}
}

View file

@ -64,6 +64,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
dest += pitch;
frac += fracstep;
}
@ -90,6 +92,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
uint32_t alpha = max(min(frac >> (16 - start_fade), 256), 0);
uint32_t inv_alpha = 256 - alpha;
@ -110,6 +114,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
frac += fracstep;
dest += pitch;
@ -121,6 +127,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
uint32_t alpha = max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0);
uint32_t inv_alpha = 256 - alpha;
@ -189,6 +197,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
*dest = fg;
@ -222,6 +232,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
uint32_t alpha = max(min(frac >> (16 - start_fade), 256), 0);
@ -245,6 +257,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
*dest = fg;
@ -262,6 +276,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
uint32_t alpha = max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0);

View file

@ -64,6 +64,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
dest += pitch;
frac += fracstep;
}
@ -90,6 +92,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
__m128i alpha = _mm_set1_epi16(max(min(frac >> (16 - start_fade), 256), 0));
__m128i inv_alpha = _mm_sub_epi16(_mm_set1_epi16(256), alpha);
@ -108,6 +112,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
*dest = source0[sample_index];
if (*dest == 0)
*dest |= 0xff000000;
frac += fracstep;
dest += pitch;
@ -119,6 +125,8 @@ namespace swrenderer
{
uint32_t sample_index = (((((uint32_t)frac) << 8) >> FRACBITS) * textureheight0) >> FRACBITS;
uint32_t fg = source0[sample_index];
if (fg == 0)
fg |= 0xff000000;
__m128i alpha = _mm_set1_epi16(max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0));
__m128i inv_alpha = _mm_sub_epi16(_mm_set1_epi16(256), alpha);
@ -173,6 +181,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
*dest = fg;
@ -218,6 +228,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
__m128i alpha = _mm_set1_epi16(max(min(frac >> (16 - start_fade), 256), 0));
@ -241,6 +253,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
*dest = fg;
@ -258,6 +272,8 @@ namespace swrenderer
{
uint32_t sample_index2 = min(sample_index, maxtextureheight1);
fg = source1[sample_index2];
if (fg == 0)
fg |= 0xff000000;
}
__m128i alpha = _mm_set1_epi16(max(min(((2 << 24) - frac) >> (16 - start_fade), 256), 0));