mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-26 14:58:51 -06:00
Feature/offline rendering (#906)
* Added functionality of saving out screenshots (with fixed FPS) from a recorded session during playback. * Test of feature to request if all data is ready to be rendered, primary used in GlobeBrowsing. Need to go over how chunkTiles are set to OK (some are never OK..). * Estimated having working request of checking if chunks with correct level have their color and height data loaded and ready to be rendered. Will re-enable frames saving and try making a movie. * Created adaptive LOD factor based on available/unavailable tile data (such that we don't run a lot of iterations with asking for a pile of data that does not fit in the tile cache). * Made it able to specify tile cache size in configurastion file. Renamed other Cache value to WMSCache, as we have the TileCache as well. * Fix for when focus node has nor renderable, when checking for if dersired data has been loaded. Should probably check all renderable/planets anyway, not just a focus object.
This commit is contained in:
@@ -63,9 +63,9 @@ namespace {
|
||||
constexpr const char* _loggerCat = "GlobeBrowsingModule";
|
||||
constexpr const char* _factoryName = "TileProvider";
|
||||
|
||||
constexpr const openspace::properties::Property::PropertyInfo CacheEnabledInfo = {
|
||||
"CacheEnabled",
|
||||
"Cache Enabled",
|
||||
constexpr const openspace::properties::Property::PropertyInfo WMSCacheEnabledInfo = {
|
||||
"WMSCacheEnabled",
|
||||
"WMS Cache Enabled",
|
||||
"Determines whether automatic caching of WMS servers is enabled. Changing the "
|
||||
"value of this property will not affect already created WMS datasets."
|
||||
};
|
||||
@@ -80,20 +80,26 @@ namespace {
|
||||
"already created WMS datasets."
|
||||
};
|
||||
|
||||
constexpr const openspace::properties::Property::PropertyInfo CacheLocationInfo = {
|
||||
"CacheLocation",
|
||||
"Cache Location",
|
||||
constexpr const openspace::properties::Property::PropertyInfo WMSCacheLocationInfo = {
|
||||
"WMSCacheLocation",
|
||||
"WMS Cache Location",
|
||||
"The location of the cache folder for WMS servers. Changing the value of this "
|
||||
"property will not affect already created WMS datasets."
|
||||
};
|
||||
|
||||
constexpr const openspace::properties::Property::PropertyInfo CacheSizeInfo = {
|
||||
"CacheSize",
|
||||
"Cache Size",
|
||||
constexpr const openspace::properties::Property::PropertyInfo WMSCacheSizeInfo = {
|
||||
"WMSCacheSize",
|
||||
"WMS Cache Size",
|
||||
"The maximum size of the cache for each WMS server. Changing the value of this "
|
||||
"property will not affect already created WMS datasets."
|
||||
};
|
||||
|
||||
constexpr const openspace::properties::Property::PropertyInfo TileCacheSizeInfo = {
|
||||
"TileCacheSize",
|
||||
"Tile Cache Size",
|
||||
"The maximum size of the MemoryAwareTileCache, on the CPU and GPU."
|
||||
};
|
||||
|
||||
|
||||
openspace::GlobeBrowsingModule::Capabilities
|
||||
parseSubDatasets(char** subDatasets, int nSubdatasets)
|
||||
@@ -151,31 +157,36 @@ namespace openspace {
|
||||
|
||||
GlobeBrowsingModule::GlobeBrowsingModule()
|
||||
: OpenSpaceModule(Name)
|
||||
, _cacheEnabled(CacheEnabledInfo, false)
|
||||
, _wmsCacheEnabled(WMSCacheEnabledInfo, false)
|
||||
, _offlineMode(OfflineModeInfo, false)
|
||||
, _cacheLocation(CacheLocationInfo, "${BASE}/cache_gdal")
|
||||
, _cacheSizeMB(CacheSizeInfo, 1024)
|
||||
, _wmsCacheLocation(WMSCacheLocationInfo, "${BASE}/cache_gdal")
|
||||
, _wmsCacheSizeMB(WMSCacheSizeInfo, 1024)
|
||||
, _tileCacheSizeMB(TileCacheSizeInfo, 1024)
|
||||
{
|
||||
addProperty(_cacheEnabled);
|
||||
addProperty(_wmsCacheEnabled);
|
||||
addProperty(_offlineMode);
|
||||
addProperty(_cacheLocation);
|
||||
addProperty(_cacheSizeMB);
|
||||
addProperty(_wmsCacheLocation);
|
||||
addProperty(_wmsCacheSizeMB);
|
||||
addProperty(_tileCacheSizeMB);
|
||||
}
|
||||
|
||||
void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
using namespace globebrowsing;
|
||||
|
||||
if (dict.hasKeyAndValue<bool>(CacheEnabledInfo.identifier)) {
|
||||
_cacheEnabled = dict.value<bool>(CacheEnabledInfo.identifier);
|
||||
if (dict.hasKeyAndValue<bool>(WMSCacheEnabledInfo.identifier)) {
|
||||
_wmsCacheEnabled = dict.value<bool>(WMSCacheEnabledInfo.identifier);
|
||||
}
|
||||
if (dict.hasKeyAndValue<bool>(OfflineModeInfo.identifier)) {
|
||||
_offlineMode = dict.value<bool>(OfflineModeInfo.identifier);
|
||||
}
|
||||
if (dict.hasKeyAndValue<std::string>(CacheLocationInfo.identifier)) {
|
||||
_cacheLocation = dict.value<std::string>(CacheLocationInfo.identifier);
|
||||
if (dict.hasKeyAndValue<std::string>(WMSCacheLocationInfo.identifier)) {
|
||||
_wmsCacheLocation = dict.value<std::string>(WMSCacheLocationInfo.identifier);
|
||||
}
|
||||
if (dict.hasKeyAndValue<double>(CacheSizeInfo.identifier)) {
|
||||
_cacheSizeMB = static_cast<int>(dict.value<double>(CacheSizeInfo.identifier));
|
||||
if (dict.hasKeyAndValue<double>(WMSCacheSizeInfo.identifier)) {
|
||||
_wmsCacheSizeMB = static_cast<int>(dict.value<double>(WMSCacheSizeInfo.identifier));
|
||||
}
|
||||
if (dict.hasKeyAndValue<double>(TileCacheSizeInfo.identifier)) {
|
||||
_tileCacheSizeMB = static_cast<int>(dict.value<double>(TileCacheSizeInfo.identifier));
|
||||
}
|
||||
|
||||
// Sanity check
|
||||
@@ -183,7 +194,7 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
dict.value<bool>("NoWarning") :
|
||||
false;
|
||||
|
||||
if (!_cacheEnabled && _offlineMode && !noWarning) {
|
||||
if (!_wmsCacheEnabled && _offlineMode && !noWarning) {
|
||||
LWARNINGC(
|
||||
"GlobeBrowsingModule",
|
||||
"WMS caching is disabled, but offline mode is enabled. Unless you know "
|
||||
@@ -196,7 +207,7 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
|
||||
// Initialize
|
||||
global::callback::initializeGL.emplace_back([&]() {
|
||||
_tileCache = std::make_unique<globebrowsing::cache::MemoryAwareTileCache>();
|
||||
_tileCache = std::make_unique<globebrowsing::cache::MemoryAwareTileCache>(_tileCacheSizeMB);
|
||||
addPropertySubOwner(*_tileCache);
|
||||
|
||||
tileprovider::initializeDefaultTile();
|
||||
@@ -697,20 +708,20 @@ bool GlobeBrowsingModule::hasUrlInfo(const std::string& globe) const {
|
||||
return _urlList.find(globe) != _urlList.end();
|
||||
}
|
||||
|
||||
bool GlobeBrowsingModule::isCachingEnabled() const {
|
||||
return _cacheEnabled;
|
||||
bool GlobeBrowsingModule::isWMSCachingEnabled() const {
|
||||
return _wmsCacheEnabled;
|
||||
}
|
||||
|
||||
bool GlobeBrowsingModule::isInOfflineMode() const {
|
||||
return _offlineMode;
|
||||
}
|
||||
|
||||
std::string GlobeBrowsingModule::cacheLocation() const {
|
||||
return _cacheLocation;
|
||||
std::string GlobeBrowsingModule::wmsCacheLocation() const {
|
||||
return _wmsCacheLocation;
|
||||
}
|
||||
|
||||
uint64_t GlobeBrowsingModule::cacheSize() const {
|
||||
uint64_t size = _cacheSizeMB;
|
||||
uint64_t GlobeBrowsingModule::wmsCacheSize() const {
|
||||
uint64_t size = _wmsCacheSizeMB;
|
||||
return size * 1024 * 1024;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user