Small improvements in time conversion

This commit is contained in:
Alexander Bock
2020-08-07 10:54:35 +02:00
parent d39d4a91ec
commit d93be0f78d
2 changed files with 22 additions and 44 deletions

View File

@@ -383,7 +383,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
);
glm::dmat4 crippedModelViewTransform = glm::transpose(glm::inverse(
glm::dmat4(glm::inverse(data.camera.sgctInternal.viewMatrix())) * modelViewTransform
glm::dmat4(glm::inverse(data.camera.sgctInternal.viewMatrix())) * modelViewTransform
));
_program->setUniform(
@@ -425,7 +425,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
}
_geometry->render();
if (_disableFaceCulling) {
glEnable(GL_CULL_FACE);
}

View File

@@ -31,6 +31,7 @@
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/assert.h>
#include <mutex>
#include <string_view>
#include "time_lua.inl"
@@ -78,51 +79,28 @@ std::string Time::UTC() const {
}
std::string Time::ISO8601() const {
ZoneScoped
std::string datetime = SpiceManager::ref().dateFromEphemerisTime(_time);
const std::string& month = datetime.substr(5, 3);
std::string_view month = std::string_view(datetime).substr(5, 3);
std::string MM;
if (month == "JAN") {
MM = "01";
}
else if (month == "FEB") {
MM = "02";
}
else if (month == "MAR") {
MM = "03";
}
else if (month == "APR") {
MM = "04";
}
else if (month == "MAY") {
MM = "05";
}
else if (month == "JUN") {
MM = "06";
}
else if (month == "JUL") {
MM = "07";
}
else if (month == "AUG") {
MM = "08";
}
else if (month == "SEP") {
MM = "09";
}
else if (month == "OCT") {
MM = "10";
}
else if (month == "NOV") {
MM = "11";
}
else if (month == "DEC") {
MM = "12";
}
else {
ghoul_assert(false, "Bad month");
}
std::string_view mm = [](std::string_view month) {
if (month == "JAN") { return "-01-"; }
else if (month == "FEB") { return "-02-"; }
else if (month == "MAR") { return "-03-"; }
else if (month == "APR") { return "-04-"; }
else if (month == "MAY") { return "-05-"; }
else if (month == "JUN") { return "-06-"; }
else if (month == "JUL") { return "-07-"; }
else if (month == "AUG") { return "-08-"; }
else if (month == "SEP") { return "-09-"; }
else if (month == "OCT") { return "-10-"; }
else if (month == "NOV") { return "-11-"; }
else if (month == "DEC") { return "-12-"; }
else { throw ghoul::MissingCaseException(); }
}(month);
datetime.replace(4, 5, "-" + MM + "-");
datetime.replace(4, 5, mm);
return datetime;
}