Various small fixes

This commit is contained in:
Alexander Bock
2018-03-14 13:13:23 -04:00
parent 7d1ee75577
commit 2bfab657f3
8 changed files with 41 additions and 23 deletions

View File

@@ -3,15 +3,15 @@
local assetHelper = asset.require("util/asset_helper")
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Single",
Type = "UrlSynchronization",
Identifier = "example_single",
Url = "http://celestrak.com/NORAD/elements/geo.txt"
})
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Multiple",
Type = "UrlSynchronization",
Identifier = "example_multiple",
Url = {
"http://celestrak.com/NORAD/elements/stations.txt",
@@ -20,23 +20,23 @@ asset.syncedResource({
})
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Large",
Type = "UrlSynchronization",
Identifier = "example_large",
Url = "http://ipv4.download.thinkbroadband.com/100MB.zip",
Override = true
})
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example Medium",
Type = "UrlSynchronization",
Identifier = "example_medium",
Url = "http://ipv4.download.thinkbroadband.com/5MB.zip",
Override = true
})
asset.syncedResource({
Type = "UrlSynchronization",
Name = "Example No ident",
Type = "UrlSynchronization",
Url = "http://ipv4.download.thinkbroadband.com/5MB.zip"
})

View File

@@ -174,7 +174,7 @@ documentation::Documentation DashboardItemAngle::Documentation() {
}
DashboardItemAngle::DashboardItemAngle(ghoul::Dictionary dictionary)
: DashboardItem("Distance")
: DashboardItem("Angle")
, _fontName(FontNameInfo, KeyFontMono)
, _fontSize(FontSizeInfo, DefaultFontSize, 6.f, 144.f, 1.f)
, _source{

View File

@@ -98,8 +98,8 @@ namespace {
node.children.begin(),
node.children.end(),
[p = *path.begin()](const std::unique_ptr<TreeNode>& c) {
return c.get()->path == p;
}
return c.get()->path == p;
}
);
TreeNode* n;
@@ -112,7 +112,6 @@ namespace {
std::unique_ptr<TreeNode> newNode = std::make_unique<TreeNode>(*path.begin());
n = newNode.get();
node.children.push_back(std::move(newNode));
}
// Recurse into the tree and chop off the first path

View File

@@ -51,6 +51,7 @@
#include <math.h>
namespace {
constexpr const char* KeyBody = "Body";
constexpr const char* KeyGeometry = "Geometry";
constexpr const char* KeyRadius = "Radius";
constexpr const char* _loggerCat = "RenderablePlanet";
@@ -118,7 +119,15 @@ documentation::Documentation RenderablePlanet::Documentation() {
new DoubleVerifier,
Optional::Yes,
"Specifies the radius of the planet. If this value is not specified, it "
"will try to query the SPICE library for radius values."
"will try to query the SPICE library for radius values using the body "
"key."
},
{
KeyBody,
new StringVerifier,
Optional::Yes,
"If that radius is not specified, this name is used to query the SPICE "
"library for the radius values."
},
{
ColorTextureInfo.identifier,
@@ -178,11 +187,6 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
, _shadowEnabled(false)
, _time(0.f)
{
ghoul_precondition(
dictionary.hasKeyAndValue<std::string>(SceneGraphNode::KeyName),
"RenderablePlanet needs the name to be specified"
);
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
@@ -197,19 +201,32 @@ RenderablePlanet::RenderablePlanet(const ghoul::Dictionary& dictionary)
// If the user specified a radius, we want to use this
_planetRadius = static_cast<float>(dictionary.value<double>(KeyRadius));
}
else if (SpiceManager::ref().hasValue(name, "RADII") ) {
else {
if (!dictionary.hasKey(KeyBody)) {
documentation::TestResult res;
res.success = false;
documentation::TestResult::Offense offense = {
fmt::format("{} or {}", KeyRadius, KeyBody),
documentation::TestResult::Offense::Reason::MissingKey
};
res.offenses.push_back(std::move(offense));
throw documentation::SpecificationError(
std::move(res),
std::move("RenderablePlanet")
);
}
const std::string body = dictionary.value<std::string>(KeyBody);
// If the user didn't specfify a radius, but Spice has a radius, we can use this
glm::dvec3 radius;
SpiceManager::ref().getValue(name, "RADII", radius);
SpiceManager::ref().getValue(body, "RADII", radius);
radius *= 1000.0; // Spice gives radii in KM.
std::swap(radius[1], radius[2]); // z is equivalent to y in our coordinate system
geomDict.setValue(KeyRadius, radius);
_planetRadius = static_cast<float>((radius.x + radius.y + radius.z) / 3.0);
}
else {
LERRORC("RenderablePlanet", "Missing radius specification");
}
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(geomDict);

View File

@@ -153,7 +153,8 @@ documentation::Documentation ProjectionComponent::Documentation() {
{
keySequenceType,
new StringInListVerifier(
{ sequenceTypeImage, sequenceTypePlaybook, sequenceTypeHybrid }
{ sequenceTypeImage, sequenceTypePlaybook, sequenceTypeHybrid,
sequenceTypeInstrumentTimes }
),
Optional::Yes,
"This value determines which type of sequencer is used for generating "

View File

@@ -143,7 +143,7 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
}
}
if (_startTime != "" && _endTime != "") {
if (!_startTime.empty() && !_endTime.empty()) {
_hasTimeInterval = true;
}

View File

@@ -84,6 +84,7 @@ int loadScheduledScript(lua_State* L) {
});
}
lua_settop(L, 0);
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
return 0;
}