Skip to content

Commit

Permalink
- generate vertices for skybox sectors in the processing pass.
Browse files Browse the repository at this point in the history
Aside from the sprites this was the only other remaining use of FQuadDrawer.
  • Loading branch information
coelckers committed Aug 15, 2018
1 parent 24d71d3 commit e63346c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 25 deletions.
23 changes: 4 additions & 19 deletions src/gl/scene/gl_flats.cpp
Expand Up @@ -198,24 +198,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++;
}


//==========================================================================
//
//
Expand Down Expand Up @@ -246,7 +228,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;
Expand Down
2 changes: 1 addition & 1 deletion src/hwrenderer/scene/hw_drawstructs.h
Expand Up @@ -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;

Expand Down Expand Up @@ -351,6 +350,7 @@ class GLSprite
uint8_t foglevel;
uint8_t hw_styleflags;
bool fullbright;
bool polyoffset;
PalEntry ThingColor; // thing's own color
FColormap Colormap;
FSpriteModelFrame * modelframe;
Expand Down
12 changes: 7 additions & 5 deletions src/hwrenderer/scene/hw_flats.cpp
Expand Up @@ -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);
Expand Down Expand Up @@ -229,11 +228,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++;
Expand Down

0 comments on commit e63346c

Please sign in to comment.