From c53b7e5d38c24bce7ba55abf3060ffd012783086 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Mon, 27 Oct 2014 23:58:09 +0100 Subject: QtBiomeVisualiser: Switched caching to entire regions. This speeds up the rendering preparation for small zooms. --- Tools/QtBiomeVisualiser/RegionLoader.h | 50 ++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Tools/QtBiomeVisualiser/RegionLoader.h (limited to 'Tools/QtBiomeVisualiser/RegionLoader.h') diff --git a/Tools/QtBiomeVisualiser/RegionLoader.h b/Tools/QtBiomeVisualiser/RegionLoader.h new file mode 100644 index 000000000..5a993f5ca --- /dev/null +++ b/Tools/QtBiomeVisualiser/RegionLoader.h @@ -0,0 +1,50 @@ +#pragma once + +#include +#include +#include + + + + +// fwd: +class Region; +typedef std::shared_ptr RegionPtr; + +class ChunkSource; +typedef std::shared_ptr ChunkSourcePtr; + + + + + +class RegionLoader : + public QObject, + public QRunnable +{ + Q_OBJECT + +public: + RegionLoader(int a_RegionX, int a_RegionZ, RegionPtr a_Region, ChunkSourcePtr a_ChunkSource); + virtual ~RegionLoader() {} + +signals: + void loaded(int a_RegionX, int a_RegionZ); + +protected: + virtual void run() override; + +private: + /** Coords of the region to be loaded. */ + int m_RegionX, m_RegionZ; + + /** The region to be loaded. */ + RegionPtr m_Region; + + /** The chunk source to be used for individual chunks within the region. */ + ChunkSourcePtr m_ChunkSource; +}; + + + + -- cgit v1.2.3 From 48ac3acc84274fe8d0bf3af30fb47c6729b07147 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Tue, 28 Oct 2014 22:19:24 +0100 Subject: QtBiomeVisualiser: Added quick shutdown to region loaders. Now the app shuts down immediately even if regions are queued for loading. --- Tools/QtBiomeVisualiser/RegionLoader.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Tools/QtBiomeVisualiser/RegionLoader.h') diff --git a/Tools/QtBiomeVisualiser/RegionLoader.h b/Tools/QtBiomeVisualiser/RegionLoader.h index 5a993f5ca..6bbb4aa60 100644 --- a/Tools/QtBiomeVisualiser/RegionLoader.h +++ b/Tools/QtBiomeVisualiser/RegionLoader.h @@ -28,6 +28,9 @@ public: RegionLoader(int a_RegionX, int a_RegionZ, RegionPtr a_Region, ChunkSourcePtr a_ChunkSource); virtual ~RegionLoader() {} + /** Signals to all loaders that the app is shutting down and the loading should be aborted. */ + static void shutdown() { m_IsShuttingDown = true; } + signals: void loaded(int a_RegionX, int a_RegionZ); @@ -43,6 +46,9 @@ private: /** The chunk source to be used for individual chunks within the region. */ ChunkSourcePtr m_ChunkSource; + + /** Flag that is set upon app exit to terminate the queued loaders faster. */ + static volatile bool m_IsShuttingDown; }; -- cgit v1.2.3