mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-03-03 15:21:19 +00:00
- Add missing DrawTextureTags.
DTA_FlipY, DTA_SrcX, DTA_SrcY, DTA_SrcWidth and DTA_SrcHeight.
This commit is contained in:
parent
7d20e74603
commit
796c25b056
7 changed files with 58 additions and 4 deletions
|
@ -101,10 +101,10 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
||||||
if (pal) dg.mTranslation = -pal->GetIndex();
|
if (pal) dg.mTranslation = -pal->GetIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u1 = gltex->GetUL();
|
u1 = parms.srcx;
|
||||||
v1 = gltex->GetVT();
|
v1 = parms.srcy;
|
||||||
u2 = gltex->GetUR();
|
u2 = parms.srcx + parms.srcwidth;
|
||||||
v2 = gltex->GetVB();
|
v2 = parms.srcy + parms.srcheight;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -119,6 +119,8 @@ void F2DDrawer::AddTexture(FTexture *img, DrawParms &parms)
|
||||||
if (parms.flipX)
|
if (parms.flipX)
|
||||||
std::swap(u1, u2);
|
std::swap(u1, u2);
|
||||||
|
|
||||||
|
if (parms.flipY)
|
||||||
|
std::swap(v1, v2);
|
||||||
|
|
||||||
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2778,6 +2778,10 @@ void OpenGLSWFrameBuffer::DrawTextureParms(FTexture *img, DrawParms &parms)
|
||||||
{
|
{
|
||||||
swapvalues(u0, u1);
|
swapvalues(u0, u1);
|
||||||
}
|
}
|
||||||
|
if (parms.flipY)
|
||||||
|
{
|
||||||
|
swapvalues(v0, v1);
|
||||||
|
}
|
||||||
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
||||||
{
|
{
|
||||||
double wi = MIN(parms.windowright, parms.texwidth);
|
double wi = MIN(parms.windowright, parms.texwidth);
|
||||||
|
|
|
@ -170,6 +170,12 @@ void SWCanvas::DrawTexture(DCanvas *canvas, FTexture *img, DrawParms &parms)
|
||||||
xiscale = -xiscale;
|
xiscale = -xiscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (parms.flipY)
|
||||||
|
{
|
||||||
|
frac = (img->GetHeight() << FRACBITS) - 1;
|
||||||
|
iyscale = -iyscale;
|
||||||
|
}
|
||||||
|
|
||||||
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
||||||
{
|
{
|
||||||
double wi = MIN(parms.windowright, parms.texwidth);
|
double wi = MIN(parms.windowright, parms.texwidth);
|
||||||
|
|
|
@ -622,6 +622,7 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
|
||||||
parms->colorOverlay = 0;
|
parms->colorOverlay = 0;
|
||||||
parms->alphaChannel = false;
|
parms->alphaChannel = false;
|
||||||
parms->flipX = false;
|
parms->flipX = false;
|
||||||
|
parms->flipY = false;
|
||||||
parms->color = 0xffffffff;
|
parms->color = 0xffffffff;
|
||||||
//parms->shadowAlpha = 0;
|
//parms->shadowAlpha = 0;
|
||||||
parms->shadowColor = 0;
|
parms->shadowColor = 0;
|
||||||
|
@ -638,6 +639,10 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
|
||||||
parms->cellx = parms->celly = 0;
|
parms->cellx = parms->celly = 0;
|
||||||
parms->maxstrlen = INT_MAX;
|
parms->maxstrlen = INT_MAX;
|
||||||
parms->virtBottom = false;
|
parms->virtBottom = false;
|
||||||
|
parms->srcx = 0.;
|
||||||
|
parms->srcy = 0.;
|
||||||
|
parms->srcwidth = 1.;
|
||||||
|
parms->srcheight = 1.;
|
||||||
parms->monospace = EMonospacing::MOff;
|
parms->monospace = EMonospacing::MOff;
|
||||||
parms->spacing = 0;
|
parms->spacing = 0;
|
||||||
parms->fsscalemode = -1;
|
parms->fsscalemode = -1;
|
||||||
|
@ -834,6 +839,26 @@ bool DCanvas::ParseDrawTextureTags(FTexture *img, double x, double y, uint32_t t
|
||||||
parms->flipX = ListGetInt(tags);
|
parms->flipX = ListGetInt(tags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DTA_FlipY:
|
||||||
|
parms->flipY = ListGetInt(tags);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DTA_SrcX:
|
||||||
|
parms->srcx = ListGetDouble(tags) / img->GetScaledWidthDouble();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DTA_SrcY:
|
||||||
|
parms->srcy = ListGetDouble(tags) / img->GetScaledHeightDouble();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DTA_SrcWidth:
|
||||||
|
parms->srcwidth = ListGetDouble(tags) / img->GetScaledWidthDouble();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DTA_SrcHeight:
|
||||||
|
parms->srcheight = ListGetDouble(tags) / img->GetScaledHeightDouble();
|
||||||
|
break;
|
||||||
|
|
||||||
case DTA_TopOffset:
|
case DTA_TopOffset:
|
||||||
assert(fortext == false);
|
assert(fortext == false);
|
||||||
if (fortext) return false;
|
if (fortext) return false;
|
||||||
|
|
|
@ -149,6 +149,11 @@ enum
|
||||||
|
|
||||||
// New additions.
|
// New additions.
|
||||||
DTA_Color,
|
DTA_Color,
|
||||||
|
DTA_FlipY, // bool: flip image vertically
|
||||||
|
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
|
||||||
|
DTA_SrcY,
|
||||||
|
DTA_SrcWidth,
|
||||||
|
DTA_SrcHeight,
|
||||||
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
|
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
|
||||||
DTA_Spacing, // Strings only: Additional spacing between characters
|
DTA_Spacing, // Strings only: Additional spacing between characters
|
||||||
DTA_Monospace, // Fonts only: Use a fixed distance between characters.
|
DTA_Monospace, // Fonts only: Use a fixed distance between characters.
|
||||||
|
@ -202,6 +207,7 @@ struct DrawParms
|
||||||
PalEntry color;
|
PalEntry color;
|
||||||
INTBOOL alphaChannel;
|
INTBOOL alphaChannel;
|
||||||
INTBOOL flipX;
|
INTBOOL flipX;
|
||||||
|
INTBOOL flipY;
|
||||||
//float shadowAlpha;
|
//float shadowAlpha;
|
||||||
int shadowColor;
|
int shadowColor;
|
||||||
INTBOOL keepratio;
|
INTBOOL keepratio;
|
||||||
|
@ -217,6 +223,8 @@ struct DrawParms
|
||||||
int maxstrlen;
|
int maxstrlen;
|
||||||
bool fortext;
|
bool fortext;
|
||||||
bool virtBottom;
|
bool virtBottom;
|
||||||
|
double srcx, srcy;
|
||||||
|
double srcwidth, srcheight;
|
||||||
bool burn;
|
bool burn;
|
||||||
int8_t fsscalemode;
|
int8_t fsscalemode;
|
||||||
};
|
};
|
||||||
|
|
|
@ -2829,6 +2829,10 @@ void D3DFB::DrawTextureParms (FTexture *img, DrawParms &parms)
|
||||||
{
|
{
|
||||||
swapvalues(u0, u1);
|
swapvalues(u0, u1);
|
||||||
}
|
}
|
||||||
|
if (parms.flipY)
|
||||||
|
{
|
||||||
|
swapvalues(v0, v1);
|
||||||
|
}
|
||||||
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
if (parms.windowleft > 0 || parms.windowright < parms.texwidth)
|
||||||
{
|
{
|
||||||
double wi = MIN(parms.windowright, parms.texwidth);
|
double wi = MIN(parms.windowright, parms.texwidth);
|
||||||
|
|
|
@ -175,6 +175,11 @@ enum DrawTextureTags
|
||||||
DTA_CellY, // vertical size of character cell
|
DTA_CellY, // vertical size of character cell
|
||||||
|
|
||||||
DTA_Color,
|
DTA_Color,
|
||||||
|
DTA_FlipY, // bool: flip image vertically
|
||||||
|
DTA_SrcX, // specify a source rectangle (this supersedes the poorly implemented DTA_WindowLeft/Right
|
||||||
|
DTA_SrcY,
|
||||||
|
DTA_SrcWidth,
|
||||||
|
DTA_SrcHeight,
|
||||||
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
|
DTA_LegacyRenderStyle, // takes an old-style STYLE_* constant instead of an FRenderStyle
|
||||||
DTA_Spacing, // Strings only: Additional spacing between characters
|
DTA_Spacing, // Strings only: Additional spacing between characters
|
||||||
DTA_Monospace, // Strings only: Use a fixed distance between characters.
|
DTA_Monospace, // Strings only: Use a fixed distance between characters.
|
||||||
|
|
Loading…
Reference in a new issue