blob: c54c66491514e7e5beb40a24bd699092eb3feaa5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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);
};
|