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/ChunkCache.h | 72 ------------------------------------ 1 file changed, 72 deletions(-) delete mode 100644 Tools/QtBiomeVisualiser/ChunkCache.h (limited to 'Tools/QtBiomeVisualiser/ChunkCache.h') diff --git a/Tools/QtBiomeVisualiser/ChunkCache.h b/Tools/QtBiomeVisualiser/ChunkCache.h deleted file mode 100644 index 8d198f02f..000000000 --- a/Tools/QtBiomeVisualiser/ChunkCache.h +++ /dev/null @@ -1,72 +0,0 @@ -#pragma once - -#include -#include -#include -#include - - - - - -class Chunk; -typedef std::shared_ptr ChunkPtr; - -class ChunkSource; - - - - - -/** Caches chunk data for reuse */ -class ChunkCache : - public QObject -{ - typedef QObject super; - Q_OBJECT - -public: - explicit ChunkCache(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); - - /** Replaces the chunk source used by the biome view to get the chunk biome data. - The cache is then invalidated. */ - void setChunkSource(std::shared_ptr a_ChunkSource); - - /** Returns true iff the chunk source has been initialized. */ - bool hasData() const { return (m_ChunkSource.get() != nullptr); } - - /** Reloads the current chunk source. */ - void reload(); - -signals: - void chunkAvailable(int a_ChunkX, int a_ChunkZ); - -protected slots: - void gotChunk(int a_ChunkX, int a_ChunkZ); - -protected: - /** The cache of the chunks */ - QCache m_Cache; - - /** Locks te cache against multithreaded access */ - QMutex m_Mtx; - - /** The source used to get the biome data. */ - std::shared_ptr m_ChunkSource; - - - /** Returns the hash used by the chunk in the cache */ - quint32 getChunkHash(int a_ChunkX, int a_ChunkZ); - - /** Queues the specified chunk for rendering by m_ChunkSource. */ - void queueChunkRender(int a_ChunkX, int a_ChunkZ, ChunkPtr & a_Chunk); -}; - - - - - -- cgit v1.2.3