mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Fix caching
This commit is contained in:
BIN
Mods/vcmi/Data/debug/cached.png
Normal file
BIN
Mods/vcmi/Data/debug/cached.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 B |
@@ -113,6 +113,9 @@ size_t MapRendererContext::terrainImageIndex(size_t groupSize) const
|
|||||||
|
|
||||||
bool MapRendererContext::tileAnimated(const int3 & coordinates) const
|
bool MapRendererContext::tileAnimated(const int3 & coordinates) const
|
||||||
{
|
{
|
||||||
|
if (!isInMap(coordinates))
|
||||||
|
return false;
|
||||||
|
|
||||||
if(movementAnimation)
|
if(movementAnimation)
|
||||||
{
|
{
|
||||||
auto objects = getObjects(coordinates);
|
auto objects = getObjects(coordinates);
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ void MapViewCache::updateTile(const std::shared_ptr<const IMapRendererContext> &
|
|||||||
newCacheEntry.tileY = coordinates.y;
|
newCacheEntry.tileY = coordinates.y;
|
||||||
newCacheEntry.checksum = mapRenderer->getTileChecksum(*context, coordinates);
|
newCacheEntry.checksum = mapRenderer->getTileChecksum(*context, coordinates);
|
||||||
|
|
||||||
if(cachedLevel == coordinates.z && oldCacheEntry == newCacheEntry)
|
if(cachedLevel == coordinates.z && oldCacheEntry == newCacheEntry && !context->tileAnimated(coordinates))
|
||||||
{
|
{
|
||||||
// debug code to check caching - cached tiles will slowly fade to black
|
// debug code to check caching - cached tiles will slowly fade to black
|
||||||
//static const auto overlay = IImage::createFromFile("debug/cached");
|
//static const auto overlay = IImage::createFromFile("debug/cached");
|
||||||
@@ -132,7 +132,7 @@ void MapViewCache::render(const std::shared_ptr<const IMapRendererContext> & con
|
|||||||
int cacheY = (terrainChecksum.shape()[1] + y) % terrainChecksum.shape()[1];
|
int cacheY = (terrainChecksum.shape()[1] + y) % terrainChecksum.shape()[1];
|
||||||
int3 tile(x, y, model->getLevel());
|
int3 tile(x, y, model->getLevel());
|
||||||
|
|
||||||
if(lazyUpdate && tilesUpToDate[cacheX][cacheY] && !context->tileAnimated(tile))
|
if(lazyUpdate && tilesUpToDate[cacheX][cacheY])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Canvas source = getTile(tile);
|
Canvas source = getTile(tile);
|
||||||
|
|||||||
Reference in New Issue
Block a user