mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-24 13:01:48 +00:00
Change RenderTranslucentPass to be a singleton
This commit is contained in:
parent
8b0304c1e3
commit
34f85569b4
8 changed files with 31 additions and 20 deletions
|
@ -239,7 +239,7 @@ namespace swrenderer
|
|||
// Masked textures and planes need the view coordinates restored for proper positioning.
|
||||
viewposStack.Pop(ViewPos);
|
||||
|
||||
RenderTranslucentPass::Render();
|
||||
RenderTranslucentPass::Instance()->Render();
|
||||
|
||||
drawseglist->ds_p = drawseglist->firstdrawseg;
|
||||
|
||||
|
@ -458,7 +458,7 @@ namespace swrenderer
|
|||
NetUpdate();
|
||||
|
||||
MaskedCycles.Clock(); // [ZZ] count sprites in portals/mirrors along with normal ones.
|
||||
RenderTranslucentPass::Render(); // this is required since with portals there often will be cases when more than 80% of the view is inside a portal.
|
||||
RenderTranslucentPass::Instance()->Render(); // this is required since with portals there often will be cases when more than 80% of the view is inside a portal.
|
||||
MaskedCycles.Unclock();
|
||||
|
||||
NetUpdate();
|
||||
|
|
|
@ -134,7 +134,7 @@ namespace swrenderer
|
|||
RenderClipSegment::Instance()->Clear(0, viewwidth);
|
||||
DrawSegmentList::Instance()->Clear();
|
||||
VisiblePlaneList::Instance()->Clear();
|
||||
RenderTranslucentPass::Clear();
|
||||
RenderTranslucentPass::Instance()->Clear();
|
||||
|
||||
// opening / clipping determination
|
||||
RenderOpaquePass::Instance()->ClearClip();
|
||||
|
@ -182,7 +182,7 @@ namespace swrenderer
|
|||
NetUpdate();
|
||||
|
||||
MaskedCycles.Clock();
|
||||
RenderTranslucentPass::Render();
|
||||
RenderTranslucentPass::Instance()->Render();
|
||||
MaskedCycles.Unclock();
|
||||
|
||||
NetUpdate();
|
||||
|
@ -267,7 +267,7 @@ namespace swrenderer
|
|||
|
||||
void RenderScene::Deinit()
|
||||
{
|
||||
RenderTranslucentPass::Deinit();
|
||||
RenderTranslucentPass::Instance()->Deinit();
|
||||
Clip3DFloors::Instance()->Cleanup();
|
||||
DrawSegmentList::Instance()->Deinit();
|
||||
}
|
||||
|
|
|
@ -47,8 +47,11 @@ CVAR(Bool, r_fullbrightignoresectorcolor, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG
|
|||
|
||||
namespace swrenderer
|
||||
{
|
||||
bool RenderTranslucentPass::DrewAVoxel;
|
||||
TArray<DrawSegment *> RenderTranslucentPass::portaldrawsegs;
|
||||
RenderTranslucentPass *RenderTranslucentPass::Instance()
|
||||
{
|
||||
static RenderTranslucentPass instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void RenderTranslucentPass::Deinit()
|
||||
{
|
||||
|
|
|
@ -28,18 +28,20 @@ namespace swrenderer
|
|||
class RenderTranslucentPass
|
||||
{
|
||||
public:
|
||||
static void Deinit();
|
||||
static void Clear();
|
||||
static void Render();
|
||||
static RenderTranslucentPass *Instance();
|
||||
|
||||
static bool DrewAVoxel;
|
||||
void Deinit();
|
||||
void Clear();
|
||||
void Render();
|
||||
|
||||
static bool ClipSpriteColumnWithPortals(int x, VisibleSprite *spr);
|
||||
bool DrewAVoxel = false;
|
||||
|
||||
bool ClipSpriteColumnWithPortals(int x, VisibleSprite *spr);
|
||||
|
||||
private:
|
||||
static void CollectPortals();
|
||||
static void DrawMaskedSingle(bool renew);
|
||||
void CollectPortals();
|
||||
void DrawMaskedSingle(bool renew);
|
||||
|
||||
static TArray<DrawSegment *> portaldrawsegs;
|
||||
TArray<DrawSegment *> portaldrawsegs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -236,11 +236,13 @@ namespace swrenderer
|
|||
uint32_t fracstepx = PARTICLE_TEXTURE_SIZE * FRACUNIT / countbase;
|
||||
uint32_t fracposx = fracstepx / 2;
|
||||
|
||||
RenderTranslucentPass *translucentPass = RenderTranslucentPass::Instance();
|
||||
|
||||
if (r_swtruecolor)
|
||||
{
|
||||
for (int x = x1; x < (x1 + countbase); x++, fracposx += fracstepx)
|
||||
{
|
||||
if (RenderTranslucentPass::ClipSpriteColumnWithPortals(x, vis))
|
||||
if (translucentPass->ClipSpriteColumnWithPortals(x, vis))
|
||||
continue;
|
||||
uint32_t *dest = ylookup[yl] + x + (uint32_t*)dc_destorg;
|
||||
DrawerCommandQueue::QueueCommand<DrawParticleColumnRGBACommand>(dest, yl, spacing, ycount, fg, alpha, fracposx);
|
||||
|
@ -250,7 +252,7 @@ namespace swrenderer
|
|||
{
|
||||
for (int x = x1; x < (x1 + countbase); x++, fracposx += fracstepx)
|
||||
{
|
||||
if (RenderTranslucentPass::ClipSpriteColumnWithPortals(x, vis))
|
||||
if (translucentPass->ClipSpriteColumnWithPortals(x, vis))
|
||||
continue;
|
||||
uint8_t *dest = ylookup[yl] + x + dc_destorg;
|
||||
DrawerCommandQueue::QueueCommand<DrawParticleColumnPalCommand>(dest, yl, spacing, ycount, fg, alpha, fracposx);
|
||||
|
|
|
@ -288,9 +288,11 @@ namespace swrenderer
|
|||
|
||||
if (x < x2)
|
||||
{
|
||||
RenderTranslucentPass *translucentPass = RenderTranslucentPass::Instance();
|
||||
|
||||
while (x < x2)
|
||||
{
|
||||
if (!RenderTranslucentPass::ClipSpriteColumnWithPortals(x, vis))
|
||||
if (!translucentPass->ClipSpriteColumnWithPortals(x, vis))
|
||||
R_DrawMaskedColumn(x, iscale, tex, frac, spryscale, sprtopscreen, sprflipvert, mfloorclip, mceilingclip, false);
|
||||
x++;
|
||||
frac += xiscale;
|
||||
|
|
|
@ -178,7 +178,7 @@ namespace swrenderer
|
|||
vis->Light.SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
|
||||
|
||||
VisibleSpriteList::Instance()->Push(vis);
|
||||
RenderTranslucentPass::DrewAVoxel = true;
|
||||
RenderTranslucentPass::Instance()->DrewAVoxel = true;
|
||||
}
|
||||
|
||||
void RenderVoxel::Render(short *cliptop, short *clipbottom, int minZ, int maxZ)
|
||||
|
|
|
@ -226,13 +226,15 @@ namespace swrenderer
|
|||
}
|
||||
else
|
||||
{
|
||||
RenderTranslucentPass *translucentPass = RenderTranslucentPass::Instance();
|
||||
|
||||
while (x < x2)
|
||||
{
|
||||
if (calclighting)
|
||||
{ // calculate lighting
|
||||
R_SetColorMapLight(usecolormap, light, shade);
|
||||
}
|
||||
if (!RenderTranslucentPass::ClipSpriteColumnWithPortals(x, spr))
|
||||
if (!translucentPass->ClipSpriteColumnWithPortals(x, spr))
|
||||
DrawColumn(x, WallSpriteTile, walltexcoords, texturemid, maskedScaleY, sprflipvert, mfloorclip, mceilingclip);
|
||||
light += lightstep;
|
||||
x++;
|
||||
|
|
Loading…
Reference in a new issue