mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-18 22:51:39 +00:00
- Added alpha parameter to DrawLine for the GL renderer, it's a fake parameter for the software renderer so mods don't crash.
This commit is contained in:
parent
7eef13c859
commit
557380a769
13 changed files with 26 additions and 24 deletions
|
@ -313,10 +313,10 @@ void F2DDrawer::AddFlatFill(int left, int top, int right, int bottom, FTexture *
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void F2DDrawer::AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color)
|
||||
void F2DDrawer::AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color, uint8_t alpha)
|
||||
{
|
||||
PalEntry p = palcolor == -1 || color != 0 ? (PalEntry)color : GPalette.BaseColors[palcolor];
|
||||
p.a = 255;
|
||||
p.a = alpha;
|
||||
std::swap(p.r, p.b);
|
||||
|
||||
DataGeneric dg;
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
double originx, double originy, double scalex, double scaley,
|
||||
DAngle rotation, const FColormap &colormap, PalEntry flatcolor, int lightlevel);
|
||||
|
||||
void AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color);
|
||||
void AddLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color, uint8_t alpha = 255);
|
||||
void AddPixel(int x1, int y1, int palcolor, uint32_t color);
|
||||
|
||||
void Draw();
|
||||
|
|
|
@ -397,10 +397,10 @@ void OpenGLFrameBuffer::DrawTextureParms(FTexture *img, DrawParms &parms)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void OpenGLFrameBuffer::DrawLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color)
|
||||
void OpenGLFrameBuffer::DrawLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color, uint8_t alpha)
|
||||
{
|
||||
if (GLRenderer != nullptr && GLRenderer->m2DDrawer != nullptr)
|
||||
GLRenderer->m2DDrawer->AddLine(x1, y1, x2, y2, palcolor, color);
|
||||
GLRenderer->m2DDrawer->AddLine(x1, y1, x2, y2, palcolor, color, alpha);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
|
||||
// 2D drawing
|
||||
void DrawTextureParms(FTexture *img, DrawParms &parms);
|
||||
void DrawLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color);
|
||||
void DrawLine(int x1, int y1, int x2, int y2, int palcolor, uint32_t color, uint8_t alpha = 255);
|
||||
void DrawPixel(int x1, int y1, int palcolor, uint32_t color);
|
||||
void DoClear(int left, int top, int right, int bottom, int palcolor, uint32_t color);
|
||||
void Dim(PalEntry color=0);
|
||||
|
|
|
@ -2655,11 +2655,11 @@ void OpenGLSWFrameBuffer::EndLineBatch()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void OpenGLSWFrameBuffer::DrawLine(int x0, int y0, int x1, int y1, int palcolor, uint32_t color)
|
||||
void OpenGLSWFrameBuffer::DrawLine(int x0, int y0, int x1, int y1, int palcolor, uint32_t color, uint8_t alpha)
|
||||
{
|
||||
if (In2D < 2)
|
||||
{
|
||||
Super::DrawLine(x0, y0, x1, y1, palcolor, color);
|
||||
Super::DrawLine(x0, y0, x1, y1, palcolor, color, alpha);
|
||||
return;
|
||||
}
|
||||
if (!InScene)
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
void DoClear(int left, int top, int right, int bottom, int palcolor, uint32_t color) override;
|
||||
void DoDim(PalEntry color, float amount, int x1, int y1, int w, int h) override;
|
||||
void FlatFill(int left, int top, int right, int bottom, FTexture *src, bool local_origin) override;
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor) override;
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor, uint8_t alpha = 255) override;
|
||||
void DrawPixel(int x, int y, int palcolor, uint32_t rgbcolor) override;
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints, double originx, double originy, double scalex, double scaley, DAngle rotation, const FColormap &colormap, PalEntry flatcolor, int lightlevel, int bottomclip) override;
|
||||
bool WipeStartScreen(int type) override;
|
||||
|
|
|
@ -388,7 +388,7 @@ void SWCanvas::FillSimplePoly(DCanvas *canvas, FTexture *tex, FVector2 *points,
|
|||
viewport->RenderTarget = screen;
|
||||
}
|
||||
|
||||
void SWCanvas::DrawLine(DCanvas *canvas, int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor)
|
||||
void SWCanvas::DrawLine(DCanvas *canvas, int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor, uint8_t alpha)
|
||||
{
|
||||
const int WeightingScale = 0;
|
||||
const int WEIGHTBITS = 6;
|
||||
|
|
|
@ -11,7 +11,7 @@ public:
|
|||
static void FillSimplePoly(DCanvas *canvas, FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley, DAngle rotation,
|
||||
const FColormap &colormap, PalEntry flatcolor, int lightlevel, int bottomclip);
|
||||
static void DrawLine(DCanvas *canvas, int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor);
|
||||
static void DrawLine(DCanvas *canvas, int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor, uint8_t alpha = 255);
|
||||
static void DrawPixel(DCanvas *canvas, int x, int y, int palColor, uint32_t realcolor);
|
||||
static void Clear(DCanvas *canvas, int left, int top, int right, int bottom, int palcolor, uint32_t color);
|
||||
static void Dim(DCanvas *canvas, PalEntry color, float damount, int x1, int y1, int w, int h);
|
||||
|
|
|
@ -1034,10 +1034,10 @@ void DCanvas::FillBorder (FTexture *img)
|
|||
}
|
||||
}
|
||||
|
||||
void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor)
|
||||
void DCanvas::DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor, uint8_t alpha)
|
||||
{
|
||||
#ifndef NO_SWRENDER
|
||||
SWCanvas::DrawLine(this, x0, y0, x1, y1, palColor, realcolor);
|
||||
SWCanvas::DrawLine(this, x0, y0, x1, y1, palColor, realcolor, alpha);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1049,14 +1049,15 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawLine)
|
|||
PARAM_INT(x1);
|
||||
PARAM_INT(y1);
|
||||
PARAM_INT(color);
|
||||
PARAM_INT_DEF(alpha);
|
||||
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
screen->DrawLine(x0, y0, x1, y1, -1, color);
|
||||
screen->DrawLine(x0, y0, x1, y1, -1, color, alpha);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void DCanvas::DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor) {
|
||||
void DCanvas::DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor, uint8_t alpha) {
|
||||
#ifndef NO_SWRENDER
|
||||
SWCanvas::DrawLine(this, x0, y0, x1, y1, -1, realcolor);
|
||||
SWCanvas::DrawLine(this, x0, y0, x1, y1, -1, realcolor, alpha);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1069,8 +1070,9 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawThickLine)
|
|||
PARAM_INT(y1);
|
||||
PARAM_FLOAT(thickness);
|
||||
PARAM_INT(color);
|
||||
PARAM_INT_DEF(alpha);
|
||||
if (!screen->HasBegun2D()) ThrowAbortException(X_OTHER, "Attempt to draw to screen outside a draw function");
|
||||
screen->DrawLine(x0, y0, x1, y1, -1, color);
|
||||
screen->DrawLine(x0, y0, x1, y1, -1, color, alpha);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -266,10 +266,10 @@ public:
|
|||
virtual void DoClear(int left, int top, int right, int bottom, int palcolor, uint32_t color);
|
||||
|
||||
// Draws a line
|
||||
virtual void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor);
|
||||
virtual void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor, uint8_t alpha = 255);
|
||||
|
||||
// Draws a line with thickness
|
||||
virtual void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor);
|
||||
virtual void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, uint32_t realcolor, uint8_t alpha = 255);
|
||||
|
||||
// Draws a single pixel
|
||||
virtual void DrawPixel(int x, int y, int palcolor, uint32_t rgbcolor);
|
||||
|
|
|
@ -2705,11 +2705,11 @@ void D3DFB::EndLineBatch()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void D3DFB::DrawLine(int x0, int y0, int x1, int y1, int palcolor, uint32_t color)
|
||||
void D3DFB::DrawLine(int x0, int y0, int x1, int y1, int palcolor, uint32_t color, uint8_t alpha)
|
||||
{
|
||||
if (In2D < 2)
|
||||
{
|
||||
Super::DrawLine(x0, y0, x1, y1, palcolor, color);
|
||||
Super::DrawLine(x0, y0, x1, y1, palcolor, color, alpha);
|
||||
return;
|
||||
}
|
||||
if (!InScene)
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
void DoClear (int left, int top, int right, int bottom, int palcolor, uint32_t color);
|
||||
void DoDim (PalEntry color, float amount, int x1, int y1, int w, int h);
|
||||
void FlatFill (int left, int top, int right, int bottom, FTexture *src, bool local_origin);
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor);
|
||||
void DrawLine(int x0, int y0, int x1, int y1, int palColor, uint32_t realcolor, uint8_t alpha = 255);
|
||||
void DrawPixel(int x, int y, int palcolor, uint32_t rgbcolor);
|
||||
void FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||
double originx, double originy, double scalex, double scaley,
|
||||
|
|
|
@ -187,8 +187,8 @@ struct Screen native
|
|||
native static vararg void DrawShape(TextureID tex, bool animate, Shape2D s, ...);
|
||||
native static vararg void DrawChar(Font font, int normalcolor, double x, double y, int character, ...);
|
||||
native static vararg void DrawText(Font font, int normalcolor, double x, double y, String text, ...);
|
||||
native static void DrawLine(int x0, int y0, int x1, int y1, Color color);
|
||||
native static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, Color color);
|
||||
native static void DrawLine(int x0, int y0, int x1, int y1, Color color, int alpha = 255);
|
||||
native static void DrawThickLine(int x0, int y0, int x1, int y1, double thickness, Color color, int alpha = 255);
|
||||
native static void DrawFrame(int x, int y, int w, int h);
|
||||
native static Vector2, Vector2 VirtualToRealCoords(Vector2 pos, Vector2 size, Vector2 vsize, bool vbottom=false, bool handleaspect=true);
|
||||
native static double GetAspectRatio();
|
||||
|
|
Loading…
Reference in a new issue