D3D 2D code refactored but not tested yet.

This commit is contained in:
Christoph Oelckers 2018-03-29 23:21:25 +02:00
commit 811d96e07e
68 changed files with 309 additions and 266 deletions

View file

@ -140,7 +140,19 @@ bool F2DDrawer::SetStyle(FTexture *tex, DrawParms &parms, PalEntry &vertexcolor,
parms.fillcolor.r = 255 - parms.fillcolor.r;
parms.fillcolor.g = 255 - parms.fillcolor.g;
parms.fillcolor.b = 255 - parms.fillcolor.b;
style.Flags &= ~STYLEF_InvertSource;
}
if (parms.desaturate > 0)
{
// Desaturation can also be computed here without having to do it in the shader.
auto gray = parms.fillcolor.Luminance();
auto notgray = 255 - gray;
parms.fillcolor.r = uint8_t((parms.fillcolor.r * notgray + gray * 255) / 255);
parms.fillcolor.g = uint8_t((parms.fillcolor.g * notgray + gray * 255) / 255);
parms.fillcolor.b = uint8_t((parms.fillcolor.b * notgray + gray * 255) / 255);
parms.desaturate = 0;
}
// Set up the color mod to replace the color from the image data.
vertexcolor.r = parms.fillcolor.r;
vertexcolor.g = parms.fillcolor.g;
@ -236,6 +248,8 @@ void F2DDrawer::SetColorOverlay(PalEntry color, float alpha, PalEntry &vertexcol
void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
{
if (parms.style.BlendOp == STYLEOP_None) return; // not supposed to be drawn.
double xscale = parms.destwidth / parms.texwidth;
double yscale = parms.destheight / parms.texheight;
double x = parms.x - parms.left * xscale;