Created
May 16, 2018 11:33
-
-
Save nezticle/bb7d1fb13fa3e73a83756057eed9a9c5 to your computer and use it in GitHub Desktop.
Debug Back To Front sorting in Qt3D
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 0e8ec609def938ba5dc816073605b66cc213c0b9 Mon Sep 17 00:00:00 2001 | |
From: Andy Nichols <[email protected]> | |
Date: Wed, 16 May 2018 13:32:04 +0200 | |
Subject: [PATCH] DEBUG: Output BackToFront Sorting | |
Obviously dont merge this... | |
Change-Id: I5227419e0692192ff153a0c272ab00f4994ad865 | |
--- | |
src/render/renderers/opengl/renderer/renderview.cpp | 15 ++++++++++++++- | |
1 file changed, 14 insertions(+), 1 deletion(-) | |
diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp | |
index c29448570..636b4d1fa 100644 | |
--- a/src/render/renderers/opengl/renderer/renderview.cpp | |
+++ b/src/render/renderers/opengl/renderer/renderview.cpp | |
@@ -364,9 +364,22 @@ struct SubRangeSorter<QSortPolicy::BackToFront> | |
{ | |
static void sortSubRange(CommandIt begin, const CommandIt end) | |
{ | |
- std::stable_sort(begin, end, [] (RenderCommand *a, RenderCommand *b) { | |
+ QString outputString; | |
+ QTextStream outputStream(&outputString); | |
+ outputStream << "sortSubRange:\n"; | |
+ std::for_each(begin, end, [&outputStream] (RenderCommand *a){ | |
+ outputStream << "\t" << a << " " << a->m_depth << "\n"; | |
+ }); | |
+ //outputStream << "\tstable_sort\n"; | |
+ std::stable_sort(begin, end, [&outputStream] (RenderCommand *a, RenderCommand *b) { | |
+ //outputStream << "\t\t" << a << " " << a->m_depth << " \t" << b << " " << b->m_depth << "\n"; | |
return a->m_depth > b->m_depth; | |
}); | |
+ outputStream << "sorted\n"; | |
+ std::for_each(begin, end, [&outputStream] (RenderCommand *a){ | |
+ outputStream << "\t" << a << " " << a->m_depth << "\n"; | |
+ }); | |
+ qDebug() << qPrintable(outputString); | |
} | |
}; | |
-- | |
2.14.3.windows.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment