mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-09 14:58:37 -05:00
Create cache for the tiles so we don't have to recreate them each frame
This commit is contained in:
@@ -245,8 +245,15 @@ Tile VideoTileProvider::tile(const TileIndex& tileIndex) {
|
||||
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
||||
LINFO("Framebuffer is not complete");
|
||||
}
|
||||
|
||||
return Tile{ _frameTexture.get(), std::nullopt, Tile::Status::OK};
|
||||
uint64_t hash = tileIndex.hashKey();
|
||||
if (_tileCache.find(hash) == _tileCache.end()) {
|
||||
_tileCache[hash] = Tile{
|
||||
_frameTexture.get(),
|
||||
std::nullopt,
|
||||
Tile::Status::OK
|
||||
};
|
||||
}
|
||||
return _tileCache[hash];
|
||||
}
|
||||
|
||||
Tile::Status VideoTileProvider::tileStatus(const TileIndex& tileIndex) {
|
||||
|
||||
@@ -132,6 +132,9 @@ private:
|
||||
static int _wakeup;
|
||||
bool _didRender = false;
|
||||
bool _isPaused = false;
|
||||
|
||||
// Cache for rendering the same frame
|
||||
std::map<TileIndex::TileHashKey, Tile> _tileCache;
|
||||
};
|
||||
|
||||
} // namespace openspace::globebrowsing
|
||||
|
||||
Reference in New Issue
Block a user