- generate vertices for skybox sectors in the processing pass.

Aside from the sprites this was the only other remaining use of FQuadDrawer.
This commit is contained in:
Christoph Oelckers 2018-08-16 00:08:19 +02:00
parent e5ff500c5a
commit 00c8c6e3b2
3 changed files with 12 additions and 25 deletions

View file

@ -201,24 +201,6 @@ void FDrawInfo::ClearFloodStencil(int vindex)
gl_RenderState.SetEffect(EFF_NONE); 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 else
{ {
gl_RenderState.SetMaterial(flat->gltexture, CLAMP_XY, 0, -1, false); 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); gl_RenderState.SetObjectColor(0xffffffff);
break; break;

View file

@ -295,7 +295,6 @@ class GLFlat
{ {
public: public:
sector_t * sector; sector_t * sector;
float dz; // z offset for rendering hacks
float z; // the z position of the flat (only valid for non-sloped planes) float z; // the z position of the flat (only valid for non-sloped planes)
FMaterial *gltexture; FMaterial *gltexture;
@ -351,6 +350,7 @@ public:
uint8_t foglevel; uint8_t foglevel;
uint8_t hw_styleflags; uint8_t hw_styleflags;
bool fullbright; bool fullbright;
bool polyoffset;
PalEntry ThingColor; // thing's own color PalEntry ThingColor; // thing's own color
FColormap Colormap; FColormap Colormap;
FSpriteModelFrame * modelframe; FSpriteModelFrame * modelframe;

View file

@ -118,7 +118,6 @@ void GLFlat::CreateSkyboxVertices(FFlatVertex *vert)
if (y > maxy) maxy = y; if (y > maxy) maxy = y;
} }
float z = plane.plane.ZatPoint(0., 0.) + dz;
static float uvals[] = { 0, 0, 1, 1 }; static float uvals[] = { 0, 0, 1, 1 };
static float vvals[] = { 1, 0, 0, 1 }; static float vvals[] = { 1, 0, 0, 1 };
int rot = -xs_FloorToInt(plane.Angle / 90.f); 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); 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); 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); PutFlat(di, fog);
rendered_flats++; rendered_flats++;