mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-19 11:29:08 -06:00
Feature/flying fixes (#924)
* Removing various warnings * Fix the rendering of the touchbar on Mac * More warnings * Add ghoul deinitialize * Update SGCT repository
This commit is contained in:
Submodule apps/OpenSpace/ext/sgct updated: 99e5595539...8f2ed18481
@@ -76,6 +76,8 @@ constexpr const bool EnableDetailedVtune = false;
|
||||
#include "nvToolsExt.h"
|
||||
#endif // OPENSPACE_HAS_NVTOOLS
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr const char* _loggerCat = "main";
|
||||
@@ -157,9 +159,9 @@ LONG WINAPI generateMiniDump(EXCEPTION_POINTERS* exceptionPointers) {
|
||||
|
||||
std::string dumpFile = fmt::format(
|
||||
"OpenSpace_{}_{}_{}-{}-{}-{}-{}-{}-{}--{}--{}.dmp",
|
||||
openspace::OPENSPACE_VERSION_MAJOR,
|
||||
openspace::OPENSPACE_VERSION_MINOR,
|
||||
openspace::OPENSPACE_VERSION_PATCH,
|
||||
OPENSPACE_VERSION_MAJOR,
|
||||
OPENSPACE_VERSION_MINOR,
|
||||
OPENSPACE_VERSION_PATCH,
|
||||
stLocalTime.wYear,
|
||||
stLocalTime.wMonth,
|
||||
stLocalTime.wDay,
|
||||
@@ -260,7 +262,7 @@ void mainInitFunc() {
|
||||
LTRACE("main::mainInitFunc(begin)");
|
||||
|
||||
LDEBUG("Initializing OpenSpace Engine started");
|
||||
openspace::global::openSpaceEngine.initialize();
|
||||
global::openSpaceEngine.initialize();
|
||||
LDEBUG("Initializing OpenSpace Engine finished");
|
||||
|
||||
{
|
||||
@@ -287,7 +289,7 @@ void mainInitFunc() {
|
||||
|
||||
|
||||
LDEBUG("Initializing OpenGL in OpenSpace Engine started");
|
||||
openspace::global::openSpaceEngine.initializeGL();
|
||||
global::openSpaceEngine.initializeGL();
|
||||
LDEBUG("Initializing OpenGL in OpenSpace Engine finished");
|
||||
|
||||
|
||||
@@ -366,7 +368,7 @@ void mainInitFunc() {
|
||||
//
|
||||
|
||||
std::string screenshotPath = "${SCREENSHOTS}";
|
||||
if (openspace::global::configuration.shouldUseScreenshotDate) {
|
||||
if (global::configuration.shouldUseScreenshotDate) {
|
||||
std::time_t now = std::time(nullptr);
|
||||
std::tm* nowTime = std::localtime(&now);
|
||||
char mbstr[128];
|
||||
@@ -412,13 +414,13 @@ void mainPreSyncFunc() {
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
LTRACE("main::mainPreSyncFunc(begin)");
|
||||
|
||||
openspace::global::openSpaceEngine.preSynchronization();
|
||||
global::openSpaceEngine.preSynchronization();
|
||||
|
||||
// Query joystick status
|
||||
using namespace openspace::interaction;
|
||||
using namespace interaction;
|
||||
|
||||
for (int i = GLFW_JOYSTICK_1; i <= GLFW_JOYSTICK_LAST; ++i) {
|
||||
JoystickInputState& state = openspace::global::joystickInputStates[i];
|
||||
JoystickInputState& state = global::joystickInputStates[i];
|
||||
|
||||
int present = glfwJoystickPresent(i);
|
||||
if (present == GLFW_FALSE) {
|
||||
@@ -511,7 +513,7 @@ void mainPostSyncPreDrawFunc() {
|
||||
#endif // OPENSPACE_HAS_NVTOOLS
|
||||
LTRACE("main::postSynchronizationPreDraw(begin)");
|
||||
|
||||
openspace::global::openSpaceEngine.postSynchronizationPreDraw();
|
||||
global::openSpaceEngine.postSynchronizationPreDraw();
|
||||
|
||||
#ifdef OPENVR_SUPPORT
|
||||
if (FirstOpenVRWindow) {
|
||||
@@ -559,7 +561,7 @@ void mainRenderFunc() {
|
||||
#endif
|
||||
|
||||
try {
|
||||
openspace::global::openSpaceEngine.render(
|
||||
global::openSpaceEngine.render(
|
||||
SgctEngine->getModelMatrix(),
|
||||
viewMatrix,
|
||||
projectionMatrix
|
||||
@@ -591,7 +593,7 @@ void mainDraw2DFunc() {
|
||||
LTRACE("main::mainDraw2DFunc(begin)");
|
||||
|
||||
try {
|
||||
openspace::global::openSpaceEngine.drawOverlays();
|
||||
global::openSpaceEngine.drawOverlays();
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERRORC(e.component, e.message);
|
||||
@@ -627,7 +629,7 @@ void mainPostDrawFunc() {
|
||||
}
|
||||
#endif // OPENVR_SUPPORT
|
||||
|
||||
openspace::global::openSpaceEngine.postDraw();
|
||||
global::openSpaceEngine.postDraw();
|
||||
|
||||
#ifdef OPENSPACE_HAS_SPOUT
|
||||
for (const SpoutWindow& w : SpoutWindows) {
|
||||
@@ -667,7 +669,7 @@ void mainPostDrawFunc() {
|
||||
|
||||
|
||||
|
||||
void mainKeyboardCallback(int key, int, int action, int mods) {
|
||||
void mainKeyboardCallback(int key, int, int action, int modifiers) {
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
if (EnableDetailedVtune) {
|
||||
__itt_frame_begin_v3(_vTune.keyboard, nullptr);
|
||||
@@ -675,11 +677,10 @@ void mainKeyboardCallback(int key, int, int action, int mods) {
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
LTRACE("main::mainKeyboardCallback(begin)");
|
||||
|
||||
openspace::global::openSpaceEngine.keyboardCallback(
|
||||
openspace::Key(key),
|
||||
openspace::KeyModifier(mods),
|
||||
openspace::KeyAction(action)
|
||||
);
|
||||
const Key k = Key(key);
|
||||
const KeyModifier m = KeyModifier(modifiers);
|
||||
const KeyAction a = KeyAction(action);
|
||||
global::openSpaceEngine.keyboardCallback(k, m, a);
|
||||
|
||||
LTRACE("main::mainKeyboardCallback(begin)");
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
@@ -699,11 +700,10 @@ void mainMouseButtonCallback(int key, int action, int modifiers) {
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
LTRACE("main::mainMouseButtonCallback(begin)");
|
||||
|
||||
openspace::global::openSpaceEngine.mouseButtonCallback(
|
||||
openspace::MouseButton(key),
|
||||
openspace::MouseAction(action),
|
||||
openspace::KeyModifier(modifiers)
|
||||
);
|
||||
const MouseButton k = MouseButton(key);
|
||||
const MouseAction a = MouseAction(action);
|
||||
const KeyModifier m = KeyModifier(modifiers);
|
||||
global::openSpaceEngine.mouseButtonCallback(k, a, m);
|
||||
|
||||
LTRACE("main::mainMouseButtonCallback(end)");
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
@@ -722,7 +722,7 @@ void mainMousePosCallback(double x, double y) {
|
||||
}
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
|
||||
openspace::global::openSpaceEngine.mousePositionCallback(x, y);
|
||||
global::openSpaceEngine.mousePositionCallback(x, y);
|
||||
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
if (EnableDetailedVtune) {
|
||||
@@ -741,7 +741,7 @@ void mainMouseScrollCallback(double posX, double posY) {
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
LTRACE("main::mainMouseScrollCallback(begin");
|
||||
|
||||
openspace::global::openSpaceEngine.mouseScrollWheelCallback(posX, posY);
|
||||
global::openSpaceEngine.mouseScrollWheelCallback(posX, posY);
|
||||
|
||||
LTRACE("main::mainMouseScrollCallback(end)");
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
@@ -753,17 +753,15 @@ void mainMouseScrollCallback(double posX, double posY) {
|
||||
|
||||
|
||||
|
||||
void mainCharCallback(unsigned int codepoint, int mods) {
|
||||
void mainCharCallback(unsigned int codepoint, int modifiers) {
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
if (EnableDetailedVtune) {
|
||||
__itt_frame_begin_v3(_vTune.character, nullptr);
|
||||
}
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
|
||||
openspace::global::openSpaceEngine.charCallback(
|
||||
codepoint,
|
||||
openspace::KeyModifier(mods)
|
||||
);
|
||||
const KeyModifier m = KeyModifier(modifiers);
|
||||
global::openSpaceEngine.charCallback(codepoint, m);
|
||||
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
if (EnableDetailedVtune) {
|
||||
@@ -782,7 +780,7 @@ void mainEncodeFun() {
|
||||
#endif // OPENSPACE_HAS_VTUNE
|
||||
LTRACE("main::mainEncodeFun(begin)");
|
||||
|
||||
std::vector<char> data = openspace::global::openSpaceEngine.encode();
|
||||
std::vector<char> data = global::openSpaceEngine.encode();
|
||||
_synchronizationBuffer.setVal(std::move(data));
|
||||
sgct::SharedData::instance()->writeVector(&_synchronizationBuffer);
|
||||
|
||||
@@ -806,7 +804,7 @@ void mainDecodeFun() {
|
||||
|
||||
sgct::SharedData::instance()->readVector(&_synchronizationBuffer);
|
||||
std::vector<char> data = _synchronizationBuffer.getVal();
|
||||
openspace::global::openSpaceEngine.decode(std::move(data));
|
||||
global::openSpaceEngine.decode(std::move(data));
|
||||
|
||||
LTRACE("main::mainDecodeFun(end)");
|
||||
#ifdef OPENSPACE_HAS_VTUNE
|
||||
@@ -833,7 +831,7 @@ void mainLogCallback(const char* msg) {
|
||||
|
||||
|
||||
void setSgctDelegateFunctions() {
|
||||
openspace::WindowDelegate& sgctDelegate = openspace::global::windowDelegate;
|
||||
WindowDelegate& sgctDelegate = global::windowDelegate;
|
||||
sgctDelegate.terminate = []() { sgct::Engine::instance()->terminate(); };
|
||||
sgctDelegate.setBarrier = [](bool enabled) {
|
||||
sgct::SGCTWindow::setBarrier(enabled);
|
||||
@@ -1101,7 +1099,7 @@ int main(int argc, char** argv) {
|
||||
ghoul::cmdparser::CommandlineParser::AllowUnknownCommands::Yes
|
||||
);
|
||||
|
||||
openspace::CommandlineArguments commandlineArguments;
|
||||
CommandlineArguments commandlineArguments;
|
||||
parser.addCommand(std::make_unique<ghoul::cmdparser::SingleCommand<std::string>>(
|
||||
commandlineArguments.configurationName, "--file", "-f",
|
||||
"Provides the path to the OpenSpace configuration file. Only the '${TEMPORARY}' "
|
||||
@@ -1141,8 +1139,6 @@ int main(int argc, char** argv) {
|
||||
// Create the OpenSpace engine and get arguments for the SGCT engine
|
||||
std::string windowConfiguration;
|
||||
try {
|
||||
using namespace openspace;
|
||||
|
||||
// Find configuration
|
||||
std::string configurationFilePath = commandlineArguments.configurationName;
|
||||
if (commandlineArguments.configurationName.empty()) {
|
||||
@@ -1178,16 +1174,17 @@ int main(int argc, char** argv) {
|
||||
// Determining SGCT configuration file
|
||||
LDEBUG("SGCT Configuration file: " + global::configuration.windowConfiguration);
|
||||
|
||||
windowConfiguration = openspace::global::configuration.windowConfiguration;
|
||||
windowConfiguration = global::configuration.windowConfiguration;
|
||||
}
|
||||
catch (const openspace::documentation::SpecificationError& e) {
|
||||
catch (const documentation::SpecificationError& e) {
|
||||
LFATALC("main", "Loading of configuration file failed");
|
||||
for (const openspace::documentation::TestResult::Offense& o : e.result.offenses) {
|
||||
for (const documentation::TestResult::Offense& o : e.result.offenses) {
|
||||
LERRORC(o.offender, ghoul::to_string(o.reason));
|
||||
}
|
||||
for (const openspace::documentation::TestResult::Warning& w : e.result.warnings) {
|
||||
for (const documentation::TestResult::Warning& w : e.result.warnings) {
|
||||
LWARNINGC(w.offender, ghoul::to_string(w.reason));
|
||||
}
|
||||
ghoul::deinitialize();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
@@ -1196,10 +1193,11 @@ int main(int argc, char** argv) {
|
||||
if (ghoul::logging::LogManager::isInitialized()) {
|
||||
LogMgr.flushLogs();
|
||||
}
|
||||
ghoul::deinitialize();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
openspace::global::openSpaceEngine.registerPathTokens();
|
||||
global::openSpaceEngine.registerPathTokens();
|
||||
|
||||
// Prepend the outgoing sgctArguments with the program name
|
||||
// as well as the configuration file that sgct is supposed to use
|
||||
@@ -1293,8 +1291,8 @@ int main(int argc, char** argv) {
|
||||
|
||||
auto cleanup = [&](bool isInitialized) {
|
||||
if (isInitialized) {
|
||||
openspace::global::openSpaceEngine.deinitializeGL();
|
||||
openspace::global::openSpaceEngine.deinitialize();
|
||||
global::openSpaceEngine.deinitializeGL();
|
||||
global::openSpaceEngine.deinitialize();
|
||||
}
|
||||
|
||||
// Clear function bindings to avoid crash after destroying the OpenSpace Engine
|
||||
@@ -1321,6 +1319,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
#endif // OPENSPACE_HAS_SPOUT
|
||||
|
||||
ghoul::deinitialize();
|
||||
};
|
||||
|
||||
if (!initSuccess) {
|
||||
|
||||
@@ -221,7 +221,6 @@ private:
|
||||
double timestamp;
|
||||
};
|
||||
ExternInteraction _externInteract;
|
||||
bool _isRecording = false;
|
||||
double _timestampRecordStarted = 0.0;
|
||||
double _timestampPlaybackStarted_application = 0.0;
|
||||
double _timestampPlaybackStarted_simulation = 0.0;
|
||||
|
||||
@@ -261,8 +261,8 @@ void AtmosphereDeferredcaster::preRaycast(const RenderData& renderData,
|
||||
program.setUniform(_uniformCache2.dModelTransformMatrix, _modelTransform);
|
||||
|
||||
// Eye Space in SGCT to Eye Space in OS (SGCT View to OS Camera Rig)
|
||||
glm::dmat4 dSgctEye2OSEye = glm::inverse(
|
||||
glm::dmat4(renderData.camera.viewMatrix()));
|
||||
// glm::dmat4 dSgctEye2OSEye = glm::inverse(
|
||||
// glm::dmat4(renderData.camera.viewMatrix()));
|
||||
|
||||
glm::dmat4 dSGCTViewToWorldMatrix = glm::inverse(
|
||||
renderData.camera.combinedViewMatrix()
|
||||
@@ -1508,7 +1508,7 @@ bool AtmosphereDeferredcaster::isAtmosphereInFrustum(const glm::dmat4& MVMatrix,
|
||||
double bottomDistance = MVMatrix[3][3] + MVMatrix[3][1];
|
||||
double topDistance = MVMatrix[3][3] - MVMatrix[3][1];
|
||||
double nearDistance = MVMatrix[3][3] + MVMatrix[3][2];
|
||||
double farDistance = MVMatrix[3][3] - MVMatrix[3][2];
|
||||
// double farDistance = MVMatrix[3][3] - MVMatrix[3][2];
|
||||
|
||||
// Normalize Planes
|
||||
double invMag = 1.0 / glm::length(leftNormal);
|
||||
@@ -1533,7 +1533,7 @@ bool AtmosphereDeferredcaster::isAtmosphereInFrustum(const glm::dmat4& MVMatrix,
|
||||
|
||||
invMag = 1.0 / glm::length(farNormal);
|
||||
farNormal *= invMag;
|
||||
farDistance *= invMag;
|
||||
// farDistance *= invMag;
|
||||
|
||||
if ((glm::dot(leftNormal, position) + leftDistance) < -radius) {
|
||||
return false;
|
||||
|
||||
@@ -289,7 +289,7 @@ void DashboardItemFramerate::render(glm::vec2& penPosition) {
|
||||
);
|
||||
|
||||
int nLines = output.empty() ? 0 :
|
||||
(std::count(output.begin(), output.end(), '\n') + 1);
|
||||
static_cast<int>((std::count(output.begin(), output.end(), '\n') + 1));
|
||||
|
||||
penPosition.y -= _font->height() * static_cast<float>(nLines);
|
||||
|
||||
|
||||
@@ -750,7 +750,6 @@ void RenderableBillboardsCloud::renderBillboards(const RenderData& data,
|
||||
|
||||
_program->activate();
|
||||
|
||||
const glm::dmat4 projMatrix = glm::dmat4(data.camera.projectionMatrix());
|
||||
_program->setUniform(
|
||||
"screenSize",
|
||||
glm::vec2(global::renderEngine.renderingResolution())
|
||||
|
||||
@@ -77,19 +77,6 @@ namespace {
|
||||
"all point."
|
||||
};
|
||||
|
||||
//constexpr openspace::properties::Property::PropertyInfo ScaleFactorInfo = {
|
||||
// "ScaleFactor",
|
||||
// "Scale Factor",
|
||||
// "This value is used as a multiplicative factor that is applied to the apparent "
|
||||
// "size of each point."
|
||||
//};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo ColorInfo = {
|
||||
"Color",
|
||||
"Color",
|
||||
"This value is used to define the color of the astronomical object."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo TextColorInfo = {
|
||||
"TextColor",
|
||||
"Text Color",
|
||||
@@ -427,7 +414,7 @@ void RenderableDUMeshes::initializeGL() {
|
||||
}
|
||||
|
||||
void RenderableDUMeshes::deinitializeGL() {
|
||||
for (const std::pair<int, RenderingMesh>& pair : _renderingMeshesMap) {
|
||||
for (const std::pair<const int, RenderingMesh>& pair : _renderingMeshesMap) {
|
||||
for (int i = 0; i < pair.second.numU; ++i) {
|
||||
glDeleteVertexArrays(1, &pair.second.vaoArray[i]);
|
||||
glDeleteBuffers(1, &pair.second.vboArray[i]);
|
||||
@@ -483,7 +470,7 @@ void RenderableDUMeshes::renderMeshes(const RenderData&,
|
||||
_program->setUniform(_uniformCache.alphaValue, _alphaValue);
|
||||
//_program->setUniform(_uniformCache.scaleFactor, _scaleFactor);
|
||||
|
||||
for (const std::pair<int, RenderingMesh>& pair : _renderingMeshesMap) {
|
||||
for (const std::pair<const int, RenderingMesh>& pair : _renderingMeshesMap) {
|
||||
_program->setUniform(_uniformCache.color, _meshColorMap[pair.second.colorIndex]);
|
||||
for (size_t i = 0; i < pair.second.vaoArray.size(); ++i) {
|
||||
glBindVertexArray(pair.second.vaoArray[i]);
|
||||
|
||||
@@ -844,7 +844,7 @@ bool RenderablePlanesCloud::loadData() {
|
||||
|
||||
bool RenderablePlanesCloud::loadTextures() {
|
||||
if (!_textureFileMap.empty()) {
|
||||
for (const std::pair<int, std::string>& pair : _textureFileMap) {
|
||||
for (const std::pair<const int, std::string>& pair : _textureFileMap) {
|
||||
const auto& p = _textureMap.insert(std::make_pair(
|
||||
pair.first,
|
||||
ghoul::io::TextureReader::ref().loadTexture(pair.second)
|
||||
|
||||
@@ -45,11 +45,10 @@
|
||||
#include <locale>
|
||||
|
||||
namespace {
|
||||
constexpr const char* KeyLabels = "Labels";
|
||||
constexpr const char* KeyLabelsFileName = "FileName";
|
||||
|
||||
constexpr const char* _loggerCat = "GlobeLabels";
|
||||
|
||||
constexpr const char* KeyLabelsFileName = "FileName";
|
||||
|
||||
constexpr const double LabelFadeRangeConst = 1500.0;
|
||||
constexpr const double RangeAngularCoefConst = 0.8;
|
||||
constexpr const float MinTransparencyValueConst = 0.009f;
|
||||
@@ -671,19 +670,10 @@ void GlobeLabelsComponent::renderLabels(const RenderData& data,
|
||||
float distToCamera,
|
||||
float fadeInVariable
|
||||
) {
|
||||
constexpr double DIST_EPS = 6000.0;
|
||||
constexpr double SIN_EPS = 0.001;
|
||||
|
||||
glm::vec4 textColor = _labelsColor;
|
||||
textColor.a *= fadeInVariable;
|
||||
|
||||
glm::dmat4 invMP = glm::inverse(_globe->modelTransform());
|
||||
glm::dmat4 invCombinedView = glm::inverse(data.camera.combinedViewMatrix());
|
||||
|
||||
glm::dvec4 cameraPosWorld = invCombinedView * glm::dvec4(0.0, 0.0, 0.0, 1.0);
|
||||
glm::dvec3 cameraPosObj = glm::dvec3(invMP * cameraPosWorld);
|
||||
glm::dvec4 cameraUpVecWorld = glm::dvec4(data.camera.lookUpVectorWorldSpace(), 0.0);
|
||||
glm::dvec3 cameraLookUpObj = glm::dvec3(invMP * cameraUpVecWorld);
|
||||
|
||||
glm::dmat4 VP = glm::dmat4(data.camera.sgctInternal.projectionMatrix()) *
|
||||
data.camera.combinedViewMatrix();
|
||||
@@ -799,7 +789,7 @@ bool GlobeLabelsComponent::isLabelInFrustum(const glm::dmat4& MVMatrix,
|
||||
double bottomDistance = MVMatrix[3][3] + MVMatrix[3][1];
|
||||
double topDistance = MVMatrix[3][3] - MVMatrix[3][1];
|
||||
double nearDistance = MVMatrix[3][3] + MVMatrix[3][2];
|
||||
double farDistance = MVMatrix[3][3] - MVMatrix[3][2];
|
||||
// double farDistance = MVMatrix[3][3] - MVMatrix[3][2];
|
||||
|
||||
// Normalize Planes
|
||||
const double invMagLeft = 1.0 / glm::length(leftNormal);
|
||||
@@ -824,7 +814,7 @@ bool GlobeLabelsComponent::isLabelInFrustum(const glm::dmat4& MVMatrix,
|
||||
|
||||
const double invMagFar = 1.0 / glm::length(farNormal);
|
||||
farNormal *= invMagFar;
|
||||
farDistance *= invMagFar;
|
||||
// farDistance *= invMagFar;
|
||||
|
||||
constexpr const float Radius = 1.0;
|
||||
|
||||
|
||||
@@ -173,8 +173,10 @@ void GlobeTranslation::fillAttachedNode() {
|
||||
"GlobeTranslation",
|
||||
"Could not set attached node as it does not have a RenderableGlobe"
|
||||
);
|
||||
// Reset the globe name to it's previous name
|
||||
_globe = _attachedNode->identifier();
|
||||
if (_attachedNode) {
|
||||
// Reset the globe name to it's previous name
|
||||
_globe = _attachedNode->identifier();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1123,7 +1123,9 @@ void update(TileProvider& tp) {
|
||||
if (newCurrent) {
|
||||
t.currentTileProvider = newCurrent;
|
||||
}
|
||||
update(*t.currentTileProvider);
|
||||
if (t.currentTileProvider) {
|
||||
update(*t.currentTileProvider);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "TimeTopic";
|
||||
constexpr const char* EventKey = "event";
|
||||
constexpr const char* SubscribeEvent = "start_subscription";
|
||||
constexpr const char* UnsubscribeEvent = "stop_subscription";
|
||||
|
||||
@@ -773,7 +773,6 @@ void RenderableStars::renderPSFToTexture() {
|
||||
GLenum blendDestRGB;
|
||||
GLenum blendSrcAlpha;
|
||||
GLenum blendSrcRGB;
|
||||
GLboolean depthMask;
|
||||
|
||||
glGetIntegerv(GL_BLEND_EQUATION_RGB, &blendEquationRGB);
|
||||
glGetIntegerv(GL_BLEND_EQUATION_ALPHA, &blendEquationAlpha);
|
||||
@@ -927,7 +926,6 @@ void RenderableStars::render(const RenderData& data, RendererTasks&) {
|
||||
glm::dmat4(data.modelTransform.rotation) *
|
||||
glm::dmat4(glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)));
|
||||
|
||||
glm::dmat4 modelViewMatrix = data.camera.combinedViewMatrix() * modelMatrix;
|
||||
glm::dmat4 projectionMatrix = glm::dmat4(data.camera.projectionMatrix());
|
||||
|
||||
glm::dmat4 cameraViewProjectionMatrix = projectionMatrix *
|
||||
|
||||
@@ -165,7 +165,6 @@ private:
|
||||
GLuint _psfVao = 0;
|
||||
GLuint _psfVbo = 0;
|
||||
GLuint _psfTexture = 0;
|
||||
GLuint _discTexture = 0;
|
||||
GLuint _convolvedTexture = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,9 +50,6 @@ namespace {
|
||||
constexpr const char* KeyValueFunction = "ValueFunction";
|
||||
constexpr const char* KeyLowerDomainBound = "LowerDomainBound";
|
||||
constexpr const char* KeyUpperDomainBound = "UpperDomainBound";
|
||||
|
||||
constexpr const char* KeyMinValue = "MinValue";
|
||||
constexpr const char* KeyMaxValue = "MaxValue";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -35,12 +35,6 @@ namespace {
|
||||
"All the envelopes used in the transfer function"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo HistogramInfo = {
|
||||
"Histogram",
|
||||
"Histogram",
|
||||
"All the data"
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo DataUnitInfo = {
|
||||
"DataUnit",
|
||||
"DataUnit",
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <openspace/util/timemanager.h>
|
||||
#include <ghoul/fmt.h>
|
||||
|
||||
using namespace openspace;
|
||||
|
||||
@@ -44,8 +45,8 @@ using namespace openspace;
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static NSString* pauseResultId = @"com.openspaceproject.pause_resume";
|
||||
static NSString* showFullGuiId = @"com.openspaceproject.show_full_gui";
|
||||
static NSString* showSimpleGuiId = @"com.openspaceproject.show_simple_gui";
|
||||
static NSString* hideGuiId = @"com.openspaceproject.hide_gui";
|
||||
static NSString* hideOnScreenTextId = @"com.openspaceproject.hide_onscreen";
|
||||
NSArray* focusIdentifiers;
|
||||
|
||||
|
||||
@@ -55,8 +56,8 @@ NSArray* focusIdentifiers;
|
||||
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier;
|
||||
- (void)pauseResumeButtonAction:(id)sender;
|
||||
- (void)focusObjectAction:(id)sender;
|
||||
- (void)fullGuiButtonAction:(id)sender;
|
||||
- (void)simpleGuiButtonAction:(id)sender;
|
||||
- (void)hideTextAction:(id)sender;
|
||||
- (void)hideGuiAction:(id)sender;
|
||||
@end
|
||||
|
||||
@implementation TouchBarDelegate
|
||||
@@ -66,7 +67,7 @@ NSArray* focusIdentifiers;
|
||||
|
||||
touchBar.customizationIdentifier = @"com.openspaceproject.main_touch_bar";
|
||||
|
||||
NSArray* objs = [@[showSimpleGuiId, showFullGuiId,
|
||||
NSArray* objs = [@[hideGuiId, hideOnScreenTextId,
|
||||
NSTouchBarItemIdentifierFixedSpaceSmall, pauseResultId,
|
||||
NSTouchBarItemIdentifierFlexibleSpace]
|
||||
arrayByAddingObjectsFromArray: focusIdentifiers];
|
||||
@@ -85,8 +86,6 @@ NSArray* focusIdentifiers;
|
||||
- (NSTouchBarItem *)touchBar:(NSTouchBar *)touchBar
|
||||
makeItemForIdentifier:(NSTouchBarItemIdentifier)identifier
|
||||
{
|
||||
// @TODO(abock): Potential memory leak here by returning an alloc?
|
||||
|
||||
// Remove the unused variable warning
|
||||
(void)touchBar;
|
||||
|
||||
@@ -112,38 +111,38 @@ NSArray* focusIdentifiers;
|
||||
return [touchBarItem autorelease];
|
||||
}
|
||||
|
||||
if ([identifier isEqualToString:showFullGuiId]) {
|
||||
if ([identifier isEqualToString:hideOnScreenTextId]) {
|
||||
NSButton* button = [NSButton
|
||||
buttonWithTitle:@"Full GUI"
|
||||
target:self action:@selector(fullGuiButtonAction:)
|
||||
buttonWithTitle:@"Toggle Text"
|
||||
target:self action:@selector(hideTextAction:)
|
||||
];
|
||||
|
||||
NSCustomTouchBarItem* touchBarItem = [
|
||||
[NSCustomTouchBarItem alloc]
|
||||
initWithIdentifier:showFullGuiId
|
||||
initWithIdentifier:hideOnScreenTextId
|
||||
];
|
||||
touchBarItem.view = button;
|
||||
touchBarItem.customizationLabel = NSLocalizedString(
|
||||
@"Toggles the full GUI",
|
||||
@"Toogles on-screen text",
|
||||
@""
|
||||
);
|
||||
|
||||
return [touchBarItem autorelease];
|
||||
}
|
||||
|
||||
if ([identifier isEqualToString:showSimpleGuiId]) {
|
||||
if ([identifier isEqualToString:hideGuiId]) {
|
||||
NSButton* button = [NSButton
|
||||
buttonWithTitle:@"Simple GUI"
|
||||
target:self action:@selector(simpleGuiButtonAction:)
|
||||
buttonWithTitle:@"Toggle GUI"
|
||||
target:self action:@selector(hideGuiAction:)
|
||||
];
|
||||
|
||||
NSCustomTouchBarItem* touchBarItem = [
|
||||
[NSCustomTouchBarItem alloc]
|
||||
initWithIdentifier:showSimpleGuiId
|
||||
initWithIdentifier:hideGuiId
|
||||
];
|
||||
touchBarItem.view = button;
|
||||
touchBarItem.customizationLabel = NSLocalizedString(
|
||||
@"Toggles the simple GUI",
|
||||
@"Toggles the main GUI",
|
||||
@""
|
||||
);
|
||||
|
||||
@@ -188,63 +187,40 @@ NSArray* focusIdentifiers;
|
||||
|
||||
NSString* title = [button title];
|
||||
|
||||
std::string str = fmt::format(
|
||||
"openspace.setPropertyValueSingle('{}', '{}');\
|
||||
openspace.setPropertyValueSingle('{}', '');\
|
||||
openspace.setPropertyValueSingle('{}', '');",
|
||||
"NavigationHandler.OrbitalNavigator.Anchor", std::string([title UTF8String]),
|
||||
"NavigationHandler.OrbitalNavigator.Aim",
|
||||
"NavigationHandler.OrbitalNavigator.RetargetAnchor"
|
||||
);
|
||||
global::scriptEngine.queueScript(
|
||||
"openspace.setPropertyValue('NavigationHandler.Origin', '" +
|
||||
std::string([title UTF8String]) + "');",
|
||||
str,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
}
|
||||
|
||||
- (void)fullGuiButtonAction:(id)sender {
|
||||
- (void)hideTextAction:(id)sender {
|
||||
// Remove unused variable warning
|
||||
(void)sender;
|
||||
|
||||
global::scriptEngine.queueScript(
|
||||
"local b = openspace.getPropertyValue(\
|
||||
'Modules.ImGUI.Main.Enabled'\
|
||||
);\
|
||||
openspace.setPropertyValueSingle(\
|
||||
'Modules.ImGUI.Main.Enabled',\
|
||||
not b\
|
||||
);\
|
||||
openspace.setPropertyValueSingle(\
|
||||
'Modules.ImGUI.Main.IsHidden',\
|
||||
b\
|
||||
);",
|
||||
"local isEnabled = openspace.getPropertyValue('Dashboard.IsEnabled');\
|
||||
openspace.setPropertyValueSingle('Dashboard.IsEnabled', not isEnabled);\
|
||||
openspace.setPropertyValueSingle('RenderEngine.ShowLog', not isEnabled);\
|
||||
openspace.setPropertyValueSingle('RenderEngine.ShowVersion', not isEnabled);\
|
||||
openspace.setPropertyValueSingle('RenderEngine.ShowCamera', not isEnabled)",
|
||||
scripting::ScriptEngine::RemoteScripting::No
|
||||
);
|
||||
}
|
||||
|
||||
- (void)simpleGuiButtonAction:(id)sender {
|
||||
- (void)hideGuiAction:(id)sender {
|
||||
// Remove unused variable warning
|
||||
(void)sender;
|
||||
global::scriptEngine.queueScript(
|
||||
"local b = openspace.getPropertyValue('Modules.ImGUI.Main.FeaturedProperties.Enabled');\n\
|
||||
local c = openspace.getPropertyValue('Modules.ImGUI.Main.IsHidden');\n\
|
||||
openspace.setPropertyValue('Modules.ImGUI.*.Enabled', false);\n\
|
||||
if b and c then\n\
|
||||
-- This can happen if the main properties window is enabled, the main gui\n\
|
||||
-- is enabled and then closed again. So the main properties window is\n\
|
||||
-- enabled, but also all windows are hidden\n\
|
||||
openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', false);\n\
|
||||
openspace.setPropertyValueSingle(\n\
|
||||
'Modules.ImGUI.Main.FeaturedProperties.Enabled',\n\
|
||||
true\n\
|
||||
);\n\
|
||||
openspace.setPropertyValueSingle(\n\
|
||||
'Modules.ImGUI.Main.SpaceTime.Enabled',\n\
|
||||
true\n\
|
||||
);\n\
|
||||
else\n\
|
||||
openspace.setPropertyValueSingle(\n\
|
||||
'Modules.ImGUI.Main.FeaturedProperties.Enabled',\n\
|
||||
not b\n\
|
||||
);\n\
|
||||
openspace.setPropertyValueSingle(\n\
|
||||
'Modules.ImGUI.Main.SpaceTime.Enabled',\n\
|
||||
not b\n\
|
||||
);\n\
|
||||
openspace.setPropertyValueSingle('Modules.ImGUI.Main.IsHidden', b);\n\
|
||||
end",
|
||||
"local isEnabled = openspace.getPropertyValue('Modules.CefWebGui.Visible');\
|
||||
openspace.setPropertyValueSingle('Modules.CefWebGui.Visible', not isEnabled);",
|
||||
scripting::ScriptEngine::RemoteScripting::No
|
||||
);
|
||||
}
|
||||
@@ -266,19 +242,18 @@ void showTouchbar() {
|
||||
[NSApplication sharedApplication].automaticCustomizeTouchBarMenuItemEnabled = YES;
|
||||
}
|
||||
|
||||
std::vector<SceneGraphNode*> nodes =
|
||||
global::renderEngine.scene()->allSceneGraphNodes();
|
||||
std::vector<SceneGraphNode*> ns = global::renderEngine.scene()->allSceneGraphNodes();
|
||||
|
||||
std::sort(
|
||||
nodes.begin(),
|
||||
nodes.end(),
|
||||
ns.begin(),
|
||||
ns.end(),
|
||||
[](SceneGraphNode* lhs, SceneGraphNode* rhs) {
|
||||
return lhs->guiName() < rhs->guiName();
|
||||
}
|
||||
);
|
||||
|
||||
NSMutableArray* ids = [[NSMutableArray alloc] init];
|
||||
for (SceneGraphNode* n : nodes) {
|
||||
for (SceneGraphNode* n : ns) {
|
||||
const std::vector<std::string>& tags = n->tags();
|
||||
auto it = std::find(tags.begin(), tags.end(), "GUI.Interesting");
|
||||
if (it != tags.end()) {
|
||||
|
||||
@@ -62,7 +62,6 @@ namespace openspace::performance {
|
||||
// The ghoul::SharedData block addressed by OpenSpacePerformanceMeasurementSharedData
|
||||
// will only get allocated once and contains the total number of allocated shared memory
|
||||
// blocks alongside a list of names of these blocks
|
||||
//
|
||||
|
||||
void PerformanceManager::CreateGlobalSharedMemory() {
|
||||
static_assert(
|
||||
@@ -70,6 +69,8 @@ void PerformanceManager::CreateGlobalSharedMemory() {
|
||||
"The global memory struct does not fit the allocated global memory space"
|
||||
);
|
||||
|
||||
ghoul::SharedMemory::remove(GlobalSharedMemoryName);
|
||||
|
||||
if (ghoul::SharedMemory::exists(GlobalSharedMemoryName)) {
|
||||
ghoul::SharedMemory sharedMemory(GlobalSharedMemoryName);
|
||||
sharedMemory.acquireLock();
|
||||
|
||||
@@ -246,6 +246,7 @@ RenderEngine::RenderEngine()
|
||||
, _hdrExposure(HDRExposureInfo, 0.4f, 0.01f, 10.0f)
|
||||
, _hdrBackground(BackgroundExposureInfo, 2.8f, 0.01f, 10.0f)
|
||||
, _gamma(GammaInfo, 2.2f, 0.01f, 10.0f)
|
||||
, _horizFieldOfView(HorizFieldOfViewInfo, 80.f, 1.f, 179.0f)
|
||||
, _globalRotation(
|
||||
GlobalRotationInfo,
|
||||
glm::vec3(0.f),
|
||||
@@ -264,7 +265,6 @@ RenderEngine::RenderEngine()
|
||||
glm::vec3(-glm::pi<float>()),
|
||||
glm::vec3(glm::pi<float>())
|
||||
)
|
||||
, _horizFieldOfView(HorizFieldOfViewInfo, 80.f, 1.f, 179.0f)
|
||||
{
|
||||
_doPerformanceMeasurements.onChange([this](){
|
||||
global::performanceManager.setEnabled(_doPerformanceMeasurements);
|
||||
|
||||
@@ -138,7 +138,7 @@ void TimeManager::preSynchronization(double dt) {
|
||||
if (newTime != _lastTime) {
|
||||
using K = const CallbackHandle;
|
||||
using V = TimeChangeCallback;
|
||||
for (const std::pair<const K, V>& it : _timeChangeCallbacks) {
|
||||
for (const std::pair<K, V>& it : _timeChangeCallbacks) {
|
||||
it.second();
|
||||
}
|
||||
}
|
||||
@@ -148,14 +148,14 @@ void TimeManager::preSynchronization(double dt) {
|
||||
{
|
||||
using K = const CallbackHandle;
|
||||
using V = TimeChangeCallback;
|
||||
for (const std::pair<const K, V>& it : _deltaTimeChangeCallbacks) {
|
||||
for (const std::pair<K, V>& it : _deltaTimeChangeCallbacks) {
|
||||
it.second();
|
||||
}
|
||||
}
|
||||
if (_timelineChanged) {
|
||||
using K = const CallbackHandle;
|
||||
using V = TimeChangeCallback;
|
||||
for (const std::pair<const K, V>& it : _timelineChangeCallbacks) {
|
||||
for (const std::pair<K, V>& it : _timelineChangeCallbacks) {
|
||||
it.second();
|
||||
}
|
||||
}
|
||||
@@ -230,7 +230,7 @@ void TimeManager::progressTime(double dt) {
|
||||
|
||||
using K = const CallbackHandle;
|
||||
using V = TimeChangeCallback;
|
||||
for (const std::pair<const K, V>& it : _timeJumpCallbacks) {
|
||||
for (const std::pair<K, V>& it : _timeJumpCallbacks) {
|
||||
it.second();
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user