- adjustments and fixes for alphatextures:

* Instead of using the red channel it now uses the grayscale value. While slower in a few situations, it is also more precise and makes the feature more useful.
* For paletted textures do not use the index as alpha anymore but the actual grayscaled color. This is again to make the feature more consistent and useful.
* To compensate for the above there is now a list of hashes for known alpha textures in patch format, so that they don't get broken.
* IMGZ is now considered a grayscale format. There's only two known textures that use IMGZ for something else than crosshairs and those are explicitly handled.
* several smaller fixes.
* the actual color conversion functions for paletted output are now consolidated in a small number of inlines so that future changes are easier to do.

Note: This hasn't been tested yet and will need further changes in the hardware rendering code. As it is it is not production-ready.
This commit is contained in:
Christoph Oelckers 2018-03-22 00:29:01 +01:00
commit b473838627
18 changed files with 220 additions and 104 deletions

View file

@ -416,13 +416,6 @@ uint8_t *FMultiPatchTexture::MakeTexture (FRenderStyle style)
if (style.Flags & STYLEF_RedIsAlpha)
{
// The rules here are as follows:
// A texture uses its palette index as alpha only if it reports to use the base palette.
// In summary this means:
// If a texture is marked 'complex', it will use the red channel.
// If a texture uses non-base-palette patches, it will use the red channel for all pixels, even those coming from a base palette patch.
// If a texture only uses base-palette patches and no compositing effects it will use the palette index.
//
buildrgb = !UseBasePalette();
}
else
@ -449,8 +442,7 @@ uint8_t *FMultiPatchTexture::MakeTexture (FRenderStyle style)
{
trans = GetBlendMap(Parts[i].Blend, blendwork);
}
Parts[i].Texture->CopyToBlock (Pixels, Width, Height,
Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans, style);
Parts[i].Texture->CopyToBlock (Pixels, Width, Height, Parts[i].OriginX, Parts[i].OriginY, Parts[i].Rotate, trans, style);
}
}
}
@ -469,7 +461,7 @@ uint8_t *FMultiPatchTexture::MakeTexture (FRenderStyle style)
{
if (*out == 0 && in[3] != 0)
{
*out = (style.Flags & STYLEF_RedIsAlpha)? in[2]*in[3] : RGB256k.RGB[in[2]>>2][in[1]>>2][in[0]>>2];
*out = RGBToPalette(style, in[2], in[1], in[0]);
}
out += Height;
in += 4;