- render simple quad-based render hacks as triangle strips.

This commit is contained in:
Christoph Oelckers 2019-03-08 17:52:44 +01:00
parent f7112786d7
commit 4668d0b1de
2 changed files with 10 additions and 10 deletions

View file

@ -126,8 +126,8 @@ void GLFlat::CreateSkyboxVertices(FFlatVertex *vert)
vert[0].Set(minx, z, miny, uvals[rot & 3], vvals[rot & 3]); vert[0].Set(minx, z, miny, uvals[rot & 3], vvals[rot & 3]);
vert[1].Set(minx, z, maxy, uvals[(rot + 1) & 3], vvals[(rot + 1) & 3]); vert[1].Set(minx, z, maxy, uvals[(rot + 1) & 3], vvals[(rot + 1) & 3]);
vert[2].Set(maxx, z, maxy, uvals[(rot + 2) & 3], vvals[(rot + 2) & 3]); vert[2].Set(maxx, z, miny, uvals[(rot + 3) & 3], vvals[(rot + 3) & 3]);
vert[3].Set(maxx, z, miny, uvals[(rot + 3) & 3], vvals[(rot + 3) & 3]); vert[3].Set(maxx, z, maxy, uvals[(rot + 2) & 3], vvals[(rot + 2) & 3]);
} }
//========================================================================== //==========================================================================
@ -258,20 +258,20 @@ void GLFlat::DrawFloodPlanes(HWDrawInfo *di, FRenderState &state)
state.SetEffect(EFF_STENCIL); state.SetEffect(EFF_STENCIL);
state.EnableTexture(false); state.EnableTexture(false);
state.SetStencil(0, SOP_Increment, SF_ColorMaskOff); state.SetStencil(0, SOP_Increment, SF_ColorMaskOff);
state.Draw(DT_TriangleFan, fnode->vertexindex, 4); state.Draw(DT_TriangleStrip, fnode->vertexindex, 4);
// Draw projected plane into stencil // Draw projected plane into stencil
state.EnableTexture(true); state.EnableTexture(true);
state.SetEffect(EFF_NONE); state.SetEffect(EFF_NONE);
state.SetStencil(1, SOP_Keep, SF_DepthMaskOff); state.SetStencil(1, SOP_Keep, SF_DepthMaskOff);
state.EnableDepthTest(false); state.EnableDepthTest(false);
state.Draw(DT_TriangleFan, fnode->vertexindex + 4, 4); state.Draw(DT_TriangleStrip, fnode->vertexindex + 4, 4);
// clear stencil // clear stencil
state.SetEffect(EFF_STENCIL); state.SetEffect(EFF_STENCIL);
state.EnableTexture(false); state.EnableTexture(false);
state.SetStencil(1, SOP_Decrement, SF_ColorMaskOff | SF_DepthMaskOff); state.SetStencil(1, SOP_Decrement, SF_ColorMaskOff | SF_DepthMaskOff);
state.Draw(DT_TriangleFan, fnode->vertexindex, 4); state.Draw(DT_TriangleStrip, fnode->vertexindex, 4);
// restore old stencil op. // restore old stencil op.
state.EnableTexture(true); state.EnableTexture(true);
@ -330,7 +330,7 @@ void GLFlat::DrawFlat(HWDrawInfo *di, FRenderState &state, bool translucent)
{ {
state.SetMaterial(gltexture, CLAMP_XY, 0, -1); state.SetMaterial(gltexture, CLAMP_XY, 0, -1);
state.SetLightIndex(dynlightindex); state.SetLightIndex(dynlightindex);
state.Draw(DT_TriangleFan,iboindex, 4); state.Draw(DT_TriangleStrip,iboindex, 4);
flatvertices += 4; flatvertices += 4;
flatprimitives++; flatprimitives++;
} }

View file

@ -679,8 +679,8 @@ void HWDrawInfo::CreateFloodStencilPoly(wallseg * ws, FFlatVertex *vertices)
{ {
vertices[0].Set(ws->x1, ws->z1, ws->y1, 0, 0); vertices[0].Set(ws->x1, ws->z1, ws->y1, 0, 0);
vertices[1].Set(ws->x1, ws->z2, ws->y1, 0, 0); vertices[1].Set(ws->x1, ws->z2, ws->y1, 0, 0);
vertices[2].Set(ws->x2, ws->z2, ws->y2, 0, 0); vertices[2].Set(ws->x2, ws->z1, ws->y2, 0, 0);
vertices[3].Set(ws->x2, ws->z1, ws->y2, 0, 0); vertices[3].Set(ws->x2, ws->z2, ws->y2, 0, 0);
} }
//========================================================================== //==========================================================================
@ -712,8 +712,8 @@ void HWDrawInfo::CreateFloodPoly(wallseg * ws, FFlatVertex *vertices, float plan
vertices[0].Set(px1, planez, py1, px1 / 64, -py1 / 64); vertices[0].Set(px1, planez, py1, px1 / 64, -py1 / 64);
vertices[1].Set(px2, planez, py2, px2 / 64, -py2 / 64); vertices[1].Set(px2, planez, py2, px2 / 64, -py2 / 64);
vertices[2].Set(px3, planez, py3, px3 / 64, -py3 / 64); vertices[2].Set(px4, planez, py4, px4 / 64, -py4 / 64);
vertices[3].Set(px4, planez, py4, px4 / 64, -py4 / 64); vertices[3].Set(px3, planez, py3, px3 / 64, -py3 / 64);
} }
//========================================================================== //==========================================================================