summaryrefslogtreecommitdiffstats
path: root/Tools/QtBiomeVisualiser/ChunkCache.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-10-27 23:58:09 +0100
committerMattes D <github@xoft.cz>2014-10-27 23:58:09 +0100
commitc53b7e5d38c24bce7ba55abf3060ffd012783086 (patch)
treee592eeadadbd41cede746f8729bd70c275552eb5 /Tools/QtBiomeVisualiser/ChunkCache.h
parentFixed typo. (diff)
downloadcuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.tar
cuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.tar.gz
cuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.tar.bz2
cuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.tar.lz
cuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.tar.xz
cuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.tar.zst
cuberite-c53b7e5d38c24bce7ba55abf3060ffd012783086.zip
Diffstat (limited to '')
-rw-r--r--Tools/QtBiomeVisualiser/RegionCache.h (renamed from Tools/QtBiomeVisualiser/ChunkCache.h)31
1 files changed, 16 insertions, 15 deletions
diff --git a/Tools/QtBiomeVisualiser/ChunkCache.h b/Tools/QtBiomeVisualiser/RegionCache.h
index 8d198f02f..c343e4ba9 100644
--- a/Tools/QtBiomeVisualiser/ChunkCache.h
+++ b/Tools/QtBiomeVisualiser/RegionCache.h
@@ -9,8 +9,9 @@
-class Chunk;
-typedef std::shared_ptr<Chunk> ChunkPtr;
+// fwd:
+class Region;
+typedef std::shared_ptr<Region> RegionPtr;
class ChunkSource;
@@ -18,19 +19,19 @@ class ChunkSource;
-/** Caches chunk data for reuse */
-class ChunkCache :
+/** Caches regions' chunk data for reuse */
+class RegionCache :
public QObject
{
typedef QObject super;
Q_OBJECT
public:
- explicit ChunkCache(QObject * parent = NULL);
+ explicit RegionCache(QObject * parent = NULL);
- /** Retrieves the specified chunk from the cache.
- Only returns valid chunks; if the chunk is invalid, queues it for rendering and returns an empty ptr. */
- ChunkPtr fetch(int a_ChunkX, int a_ChunkZ);
+ /** Retrieves the specified region from the cache.
+ Only returns valid regions; if the region is invalid, queues it for rendering and returns an empty ptr. */
+ RegionPtr fetch(int a_RegionX, int a_RegionZ);
/** Replaces the chunk source used by the biome view to get the chunk biome data.
The cache is then invalidated. */
@@ -43,16 +44,16 @@ public:
void reload();
signals:
- void chunkAvailable(int a_ChunkX, int a_ChunkZ);
+ void regionAvailable(int a_RegionX, int a_RegionZ);
protected slots:
- void gotChunk(int a_ChunkX, int a_ChunkZ);
+ void gotRegion(int a_RegionX, int a_RegionZ);
protected:
/** The cache of the chunks */
- QCache<quint32, ChunkPtr> m_Cache;
+ QCache<quint32, RegionPtr> m_Cache;
- /** Locks te cache against multithreaded access */
+ /** Locks the cache against multithreaded access */
QMutex m_Mtx;
/** The source used to get the biome data. */
@@ -60,10 +61,10 @@ protected:
/** Returns the hash used by the chunk in the cache */
- quint32 getChunkHash(int a_ChunkX, int a_ChunkZ);
+ quint32 getRegionHash(int a_RegionX, int a_RegionZ);
- /** Queues the specified chunk for rendering by m_ChunkSource. */
- void queueChunkRender(int a_ChunkX, int a_ChunkZ, ChunkPtr & a_Chunk);
+ /** Queues the specified region for rendering by m_RegionSource. */
+ void queueRegionRender(int a_RegionX, int a_RegionZ, RegionPtr & a_Region);
};