summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser/RegionLoader.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-11-23 18:12:34 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-11-23 18:12:34 +0100
commit79e5b823547a2a51d9f4e504fc24ec539e11ac34 (patch)
tree672b77f1c9a4741437b30f3289fc258d7917a2eb /Tools/QtBiomeVisualiser/RegionLoader.h
parentCompilation fixes (diff)
parentMerge pull request #1612 from p-mcgowan/pigsIntoZombiePigmenOnLightning (diff)
downloadcuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar
cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.gz
cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.bz2
cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.lz
cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.xz
cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.tar.zst
cuberite-79e5b823547a2a51d9f4e504fc24ec539e11ac34.zip
Diffstat (limited to 'Tools/QtBiomeVisualiser/RegionLoader.h')
-rw-r--r--Tools/QtBiomeVisualiser/RegionLoader.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/Tools/QtBiomeVisualiser/RegionLoader.h b/Tools/QtBiomeVisualiser/RegionLoader.h
new file mode 100644
index 000000000..6bbb4aa60
--- /dev/null
+++ b/Tools/QtBiomeVisualiser/RegionLoader.h
@@ -0,0 +1,56 @@
+#pragma once
+
+#include <QObject>
+#include <QRunnable>
+#include <memory>
+
+
+
+
+// fwd:
+class Region;
+typedef std::shared_ptr<Region> RegionPtr;
+
+class ChunkSource;
+typedef std::shared_ptr<ChunkSource> 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 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);
+
+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;
+
+ /** Flag that is set upon app exit to terminate the queued loaders faster. */
+ static volatile bool m_IsShuttingDown;
+};
+
+
+
+