mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- move DrawArray and DrawElements to PolyTriangleDrawer
This commit is contained in:
parent
9ba26a5ece
commit
a91147a3a5
14 changed files with 73 additions and 91 deletions
|
@ -140,24 +140,6 @@ void PolyDrawArgs::SetColor(uint32_t bgra, uint8_t palindex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyDrawArgs::DrawArray(const DrawerCommandQueuePtr &queue, const void *vertices, int vcount, PolyDrawMode mode)
|
|
||||||
{
|
|
||||||
mVertices = vertices;
|
|
||||||
mVertexCount = vcount;
|
|
||||||
mElements = nullptr;
|
|
||||||
mDrawMode = mode;
|
|
||||||
queue->Push<DrawPolyTrianglesCommand>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PolyDrawArgs::DrawElements(const DrawerCommandQueuePtr &queue, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode)
|
|
||||||
{
|
|
||||||
mVertices = vertices;
|
|
||||||
mElements = elements;
|
|
||||||
mVertexCount = count;
|
|
||||||
mDrawMode = mode;
|
|
||||||
queue->Push<DrawPolyTrianglesCommand>(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
|
void PolyDrawArgs::SetStyle(const FRenderStyle &renderstyle, double alpha, uint32_t fillcolor, uint32_t translationID, FTexture *tex, bool fullbright)
|
||||||
{
|
{
|
||||||
SetTexture(tex, translationID, renderstyle);
|
SetTexture(tex, translationID, renderstyle);
|
||||||
|
|
|
@ -80,16 +80,9 @@ public:
|
||||||
void SetColor(uint32_t bgra, uint8_t palindex);
|
void SetColor(uint32_t bgra, uint8_t palindex);
|
||||||
void SetLights(PolyLight *lights, int numLights) { mLights = lights; mNumLights = numLights; }
|
void SetLights(PolyLight *lights, int numLights) { mLights = lights; mNumLights = numLights; }
|
||||||
void SetDynLightColor(uint32_t color) { mDynLightColor = color; }
|
void SetDynLightColor(uint32_t color) { mDynLightColor = color; }
|
||||||
void DrawArray(const DrawerCommandQueuePtr &queue, const void *vertices, int vcount, PolyDrawMode mode = PolyDrawMode::Triangles);
|
|
||||||
void DrawElements(const DrawerCommandQueuePtr &queue, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode = PolyDrawMode::Triangles);
|
|
||||||
|
|
||||||
const PolyClipPlane &ClipPlane(int index) const { return mClipPlane[index]; }
|
const PolyClipPlane &ClipPlane(int index) const { return mClipPlane[index]; }
|
||||||
|
|
||||||
const void *Vertices() const { return mVertices; }
|
|
||||||
int VertexCount() const { return mVertexCount; }
|
|
||||||
const unsigned int *Elements() const { return mElements; }
|
|
||||||
PolyDrawMode DrawMode() const { return mDrawMode; }
|
|
||||||
|
|
||||||
bool WriteColor() const { return mWriteColor; }
|
bool WriteColor() const { return mWriteColor; }
|
||||||
|
|
||||||
FTexture *Texture() const { return mTexture; }
|
FTexture *Texture() const { return mTexture; }
|
||||||
|
@ -134,10 +127,6 @@ public:
|
||||||
void SetNormal(const FVector3 &normal) { mNormal = normal; }
|
void SetNormal(const FVector3 &normal) { mNormal = normal; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const void *mVertices = nullptr;
|
|
||||||
int mVertexCount = 0;
|
|
||||||
const unsigned int *mElements = nullptr;
|
|
||||||
PolyDrawMode mDrawMode = PolyDrawMode::Triangles;
|
|
||||||
bool mDepthTest = false;
|
bool mDepthTest = false;
|
||||||
bool mWriteStencil = true;
|
bool mWriteStencil = true;
|
||||||
bool mWriteColor = true;
|
bool mWriteColor = true;
|
||||||
|
|
|
@ -108,6 +108,16 @@ void PolyTriangleDrawer::SetModelVertexShader(const DrawerCommandQueuePtr &queue
|
||||||
queue->Push<PolySetModelVertexShaderCommand>(frame1, frame2, interpolationFactor);
|
queue->Push<PolySetModelVertexShaderCommand>(frame1, frame2, interpolationFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PolyTriangleDrawer::DrawArray(const DrawerCommandQueuePtr &queue, const PolyDrawArgs &args, const void *vertices, int vcount, PolyDrawMode mode)
|
||||||
|
{
|
||||||
|
queue->Push<DrawPolyTrianglesCommand>(args, vertices, nullptr, vcount, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PolyTriangleDrawer::DrawElements(const DrawerCommandQueuePtr &queue, const PolyDrawArgs &args, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode)
|
||||||
|
{
|
||||||
|
queue->Push<DrawPolyTrianglesCommand>(args, vertices, elements, count, mode);
|
||||||
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void PolyTriangleThreadData::ClearStencil(uint8_t value)
|
void PolyTriangleThreadData::ClearStencil(uint8_t value)
|
||||||
|
@ -146,9 +156,9 @@ void PolyTriangleThreadData::SetTransform(const Mat4f *newObjectToClip, const Ma
|
||||||
objectToWorld = newObjectToWorld;
|
objectToWorld = newObjectToWorld;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyTriangleThreadData::DrawElements(const PolyDrawArgs &drawargs)
|
void PolyTriangleThreadData::DrawElements(const PolyDrawArgs &drawargs, const void *vertices, const unsigned int *elements, int vcount, PolyDrawMode drawmode)
|
||||||
{
|
{
|
||||||
if (drawargs.VertexCount() < 3)
|
if (vcount < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TriDrawTriangleArgs args;
|
TriDrawTriangleArgs args;
|
||||||
|
@ -162,26 +172,23 @@ void PolyTriangleThreadData::DrawElements(const PolyDrawArgs &drawargs)
|
||||||
args.zbuffer = PolyZBuffer::Instance()->Values();
|
args.zbuffer = PolyZBuffer::Instance()->Values();
|
||||||
args.depthOffset = weaponScene ? 1.0f : 0.0f;
|
args.depthOffset = weaponScene ? 1.0f : 0.0f;
|
||||||
|
|
||||||
const unsigned int *elements = drawargs.Elements();
|
|
||||||
int vcount = drawargs.VertexCount();
|
|
||||||
|
|
||||||
ShadedTriVertex vert[3];
|
ShadedTriVertex vert[3];
|
||||||
if (drawargs.DrawMode() == PolyDrawMode::Triangles)
|
if (drawmode == PolyDrawMode::Triangles)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vcount / 3; i++)
|
for (int i = 0; i < vcount / 3; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
vert[j] = ShadeVertex(drawargs, *(elements++));
|
vert[j] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
DrawShadedTriangle(vert, ccw, &args);
|
DrawShadedTriangle(vert, ccw, &args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (drawargs.DrawMode() == PolyDrawMode::TriangleFan)
|
else if (drawmode == PolyDrawMode::TriangleFan)
|
||||||
{
|
{
|
||||||
vert[0] = ShadeVertex(drawargs, *(elements++));
|
vert[0] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
vert[1] = ShadeVertex(drawargs, *(elements++));
|
vert[1] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
for (int i = 2; i < vcount; i++)
|
for (int i = 2; i < vcount; i++)
|
||||||
{
|
{
|
||||||
vert[2] = ShadeVertex(drawargs, *(elements++));
|
vert[2] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
DrawShadedTriangle(vert, ccw, &args);
|
DrawShadedTriangle(vert, ccw, &args);
|
||||||
vert[1] = vert[2];
|
vert[1] = vert[2];
|
||||||
}
|
}
|
||||||
|
@ -189,11 +196,11 @@ void PolyTriangleThreadData::DrawElements(const PolyDrawArgs &drawargs)
|
||||||
else // TriangleDrawMode::TriangleStrip
|
else // TriangleDrawMode::TriangleStrip
|
||||||
{
|
{
|
||||||
bool toggleccw = ccw;
|
bool toggleccw = ccw;
|
||||||
vert[0] = ShadeVertex(drawargs, *(elements++));
|
vert[0] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
vert[1] = ShadeVertex(drawargs, *(elements++));
|
vert[1] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
for (int i = 2; i < vcount; i++)
|
for (int i = 2; i < vcount; i++)
|
||||||
{
|
{
|
||||||
vert[2] = ShadeVertex(drawargs, *(elements++));
|
vert[2] = ShadeVertex(drawargs, vertices, *(elements++));
|
||||||
DrawShadedTriangle(vert, toggleccw, &args);
|
DrawShadedTriangle(vert, toggleccw, &args);
|
||||||
vert[0] = vert[1];
|
vert[0] = vert[1];
|
||||||
vert[1] = vert[2];
|
vert[1] = vert[2];
|
||||||
|
@ -202,9 +209,9 @@ void PolyTriangleThreadData::DrawElements(const PolyDrawArgs &drawargs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyTriangleThreadData::DrawArrays(const PolyDrawArgs &drawargs)
|
void PolyTriangleThreadData::DrawArray(const PolyDrawArgs &drawargs, const void *vertices, int vcount, PolyDrawMode drawmode)
|
||||||
{
|
{
|
||||||
if (drawargs.VertexCount() < 3)
|
if (vcount < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TriDrawTriangleArgs args;
|
TriDrawTriangleArgs args;
|
||||||
|
@ -219,25 +226,24 @@ void PolyTriangleThreadData::DrawArrays(const PolyDrawArgs &drawargs)
|
||||||
args.depthOffset = weaponScene ? 1.0f : 0.0f;
|
args.depthOffset = weaponScene ? 1.0f : 0.0f;
|
||||||
|
|
||||||
int vinput = 0;
|
int vinput = 0;
|
||||||
int vcount = drawargs.VertexCount();
|
|
||||||
|
|
||||||
ShadedTriVertex vert[3];
|
ShadedTriVertex vert[3];
|
||||||
if (drawargs.DrawMode() == PolyDrawMode::Triangles)
|
if (drawmode == PolyDrawMode::Triangles)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < vcount / 3; i++)
|
for (int i = 0; i < vcount / 3; i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
vert[j] = ShadeVertex(drawargs, vinput++);
|
vert[j] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
DrawShadedTriangle(vert, ccw, &args);
|
DrawShadedTriangle(vert, ccw, &args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (drawargs.DrawMode() == PolyDrawMode::TriangleFan)
|
else if (drawmode == PolyDrawMode::TriangleFan)
|
||||||
{
|
{
|
||||||
vert[0] = ShadeVertex(drawargs, vinput++);
|
vert[0] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
vert[1] = ShadeVertex(drawargs, vinput++);
|
vert[1] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
for (int i = 2; i < vcount; i++)
|
for (int i = 2; i < vcount; i++)
|
||||||
{
|
{
|
||||||
vert[2] = ShadeVertex(drawargs, vinput++);
|
vert[2] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
DrawShadedTriangle(vert, ccw, &args);
|
DrawShadedTriangle(vert, ccw, &args);
|
||||||
vert[1] = vert[2];
|
vert[1] = vert[2];
|
||||||
}
|
}
|
||||||
|
@ -245,11 +251,11 @@ void PolyTriangleThreadData::DrawArrays(const PolyDrawArgs &drawargs)
|
||||||
else // TriangleDrawMode::TriangleStrip
|
else // TriangleDrawMode::TriangleStrip
|
||||||
{
|
{
|
||||||
bool toggleccw = ccw;
|
bool toggleccw = ccw;
|
||||||
vert[0] = ShadeVertex(drawargs, vinput++);
|
vert[0] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
vert[1] = ShadeVertex(drawargs, vinput++);
|
vert[1] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
for (int i = 2; i < vcount; i++)
|
for (int i = 2; i < vcount; i++)
|
||||||
{
|
{
|
||||||
vert[2] = ShadeVertex(drawargs, vinput++);
|
vert[2] = ShadeVertex(drawargs, vertices, vinput++);
|
||||||
DrawShadedTriangle(vert, toggleccw, &args);
|
DrawShadedTriangle(vert, toggleccw, &args);
|
||||||
vert[0] = vert[1];
|
vert[0] = vert[1];
|
||||||
vert[1] = vert[2];
|
vert[1] = vert[2];
|
||||||
|
@ -258,29 +264,29 @@ void PolyTriangleThreadData::DrawArrays(const PolyDrawArgs &drawargs)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ShadedTriVertex PolyTriangleThreadData::ShadeVertex(const PolyDrawArgs &drawargs, int index)
|
ShadedTriVertex PolyTriangleThreadData::ShadeVertex(const PolyDrawArgs &drawargs, const void *vertices, int index)
|
||||||
{
|
{
|
||||||
ShadedTriVertex sv;
|
ShadedTriVertex sv;
|
||||||
Vec4f objpos;
|
Vec4f objpos;
|
||||||
|
|
||||||
if (modelFrame1 == -1)
|
if (modelFrame1 == -1)
|
||||||
{
|
{
|
||||||
const TriVertex &v = ((TriVertex*)drawargs.Vertices())[index];
|
const TriVertex &v = static_cast<const TriVertex*>(vertices)[index];
|
||||||
objpos = Vec4f(v.x, v.y, v.z, v.w);
|
objpos = Vec4f(v.x, v.y, v.z, v.w);
|
||||||
sv.u = v.u;
|
sv.u = v.u;
|
||||||
sv.v = v.v;
|
sv.v = v.v;
|
||||||
}
|
}
|
||||||
else if (modelFrame1 == modelFrame2 || modelInterpolationFactor == 0.f)
|
else if (modelFrame1 == modelFrame2 || modelInterpolationFactor == 0.f)
|
||||||
{
|
{
|
||||||
const FModelVertex &v = ((FModelVertex*)drawargs.Vertices())[modelFrame1 + index];
|
const FModelVertex &v = static_cast<const FModelVertex*>(vertices)[modelFrame1 + index];
|
||||||
objpos = Vec4f(v.x, v.y, v.z, 1.0f);
|
objpos = Vec4f(v.x, v.y, v.z, 1.0f);
|
||||||
sv.u = v.u;
|
sv.u = v.u;
|
||||||
sv.v = v.v;
|
sv.v = v.v;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const FModelVertex &v1 = ((FModelVertex*)drawargs.Vertices())[modelFrame1 + index];
|
const FModelVertex &v1 = static_cast<const FModelVertex*>(vertices)[modelFrame1 + index];
|
||||||
const FModelVertex &v2 = ((FModelVertex*)drawargs.Vertices())[modelFrame2 + index];
|
const FModelVertex &v2 = static_cast<const FModelVertex*>(vertices)[modelFrame2 + index];
|
||||||
|
|
||||||
float frac = modelInterpolationFactor;
|
float frac = modelInterpolationFactor;
|
||||||
float inv_frac = 1.0f - frac;
|
float inv_frac = 1.0f - frac;
|
||||||
|
@ -718,16 +724,16 @@ void PolySetViewportCommand::Execute(DrawerThread *thread)
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DrawPolyTrianglesCommand::DrawPolyTrianglesCommand(const PolyDrawArgs &args) : args(args)
|
DrawPolyTrianglesCommand::DrawPolyTrianglesCommand(const PolyDrawArgs &args, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode) : args(args), vertices(vertices), elements(elements), count(count), mode(mode)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawPolyTrianglesCommand::Execute(DrawerThread *thread)
|
void DrawPolyTrianglesCommand::Execute(DrawerThread *thread)
|
||||||
{
|
{
|
||||||
if (!args.Elements())
|
if (!elements)
|
||||||
PolyTriangleThreadData::Get(thread)->DrawArrays(args);
|
PolyTriangleThreadData::Get(thread)->DrawArray(args, vertices, count, mode);
|
||||||
else
|
else
|
||||||
PolyTriangleThreadData::Get(thread)->DrawElements(args);
|
PolyTriangleThreadData::Get(thread)->DrawElements(args, vertices, elements, count, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -40,7 +40,8 @@ public:
|
||||||
static void SetWeaponScene(const DrawerCommandQueuePtr &queue, bool enable);
|
static void SetWeaponScene(const DrawerCommandQueuePtr &queue, bool enable);
|
||||||
static void SetModelVertexShader(const DrawerCommandQueuePtr &queue, int frame1, int frame2, float interpolationFactor);
|
static void SetModelVertexShader(const DrawerCommandQueuePtr &queue, int frame1, int frame2, float interpolationFactor);
|
||||||
static void SetTransform(const DrawerCommandQueuePtr &queue, const Mat4f *objectToClip, const Mat4f *objectToWorld);
|
static void SetTransform(const DrawerCommandQueuePtr &queue, const Mat4f *objectToClip, const Mat4f *objectToWorld);
|
||||||
|
static void DrawArray(const DrawerCommandQueuePtr &queue, const PolyDrawArgs &args, const void *vertices, int vcount, PolyDrawMode mode = PolyDrawMode::Triangles);
|
||||||
|
static void DrawElements(const DrawerCommandQueuePtr &queue, const PolyDrawArgs &args, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode = PolyDrawMode::Triangles);
|
||||||
static bool IsBgra();
|
static bool IsBgra();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,8 +58,8 @@ public:
|
||||||
void SetWeaponScene(bool value) { weaponScene = value; }
|
void SetWeaponScene(bool value) { weaponScene = value; }
|
||||||
void SetModelVertexShader(int frame1, int frame2, float interpolationFactor) { modelFrame1 = frame1; modelFrame2 = frame2; modelInterpolationFactor = interpolationFactor; }
|
void SetModelVertexShader(int frame1, int frame2, float interpolationFactor) { modelFrame1 = frame1; modelFrame2 = frame2; modelInterpolationFactor = interpolationFactor; }
|
||||||
|
|
||||||
void DrawElements(const PolyDrawArgs &args);
|
void DrawElements(const PolyDrawArgs &args, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode);
|
||||||
void DrawArrays(const PolyDrawArgs &args);
|
void DrawArray(const PolyDrawArgs &args, const void *vertices, int vcount, PolyDrawMode mode);
|
||||||
|
|
||||||
int32_t core;
|
int32_t core;
|
||||||
int32_t num_cores;
|
int32_t num_cores;
|
||||||
|
@ -73,7 +74,7 @@ public:
|
||||||
static PolyTriangleThreadData *Get(DrawerThread *thread);
|
static PolyTriangleThreadData *Get(DrawerThread *thread);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ShadedTriVertex ShadeVertex(const PolyDrawArgs &drawargs, int index);
|
ShadedTriVertex ShadeVertex(const PolyDrawArgs &drawargs, const void *vertices, int index);
|
||||||
void DrawShadedTriangle(const ShadedTriVertex *vertices, bool ccw, TriDrawTriangleArgs *args);
|
void DrawShadedTriangle(const ShadedTriVertex *vertices, bool ccw, TriDrawTriangleArgs *args);
|
||||||
static bool IsDegenerate(const ShadedTriVertex *vertices);
|
static bool IsDegenerate(const ShadedTriVertex *vertices);
|
||||||
static bool IsFrontfacing(TriDrawTriangleArgs *args);
|
static bool IsFrontfacing(TriDrawTriangleArgs *args);
|
||||||
|
@ -191,12 +192,16 @@ private:
|
||||||
class DrawPolyTrianglesCommand : public DrawerCommand
|
class DrawPolyTrianglesCommand : public DrawerCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DrawPolyTrianglesCommand(const PolyDrawArgs &args);
|
DrawPolyTrianglesCommand(const PolyDrawArgs &args, const void *vertices, const unsigned int *elements, int count, PolyDrawMode mode);
|
||||||
|
|
||||||
void Execute(DrawerThread *thread) override;
|
void Execute(DrawerThread *thread) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PolyDrawArgs args;
|
PolyDrawArgs args;
|
||||||
|
const void *vertices;
|
||||||
|
const unsigned int *elements;
|
||||||
|
int count;
|
||||||
|
PolyDrawMode mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawRectCommand : public DrawerCommand
|
class DrawRectCommand : public DrawerCommand
|
||||||
|
|
|
@ -191,7 +191,7 @@ void RenderPolyDecal::Render(PolyRenderThread *thread, DBaseDecal *decal, const
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderPolyDecal::GetDecalSectors(DBaseDecal *decal, const seg_t *line, sector_t **front, sector_t **back)
|
void RenderPolyDecal::GetDecalSectors(DBaseDecal *decal, const seg_t *line, sector_t **front, sector_t **back)
|
||||||
|
|
|
@ -231,7 +231,7 @@ void PolyModelRenderer::DrawArrays(int start, int count)
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.DrawArray(Thread->DrawQueue, VertexBuffer + start, count);
|
PolyTriangleDrawer::DrawArray(Thread->DrawQueue, args, VertexBuffer + start, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
|
void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
|
||||||
|
@ -254,7 +254,7 @@ void PolyModelRenderer::DrawElements(int numIndices, size_t offset)
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.DrawElements(Thread->DrawQueue, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
|
PolyTriangleDrawer::DrawElements(Thread->DrawQueue, args, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -86,7 +86,7 @@ void RenderPolyParticle::Render(PolyRenderThread *thread, particle_t *particle,
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.SetTexture(GetParticleTexture(), ParticleTextureSize, ParticleTextureSize);
|
args.SetTexture(GetParticleTexture(), ParticleTextureSize, ParticleTextureSize);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *RenderPolyParticle::GetParticleTexture()
|
uint8_t *RenderPolyParticle::GetParticleTexture()
|
||||||
|
|
|
@ -80,7 +80,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferH
|
||||||
args.SetWriteStencil(true, stencilValue + 1);
|
args.SetWriteStencil(true, stencilValue + 1);
|
||||||
args.SetTexture(tex, DefaultRenderStyle());
|
args.SetTexture(tex, DefaultRenderStyle());
|
||||||
args.SetStyle(TriBlendMode::Opaque);
|
args.SetStyle(TriBlendMode::Opaque);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -91,7 +91,7 @@ void RenderPolyPlane::RenderNormal(PolyRenderThread *thread, const PolyTransferH
|
||||||
args.SetWriteStencil(true, 255);
|
args.SetWriteStencil(true, 255);
|
||||||
args.SetWriteColor(false);
|
args.SetWriteColor(false);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
||||||
|
|
||||||
RenderSkyWalls(thread, args, fakeflat.Subsector, nullptr, ceiling, skyHeight);
|
RenderSkyWalls(thread, args, fakeflat.Subsector, nullptr, ceiling, skyHeight);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void RenderPolyPlane::RenderPortal(PolyRenderThread *thread, const PolyTransferH
|
||||||
args.SetWriteStencil(true, polyportal->StencilValue);
|
args.SetWriteStencil(true, polyportal->StencilValue);
|
||||||
args.SetWriteColor(false);
|
args.SetWriteColor(false);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, fakeflat.Subsector->numlines, PolyDrawMode::TriangleFan);
|
||||||
|
|
||||||
RenderSkyWalls(thread, args, fakeflat.Subsector, polyportal, ceiling, skyHeight);
|
RenderSkyWalls(thread, args, fakeflat.Subsector, polyportal, ceiling, skyHeight);
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ void RenderPolyPlane::RenderSkyWalls(PolyRenderThread *thread, PolyDrawArgs &arg
|
||||||
wallvert[3] = GetSkyVertex(line->v1, skyHeight);
|
wallvert[3] = GetSkyVertex(line->v1, skyHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
args.DrawArray(thread->DrawQueue, wallvert, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, wallvert, 4, PolyDrawMode::TriangleFan);
|
||||||
|
|
||||||
if (polyportal)
|
if (polyportal)
|
||||||
{
|
{
|
||||||
|
@ -557,5 +557,5 @@ void Render3DFloorPlane::Render(PolyRenderThread *thread)
|
||||||
args.SetStencilTestValue(stencilValue);
|
args.SetStencilTestValue(stencilValue);
|
||||||
args.SetWriteStencil(true, stencilValue + 1);
|
args.SetWriteStencil(true, stencilValue + 1);
|
||||||
args.SetTexture(tex, DefaultRenderStyle());
|
args.SetTexture(tex, DefaultRenderStyle());
|
||||||
args.DrawArray(thread->DrawQueue, vertices, sub->numlines, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, sub->numlines, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,7 @@ void RenderPolyScene::RenderPortals()
|
||||||
args.SetWriteStencil(true, CurrentViewpoint->StencilValue + 1);
|
args.SetWriteStencil(true, CurrentViewpoint->StencilValue + 1);
|
||||||
for (const auto &verts : portal->Shape)
|
for (const auto &verts : portal->Shape)
|
||||||
{
|
{
|
||||||
args.DrawArray(thread->DrawQueue, verts.Vertices, verts.Count, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, verts.Vertices, verts.Count, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ void RenderPolyScene::RenderPortals()
|
||||||
args.SetWriteStencil(true, CurrentViewpoint->StencilValue + 1);
|
args.SetWriteStencil(true, CurrentViewpoint->StencilValue + 1);
|
||||||
for (const auto &verts : portal->Shape)
|
for (const auto &verts : portal->Shape)
|
||||||
{
|
{
|
||||||
args.DrawArray(thread->DrawQueue, verts.Vertices, verts.Count, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, verts.Vertices, verts.Count, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ void PolySkyDome::RenderRow(PolyRenderThread *thread, PolyDrawArgs &args, int ro
|
||||||
{
|
{
|
||||||
args.SetColor(capcolor, capcolorindex);
|
args.SetColor(capcolor, capcolorindex);
|
||||||
args.SetStyle(TriBlendMode::Skycap);
|
args.SetStyle(TriBlendMode::Skycap);
|
||||||
args.DrawArray(thread->DrawQueue, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleStrip);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleStrip);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolySkyDome::RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args, FTexture *skytex, int row, bool bottomCap)
|
void PolySkyDome::RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args, FTexture *skytex, int row, bool bottomCap)
|
||||||
|
@ -122,7 +122,7 @@ void PolySkyDome::RenderCapColorRow(PolyRenderThread *thread, PolyDrawArgs &args
|
||||||
|
|
||||||
args.SetColor(solid, palsolid);
|
args.SetColor(solid, palsolid);
|
||||||
args.SetStyle(TriBlendMode::Fill);
|
args.SetStyle(TriBlendMode::Fill);
|
||||||
args.DrawArray(thread->DrawQueue, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, &mVertices[mPrimStart[row]], mPrimStart[row + 1] - mPrimStart[row], PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PolySkyDome::CreateDome()
|
void PolySkyDome::CreateDome()
|
||||||
|
|
|
@ -168,7 +168,7 @@ void RenderPolySprite::Render(PolyRenderThread *thread, AActor *thing, subsector
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
||||||
double RenderPolySprite::GetSpriteFloorZ(AActor *thing, const DVector2 &thingpos)
|
double RenderPolySprite::GetSpriteFloorZ(AActor *thing, const DVector2 &thingpos)
|
||||||
|
|
|
@ -331,7 +331,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread)
|
||||||
args.SetDepthTest(true);
|
args.SetDepthTest(true);
|
||||||
args.SetWriteDepth(true);
|
args.SetWriteDepth(true);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
if (!Texture)
|
if (!Texture)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ void RenderPolyWall::Render(PolyRenderThread *thread)
|
||||||
args.SetWriteStencil(true, Polyportal->StencilValue);
|
args.SetWriteStencil(true, Polyportal->StencilValue);
|
||||||
args.SetWriteColor(false);
|
args.SetWriteColor(false);
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
Polyportal->Shape.push_back({ vertices, 4 });
|
Polyportal->Shape.push_back({ vertices, 4 });
|
||||||
}
|
}
|
||||||
else if (!Masked)
|
else if (!Masked)
|
||||||
|
@ -466,7 +466,7 @@ void RenderPolyWall::DrawStripes(PolyRenderThread *thread, PolyDrawArgs &args, T
|
||||||
|
|
||||||
args.SetClipPlane(1, topPlane);
|
args.SetClipPlane(1, topPlane);
|
||||||
args.SetClipPlane(2, bottomPlane);
|
args.SetClipPlane(2, bottomPlane);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
|
|
||||||
FDynamicColormap *basecolormap = GetColorTable(lit->extra_colormap, Line->frontsector->SpecialColors[sector_t::walltop]);
|
FDynamicColormap *basecolormap = GetColorTable(lit->extra_colormap, Line->frontsector->SpecialColors[sector_t::walltop]);
|
||||||
|
|
||||||
|
@ -489,11 +489,11 @@ void RenderPolyWall::DrawStripes(PolyRenderThread *thread, PolyDrawArgs &args, T
|
||||||
|
|
||||||
args.SetClipPlane(1, topPlane);
|
args.SetClipPlane(1, topPlane);
|
||||||
args.SetClipPlane(2, PolyClipPlane());
|
args.SetClipPlane(2, PolyClipPlane());
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,5 +108,5 @@ void RenderPolyWallSprite::Render(PolyRenderThread *thread, AActor *thing, subse
|
||||||
args.SetWriteDepth(false);
|
args.SetWriteDepth(false);
|
||||||
args.SetWriteStencil(false);
|
args.SetWriteStencil(false);
|
||||||
args.SetStyle(TriBlendMode::Normal);
|
args.SetStyle(TriBlendMode::Normal);
|
||||||
args.DrawArray(thread->DrawQueue, vertices, 4, PolyDrawMode::TriangleFan);
|
PolyTriangleDrawer::DrawArray(thread->DrawQueue, args, vertices, 4, PolyDrawMode::TriangleFan);
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ namespace swrenderer
|
||||||
args.SetClipPlane(1, ClipTop);
|
args.SetClipPlane(1, ClipTop);
|
||||||
args.SetClipPlane(2, ClipBottom);
|
args.SetClipPlane(2, ClipBottom);
|
||||||
|
|
||||||
args.DrawArray(Thread->DrawQueue, VertexBuffer + start, count);
|
PolyTriangleDrawer::DrawArray(Thread->DrawQueue, args, VertexBuffer + start, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SWModelRenderer::DrawElements(int numIndices, size_t offset)
|
void SWModelRenderer::DrawElements(int numIndices, size_t offset)
|
||||||
|
@ -356,7 +356,7 @@ namespace swrenderer
|
||||||
args.SetClipPlane(1, ClipTop);
|
args.SetClipPlane(1, ClipTop);
|
||||||
args.SetClipPlane(2, ClipBottom);
|
args.SetClipPlane(2, ClipBottom);
|
||||||
|
|
||||||
args.DrawElements(Thread->DrawQueue, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
|
PolyTriangleDrawer::DrawElements(Thread->DrawQueue, args, VertexBuffer, IndexBuffer + offset / sizeof(unsigned int), numIndices);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
Loading…
Reference in a new issue