From 1a1204472e4d047de824686e9f606d7c832ec698 Mon Sep 17 00:00:00 2001 From: frosch Date: Thu, 15 Nov 2018 23:12:37 +0100 Subject: Revert: Sprite sorting optimisation sorted incorrectly. This reverts commit 25ab9c1997f770f4a8a66bb3ad4b82ba87e3a977. --- src/viewport.cpp | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src/viewport.cpp') diff --git a/src/viewport.cpp b/src/viewport.cpp index 13f87de1d..350bb9238 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -88,7 +88,6 @@ #include "command_func.h" #include "network/network_func.h" #include "framerate_type.h" -#include "core/sort_func.hpp" #include @@ -1380,22 +1379,11 @@ static bool ViewportSortParentSpritesChecker() return true; } -static int CDECL CompareParentSprites(ParentSpriteToDraw * const *psd, ParentSpriteToDraw * const *psd2) -{ - const ParentSpriteToDraw *ps = *psd; - const ParentSpriteToDraw *ps2 = *psd2; - return ps->xmin - ps2->xmin; -} - /** Sort parent sprites pointer array */ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) { ParentSpriteToDraw **psdvend = psdv->End(); ParentSpriteToDraw **psd = psdv->Begin(); - - /* pre-sort by xmin in ascending order */ - QSortT(psd, psdvend - psd, CompareParentSprites); - while (psd != psdvend) { ParentSpriteToDraw *ps = *psd; @@ -1432,11 +1420,9 @@ static void ViewportSortParentSprites(ParentSpriteToSortVector *psdv) * I.e. every single order of X, Y, Z says ps2 is behind ps or they overlap. * That is: If one partial order says ps behind ps2, do not change the order. */ - if (ps->xmax < ps2->xmin) { - /* all following sprites have xmin >= ps2->xmin */ - break; - } - if (ps->ymax < ps2->ymin || ps->zmax < ps2->zmin) { + if (ps->xmax < ps2->xmin || + ps->ymax < ps2->ymin || + ps->zmax < ps2->zmin) { continue; } } -- cgit v1.2.3-54-g00ecf