- split out the span generation from most texture classes

Until now each subclass of FTexture had to implement the entire span generation itself, presumably so that a few classes can use simpler structures.
This does not work if a texture can have more than one pixel buffer as is needed for alpha textures.
Even though it means that some classes will allocate more data now, it's the only way to do it properly.
In addition this removes a significant amount of mostly redundant code from the texture classes.

- added alpha texture processing to all converted classes

As of now this is not active and not tested.
Note that as part of the conversion even those textures that were working as alphatextures will not look correct until the higher level code gets adjusted.
This commit is contained in:
Christoph Oelckers 2018-03-18 12:36:14 +01:00
commit 7e169eb76f
21 changed files with 484 additions and 1416 deletions

View file

@ -248,10 +248,6 @@ void FTexture::CalcBitSize ()
HeightBits = i;
}
void FTexture::HackHack (int newheight)
{
}
FTexture::Span **FTexture::CreateSpans (const uint8_t *pixels) const
{
Span **spans, *span;
@ -554,14 +550,15 @@ void FTexture::GenerateBgraMipmapsFast()
}
}
void FTexture::CopyToBlock (uint8_t *dest, int dwidth, int dheight, int xpos, int ypos, int rotate, const uint8_t *translation)
void FTexture::CopyToBlock (uint8_t *dest, int dwidth, int dheight, int xpos, int ypos, int rotate, const uint8_t *translation, FRenderStyle style)
{
const uint8_t *pixels = GetPixels();
const uint8_t *pixels = GetPixels(/*style*/);
int srcwidth = Width;
int srcheight = Height;
int step_x = Height;
int step_y = 1;
FClipRect cr = {0, 0, dwidth, dheight};
if (style.Flags & STYLEF_RedIsAlpha) translation = nullptr; // do not apply translations to alpha textures.
if (ClipCopyPixelRect(&cr, xpos, ypos, pixels, srcwidth, srcheight, step_x, step_y, rotate))
{