Merge with latest master

This commit is contained in:
GPayne
2020-02-19 09:25:33 -07:00
parent 79a3b42d06
commit addfa65fa6
230 changed files with 1151 additions and 2270 deletions

View File

@@ -113,7 +113,8 @@ std::string generateJsonDocumentation(const Documentation& d) {
if (it == documentations.end()) {
result << R"("reference": { "found": false })";
} else {
}
else {
result << R"("reference": {)"
<< R"("found": true,)"
<< R"("name": ")" << it->name << "\","

View File

@@ -271,17 +271,20 @@ std::future<DownloadManager::MemoryFile> DownloadManager::fetchFile(
getline(ss, extension ,'/');
getline(ss, extension);
file.format = extension;
} else {
}
else {
LWARNING("Could not get extension from file downloaded from: " + url);
}
successCb(file);
curl_easy_cleanup(curl);
return file;
} else {
}
else {
std::string err = curl_easy_strerror(res);
if (errorCb) {
errorCb(err);
} else {
}
else {
LWARNING(fmt::format("Error downloading '{}': {}", url, err));
}
curl_easy_cleanup(curl);

View File

@@ -723,7 +723,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
unsigned int nAvailableThreads = std::thread::hardware_concurrency();
unsigned int nThreads = nAvailableThreads == 0 ? 2 : nAvailableThreads - 1;
sceneInitializer = std::make_unique<MultiThreadedSceneInitializer>(nThreads);
} else {
}
else {
sceneInitializer = std::make_unique<SingleThreadedSceneInitializer>();
}
@@ -740,7 +741,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
const SceneGraphNode* parent = camera->parent();
if (parent) {
global::navigationHandler.orbitalNavigator().setFocusNode(parent->identifier());
} else {
}
else {
global::navigationHandler.orbitalNavigator().setFocusNode(
_scene->root()->identifier()
);
@@ -817,7 +819,8 @@ void OpenSpaceEngine::loadSingleAsset(const std::string& assetPath) {
progressInfo
);
++it;
} else {
}
else {
LoadingScreen::ProgressInfo progressInfo;
progressInfo.progress = 1.f;

View File

@@ -53,6 +53,12 @@ namespace {
constexpr const char* KeyReferenceFrame = "ReferenceFrame";
const double Epsilon = 1E-7;
constexpr const openspace::properties::Property::PropertyInfo KeyDisableInputInfo = {
"DisableInputs",
"Disable all mouse inputs",
"Disables all mouse inputs and prevents them from affecting the camera"
};
constexpr const openspace::properties::Property::PropertyInfo KeyFrameInfo = {
"UseKeyFrameInteraction",
"Use keyframe interaction",
@@ -142,11 +148,13 @@ NavigationHandler::NavigationState::NavigationState(std::string anchor, std::str
NavigationHandler::NavigationHandler()
: properties::PropertyOwner({ "NavigationHandler" })
, _disableInputs(KeyDisableInputInfo, false)
, _useKeyFrameInteraction(KeyFrameInfo, false)
{
// Add the properties
addProperty(_useKeyFrameInteraction);
addPropertySubOwner(_orbitalNavigator);
addProperty(_disableInputs);
addProperty(_useKeyFrameInteraction);
}
NavigationHandler::~NavigationHandler() {} // NOLINT
@@ -326,20 +334,28 @@ const InputState& NavigationHandler::inputState() const {
}
void NavigationHandler::mouseButtonCallback(MouseButton button, MouseAction action) {
_inputState.mouseButtonCallback(button, action);
if (!_disableInputs) {
_inputState.mouseButtonCallback(button, action);
}
}
void NavigationHandler::mousePositionCallback(double x, double y) {
_inputState.mousePositionCallback(x, y);
if (!_disableInputs) {
_inputState.mousePositionCallback(x, y);
}
}
void NavigationHandler::mouseScrollWheelCallback(double pos) {
_inputState.mouseScrollWheelCallback(pos);
if (!_disableInputs) {
_inputState.mouseScrollWheelCallback(pos);
}
}
void NavigationHandler::keyboardCallback(Key key, KeyModifier modifier, KeyAction action)
{
_inputState.keyboardCallback(key, modifier, action);
if (!_disableInputs) {
_inputState.keyboardCallback(key, modifier, action);
}
}
NavigationHandler::NavigationState NavigationHandler::navigationState() const {

View File

@@ -523,7 +523,8 @@ void SessionRecording::saveTimeKeyframe() {
writeToFileBuffer(kf._requiresTimeJump);
saveKeyframeToFileBinary(_keyframeBuffer, _bufferIndex);
} else {
}
else {
std::stringstream keyframeLine = std::stringstream();
//Add simulation timestamp, timestamp relative, simulation time to recording start
keyframeLine << "time ";
@@ -880,7 +881,8 @@ void SessionRecording::playbackTimeChange() {
));
return;
}
} else {
}
else {
std::istringstream iss(_playbackLineParsing);
std::string entryType;
//double timeRef;
@@ -943,7 +945,8 @@ void SessionRecording::playbackScript() {
));
return;
}
} else {
}
else {
std::istringstream iss(_playbackLineParsing);
std::string entryType;
std::string tmpReadbackScript;
@@ -958,7 +961,8 @@ void SessionRecording::playbackScript() {
"Error parsing script line {} of playback file", _playbackLineNum
));
return;
} else if (!iss.eof()) {
}
else if (!iss.eof()) {
LERROR(fmt::format(
"Did not find an EOL at line {} of playback file", _playbackLineNum
));
@@ -1108,7 +1112,8 @@ bool SessionRecording::findNextFutureCameraIndex(double currTime) {
_idxTimeline_cameraPtrNext = seekAheadIndex;
}
break;
} else {
}
else {
// Force interpolation between consecutive keyframes
_idxTimeline_cameraPtrPrev = seekAheadIndex;
}

View File

@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
* Copyright (c) 2014-2019 *
* Copyright (c) 2014-2020 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *

View File

@@ -547,7 +547,8 @@ void ParallelPeer::setStatus(ParallelConnection::Status status) {
global::timeManager.addTimelineChangeCallback([this]() {
_timeTimelineChanged = true;
});
} else {
}
else {
if (_timeJumpCallback != -1) {
global::timeManager.removeTimeJumpCallback(_timeJumpCallback);
}

View File

@@ -382,7 +382,8 @@ void ParallelServer::setToClient(Peer& peer) {
it.second->status = ParallelConnection::Status::ClientWithoutHost;
sendConnectionStatus(*it.second);
}
} else {
}
else {
peer.status = (_hostPeerId > 0) ?
ParallelConnection::Status::ClientWithHost :
ParallelConnection::Status::ClientWithoutHost;

View File

@@ -29,7 +29,7 @@ namespace openspace {
std::string licenseText() {
return "OpenSpace\n\
\n\
Copyright (c) 2014-2019\n\
Copyright (c) 2014-2020\n\
\n\
Permission is hereby granted, free of charge, to any person obtaining a copy of this\n\
software and associated documentation files (the \"Software\"), to deal in the Software\n\

View File

@@ -46,7 +46,8 @@ glm::dmat4x3 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::dmat4x3(0.0);
} else {
}
else {
result[i][j] = lua_tonumber(state, -1);
lua_pop(state, 1);
++number;

View File

@@ -46,7 +46,8 @@ glm::mat2x2 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat2x2(1.f);
} else {
}
else {
result[i][j] = static_cast<glm::mat2x2::value_type>(
lua_tonumber(state, -1)
);

View File

@@ -46,7 +46,8 @@ glm::mat3x3 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat3x3(1.f);
} else {
}
else {
result[i][j]
= static_cast<glm::mat3x3::value_type>(lua_tonumber(state, -1));
lua_pop(state, 1);

View File

@@ -43,10 +43,11 @@ glm::mat3x2 fromLuaConversion(lua_State* state, bool& success) {
success = false;
return glm::mat3x2(0.f);
}
if (lua_isnumber(state, -1) != 1) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat3x2(0.f);
} else {
}
else {
result[i][j]
= static_cast<glm::mat3x2::value_type>(lua_tonumber(state, -1));
lua_pop(state, 1);

View File

@@ -46,7 +46,8 @@ glm::mat3x4 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat3x4(1.f);
} else {
}
else {
result[i][j]
= static_cast<glm::mat3x4::value_type>(lua_tonumber(state, -1));
lua_pop(state, 1);

View File

@@ -48,7 +48,8 @@ glm::mat4x4 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat4x4(1.f);
} else {
}
else {
result[i][j]
= static_cast<glm::mat4x4::value_type>(lua_tonumber(state, -1));
lua_pop(state, 1);

View File

@@ -46,7 +46,8 @@ glm::mat4x2 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat4x2(1.f);
} else {
}
else {
result[i][j]
= static_cast<glm::mat4x2::value_type>(lua_tonumber(state, -1));
lua_pop(state, 1);

View File

@@ -46,7 +46,8 @@ glm::mat4x3 fromLuaConversion(lua_State* state, bool& success) {
if (lua_isnumber(state, -1) != 1) {
success = false;
return glm::mat4x3(1.f);
} else {
}
else {
result[i][j]
= static_cast<glm::mat4x3::value_type>(lua_tonumber(state, -1));
lua_pop(state, 1);

View File

@@ -190,7 +190,8 @@ void PropertyOwner::addProperty(Property* prop) {
identifier()
));
return;
} else {
}
else {
// Otherwise we still have to look if there is a PropertyOwner with the same name
const bool hasOwner = hasPropertySubOwner(prop->identifier());
if (hasOwner) {
@@ -235,7 +236,8 @@ void PropertyOwner::addPropertySubOwner(openspace::properties::PropertyOwner* ow
identifier()
));
return;
} else {
}
else {
// We still need to check if the PropertyOwners name is used in a Property
const bool hasProp = hasProperty(owner->identifier());
if (hasProp) {
@@ -269,7 +271,8 @@ void PropertyOwner::removeProperty(Property* prop) {
if (it != _properties.end() && (*it)->identifier() == prop->identifier()) {
(*it)->setPropertyOwner(nullptr);
_properties.erase(it);
} else {
}
else {
LERROR(fmt::format(
"Property with identifier '{}' not found for removal", prop->identifier()
));
@@ -295,7 +298,8 @@ void PropertyOwner::removePropertySubOwner(openspace::properties::PropertyOwner*
// If we found the propertyowner, we can delete it
if (it != _subOwners.end() && (*it)->identifier() == owner->identifier()) {
_subOwners.erase(it);
} else {
}
else {
LERROR(fmt::format(
"PropertyOwner with name '{}' not found for removal", owner->identifier()
));

View File

@@ -975,7 +975,8 @@ void ABufferRenderer::updateRaycastData() {
if (helperPath.empty()) {
data.namespaceName = "NAMESPACE_" + std::to_string(nextNamespaceIndex++);
} else {
}
else {
auto iter = namespaceIndices.find(helperPath);
if (iter == namespaceIndices.end()) {
int namespaceIndex = nextNamespaceIndex++;

View File

@@ -51,6 +51,30 @@
namespace {
constexpr const char* _loggerCat = "FramebufferRenderer";
// If this is true (detected automatically), the OpenGL debug information functions
// are available and will be used to mark object names and debug groups
bool HasGLDebugInfo = false;
struct GLDebugGroup {
explicit GLDebugGroup(std::string_view name) {
if (HasGLDebugInfo) {
glPushDebugGroup(
GL_DEBUG_SOURCE_APPLICATION,
0,
name.length(),
name.data()
);
}
}
~GLDebugGroup() {
if (HasGLDebugInfo) {
glPopDebugGroup();
}
}
};
constexpr const std::array<const char*, 7> HDRUniformNames = {
"hdrFeedingTexture", "blackoutFactor", "hdrExposure", "gamma",
"Hue", "Saturation", "Value"
@@ -141,6 +165,10 @@ namespace openspace {
void FramebufferRenderer::initialize() {
LDEBUG("Initializing FramebufferRenderer");
HasGLDebugInfo = glbinding::Binding::ObjectLabel.isResolved() &&
glbinding::Binding::PushDebugGroup.isResolved() &&
glbinding::Binding::PopDebugGroup.isResolved();
const GLfloat vertexData[] = {
// x y
-1.f, -1.f,
@@ -165,35 +193,112 @@ void FramebufferRenderer::initialize() {
// GBuffers
glGenTextures(1, &_gBuffers.colorTexture);
if (HasGLDebugInfo) {
glObjectLabel(GL_TEXTURE, _gBuffers.colorTexture, -1, "G-Buffer Color");
}
glGenTextures(1, &_gBuffers.depthTexture);
if (HasGLDebugInfo) {
glObjectLabel(GL_TEXTURE, _gBuffers.depthTexture, -1, "G-Buffer Depth");
}
glGenTextures(1, &_gBuffers.positionTexture);
if (HasGLDebugInfo) {
glObjectLabel(GL_TEXTURE, _gBuffers.positionTexture, -1, "G-Buffer Position");
}
glGenTextures(1, &_gBuffers.normalTexture);
if (HasGLDebugInfo) {
glObjectLabel(GL_TEXTURE, _gBuffers.normalTexture, -1, "G-Buffer Normal");
}
glGenFramebuffers(1, &_gBuffers.framebuffer);
if (HasGLDebugInfo) {
glObjectLabel(GL_FRAMEBUFFER, _gBuffers.framebuffer, -1, "G-Buffer Main");
}
// PingPong Buffers
// The first pingpong buffer shares the color texture with the renderbuffer:
_pingPongBuffers.colorTexture[0] = _gBuffers.colorTexture;
glGenTextures(1, &_pingPongBuffers.colorTexture[1]);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(
GL_TEXTURE,
_pingPongBuffers.colorTexture[1],
-1,
"G-Buffer Color Ping-Pong"
);
}
glGenFramebuffers(1, &_pingPongBuffers.framebuffer);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(
GL_FRAMEBUFFER,
_pingPongBuffers.framebuffer,
-1,
"G-Buffer Ping-Pong"
);
}
// Exit framebuffer
glGenTextures(1, &_exitColorTexture);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_TEXTURE, _exitColorTexture, -1, "Exit color");
}
glGenTextures(1, &_exitDepthTexture);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_TEXTURE, _exitColorTexture, -1, "Exit depth");
}
glGenFramebuffers(1, &_exitFramebuffer);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_FRAMEBUFFER, _exitFramebuffer, -1, "Exit");
}
// HDR / Filtering Buffers
glGenFramebuffers(1, &_hdrBuffers.hdrFilteringFramebuffer);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_FRAMEBUFFER, _exitFramebuffer, -1, "HDR filtering");
}
glGenTextures(1, &_hdrBuffers.hdrFilteringTexture);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_TEXTURE, _hdrBuffers.hdrFilteringTexture, -1, "HDR filtering");
}
// FXAA Buffers
glGenFramebuffers(1, &_fxaaBuffers.fxaaFramebuffer);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_FRAMEBUFFER, _fxaaBuffers.fxaaFramebuffer, -1, "FXAA");
}
glGenTextures(1, &_fxaaBuffers.fxaaTexture);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(GL_TEXTURE, _fxaaBuffers.fxaaTexture, -1, "FXAA");
}
// DownscaleVolumeRendering
glGenFramebuffers(1, &_downscaleVolumeRendering.framebuffer);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(
GL_FRAMEBUFFER,
_downscaleVolumeRendering.framebuffer,
-1,
"Downscaled Volume"
);
}
glGenTextures(1, &_downscaleVolumeRendering.colorTexture);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(
GL_TEXTURE,
_downscaleVolumeRendering.colorTexture,
-1,
"Downscaled Volume Color"
);
}
glGenTextures(1, &_downscaleVolumeRendering.depthbuffer);
if (glbinding::Binding::ObjectLabel.isResolved()) {
glObjectLabel(
GL_TEXTURE,
_downscaleVolumeRendering.depthbuffer,
-1,
"Downscaled Volume Depth"
);
}
// Allocate Textures/Buffers Memory
updateResolution();
@@ -424,23 +529,19 @@ void FramebufferRenderer::applyTMO(float blackoutFactor) {
if (doPerformanceMeasurements) {
perfInternal = std::make_unique<performance::PerformanceMeasurement>(
"FramebufferRenderer::render::TMO"
);
);
}
_hdrFilteringProgram->activate();
ghoul::opengl::TextureUnit hdrFeedingTextureUnit;
hdrFeedingTextureUnit.activate();
glBindTexture(
GL_TEXTURE_2D,
_pingPongBuffers.colorTexture[_pingPongIndex]
);
glBindTexture(GL_TEXTURE_2D, _pingPongBuffers.colorTexture[_pingPongIndex]);
_hdrFilteringProgram->setUniform(
_hdrUniformCache.hdrFeedingTexture,
hdrFeedingTextureUnit
);
_hdrFilteringProgram->setUniform(_hdrUniformCache.blackoutFactor, blackoutFactor);
_hdrFilteringProgram->setUniform(_hdrUniformCache.hdrExposure, _hdrExposure);
_hdrFilteringProgram->setUniform(_hdrUniformCache.gamma, _gamma);
@@ -468,7 +569,7 @@ void FramebufferRenderer::applyFXAA() {
if (doPerformanceMeasurements) {
perfInternal = std::make_unique<performance::PerformanceMeasurement>(
"FramebufferRenderer::render::FXAA"
);
);
}
_fxaaProgram->activate();
@@ -1042,6 +1143,9 @@ void FramebufferRenderer::updateDownscaledVolume() {
void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFactor) {
ZoneScoped
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
{
// Set OpenGL default rendering state
ZoneScopedN("Setting OpenGL state")
@@ -1076,6 +1180,8 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
ZoneScopedN("Deferred G-Buffer")
TracyGpuZone("Deferred G-Buffer")
glViewport(0, 0, _resolution.x, _resolution.y);
glBindFramebuffer(GL_FRAMEBUFFER, _gBuffers.framebuffer);
glDrawBuffers(3, ColorAttachment012Array);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@@ -1091,15 +1197,28 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
};
RendererTasks tasks;
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Background);
scene->render(data, tasks);
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Opaque);
scene->render(data, tasks);
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Transparent);
scene->render(data, tasks);
{
GLDebugGroup group("Background");
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Background);
scene->render(data, tasks);
}
{
GLDebugGroup group("Opaque");
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Opaque);
scene->render(data, tasks);
}
{
GLDebugGroup group("Transparent");
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Transparent);
scene->render(data, tasks);
}
// Run Volume Tasks
{
GLDebugGroup group("Raycaster Tasks");
std::unique_ptr<performance::PerformanceMeasurement> perfInternal;
if (doPerformanceMeasurements) {
perfInternal = std::make_unique<performance::PerformanceMeasurement>(
@@ -1107,9 +1226,15 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
);
}
performRaycasterTasks(tasks.raycasterTasks);
if (HasGLDebugInfo) {
glPopDebugGroup();
}
}
if (!tasks.deferredcasterTasks.empty()) {
GLDebugGroup group("Deferred Caster Tasks");
// We use ping pong rendering in order to be able to
// render to the same final buffer, multiple
// deferred tasks at same time (e.g. more than 1 ATM being seen at once)
@@ -1124,22 +1249,28 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
}
performDeferredTasks(tasks.deferredcasterTasks);
}
glDrawBuffers(1, &ColorAttachment01Array[_pingPongIndex]);
glEnablei(GL_BLEND, 0);
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Overlay);
scene->render(data, tasks);
{
GLDebugGroup group("Overlay");
data.renderBinMask = static_cast<int>(Renderable::RenderBin::Overlay);
scene->render(data, tasks);
}
glDrawBuffer(GL_COLOR_ATTACHMENT0);
// Disabling depth test for filtering and hdr
glDisable(GL_DEPTH_TEST);
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
if (_enableFXAA) {
glBindFramebuffer(GL_FRAMEBUFFER, _fxaaBuffers.fxaaFramebuffer);
glDrawBuffers(1, ColorAttachment0Array);
glDisable(GL_BLEND);
}
else {
// When applying the TMO, the result is saved to the default FBO to be displayed
@@ -1147,10 +1278,15 @@ void FramebufferRenderer::render(Scene* scene, Camera* camera, float blackoutFac
glBindFramebuffer(GL_FRAMEBUFFER, _defaultFBO);
}
// Apply the selected TMO on the results and resolve the result for the default FBO
applyTMO(blackoutFactor);
{
// Apply the selected TMO on the results and resolve the result to the default FBO
GLDebugGroup group("Apply TMO");
applyTMO(blackoutFactor);
}
if (_enableFXAA) {
GLDebugGroup group("Apply FXAA");
glBindFramebuffer(GL_FRAMEBUFFER, _defaultFBO);
applyFXAA();
}

View File

@@ -817,7 +817,8 @@ void LuaConsole::render() {
const glm::vec2 loc = locationForRightJustifiedText(nClientsText);
RenderFont(*_font, loc, nClientsText, Red);
} else if (global::parallelPeer.isHost()) {
}
else if (global::parallelPeer.isHost()) {
const glm::vec4 LightBlue(0.4f, 0.4f, 1.f, 1.f);
const std::string localExecutionText = "Local script execution";

View File

@@ -128,7 +128,8 @@ Renderable::Renderable(const ghoul::Dictionary& dictionary)
if (!tagName.empty()) {
addTag(std::move(tagName));
}
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
}
else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
const ghoul::Dictionary& tagNames = dictionary.value<ghoul::Dictionary>(KeyTag);
const std::vector<std::string>& keys = tagNames.keys();
for (const std::string& key : keys) {

View File

@@ -442,7 +442,8 @@ ScreenSpaceRenderable::ScreenSpaceRenderable(const ghoul::Dictionary& dictionary
if (!tagName.empty()) {
addTag(std::move(tagName));
}
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
}
else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
const ghoul::Dictionary& tagNames = dictionary.value<ghoul::Dictionary>(KeyTag);
const std::vector<std::string>& keys = tagNames.keys();
for (const std::string& key : keys) {

View File

@@ -45,7 +45,8 @@ namespace {
return (0 == filepath.compare(
filepath.length() - ending.length(),
ending.length(), ending));
} else {
}
else {
return false;
}
}
@@ -95,7 +96,8 @@ void TransferFunction::update() {
if (_needsUpdate) {
if (hasExtension(_filepath, "txt")) {
setTextureFromTxt();
} else {
}
else {
setTextureFromImage();
}
_texture->uploadTexture();
@@ -133,13 +135,16 @@ void TransferFunction::setTextureFromTxt(std::shared_ptr<ghoul::opengl::Texture>
if (key == "width") {
iss >> width;
} else if (key == "lower") {
}
else if (key == "lower") {
iss >> lower;
lower = glm::clamp(lower, 0.f, 1.f);
} else if (key == "upper") {
}
else if (key == "upper") {
iss >> upper;
upper = glm::clamp(upper, lower, 1.f);
} else if (key == "mappingkey") {
}
else if (key == "mappingkey") {
float intensity;
glm::vec4 rgba = glm::vec4(0.f);
iss >> intensity;

View File

@@ -323,7 +323,8 @@ std::string AssetLoader::generateAssetPath(const std::string& baseDirectory,
std::string prefix;
if (pathType == PathType::RelativeToAsset) {
prefix = baseDirectory + ghoul::filesystem::FileSystem::PathSeparator;
} else if (pathType == PathType::RelativeToAssetRoot) {
}
else if (pathType == PathType::RelativeToAssetRoot) {
prefix = _assetRootDirectory + ghoul::filesystem::FileSystem::PathSeparator;
}
@@ -464,7 +465,8 @@ void AssetLoader::unrequest(const std::string& identifier) {
ghoul::filesystem::Directory AssetLoader::currentDirectory() const {
if (_currentAsset->hasAssetFile()) {
return _currentAsset->assetDirectory();
} else {
}
else {
return _assetRootDirectory;
}
}

View File

@@ -34,6 +34,7 @@
#include <openspace/scene/sceneinitializer.h>
#include <openspace/scripting/lualibrary.h>
#include <openspace/util/camera.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/profiling.h>
@@ -468,7 +469,8 @@ SceneGraphNode* Scene::loadNode(const ghoul::Dictionary& nodeDictionary) {
if (parent) {
parent->attachChild(std::move(node));
} else {
}
else {
attachNode(std::move(node));
}

View File

@@ -29,7 +29,6 @@
#include <ghoul/misc/easing.h>
#include <regex>
#pragma optimize ("", off)
namespace openspace {
namespace {

View File

@@ -252,7 +252,8 @@ std::unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
if (!tagName.empty()) {
result->addTag(std::move(tagName));
}
} else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
}
else if (dictionary.hasKeyAndValue<ghoul::Dictionary>(KeyTag)) {
ghoul::Dictionary tagNames = dictionary.value<ghoul::Dictionary>(KeyTag);
std::vector<std::string> keys = tagNames.keys();
std::string tagName;

View File

@@ -66,7 +66,8 @@ std::string SceneLicenseWriter::generateJson() const {
for (const char& c : json.str()) {
if (c == '\'') {
jsonString += "\\'";
} else {
}
else {
jsonString += c;
}
}

View File

@@ -182,7 +182,8 @@ bool ScriptEngine::runScript(const std::string& script, ScriptCallback callback)
ghoul::Dictionary returnValue =
ghoul::lua::loadArrayDictionaryFromString(script, _state);
callback(returnValue);
} else {
}
else {
ghoul::lua::runScript(_state, script);
}
}
@@ -651,7 +652,8 @@ bool ScriptEngine::writeLog(const std::string& script) {
return false;
}
} else {
}
else {
_logScripts = false;
return false;
}
@@ -738,7 +740,8 @@ void ScriptEngine::postSync(bool isMaster) {
continue;
}
}
} else {
}
else {
std::lock_guard<std::mutex> guard(_slaveScriptsMutex);
while (!_slaveScriptQueue.empty()) {
try {

View File

@@ -412,18 +412,18 @@ int saveLastChangeToProfile(lua_State* L) {
std::string strNew = fmt::format("{}\n{}",actualLastLine, strReplace);
std::ifstream filein(assetPath);
std::ofstream fileout(tempAssetPath);
if(!filein) {
if (!filein) {
ghoul::lua::push(L, fmt::format("Could not open profile '{}'", assetPath));
printInternal(ghoul::logging::LogLevel::Error, L);
}
if(!fileout) {
if (!fileout) {
ghoul::lua::push(L, fmt::format("Could not open tmp profile '{}'", tempAssetPath));
printInternal(ghoul::logging::LogLevel::Error, L);
}
bool found = false;
while(std::getline (filein, line)) {
if(line == strReplace){
if (line == strReplace) {
line = strNew;
found = true;
}
@@ -444,7 +444,8 @@ int saveLastChangeToProfile(lua_State* L) {
}
FileSys.deleteFile(tempAssetPath);
return 0;
} else {
}
else {
ghoul::lua::push(L, "can not save to built in profiles");
printInternal(ghoul::logging::LogLevel::Error, L);
return -1;

View File

@@ -156,20 +156,20 @@ float Camera::scaling() const {
}
const glm::dmat4& Camera::viewRotationMatrix() const {
if (_cachedViewRotationMatrix.isDirty) {
//if (_cachedViewRotationMatrix.isDirty) {
_cachedViewRotationMatrix.datum = glm::mat4_cast(
glm::inverse(static_cast<glm::dquat>(_rotation))
);
_cachedViewRotationMatrix.isDirty = false;
}
//}
return _cachedViewRotationMatrix.datum;
}
const glm::dmat4& Camera::viewScaleMatrix() const {
if (_cachedViewScaleMatrix.isDirty) {
//if (_cachedViewScaleMatrix.isDirty) {
_cachedViewScaleMatrix.datum = glm::scale(glm::mat4(1.f), glm::vec3(_scaling));
_cachedViewScaleMatrix.isDirty = false;
}
//}
return _cachedViewScaleMatrix.datum;
}
@@ -178,7 +178,7 @@ const glm::dquat& Camera::rotationQuaternion() const {
}
const glm::dmat4& Camera::combinedViewMatrix() const {
if (_cachedCombinedViewMatrix.isDirty) {
//if (_cachedCombinedViewMatrix.isDirty) {
const glm::dmat4 cameraTranslation = glm::inverse(
glm::translate(glm::dmat4(1.0), static_cast<glm::dvec3>(_position))
);
@@ -188,7 +188,7 @@ const glm::dmat4& Camera::combinedViewMatrix() const {
glm::dmat4(viewRotationMatrix()) *
cameraTranslation;
_cachedCombinedViewMatrix.isDirty = false;
}
//}
return _cachedCombinedViewMatrix.datum;
}
@@ -256,11 +256,11 @@ const glm::mat4& Camera::SgctInternal::projectionMatrix() const {
}
const glm::mat4& Camera::SgctInternal::viewProjectionMatrix() const {
if (_cachedViewProjectionMatrix.isDirty) {
//if (_cachedViewProjectionMatrix.isDirty) {
std::lock_guard<std::mutex> _lock(_mutex);
_cachedViewProjectionMatrix.datum = _projectionMatrix * _viewMatrix;
_cachedViewProjectionMatrix.isDirty = false;
}
//}
return _cachedViewProjectionMatrix.datum;
}

View File

@@ -127,7 +127,8 @@ bool Histogram::add(const Histogram& histogram) {
}
_numValues += histogram._numValues;
return true;
} else {
}
else {
LERROR("Dimension mismatch");
return false;
}
@@ -329,7 +330,8 @@ float Histogram::highestBinValue(bool equalized, int overBins){
_numBins * (_maxValue - _minValue);
float high = low + (_maxValue - _minValue) / static_cast<float>(_numBins);
return (high+low) / 2.f;
} else {
}
else {
return highestBin / static_cast<float>(_numBins);
// return equalize((high+low)/2.0);
}

View File

@@ -142,10 +142,12 @@ void HttpRequest::perform(RequestOptions opt) {
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &responseCode); // NOLINT
if (responseCode == StatusCodeOk) {
setReadyState(ReadyState::Success);
} else {
}
else {
setReadyState(ReadyState::Fail);
}
} else {
}
else {
setReadyState(ReadyState::Fail);
}
curl_easy_cleanup(curl);
@@ -218,7 +220,8 @@ void SyncHttpDownload::download(HttpRequest::RequestOptions opt) {
LTRACE(fmt::format("Finished sync download '{}'", _httpRequest.url()));
deinitDownload();
markAsSuccessful();
} else if (rs == HttpRequest::ReadyState::Fail) {
}
else if (rs == HttpRequest::ReadyState::Fail) {
LERROR(fmt::format("Failed sync download '{}'", _httpRequest.url()));
deinitDownload();
markAsFailed();

View File

@@ -52,7 +52,8 @@ std::vector<std::unique_ptr<Task>> TaskLoader::tasksFromDictionary(
const std::string path = taskName + ".task";
std::vector<std::unique_ptr<Task>> subTasks = tasksFromFile(path);
std::move(subTasks.begin(), subTasks.end(), std::back_inserter(tasks));
} else if (tasksDictionary.getValue(key, subTask)) {
}
else if (tasksDictionary.getValue(key, subTask)) {
const std::string& taskType = subTask.value<std::string>("Type");
std::unique_ptr<Task> task = Task::createFromDictionary(subTask);
if (!task) {

View File

@@ -56,7 +56,8 @@ int time_setDeltaTime(lua_State* L) {
}
const double newDeltaTime = lua_tonumber(L, 1);
global::timeManager.setDeltaTime(newDeltaTime);
} else {
}
else {
lua_settop(L, 0);
const char* msg = lua_pushfstring(L,
"Bad number of arguments. Expected 1 or 2.");
@@ -159,7 +160,8 @@ int time_togglePause(lua_State* L) {
if (nArguments == 0) {
global::timeManager.setPause(!global::timeManager.isPaused());
} else {
}
else {
lua_settop(L, 0);
return luaL_error(
L,
@@ -210,7 +212,8 @@ int time_interpolateTogglePause(lua_State* L) {
global::timeManager.defaultPauseInterpolationDuration() :
global::timeManager.defaultUnpauseInterpolationDuration()
);
} else {
}
else {
lua_settop(L, 0);
return luaL_error(
L,
@@ -236,7 +239,8 @@ int time_setPause(lua_State* L) {
if (nArguments == 1) {
const bool pause = lua_toboolean(L, 1) == 1;
global::timeManager.setPause(pause);
} else {
}
else {
lua_settop(L, 0);
return luaL_error(
L,
@@ -284,7 +288,8 @@ int time_interpolatePause(lua_State* L) {
global::timeManager.defaultPauseInterpolationDuration() :
global::timeManager.defaultUnpauseInterpolationDuration()
);
} else {
}
else {
lua_settop(L, 0);
return luaL_error(
L,
@@ -342,7 +347,8 @@ int time_setTime(lua_State* L) {
return 0;
}
ghoul_assert(lua_gettop(L) == 0, "Incorrect number of items left on stack");
} else {
}
else {
return luaL_error(
L,
"bad number of arguments, expected 1 or 2, got %i",

View File

@@ -193,7 +193,8 @@ TimeKeyframeData TimeManager::interpolate(double applicationTime) {
*firstFutureKeyframe,
applicationTime
);
} else if (hasPastKeyframes) {
}
else if (hasPastKeyframes) {
// Extrapolate based on last past keyframe
const double deltaApplicationTime = applicationTime - lastPastKeyframe->timestamp;
Time predictedTime(
@@ -271,9 +272,11 @@ void TimeManager::progressTime(double dt) {
_currentTime.data().setTime(interpolated.time.j2000Seconds());
_deltaTime = interpolated.delta;
} else if (!hasConsumedLastPastKeyframe) {
}
else if (!hasConsumedLastPastKeyframe) {
applyKeyframeData(lastPastKeyframe->data);
} else if (!isPaused()) {
}
else if (!isPaused()) {
// If there are no keyframes to consider
// and time is not paused, just advance time.
_deltaTime = _targetDeltaTime;

View File

@@ -128,7 +128,7 @@ float TouchInputHolder::speedX() const {
}
float TouchInputHolder::speedY() const {
if(_inputs.size() <= 1) {
if (_inputs.size() <= 1) {
return 0.f;
}
const TouchInput& currentInput = _inputs[0];

View File

@@ -134,7 +134,8 @@ glm::dmat3 TransformationManager::frameTransformationMatrix(
if (fromKameleon && toKameleon) {
return kameleonTransformationMatrix(from, to, ephemerisTime);
} else if (fromKameleon && !toKameleon) {
}
else if (fromKameleon && !toKameleon) {
glm::dmat3 kameleonTransformation = kameleonTransformationMatrix(
from,
"J2000",
@@ -146,7 +147,8 @@ glm::dmat3 TransformationManager::frameTransformationMatrix(
ephemerisTime
);
return spiceTransformation*kameleonTransformation;
} else if (!fromKameleon && toKameleon) {
}
else if (!fromKameleon && toKameleon) {
glm::dmat3 spiceTransformation = SpiceManager::ref().frameTransformationMatrix(
from,
"J2000",

View File

@@ -105,7 +105,8 @@ void VersionChecker::cancel() {
currentVersion.minor,
currentVersion.patch
));
} else {
}
else {
LINFO(fmt::format(
"OpenSpace version {}.{}.{} is up to date.",
currentVersion.major,