Skip to content

Commit

Permalink
D3D 2D code refactored but not tested yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Mar 29, 2018
1 parent a40e085 commit 811d96e
Show file tree
Hide file tree
Showing 68 changed files with 282 additions and 219 deletions.
1 change: 0 additions & 1 deletion src/gl/renderer/gl_renderer.cpp
Expand Up @@ -486,7 +486,6 @@ class F2DVertexBuffer : public FSimpleVertexBuffer

void FGLRenderer::Draw2D(F2DDrawer *drawer)
{
F2DDrawer::EDrawType lasttype = F2DDrawer::DrawTypeTriangles;
auto &vertices = drawer->mVertices;
auto &indices = drawer->mIndices;
auto &commands = drawer->mData;
Expand Down
14 changes: 14 additions & 0 deletions src/v_2ddrawer.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/v_video.h
Expand Up @@ -79,7 +79,7 @@ enum
DTA_DestWidth, // width of area to draw to
DTA_DestHeight, // height of area to draw to
DTA_Alpha, // alpha value for translucency
DTA_FillColor, // color to stencil onto the destination (RGB is the color for truecolor drawers, A is the palette index for paletted drawers)
DTA_FillColor, // color to stencil onto the destination
DTA_TranslationIndex, // translation table to recolor the source
DTA_AlphaChannel, // bool: the source is an alpha channel; used with DTA_FillColor
DTA_Clean, // bool: scale texture size and position by CleanXfac and CleanYfac
Expand Down

0 comments on commit 811d96e

Please sign in to comment.