summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser/BiomeView.h
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-14 14:16:17 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-14 14:16:17 +0200
commit92e7e5c615efb591210ffd978afa012027f2c84f (patch)
tree1271b2281ab938f59f3f2d933a6c873fd3f633ba /Tools/QtBiomeVisualiser/BiomeView.h
parent1.8: Updated scoreboard packets. (diff)
parentAdded new Qt-based biome visualiser. (diff)
downloadcuberite-92e7e5c615efb591210ffd978afa012027f2c84f.tar
cuberite-92e7e5c615efb591210ffd978afa012027f2c84f.tar.gz
cuberite-92e7e5c615efb591210ffd978afa012027f2c84f.tar.bz2
cuberite-92e7e5c615efb591210ffd978afa012027f2c84f.tar.lz
cuberite-92e7e5c615efb591210ffd978afa012027f2c84f.tar.xz
cuberite-92e7e5c615efb591210ffd978afa012027f2c84f.tar.zst
cuberite-92e7e5c615efb591210ffd978afa012027f2c84f.zip
Diffstat (limited to 'Tools/QtBiomeVisualiser/BiomeView.h')
-rw-r--r--Tools/QtBiomeVisualiser/BiomeView.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/Tools/QtBiomeVisualiser/BiomeView.h b/Tools/QtBiomeVisualiser/BiomeView.h
new file mode 100644
index 000000000..c54c66491
--- /dev/null
+++ b/Tools/QtBiomeVisualiser/BiomeView.h
@@ -0,0 +1,65 @@
+#pragma once
+
+#include <QWidget>
+#include "ChunkCache.h"
+#include "ChunkSource.h"
+
+
+
+
+
+class BiomeView :
+ public QWidget
+{
+ typedef QWidget super;
+ Q_OBJECT
+
+public:
+ explicit BiomeView(QWidget * parent = NULL);
+
+ QSize minimumSizeHint() const;
+ QSize sizeHint() const;
+
+ /** Replaces the chunk source used by the biome view to get the chunk biome data.
+ The entire view is then invalidated and regenerated. */
+ void setChunkSource(std::shared_ptr<ChunkSource> a_ChunkSource);
+
+signals:
+
+public slots:
+ /** Redraw the entire widget area. */
+ void redraw();
+
+ /** A specified chunk has become available, redraw it. */
+ void chunkAvailable(int a_ChunkX, int a_ChunkZ);
+
+protected:
+ double m_X, m_Z;
+ int m_Zoom;
+ ChunkCache m_Cache;
+ QImage m_Image;
+
+ /** Data used for rendering a chunk that hasn't been loaded yet */
+ uchar m_EmptyChunkImage[16 * 16 * 4];
+
+
+ /** Draws the specified chunk into m_Image */
+ void drawChunk(int a_ChunkX, int a_ChunkZ);
+
+ /** Returns true iff the biome view has been initialized to contain proper biome data. */
+ bool hasData(void) const { return m_Cache.hasData(); }
+
+ /** Called when the widget is resized */
+ virtual void resizeEvent(QResizeEvent *) override;
+
+ /** Paints the entire widget */
+ virtual void paintEvent(QPaintEvent *) override;
+
+ /** Queues the chunk for rendering. */
+ void queueChunkRender(ChunkPtr a_Chunk);
+};
+
+
+
+
+