From 00c8c6e3b224152693ea784c353cc1619625bc33 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 16 Aug 2018 00:08:19 +0200 Subject: [PATCH] - generate vertices for skybox sectors in the processing pass. Aside from the sprites this was the only other remaining use of FQuadDrawer. --- src/gl/scene/gl_flats.cpp | 23 ++++------------------- src/hwrenderer/scene/hw_drawstructs.h | 2 +- src/hwrenderer/scene/hw_flats.cpp | 12 +++++++----- 3 files changed, 12 insertions(+), 25 deletions(-) diff --git a/src/gl/scene/gl_flats.cpp b/src/gl/scene/gl_flats.cpp index b75944a47..5499f1357 100644 --- a/src/gl/scene/gl_flats.cpp +++ b/src/gl/scene/gl_flats.cpp @@ -201,24 +201,6 @@ void FDrawInfo::ClearFloodStencil(int vindex) gl_RenderState.SetEffect(EFF_NONE); } -//========================================================================== -// -// -// -//========================================================================== - -void FDrawInfo::DrawSkyboxSector(GLFlat *flat, int pass) -{ - FQuadDrawer qd; - flat->CreateSkyboxVertices(qd.Pointer()); - gl_RenderState.ApplyLightIndex(flat->dynlightindex); - qd.Render(GL_TRIANGLE_FAN); - - flatvertices += 4; - flatprimitives++; -} - - //========================================================================== // // @@ -248,7 +230,10 @@ void FDrawInfo::DrawFlat(GLFlat *flat, int pass, bool trans) // trans only has m else { gl_RenderState.SetMaterial(flat->gltexture, CLAMP_XY, 0, -1, false); - DrawSkyboxSector(flat, pass); + gl_RenderState.ApplyLightIndex(flat->dynlightindex); + glDrawArrays(GL_TRIANGLE_FAN, flat->iboindex, 4); + flatvertices += 4; + flatprimitives++; } gl_RenderState.SetObjectColor(0xffffffff); break; diff --git a/src/hwrenderer/scene/hw_drawstructs.h b/src/hwrenderer/scene/hw_drawstructs.h index c84f8c179..069a5b1cd 100644 --- a/src/hwrenderer/scene/hw_drawstructs.h +++ b/src/hwrenderer/scene/hw_drawstructs.h @@ -295,7 +295,6 @@ class GLFlat { public: sector_t * sector; - float dz; // z offset for rendering hacks float z; // the z position of the flat (only valid for non-sloped planes) FMaterial *gltexture; @@ -351,6 +350,7 @@ public: uint8_t foglevel; uint8_t hw_styleflags; bool fullbright; + bool polyoffset; PalEntry ThingColor; // thing's own color FColormap Colormap; FSpriteModelFrame * modelframe; diff --git a/src/hwrenderer/scene/hw_flats.cpp b/src/hwrenderer/scene/hw_flats.cpp index e63f3e74c..6c28d5636 100644 --- a/src/hwrenderer/scene/hw_flats.cpp +++ b/src/hwrenderer/scene/hw_flats.cpp @@ -118,7 +118,6 @@ void GLFlat::CreateSkyboxVertices(FFlatVertex *vert) if (y > maxy) maxy = y; } - float z = plane.plane.ZatPoint(0., 0.) + dz; static float uvals[] = { 0, 0, 1, 1 }; static float vvals[] = { 1, 0, 0, 1 }; int rot = -xs_FloorToInt(plane.Angle / 90.f); @@ -231,11 +230,14 @@ void GLFlat::Process(HWDrawInfo *di, sector_t * model, int whichplane, bool fog) lightlevel = abs(lightlevel); } - // get height from vplane - if (whichplane == sector_t::floor && sector->transdoor) dz = -1; - else dz = 0; - z = plane.plane.ZatPoint(0.f, 0.f); + if (sector->special == GLSector_Skybox) + { + auto vert = di->AllocVertices(4); + CreateSkyboxVertices(vert.first); + iboindex = vert.second; + } + PutFlat(di, fog); rendered_flats++;