mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-29 07:22:07 +00:00
- moved a bit more of the wall setup to the API independent side.
This commit is contained in:
parent
6285a309ce
commit
e309fd1f3d
3 changed files with 36 additions and 36 deletions
|
@ -303,19 +303,8 @@ void FDrawInfo::DrawWall(GLWall *wall, int pass)
|
||||||
|
|
||||||
void FDrawInfo::AddWall(GLWall *wall)
|
void FDrawInfo::AddWall(GLWall *wall)
|
||||||
{
|
{
|
||||||
bool translucent = !!(wall->flags & GLWall::GLWF_TRANSLUCENT);
|
if (wall->flags & GLWall::GLWF_TRANSLUCENT)
|
||||||
int list;
|
|
||||||
|
|
||||||
wall->MakeVertices(this, translucent);
|
|
||||||
|
|
||||||
if (translucent) // translucent walls
|
|
||||||
{
|
{
|
||||||
if (!gl.legacyMode && mDrawer->FixedColormap == CM_DEFAULT && wall->gltexture != nullptr)
|
|
||||||
{
|
|
||||||
if (wall->SetupLights(lightdata))
|
|
||||||
wall->dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
|
||||||
}
|
|
||||||
wall->ViewDistance = (r_viewpoint.Pos - (wall->seg->linedef->v1->fPos() + wall->seg->linedef->Delta() / 2)).XY().LengthSquared();
|
|
||||||
auto newwall = drawlists[GLDL_TRANSLUCENT].NewWall();
|
auto newwall = drawlists[GLDL_TRANSLUCENT].NewWall();
|
||||||
*newwall = *wall;
|
*newwall = *wall;
|
||||||
}
|
}
|
||||||
|
@ -325,16 +314,9 @@ void FDrawInfo::AddWall(GLWall *wall)
|
||||||
{
|
{
|
||||||
if (PutWallCompat(wall, GLWall::passflag[wall->type])) return;
|
if (PutWallCompat(wall, GLWall::passflag[wall->type])) return;
|
||||||
}
|
}
|
||||||
else if (mDrawer->FixedColormap == CM_DEFAULT)
|
|
||||||
{
|
|
||||||
if (wall->SetupLights(lightdata))
|
|
||||||
wall->dynlightindex = GLRenderer->mLights->UploadLights(lightdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
bool masked = GLWall::passflag[wall->type] == 1 ? false : (wall->gltexture && wall->gltexture->isMasked());
|
||||||
bool masked;
|
int list;
|
||||||
|
|
||||||
masked = GLWall::passflag[wall->type] == 1 ? false : (wall->gltexture && wall->gltexture->isMasked());
|
|
||||||
|
|
||||||
if ((wall->flags & GLWall::GLWF_SKYHACK && wall->type == RENDERWALL_M2S))
|
if ((wall->flags & GLWall::GLWF_SKYHACK && wall->type == RENDERWALL_M2S))
|
||||||
{
|
{
|
||||||
|
@ -346,10 +328,7 @@ void FDrawInfo::AddWall(GLWall *wall)
|
||||||
}
|
}
|
||||||
auto newwall = drawlists[list].NewWall();
|
auto newwall = drawlists[list].NewWall();
|
||||||
*newwall = *wall;
|
*newwall = *wall;
|
||||||
if (!masked) newwall->ProcessDecals(this);
|
|
||||||
}
|
}
|
||||||
wall->dynlightindex = -1;
|
|
||||||
wall->vertcount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -205,7 +205,7 @@ public:
|
||||||
bool SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright);
|
bool SplitWallComplex(HWDrawInfo *di, sector_t * frontsector, bool translucent, float& maplightbottomleft, float& maplightbottomright);
|
||||||
void SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
void SplitWall(HWDrawInfo *di, sector_t * frontsector, bool translucent);
|
||||||
|
|
||||||
bool SetupLights(FDynLightData &lightdata);
|
void SetupLights(HWDrawInfo *di, FDynLightData &lightdata);
|
||||||
|
|
||||||
void MakeVertices(HWDrawInfo *di, bool nosplit);
|
void MakeVertices(HWDrawInfo *di, bool nosplit);
|
||||||
|
|
||||||
|
|
|
@ -46,10 +46,12 @@
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool GLWall::SetupLights(FDynLightData &lightdata)
|
void GLWall::SetupLights(HWDrawInfo *di, FDynLightData &lightdata)
|
||||||
{
|
{
|
||||||
if (screen->hwcaps & RFL_NO_SHADERS) return false; // useless in OpenGL 2.
|
lightdata.Clear();
|
||||||
if (RenderStyle == STYLE_Add && !level.lightadditivesurfaces) return false; // no lights on additively blended surfaces.
|
|
||||||
|
if (screen->hwcaps & RFL_NO_SHADERS) return; // useless in OpenGL 2.
|
||||||
|
if (RenderStyle == STYLE_Add && !level.lightadditivesurfaces) return; // no lights on additively blended surfaces.
|
||||||
|
|
||||||
// check for wall types which cannot have dynamic lights on them (portal types never get here so they don't need to be checked.)
|
// check for wall types which cannot have dynamic lights on them (portal types never get here so they don't need to be checked.)
|
||||||
switch (type)
|
switch (type)
|
||||||
|
@ -57,13 +59,12 @@ bool GLWall::SetupLights(FDynLightData &lightdata)
|
||||||
case RENDERWALL_FOGBOUNDARY:
|
case RENDERWALL_FOGBOUNDARY:
|
||||||
case RENDERWALL_MIRRORSURFACE:
|
case RENDERWALL_MIRRORSURFACE:
|
||||||
case RENDERWALL_COLOR:
|
case RENDERWALL_COLOR:
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
float vtx[]={glseg.x1,zbottom[0],glseg.y1, glseg.x1,ztop[0],glseg.y1, glseg.x2,ztop[1],glseg.y2, glseg.x2,zbottom[1],glseg.y2};
|
float vtx[]={glseg.x1,zbottom[0],glseg.y1, glseg.x1,ztop[0],glseg.y1, glseg.x2,ztop[1],glseg.y2, glseg.x2,zbottom[1],glseg.y2};
|
||||||
Plane p;
|
Plane p;
|
||||||
|
|
||||||
lightdata.Clear();
|
|
||||||
|
|
||||||
auto normal = glseg.Normal();
|
auto normal = glseg.Normal();
|
||||||
p.Set(normal, -normal.X * glseg.x1 - normal.Z * glseg.y1);
|
p.Set(normal, -normal.X * glseg.x1 - normal.Z * glseg.y1);
|
||||||
|
@ -138,7 +139,7 @@ bool GLWall::SetupLights(FDynLightData &lightdata)
|
||||||
}
|
}
|
||||||
node = node->nextLight;
|
node = node->nextLight;
|
||||||
}
|
}
|
||||||
return true;
|
dynlightindex = di->UploadLights(lightdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,8 +167,12 @@ void GLWall::PutWall(HWDrawInfo *di, bool translucent)
|
||||||
{
|
{
|
||||||
translucent = true;
|
translucent = true;
|
||||||
}
|
}
|
||||||
if (translucent) flags |= GLWF_TRANSLUCENT;
|
if (translucent)
|
||||||
|
{
|
||||||
|
flags |= GLWF_TRANSLUCENT;
|
||||||
|
ViewDistance = (r_viewpoint.Pos - (seg->linedef->v1->fPos() + seg->linedef->Delta() / 2)).XY().LengthSquared();
|
||||||
|
}
|
||||||
|
|
||||||
if (di->FixedColormap)
|
if (di->FixedColormap)
|
||||||
{
|
{
|
||||||
// light planes don't get drawn with fullbright rendering
|
// light planes don't get drawn with fullbright rendering
|
||||||
|
@ -178,9 +183,25 @@ void GLWall::PutWall(HWDrawInfo *di, bool translucent)
|
||||||
if (di->FixedColormap != CM_DEFAULT || (Colormap.LightColor.isWhite() && lightlevel == 255))
|
if (di->FixedColormap != CM_DEFAULT || (Colormap.LightColor.isWhite() && lightlevel == 255))
|
||||||
flags &= ~GLWF_GLOW;
|
flags &= ~GLWF_GLOW;
|
||||||
|
|
||||||
di->AddWall(this);
|
if (level.HasDynamicLights && di->FixedColormap == CM_DEFAULT && gltexture != nullptr && !(screen->hwcaps & RFL_NO_SHADERS))
|
||||||
lightlist = NULL;
|
{
|
||||||
vertcount = 0; // make sure that following parts of the same linedef do not get this one's vertex info.
|
SetupLights(di, lightdata);
|
||||||
|
}
|
||||||
|
MakeVertices(di, translucent);
|
||||||
|
|
||||||
|
|
||||||
|
bool solid;
|
||||||
|
if (passflag[type] == 1) solid = true;
|
||||||
|
else if (type == RENDERWALL_FFBLOCK) solid = (gltexture && gltexture->isMasked());
|
||||||
|
else solid = false;
|
||||||
|
if (solid) ProcessDecals(di);
|
||||||
|
|
||||||
|
di->AddWall(this);
|
||||||
|
|
||||||
|
lightlist = nullptr;
|
||||||
|
// make sure that following parts of the same linedef do not get this one's vertex and lighting info.
|
||||||
|
vertcount = 0;
|
||||||
|
dynlightindex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLWall::PutPortal(HWDrawInfo *di, int ptype)
|
void GLWall::PutPortal(HWDrawInfo *di, int ptype)
|
||||||
|
|
Loading…
Reference in a new issue