- Backend update from Raze

This commit is contained in:
Christoph Oelckers 2021-04-19 12:58:35 +02:00
commit ba146ed5e5
43 changed files with 473 additions and 168 deletions

View file

@ -189,8 +189,9 @@ DEFINE_ACTION_FUNCTION_NATIVE(DShape2D, PushTriangle, Shape2D_PushTriangle)
//
//==========================================================================
int F2DDrawer::AddCommand(const RenderCommand *data)
int F2DDrawer::AddCommand(RenderCommand *data)
{
data->mScreenFade = screenFade;
if (mData.Size() > 0 && data->isCompatible(mData.Last()))
{
// Merge with the last command.
@ -738,12 +739,12 @@ void F2DDrawer::AddPoly(FGameTexture *texture, FVector2 *points, int npoints,
//
//==========================================================================
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, const unsigned int* ind, size_t idxcount, int translation, PalEntry color, FRenderStyle style, int clipx1, int clipy1, int clipx2, int clipy2)
{
RenderCommand dg;
int method = 0;
if (!img->isValid()) return;
if (!img || !img->isValid()) return;
dg.mType = DrawTypeTriangles;
if (clipx1 > 0 || clipy1 > 0 || clipx2 < GetWidth() - 1 || clipy2 < GetHeight() - 1)
@ -769,14 +770,28 @@ void F2DDrawer::AddPoly(FGameTexture* img, FVector4* vt, size_t vtcount, unsigne
Set(ptr, vt[i].X, vt[i].Y, 0.f, vt[i].Z, vt[i].W, color);
ptr++;
}
dg.mIndexIndex = mIndices.Size();
mIndices.Reserve(idxcount);
for (size_t i = 0; i < idxcount; i++)
if (idxcount > 0)
{
mIndices[dg.mIndexIndex + i] = ind[i] + dg.mVertIndex;
mIndices.Reserve(idxcount);
for (size_t i = 0; i < idxcount; i++)
{
mIndices[dg.mIndexIndex + i] = ind[i] + dg.mVertIndex;
}
dg.mIndexCount = (int)idxcount;
}
else
{
// If we have no index buffer, treat this as an unindexed list of triangles.
mIndices.Reserve(vtcount);
for (size_t i = 0; i < vtcount; i++)
{
mIndices[dg.mIndexIndex + i] = i + dg.mVertIndex;
}
dg.mIndexCount = (int)vtcount;
}
dg.mIndexCount = (int)idxcount;
AddCommand(&dg);
}
@ -941,6 +956,7 @@ void F2DDrawer::AddColorOnlyQuad(int x1, int y1, int w, int h, PalEntry color, F
{
// Only needed by Raze's fullscreen blends because they are being calculated late when half of the 2D content has already been submitted,
// This ensures they are below the HUD, not above it.
dg.mScreenFade = screenFade;
mData.Insert(0, dg);
}
}