Merge branch 'master' into feature/radec-conversion

This commit is contained in:
Malin Ejdbo
2021-06-28 12:13:58 +02:00
15 changed files with 145 additions and 95 deletions

View File

@@ -115,8 +115,7 @@ local JWSTModel = {
ModelScale = "Foot",
InvertModelScale = true,
EnableAnimation = true,
--TODO: Update theese when the new animation is finished
AnimationStartTime = "2018 10 01 15:00:00",
AnimationStartTime = "2018 10 01 14:05:52",
AnimationMode = "Once",
LightSources = {
{
@@ -130,7 +129,7 @@ local JWSTModel = {
DisableFaceCulling = true
},
GUI = {
Name = "James Webb Space Telescope",
Name = "James Webb Space Telescope Model",
Path = "/Solar System/Missions/JWST",
}
}
@@ -226,7 +225,7 @@ local JWSTLaunchModel = {
Parent = JWSTLaunchPosition.Identifier,
TimeFrame = {
Type = "TimeFrameInterval",
Start = "2018 OCT 01 13:18:00",
Start = "2018 OCT 01 14:05:52",
End = "2019 OCT 01"
},
Transform = {
@@ -245,8 +244,7 @@ local JWSTLaunchModel = {
ModelScale = "Foot",
InvertModelScale = true,
EnableAnimation = true,
--TODO: Update theese when the new animation is finished
AnimationStartTime = "2018 10 01 15:00:00",
AnimationStartTime = "2018 10 01 14:05:52",
AnimationMode = "Once",
LightSources = {
{

View File

@@ -130,34 +130,36 @@ local PolyCamFov = {
}
}
local RexisFov = {
Identifier = "REXIS FOV",
Parent = Rexis.Identifier,
Renderable = {
Type = "RenderableFov",
Body = "OSIRIS-REX",
Frame = "ORX_REXIS",
RGB = { 0.8, 0.7, 0.7 },
Instrument = {
Name = "ORX_REXIS",
Method = "ELLIPSOID",
Aberration = "NONE"
},
PotentialTargets = { BENNU_BODY },
FrameConversions = {
[BENNU_BODY] = "IAU_BENNU"
}
},
GUI = {
Name = "REXIS FOV",
Path = "/Solar System/Missions/OSIRIS REx/Instruments"
}
}
-- Commenting this out as REXIS' shape is circle, which is currently not supported in
-- the RenderableFOV class
-- local RexisFov = {
-- Identifier = "REXIS FOV",
-- Parent = Rexis.Identifier,
-- Renderable = {
-- Type = "RenderableFov",
-- Body = "OSIRIS-REX",
-- Frame = "ORX_REXIS",
-- RGB = { 0.8, 0.7, 0.7 },
-- Instrument = {
-- Name = "ORX_REXIS",
-- Method = "ELLIPSOID",
-- Aberration = "NONE"
-- },
-- PotentialTargets = { BENNU_BODY },
-- FrameConversions = {
-- [BENNU_BODY] = "IAU_BENNU"
-- }
-- },
-- GUI = {
-- Name = "REXIS FOV",
-- Path = "/Solar System/Missions/OSIRIS REx/Instruments"
-- }
-- }
assetHelper.registerSceneGraphNodesAndExport(asset, {
OsirisRex,
PolyCam,
Rexis,
PolyCamFov,
RexisFov
-- RexisFov
})

View File

@@ -53,6 +53,15 @@ struct Configuration {
};
std::map<std::string, std::string> fonts;
struct FontSizes {
float frameInfo;
float shutdown;
float log;
float cameraInfo;
float versionInfo;
};
FontSizes fontSize;
struct Logging {
std::string level = "Info";
bool forceImmediateFlush = false;

View File

@@ -233,8 +233,9 @@ private:
std::vector<ghoul::opengl::ProgramObject*> _programs;
std::shared_ptr<ghoul::fontrendering::Font> _fontFrameInfo;
std::shared_ptr<ghoul::fontrendering::Font> _fontInfo;
std::shared_ptr<ghoul::fontrendering::Font> _fontDate;
std::shared_ptr<ghoul::fontrendering::Font> _fontCameraInfo;
std::shared_ptr<ghoul::fontrendering::Font> _fontVersionInfo;
std::shared_ptr<ghoul::fontrendering::Font> _fontShutdown;
std::shared_ptr<ghoul::fontrendering::Font> _fontLog;
struct {

View File

@@ -125,7 +125,6 @@ private:
// Logging variables
bool _logFileExists = false;
bool _logScripts = true;
std::string _logType;
std::string _logFilename;
};

View File

@@ -49,14 +49,11 @@ documentation::Documentation StaticTranslation::Documentation() {
}
StaticTranslation::StaticTranslation()
: _position(
PositionInfo,
glm::dvec3(0.0),
glm::dvec3(-std::numeric_limits<double>::max()),
glm::dvec3(std::numeric_limits<double>::max())
)
: _position(PositionInfo, glm::dvec3(0.0), glm::dvec3(-1e35), glm::dvec3(1e35))
{
_position.setExponent(20.f);
// @TODO (2021-06-24, emmbr) The exponential sliders do not handle ranges with
// negative values very well. When they do, this line can be uncommented
//_position.setExponent(20.f);
addProperty(_position);
_position.onChange([this]() {

View File

@@ -98,7 +98,7 @@ void main() {
levelWeights = getLevelWeights(distToVertexOnEllipsoid);
// Get the height value and apply skirts
float height = getTileHeightScaled(in_uv, levelWeights) - getTileVertexSkirtLength();
float height = getTileHeightScaled(in_uv, levelWeights) - getTileVertexSkirtLength() * 100.0;
// Translate the point along normal
p += patchNormalCameraSpace * height;

View File

@@ -125,6 +125,7 @@ GlobeTranslation::GlobeTranslation(const ghoul::Dictionary& dictionary)
addProperty(_latitude);
_altitude = p.altitude.value_or(_altitude);
_altitude.setExponent(8.f);
_altitude.onChange([this]() { _positionIsDirty = true; });
addProperty(_altitude);

View File

@@ -66,6 +66,13 @@ namespace {
"making it more visible."
};
constexpr openspace::properties::Property::PropertyInfo AlwaysDrawFovInfo = {
"AlwaysDrawFov",
"Always Draw FOV",
"If this value is enabled, the field of view will always be drawn, regardless of "
"whether image information has been loaded or not"
};
constexpr openspace::properties::Property::PropertyInfo DefaultStartColorInfo = {
"Colors.DefaultStart",
"Start of default color",
@@ -160,6 +167,10 @@ namespace {
// A table describing the instrument whose field of view should be rendered
Instrument instrument;
// If this value is set to 'true', the field of view specified here will always be
// rendered, regardless of whether image information is currently available or not
std::optional<bool> alwaysDrawFov;
// A list of potential targets (specified as SPICE names) that the field of view
// should be tested against
std::vector<std::string> potentialTargets;
@@ -192,6 +203,7 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _lineWidth(LineWidthInfo, 1.f, 1.f, 20.f)
, _standOffDistance(StandoffDistanceInfo, 0.9999, 0.99, 1.0, 0.000001)
, _alwaysDrawFov(AlwaysDrawFovInfo, false)
, _colors({
{ DefaultStartColorInfo, glm::vec3(0.4f), glm::vec3(0.f), glm::vec3(1.f) },
{ DefaultEndColorInfo, glm::vec3(0.85f), glm::vec3(0.f), glm::vec3(1.f) },
@@ -239,6 +251,9 @@ RenderableFov::RenderableFov(const ghoul::Dictionary& dictionary)
_standOffDistance = p.standOffDistance.value_or(_standOffDistance);
addProperty(_standOffDistance);
_alwaysDrawFov = p.alwaysDrawFov.value_or(_alwaysDrawFov);
addProperty(_alwaysDrawFov);
_simplifyBounds = p.simplifyBounds.value_or(_simplifyBounds);
@@ -769,7 +784,7 @@ void RenderableFov::render(const RenderData& data, RendererTasks&) {
}
void RenderableFov::update(const UpdateData& data) {
_drawFOV = false;
_drawFOV = _alwaysDrawFov;
if (ImageSequencer::ref().isReady()) {
_drawFOV = ImageSequencer::ref().isInstrumentActive(
data.time.j2000Seconds(),

View File

@@ -77,6 +77,7 @@ private:
// properties
properties::FloatProperty _lineWidth;
properties::DoubleProperty _standOffDistance;
properties::BoolProperty _alwaysDrawFov;
ghoul::opengl::ProgramObject* _program = nullptr;
UniformCache(modelViewProjection, defaultColorStart, defaultColorEnd, activeColor,
targetInFieldOfViewColor, intersectionStartColor, intersectionEndColor,

View File

@@ -188,6 +188,13 @@ Fonts = {
Console = "${FONTS}/Inconsolata/Inconsolata-Regular.ttf",
Loading = "${FONTS}/Roboto/Roboto-Regular.ttf"
}
FontSize = {
FrameInfo = 32.0,
Shutdown = 30.0,
Log = 8.0,
CameraInfo = 12.0,
VersionInfo = 12.0
}
Logging = {
LogDir = "${LOGS}",

View File

@@ -69,6 +69,22 @@ namespace {
// font
std::optional<std::map<std::string, std::string>> fonts;
struct FontSizes {
// The font size (in pt) used for printing optional information about the
// currently rendered frame
float frameInfo;
// The font size (in pt) used for rendering the shutdown text
float shutdown;
// The font size (in pt) used for rendering the screen log
float log;
// The font size (in pt) used for printing the camera friction state
float cameraInfo;
// The font size (in pt) used for printing the version information
float versionInfo;
};
// Information about the hardcoded fontsizes used by the rendering engine itself
FontSizes fontSize;
struct Logging {
// List from logmanager.cpp::levelFromString
enum class Level {
@@ -368,6 +384,11 @@ void parseLuaState(Configuration& configuration) {
p.globalCustomizationScripts.value_or(c.globalCustomizationScripts);
c.pathTokens = p.paths;
c.fonts = p.fonts.value_or(c.fonts);
c.fontSize.frameInfo = p.fontSize.frameInfo;
c.fontSize.shutdown = p.fontSize.shutdown;
c.fontSize.log = p.fontSize.log;
c.fontSize.cameraInfo = p.fontSize.cameraInfo;
c.fontSize.versionInfo = p.fontSize.versionInfo;
c.scriptLog = p.scriptLog.value_or(c.scriptLog);
c.versionCheckUrl = p.versionCheckUrl.value_or(c.versionCheckUrl);
c.useMultithreadedInitialization =

View File

@@ -154,7 +154,7 @@ void OpenSpaceEngine::registerPathTokens() {
using T = std::string;
for (const std::pair<const T, T>& path : global::configuration->pathTokens) {
std::string fullKey = "${" + path.first + "}";
LDEBUG(fmt::format("Registering path {}: {}", fullKey, path.second));
LDEBUG(fmt::format("Registering path '{}': '{}'", fullKey, path.second));
const bool overrideBase = (fullKey == "${BASE}");
if (overrideBase) {

View File

@@ -532,28 +532,44 @@ void RenderEngine::initializeGL() {
_horizFieldOfView = static_cast<float>(global::windowDelegate->getHorizFieldOfView());
{
ZoneScopedN("Font: Mono")
TracyGpuZone("Font: Mono")
constexpr const float FontSizeFrameinfo = 32.f;
_fontFrameInfo = global::fontManager->font(KeyFontMono, FontSizeFrameinfo);
ZoneScopedN("Font: FrameInfo")
TracyGpuZone("Font: FrameInfo")
_fontFrameInfo = global::fontManager->font(
KeyFontMono,
global::configuration->fontSize.frameInfo
);
}
{
ZoneScopedN("Font: Date")
TracyGpuZone("Font: Date")
constexpr const float FontSizeTime = 15.f;
_fontDate = global::fontManager->font(KeyFontMono, FontSizeTime);
ZoneScopedN("Font: Shutdown")
TracyGpuZone("Font: Shutdown")
_fontShutdown = global::fontManager->font(
KeyFontMono,
global::configuration->fontSize.shutdown
);
}
{
ZoneScopedN("Font: Info")
TracyGpuZone("Font: Info")
constexpr const float FontSizeMono = 10.f;
_fontInfo = global::fontManager->font(KeyFontMono, FontSizeMono);
ZoneScopedN("Font: CameraInfo")
TracyGpuZone("Font: CameraInfo")
_fontCameraInfo = global::fontManager->font(
KeyFontMono,
global::configuration->fontSize.cameraInfo
);
}
{
ZoneScopedN("Font: VersionInfo")
TracyGpuZone("Font: VersionInfo")
_fontVersionInfo = global::fontManager->font(
KeyFontMono,
global::configuration->fontSize.versionInfo
);
}
{
ZoneScopedN("Font: Log")
TracyGpuZone("Font: Log")
constexpr const float FontSizeLight = 8.f;
_fontLog = global::fontManager->font(KeyFontLight, FontSizeLight);
_fontLog = global::fontManager->font(
KeyFontLight,
global::configuration->fontSize.log
);
}
{
@@ -874,12 +890,12 @@ void RenderEngine::renderEndscreen() {
glm::vec2(global::windowDelegate->currentSubwindowSize()) / dpiScaling;
glViewport(0, 0, res.x, res.y);
const glm::vec2 size = _fontDate->boundingBox("Shutting down");
const glm::vec2 size = _fontShutdown->boundingBox("Shutting down");
glm::vec2 penPosition = glm::vec2(
fontResolution().x / 2 - size.x / 2,
fontResolution().y / 2 - size.y / 2
);
RenderFont(*_fontDate, penPosition, "Shutting down");
RenderFont(*_fontShutdown, penPosition, "Shutting down");
}
void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
@@ -887,7 +903,7 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
timer = std::max(timer, 0.f);
const glm::vec2 size = _fontDate->boundingBox(
const glm::vec2 size = _fontShutdown->boundingBox(
fmt::format("Shutdown in: {:.2f}s/{:.2f}s", timer, fullTime)
);
@@ -897,14 +913,14 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
);
RenderFont(
*_fontDate,
*_fontShutdown,
penPosition,
fmt::format("Shutdown in: {:.2f}s/{:.2f}s", timer, fullTime),
ghoul::fontrendering::CrDirection::Down
);
RenderFont(
*_fontDate,
*_fontShutdown,
penPosition,
// Important: length of this string is the same as the shutdown time text
// to make them align
@@ -923,21 +939,6 @@ void RenderEngine::renderDashboard() {
);
global::dashboard->render(penPosition);
#ifdef REALTIME_CAMERA_POS_DISPLAY
penPosition += glm::vec2(0.f, -50.f);
glm::dvec3 p = _camera->positionVec3();
glm::dquat rot = _camera->rotationQuaternion();
std::string fc = global::navigationHandler.focusNode()->identifier();
RenderFont(
*_fontInfo,
penPosition,
fmt::format("Pos: {} {} {}\nOrientation: {} {} {} {}\nFocus: {}",
p.x, p.y, p.z, rot[0], rot[1], rot[2], rot[3], fc
)
);
#endif
}
void RenderEngine::postDraw() {
@@ -1284,7 +1285,7 @@ void RenderEngine::renderCameraInformation() {
const glm::vec4 EnabledColor = glm::vec4(0.2f, 0.75f, 0.2f, 1.f);
const glm::vec4 DisabledColor = glm::vec4(0.55f, 0.2f, 0.2f, 1.f);
const glm::vec2 rotationBox = _fontInfo->boundingBox("Rotation");
const glm::vec2 rotationBox = _fontCameraInfo->boundingBox("Rotation");
float penPosY = fontResolution().y - rotationBox.y;
@@ -1303,14 +1304,14 @@ void RenderEngine::renderCameraInformation() {
rotationBox.y
};
FR::defaultRenderer().render(
*_fontInfo,
*_fontCameraInfo,
glm::vec2(fontResolution().x - rotationBox.x - XSeparation, penPosY),
"Rotation",
nav.hasRotationalFriction() ? EnabledColor : DisabledColor
);
penPosY -= rotationBox.y + YSeparation;
const glm::vec2 zoomBox = _fontInfo->boundingBox("Zoom");
const glm::vec2 zoomBox = _fontCameraInfo->boundingBox("Zoom");
_cameraButtonLocations.zoom = {
fontResolution().x - zoomBox.x - XSeparation,
@@ -1319,14 +1320,14 @@ void RenderEngine::renderCameraInformation() {
zoomBox.y
};
FR::defaultRenderer().render(
*_fontInfo,
*_fontCameraInfo,
glm::vec2(fontResolution().x - zoomBox.x - XSeparation, penPosY),
"Zoom",
nav.hasZoomFriction() ? EnabledColor : DisabledColor
);
penPosY -= zoomBox.y + YSeparation;
const glm::vec2 rollBox = _fontInfo->boundingBox("Roll");
const glm::vec2 rollBox = _fontCameraInfo->boundingBox("Roll");
_cameraButtonLocations.roll = {
fontResolution().x - rollBox.x - XSeparation,
@@ -1335,7 +1336,7 @@ void RenderEngine::renderCameraInformation() {
rollBox.y
};
FR::defaultRenderer().render(
*_fontInfo,
*_fontCameraInfo,
glm::vec2(fontResolution().x - rollBox.x - XSeparation, penPosY),
"Roll",
nav.hasRollFriction() ? EnabledColor : DisabledColor
@@ -1350,27 +1351,27 @@ void RenderEngine::renderVersionInformation() {
}
using FR = ghoul::fontrendering::FontRenderer;
const glm::vec2 versionBox = _fontInfo->boundingBox(_versionString);
const glm::vec2 commitBox = _fontInfo->boundingBox(OPENSPACE_GIT_FULL);
const glm::vec2 versionBox = _fontVersionInfo->boundingBox(_versionString);
const glm::vec2 commitBox = _fontVersionInfo->boundingBox(OPENSPACE_GIT_FULL);
FR::defaultRenderer().render(
*_fontInfo,
*_fontVersionInfo,
glm::vec2(
fontResolution().x - versionBox.x - 10.f,
5.f
),
_versionString,
glm::vec4(0.5, 0.5, 0.5, 1.f)
glm::vec4(0.5f, 0.5f, 0.5f, 1.f)
);
// If a developer hasn't placed the Git command in the path, this variable will be
// empty
if (!std::string_view(OPENSPACE_GIT_COMMIT).empty()) {
// We check OPENSPACE_GIT_COMMIT but puse OPENSPACE_GIT_FULL on purpose since
// We check OPENSPACE_GIT_COMMIT but use OPENSPACE_GIT_FULL on purpose since
// OPENSPACE_GIT_FULL will never be empty (always will contain at least @, but
// checking for that is a bit brittle)
FR::defaultRenderer().render(
*_fontInfo,
*_fontVersionInfo,
glm::vec2(fontResolution().x - commitBox.x - 10.f, versionBox.y + 5.f),
OPENSPACE_GIT_FULL,
glm::vec4(0.5, 0.5, 0.5, 1.f)
@@ -1384,15 +1385,15 @@ void RenderEngine::renderVersionInformation() {
ZoneScopedN("Tracy Information")
const glm::vec2 tracyBox = _fontInfo->boundingBox("TRACY PROFILING ENABLED");
const glm::vec2 tracyBox = _fontVersionInfo->boundingBox("TRACY PROFILING");
const glm::vec2 penPosition = glm::vec2(
fontResolution().x - tracyBox.x - 10.f,
versionBox.y + commitBox.y + 5.f
);
FR::defaultRenderer().render(
*_fontInfo,
*_fontVersionInfo,
penPosition,
"TRACY PROFILING ENABLED",
"TRACY PROFILING",
glm::vec4(0.8f, 0.2f, 0.15f, 1.f)
);
}

View File

@@ -649,9 +649,7 @@ bool ScriptEngine::writeLog(const std::string& script) {
_logFilename = absPath(global::configuration->scriptLog).string();
_logFileExists = true;
LDEBUG(fmt::format(
"Using script log of type '{}' to file '{}'", _logType, _logFilename
));
LDEBUG(fmt::format("Using script log file '{}'", _logFilename));
// Test file and clear previous input
std::ofstream file(_logFilename, std::ofstream::out | std::ofstream::trunc);