From 670a8914adb65b825a377210dd9d7f5c64582e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20=E2=80=98Touky=E2=80=99=20Huet?= Date: Tue, 27 May 2014 04:30:13 +0000 Subject: [PATCH] Added thread sort && info build for SpriteSorter --- src/lol/algorithm/aabb_tree.h | 18 +++++++++++++++++- src/lol/sys/thread.h | 1 + src/sys/thread.cpp | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/lol/algorithm/aabb_tree.h b/src/lol/algorithm/aabb_tree.h index a288dc5e..2da8c1a2 100644 --- a/src/lol/algorithm/aabb_tree.h +++ b/src/lol/algorithm/aabb_tree.h @@ -168,7 +168,20 @@ public: m_max_element = 1; AddLeaf(0); } - ~AABBTree() { } + ~AABBTree() + { + Clear(); + } + void CopySetup(const AABBTree* src) + { + CopySetup(*src); + } + void CopySetup(const AABBTree& src) + { + m_size = src.m_size; + m_max_depth = src.m_max_depth; + m_max_element = src.m_max_element; + } private: //-- @@ -333,6 +346,9 @@ public: } //-- + TV GetSize() { return m_size; } + int GetMaxDepth() { return m_max_depth; } + int GetMaxElement() { return m_max_element; } void SetSize(TV size) { m_size = size; } void SetMaxDepth(int max_depth) { m_max_depth = max_depth; } void SetMaxElement(int max_element) { m_max_element = max_element; } diff --git a/src/lol/sys/thread.h b/src/lol/sys/thread.h index 7ce86169..2bfe20fe 100644 --- a/src/lol/sys/thread.h +++ b/src/lol/sys/thread.h @@ -72,6 +72,7 @@ struct ThreadJobType WORK_TODO, WORK_DONE, WORK_FAILED, + WORK_FETCHED, THREAD_STOP, MAX diff --git a/src/sys/thread.cpp b/src/sys/thread.cpp index dab6512d..43c403f1 100644 --- a/src/sys/thread.cpp +++ b/src/sys/thread.cpp @@ -116,7 +116,10 @@ void BaseThreadManager::TickGame(float seconds) { ThreadJob* job = result[i]; if (job->GetJobType() == ThreadJobType::WORK_DONE) + { + job->SetJobType(ThreadJobType::WORK_FETCHED); TreatResult(job); + } } } }