mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-16 17:21:10 +00:00
take most direct drawinfo references out of HWWall.
This commit is contained in:
parent
1f5df23818
commit
eeac40fffc
5 changed files with 36 additions and 33 deletions
|
@ -37,6 +37,7 @@
|
|||
#include "hw_renderstate.h"
|
||||
#include "hw_drawinfo.h"
|
||||
#include "hw_fakeflat.h"
|
||||
#include "hw_walldispatcher.h"
|
||||
|
||||
FMemArena RenderDataAllocator(1024*1024); // Use large blocks to reduce allocation time.
|
||||
|
||||
|
@ -304,8 +305,8 @@ void HWDrawList::SortWallIntoPlane(HWDrawInfo* di, SortNode * head, SortNode * s
|
|||
w->tcs[HWWall::UPLFT].v = ws->tcs[HWWall::LOLFT].v = w->tcs[HWWall::UPRGT].v = ws->tcs[HWWall::LORGT].v = newtexv;
|
||||
w->lightuv[HWWall::UPLFT].v = ws->lightuv[HWWall::LOLFT].v = w->lightuv[HWWall::UPRGT].v = ws->lightuv[HWWall::LORGT].v = newlmv;
|
||||
}
|
||||
w->MakeVertices(di, false);
|
||||
ws->MakeVertices(di, false);
|
||||
w->MakeVertices(false);
|
||||
ws->MakeVertices(false);
|
||||
}
|
||||
|
||||
SortNode * sort2 = SortNodes.GetNew();
|
||||
|
@ -451,8 +452,8 @@ void HWDrawList::SortWallIntoWall(HWDrawInfo *di, SortNode * head,SortNode * sor
|
|||
w->zbottom[0]=ws->zbottom[1]=izb;
|
||||
w->tcs[HWWall::LOLFT].u = w->tcs[HWWall::UPLFT].u = ws->tcs[HWWall::LORGT].u = ws->tcs[HWWall::UPRGT].u = iu;
|
||||
w->lightuv[HWWall::LOLFT].u = w->lightuv[HWWall::UPLFT].u = ws->lightuv[HWWall::LORGT].u = ws->lightuv[HWWall::UPRGT].u = iu;
|
||||
ws->MakeVertices(di, false);
|
||||
w->MakeVertices(di, false);
|
||||
ws->MakeVertices(false);
|
||||
w->MakeVertices(false);
|
||||
|
||||
SortNode * sort2=SortNodes.GetNew();
|
||||
memset(sort2,0,sizeof(SortNode));
|
||||
|
@ -808,8 +809,9 @@ void HWDrawList::DoDraw(HWDrawInfo *di, FRenderState &state, bool translucent, i
|
|||
case DrawType_WALL:
|
||||
{
|
||||
HWWall * w= walls[drawitems[i].index];
|
||||
HWWallDispatcher dis(di);
|
||||
RenderWall.Clock();
|
||||
w->DrawWall(di, state, translucent);
|
||||
w->DrawWall(&dis, state, translucent);
|
||||
RenderWall.Unclock();
|
||||
}
|
||||
break;
|
||||
|
@ -845,10 +847,11 @@ void HWDrawList::Draw(HWDrawInfo *di, FRenderState &state, bool translucent)
|
|||
//==========================================================================
|
||||
void HWDrawList::DrawWalls(HWDrawInfo *di, FRenderState &state, bool translucent)
|
||||
{
|
||||
HWWallDispatcher dis(di);
|
||||
RenderWall.Clock();
|
||||
for (auto &item : drawitems)
|
||||
{
|
||||
walls[item.index]->DrawWall(di, state, translucent);
|
||||
walls[item.index]->DrawWall(&dis, state, translucent);
|
||||
}
|
||||
RenderWall.Unclock();
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ void HWDrawInfo::AddMirrorSurface(HWWall *w)
|
|||
auto tcs = newwall->tcs;
|
||||
tcs[HWWall::LOLFT].u = tcs[HWWall::LORGT].u = tcs[HWWall::UPLFT].u = tcs[HWWall::UPRGT].u = v.X;
|
||||
tcs[HWWall::LOLFT].v = tcs[HWWall::LORGT].v = tcs[HWWall::UPLFT].v = tcs[HWWall::UPRGT].v = v.Z;
|
||||
newwall->MakeVertices(this, false);
|
||||
newwall->MakeVertices(false);
|
||||
|
||||
bool hasDecals = newwall->seg->sidedef && newwall->seg->sidedef->AttachedDecals;
|
||||
if (hasDecals && Level->HasDynamicLights && !isFullbrightScene())
|
||||
|
|
|
@ -226,7 +226,7 @@ public:
|
|||
|
||||
void SetupLights(HWDrawInfo* di, FDynLightData& lightdata);
|
||||
|
||||
void MakeVertices(HWDrawInfo* di, bool nosplit);
|
||||
void MakeVertices(bool nosplit);
|
||||
|
||||
void SkyPlane(HWWallDispatcher* di, sector_t* sector, int plane, bool allowmirror);
|
||||
void SkyLine(HWWallDispatcher* di, sector_t* sec, line_t* line);
|
||||
|
@ -280,11 +280,11 @@ public:
|
|||
|
||||
int CountVertices();
|
||||
|
||||
void RenderWall(HWDrawInfo* di, FRenderState& state, int textured);
|
||||
void RenderFogBoundary(HWDrawInfo* di, FRenderState& state);
|
||||
void RenderMirrorSurface(HWDrawInfo* di, FRenderState& state);
|
||||
void RenderTexturedWall(HWDrawInfo* di, FRenderState& state, int rflags);
|
||||
void RenderTranslucentWall(HWDrawInfo* di, FRenderState& state);
|
||||
void RenderWall(FRenderState& state, int textured);
|
||||
void RenderFogBoundary(HWWallDispatcher* di, FRenderState& state);
|
||||
void RenderMirrorSurface(HWWallDispatcher* di, FRenderState& state);
|
||||
void RenderTexturedWall(HWWallDispatcher* di, FRenderState& state, int rflags);
|
||||
void RenderTranslucentWall(HWWallDispatcher* di, FRenderState& state);
|
||||
void DrawDecalsForMirror(HWDrawInfo* di, FRenderState& state, TArray<HWDecal*>& decals);
|
||||
|
||||
public:
|
||||
|
@ -296,7 +296,7 @@ public:
|
|||
return -((y - glseg.y1) * (glseg.x2 - glseg.x1) - (x - glseg.x1) * (glseg.y2 - glseg.y1));
|
||||
}
|
||||
|
||||
void DrawWall(HWDrawInfo* di, FRenderState& state, bool translucent);
|
||||
void DrawWall(HWWallDispatcher* di, FRenderState& state, bool translucent);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ void SetSplitPlanes(FRenderState& state, const secplane_t& top, const secplane_t
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::RenderWall(HWDrawInfo*di, FRenderState &state, int textured)
|
||||
void HWWall::RenderWall(FRenderState &state, int textured)
|
||||
{
|
||||
assert(vertcount > 0);
|
||||
state.SetLightIndex(dynlightindex);
|
||||
|
@ -95,7 +95,7 @@ void HWWall::RenderWall(HWDrawInfo*di, FRenderState &state, int textured)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::RenderFogBoundary(HWDrawInfo*di, FRenderState &state)
|
||||
void HWWall::RenderFogBoundary(HWWallDispatcher*di, FRenderState &state)
|
||||
{
|
||||
if (gl_fogmode && !di->isFullbrightScene())
|
||||
{
|
||||
|
@ -105,7 +105,7 @@ void HWWall::RenderFogBoundary(HWDrawInfo*di, FRenderState &state)
|
|||
state.SetEffect(EFF_FOGBOUNDARY);
|
||||
state.AlphaFunc(Alpha_GEqual, 0.f);
|
||||
state.SetDepthBias(-1, -128);
|
||||
RenderWall(di, state, HWWall::RWF_BLANK);
|
||||
RenderWall(state, HWWall::RWF_BLANK);
|
||||
state.ClearDepthBias();
|
||||
state.SetEffect(EFF_NONE);
|
||||
state.EnableDrawBufferAttachments(true);
|
||||
|
@ -118,7 +118,7 @@ void HWWall::RenderFogBoundary(HWDrawInfo*di, FRenderState &state)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::RenderMirrorSurface(HWDrawInfo*di, FRenderState &state)
|
||||
void HWWall::RenderMirrorSurface(HWWallDispatcher*di, FRenderState &state)
|
||||
{
|
||||
if (!TexMan.mirrorTexture.isValid()) return;
|
||||
|
||||
|
@ -138,7 +138,7 @@ void HWWall::RenderMirrorSurface(HWDrawInfo*di, FRenderState &state)
|
|||
state.SetMaterial(tex, UF_None, 0, CLAMP_NONE, 0, -1); // do not upscale the mirror texture.
|
||||
|
||||
flags &= ~HWWall::HWF_GLOW;
|
||||
RenderWall(di, state, HWWall::RWF_BLANK);
|
||||
RenderWall(state, HWWall::RWF_BLANK);
|
||||
|
||||
state.EnableTextureMatrix(false);
|
||||
state.SetEffect(EFF_NONE);
|
||||
|
@ -149,9 +149,9 @@ void HWWall::RenderMirrorSurface(HWDrawInfo*di, FRenderState &state)
|
|||
// This is drawn in the translucent pass which is done after the decal pass
|
||||
// As a result the decals have to be drawn here, right after the wall they are on,
|
||||
// because the depth buffer won't get set by translucent items.
|
||||
if (seg->sidedef->AttachedDecals)
|
||||
if (di->di && seg->sidedef->AttachedDecals)
|
||||
{
|
||||
DrawDecalsForMirror(di, state, di->Decals[1]);
|
||||
DrawDecalsForMirror(di->di, state, di->di->Decals[1]);
|
||||
}
|
||||
state.SetRenderStyle(STYLE_Translucent);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ static const uint8_t renderwalltotier[] =
|
|||
CVAR(Bool, hw_npottest, false, 0)
|
||||
#endif
|
||||
|
||||
void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
||||
void HWWall::RenderTexturedWall(HWWallDispatcher*di, FRenderState &state, int rflags)
|
||||
{
|
||||
int tmode = state.GetTextureMode();
|
||||
int rel = rellight + getExtraLight();
|
||||
|
@ -266,7 +266,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
|||
{
|
||||
if (type != RENDERWALL_M2SNF) SetFog(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), &Colormap, RenderStyle == STYLE_Add);
|
||||
SetColor(state, di->Level, di->lightmode, lightlevel, rel, di->isFullbrightScene(), Colormap, absalpha);
|
||||
RenderWall(di, state, rflags);
|
||||
RenderWall(state, rflags);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -289,7 +289,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
|||
SetColor(state, di->Level, di->lightmode, thisll, rel, false, thiscm, absalpha);
|
||||
if (type != RENDERWALL_M2SNF) SetFog(state, di->Level, di->lightmode, thisll, rel, false, &thiscm, RenderStyle == STYLE_Add);
|
||||
SetSplitPlanes(state, (*lightlist)[i].plane, lowplane);
|
||||
RenderWall(di, state, rflags);
|
||||
RenderWall(state, rflags);
|
||||
}
|
||||
if (low1 <= zbottom[0] && low2 <= zbottom[1]) break;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ void HWWall::RenderTexturedWall(HWDrawInfo*di, FRenderState &state, int rflags)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::RenderTranslucentWall(HWDrawInfo*di, FRenderState &state)
|
||||
void HWWall::RenderTranslucentWall(HWWallDispatcher*di, FRenderState &state)
|
||||
{
|
||||
state.SetRenderStyle(RenderStyle);
|
||||
if (texture)
|
||||
|
@ -328,7 +328,7 @@ void HWWall::RenderTranslucentWall(HWDrawInfo*di, FRenderState &state)
|
|||
SetColor(state, di->Level, di->lightmode, lightlevel, 0, false, Colormap, fabsf(alpha));
|
||||
SetFog(state, di->Level, di->lightmode, lightlevel, 0, false, &Colormap, RenderStyle == STYLE_Add);
|
||||
state.EnableTexture(false);
|
||||
RenderWall(di, state, HWWall::RWF_NOSPLIT);
|
||||
RenderWall(state, HWWall::RWF_NOSPLIT);
|
||||
state.EnableTexture(true);
|
||||
}
|
||||
state.SetRenderStyle(STYLE_Translucent);
|
||||
|
@ -339,15 +339,15 @@ void HWWall::RenderTranslucentWall(HWDrawInfo*di, FRenderState &state)
|
|||
//
|
||||
//
|
||||
//==========================================================================
|
||||
void HWWall::DrawWall(HWDrawInfo*di, FRenderState &state, bool translucent)
|
||||
void HWWall::DrawWall(HWWallDispatcher*di, FRenderState &state, bool translucent)
|
||||
{
|
||||
if (screen->BuffersArePersistent())
|
||||
{
|
||||
if (di->Level->HasDynamicLights && !di->isFullbrightScene() && texture != nullptr)
|
||||
if (di->di && di->Level->HasDynamicLights && !di->isFullbrightScene() && texture != nullptr)
|
||||
{
|
||||
SetupLights(di, lightdata);
|
||||
SetupLights(di->di, lightdata);
|
||||
}
|
||||
MakeVertices(di, !!(flags & HWWall::HWF_TRANSLUCENT));
|
||||
MakeVertices(!!(flags & HWWall::HWF_TRANSLUCENT));
|
||||
}
|
||||
|
||||
state.SetNormal(glseg.Normal());
|
||||
|
@ -532,7 +532,7 @@ void HWWall::PutWall(HWWallDispatcher *di, bool translucent)
|
|||
{
|
||||
SetupLights(ddi, lightdata);
|
||||
}
|
||||
MakeVertices(ddi, translucent);
|
||||
MakeVertices(translucent);
|
||||
}
|
||||
|
||||
|
||||
|
@ -580,7 +580,7 @@ void HWWall::PutPortal(HWWallDispatcher *di, int ptype, int plane)
|
|||
auto ddi = di->di;
|
||||
if (ddi)
|
||||
{
|
||||
MakeVertices(ddi, false);
|
||||
MakeVertices(false);
|
||||
switch (ptype)
|
||||
{
|
||||
// portals don't go into the draw list.
|
||||
|
|
|
@ -282,7 +282,7 @@ int HWWall::CountVertices()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void HWWall::MakeVertices(HWDrawInfo *di, bool nosplit)
|
||||
void HWWall::MakeVertices(bool nosplit)
|
||||
{
|
||||
if (vertcount == 0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue