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

View File

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

View File

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

View File

@ -26,13 +26,14 @@ namespace swrenderer
void Clear(); void Clear();
void PushPortal(); void PushPortal();
void PopPortal(); void PopPortal();
void Push(VisibleSprite *sprite); void Push(VisibleSprite *sprite, bool isVoxel = false);
void Sort(bool compare2d); void Sort();
TArray<VisibleSprite *> SortedSprites; TArray<VisibleSprite *> SortedSprites;
private: private:
TArray<VisibleSprite *> Sprites; TArray<VisibleSprite *> Sprites;
TArray<unsigned int> StartIndices; 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); vis->Light.SetColormap(r_SpriteVisibility / MAX(tz, MINZ), spriteshade, basecolormap, fullbright, invertcolormap, fadeToBlack);
VisibleSpriteList::Instance()->Push(vis); VisibleSpriteList::Instance()->Push(vis, true);
RenderTranslucentPass::Instance()->DrewAVoxel = true;
} }
void RenderVoxel::Render(short *cliptop, short *clipbottom, int minZ, int maxZ) void RenderVoxel::Render(short *cliptop, short *clipbottom, int minZ, int maxZ)