Add Override parameter for URLSynchronization

Add PerformShading asset parameter for RenderablePlanet
Disable shading on default for Earth
This commit is contained in:
Alexander Bock
2018-03-09 11:42:32 -05:00
parent 7ccb42545c
commit 5b6ae62bab
7 changed files with 27 additions and 5 deletions

View File

@@ -23,7 +23,8 @@ asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Large",
Identifier = "example_large",
Url = "http://ipv4.download.thinkbroadband.com/100MB.zip"
Url = "http://ipv4.download.thinkbroadband.com/100MB.zip",
Override = true
})
asset.syncedResource({

View File

@@ -16,6 +16,7 @@ local Earth = {
Type = "RenderableGlobe",
Radii = earthEllipsoid,
SegmentsPerPatch = 64,
PerformShading = false,
Layers = {
ColorLayers = {
{

View File

@@ -220,6 +220,10 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
dictionary.getValue(keySegmentsPerPatch, patchSegmentsd);
int patchSegments = static_cast<int>(patchSegmentsd);
if (dictionary.hasValue<bool>("PerformShading")) {
_generalProperties.performShading = dictionary.value<bool>("PerformShading");
}
// Init layer manager
ghoul::Dictionary layersDictionary;
if (!dictionary.getValue(keyLayers, layersDictionary)) {

View File

@@ -39,6 +39,7 @@
namespace {
constexpr const char* KeyUrl = "Url";
constexpr const char* KeyIdentifier = "Identifier";
constexpr const char* KeyOverride = "Override";
} // namespace
namespace openspace {
@@ -63,6 +64,16 @@ documentation::Documentation UrlSynchronization::Documentation() {
"This optional identifier will be part of the used folder structure and, "
"if provided, can be used to manually find the downloaded folder in the "
"synchronization folder."
},
{
KeyOverride,
new BoolVerifier,
Optional::Yes,
"If this value is set to 'true' and it is not overwritten by the global "
"settings, the file(s) pointed to by this URLSynchronization will always "
"be downloaded, thus overwriting the local files. This is useful for "
"files that are updated regularly remotely and should be fetch at every "
"startup."
}
}
};
@@ -101,6 +112,10 @@ UrlSynchronization::UrlSynchronization(const ghoul::Dictionary& dict,
else {
_identifier = std::to_string(hash);
}
if (dict.hasValue<bool>(KeyOverride)) {
_forceOverride = dict.value<bool>(KeyOverride);
}
}
UrlSynchronization::~UrlSynchronization() {
@@ -116,7 +131,7 @@ void UrlSynchronization::start() {
}
begin();
if (hasSyncFile()) {
if (hasSyncFile() && !_forceOverride) {
resolve();
return;
}

View File

@@ -55,6 +55,7 @@ private:
std::string directory() override;
std::vector<std::string> _urls;
bool _forceOverride = false;
std::string _synchronizationRoot;
std::string _identifier;

View File

@@ -31,8 +31,8 @@ TEST_F(Issue527, Regression) {
openspace::properties::OptionProperty p({ "id", "gui", "desc"});
p.addOptions({
{-1, "a" },
{-2, "b" }
{ -1, "a" },
{ -2, "b" }
});