Move DrewAVoxel to VisibleSpriteList

This commit is contained in:
Magnus Norddahl 2017-01-26 08:39:44 +01:00
parent 34f85569b4
commit 933f2d116a
5 changed files with 12 additions and 10 deletions

View File

@ -61,7 +61,6 @@ namespace swrenderer
void RenderTranslucentPass::Clear()
{
VisibleSpriteList::Instance()->Clear();
DrewAVoxel = false;
}
void RenderTranslucentPass::CollectPortals()
@ -161,7 +160,7 @@ namespace swrenderer
void RenderTranslucentPass::Render()
{
CollectPortals();
VisibleSpriteList::Instance()->Sort(DrewAVoxel);
VisibleSpriteList::Instance()->Sort();
Clip3DFloors *clip3d = Clip3DFloors::Instance();
if (clip3d->height_top == nullptr)

View File

@ -34,8 +34,6 @@ namespace swrenderer
void Clear();
void Render();
bool DrewAVoxel = false;
bool ClipSpriteColumnWithPortals(int x, VisibleSprite *spr);
private:

View File

@ -39,6 +39,7 @@ namespace swrenderer
Sprites.Clear();
StartIndices.Clear();
SortedSprites.Clear();
DrewAVoxel = false;
}
void VisibleSpriteList::PushPortal()
@ -52,13 +53,17 @@ namespace swrenderer
StartIndices.Pop();
}
void VisibleSpriteList::Push(VisibleSprite *sprite)
void VisibleSpriteList::Push(VisibleSprite *sprite, bool isVoxel)
{
Sprites.Push(sprite);
if (isVoxel)
DrewAVoxel = true;
}
void VisibleSpriteList::Sort(bool compare2d)
void VisibleSpriteList::Sort()
{
bool compare2d = DrewAVoxel;
unsigned int first = StartIndices.Size() == 0 ? 0 : StartIndices.Last();
unsigned int count = Sprites.Size() - first;

View File

@ -26,13 +26,14 @@ namespace swrenderer
void Clear();
void PushPortal();
void PopPortal();
void Push(VisibleSprite *sprite);
void Sort(bool compare2d);
void Push(VisibleSprite *sprite, bool isVoxel = false);
void Sort();
TArray<VisibleSprite *> SortedSprites;
private:
TArray<VisibleSprite *> Sprites;
TArray<unsigned int> StartIndices;
bool DrewAVoxel = false;
};
}

View File

@ -177,8 +177,7 @@ namespace swrenderer
vis->Light.SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
VisibleSpriteList::Instance()->Push(vis);
RenderTranslucentPass::Instance()->DrewAVoxel = true;
VisibleSpriteList::Instance()->Push(vis, true);
}
void RenderVoxel::Render(short *cliptop, short *clipbottom, int minZ, int maxZ)