mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-05 02:20:11 -05:00
Issue/1355 (#1424)
* Move glfw init after macOS window is ready * MacOS fixes for BigSur * Compile fixs * Rename hirise.asset since linux filenames are case-sensitive * Modified globals DataStorage method to make Linux and Mac happy * Switched to unsecure http URLs for satellites due to httprequest problem * Keep the QApplication around on Mac because of some reason otherwise the keyboard handler crashes * Add comment explaining the madness * Apply same techniques to the globalscallback file Co-authored-by: Micah Acinapura <micahnyc@gmail.com> Co-authored-by: Gene Payne <payne.gene@gmail.com>
This commit is contained in:
+26
-3
@@ -224,6 +224,8 @@ void mainInitFunc(GLFWwindow*) {
|
||||
global::openSpaceEngine->initialize();
|
||||
LDEBUG("Initializing OpenSpace Engine finished");
|
||||
|
||||
#ifndef __APPLE__
|
||||
// Apparently: "Cocoa: Regular windows do not have icons on macOS"
|
||||
{
|
||||
std::string path = absPath("${DATA}/openspace-icon.png");
|
||||
int x;
|
||||
@@ -242,6 +244,7 @@ void mainInitFunc(GLFWwindow*) {
|
||||
|
||||
stbi_image_free(icons[0].pixels);
|
||||
}
|
||||
#endif // __APPLE__
|
||||
|
||||
currentWindow = Engine::instance().windows().front().get();
|
||||
currentViewport = currentWindow->viewports().front().get();
|
||||
@@ -1012,7 +1015,6 @@ std::string selectedSgctProfileFromLauncher(LauncherWindow& lw, bool hasCliSGCTC
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
glfwInit();
|
||||
|
||||
#ifdef WIN32
|
||||
SetUnhandledExceptionFilter(generateMiniDump);
|
||||
@@ -1169,19 +1171,38 @@ int main(int argc, char** argv) {
|
||||
sgctFunctionName
|
||||
);
|
||||
|
||||
// (abock, 2020-12-07) For some reason on Apple the keyboard handler in CEF will call
|
||||
// the Qt one even if the QApplication was destroyed, leading to invalid memory
|
||||
// access. The only way we could fix this for the release was to keep the
|
||||
// QApplication object around until the end of the program. Even though the Qt
|
||||
// keyboard handler gets called, it doesn't do anything so everything still works.
|
||||
#ifdef __APPLE__
|
||||
int qac = 0;
|
||||
QApplication app(qac, nullptr);
|
||||
#endif // __APPLE__
|
||||
|
||||
bool skipLauncher =
|
||||
(hasProfile && hasSGCTConfig) || global::configuration->bypassLauncher;
|
||||
if (!skipLauncher) {
|
||||
#ifndef __APPLE__
|
||||
int qac = 0;
|
||||
QApplication app(qac, nullptr);
|
||||
LauncherWindow win(!hasProfile,
|
||||
*global::configuration, !hasSGCTConfig, windowCfgPreset, nullptr);
|
||||
#endif // __APPLE__
|
||||
|
||||
LauncherWindow win(
|
||||
!hasProfile,
|
||||
*global::configuration,
|
||||
!hasSGCTConfig,
|
||||
windowCfgPreset,
|
||||
nullptr
|
||||
);
|
||||
win.show();
|
||||
app.exec();
|
||||
|
||||
if (!win.wasLaunchSelected()) {
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
glfwInit();
|
||||
|
||||
global::configuration->profile = win.selectedProfile();
|
||||
windowConfiguration = selectedSgctProfileFromLauncher(
|
||||
@@ -1191,6 +1212,8 @@ int main(int argc, char** argv) {
|
||||
labelFromCfgFile,
|
||||
xmlExt
|
||||
);
|
||||
} else {
|
||||
glfwInit();
|
||||
}
|
||||
if (global::configuration->profile.empty()) {
|
||||
LFATAL("Cannot launch with an empty profile");
|
||||
|
||||
@@ -3,7 +3,7 @@ local satelliteHelper = asset.require('util/tle_helper')
|
||||
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
local url = "https://celestrak.com/satcat/tle.php?CATNR=25544"
|
||||
local url = "http://celestrak.com/satcat/tle.php?CATNR=25544"
|
||||
local identifier = "ISS"
|
||||
local filename = "ISS.txt"
|
||||
local nodes = {}
|
||||
|
||||
@@ -3,7 +3,7 @@ local satelliteHelper = asset.require('util/tle_helper')
|
||||
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
local url = "https://celestrak.com/satcat/tle.php?CATNR=27424"
|
||||
local url = "http://celestrak.com/satcat/tle.php?CATNR=27424"
|
||||
local identifier = "Aqua"
|
||||
local filename = "Aqua.txt"
|
||||
local nodes = {}
|
||||
|
||||
@@ -3,7 +3,7 @@ local satelliteHelper = asset.require('util/tle_helper')
|
||||
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
local url = "https://celestrak.com/satcat/tle.php?CATNR=37849"
|
||||
local url = "http://celestrak.com/satcat/tle.php?CATNR=37849"
|
||||
local identifier = "SNPP"
|
||||
local filename = "SNPP.txt"
|
||||
local nodes = {}
|
||||
|
||||
@@ -3,7 +3,7 @@ local satelliteHelper = asset.require('util/tle_helper')
|
||||
local transforms = asset.require('scene/solarsystem/planets/earth/transforms')
|
||||
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
|
||||
|
||||
local url = "https://celestrak.com/satcat/tle.php?CATNR=25994"
|
||||
local url = "http://celestrak.com/satcat/tle.php?CATNR=25994"
|
||||
local identifier = "Terra"
|
||||
local filename = "Terra.txt"
|
||||
local nodes = {}
|
||||
|
||||
@@ -31,62 +31,26 @@
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace::global {
|
||||
namespace openspace::global::callback {
|
||||
|
||||
namespace detail {
|
||||
|
||||
std::vector<std::function<void()>>& gInitialize();
|
||||
std::vector<std::function<void()>>& gDeinitialize();
|
||||
|
||||
std::vector<std::function<void()>>& gInitializeGL();
|
||||
std::vector<std::function<void()>>& gDeinitializeGL();
|
||||
|
||||
std::vector<std::function<void()>>& gPreSync();
|
||||
std::vector<std::function<void()>>& gPostSyncPreDraw();
|
||||
std::vector<std::function<void()>>& gRender();
|
||||
std::vector<std::function<void()>>& gDraw2D();
|
||||
std::vector<std::function<void()>>& gPostDraw();
|
||||
|
||||
std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>& gKeyboard();
|
||||
std::vector<std::function<bool(unsigned int, KeyModifier)>>& gCharacter();
|
||||
|
||||
std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>& gMouseButton();
|
||||
std::vector<std::function<void(double, double)>>& gMousePosition();
|
||||
std::vector<std::function<bool(double, double)>>& gMouseScrollWheel();
|
||||
|
||||
std::vector<std::function<bool(TouchInput)>>& gTouchDetected();
|
||||
std::vector<std::function<bool(TouchInput)>>& gTouchUpdated();
|
||||
std::vector<std::function<void(TouchInput)>>& gTouchExit();
|
||||
|
||||
} // namespace detail
|
||||
|
||||
namespace callback {
|
||||
|
||||
static std::vector<std::function<void()>>& initialize = detail::gInitialize();
|
||||
static std::vector<std::function<void()>>& deinitialize = detail::gDeinitialize();
|
||||
static std::vector<std::function<void()>>& initializeGL = detail::gInitializeGL();
|
||||
static std::vector<std::function<void()>>& deinitializeGL = detail::gDeinitializeGL();
|
||||
static std::vector<std::function<void()>>& preSync = detail::gPreSync();
|
||||
static std::vector<std::function<void()>>& postSyncPreDraw = detail::gPostSyncPreDraw();
|
||||
static std::vector<std::function<void()>>& render = detail::gRender();
|
||||
static std::vector<std::function<void()>>& draw2D = detail::gDraw2D();
|
||||
static std::vector<std::function<void()>>& postDraw = detail::gPostDraw();
|
||||
static std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>& keyboard =
|
||||
detail::gKeyboard();
|
||||
static std::vector<std::function<bool(unsigned int, KeyModifier)>>& character =
|
||||
detail::gCharacter();
|
||||
static std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>&
|
||||
mouseButton = detail::gMouseButton();
|
||||
static std::vector<std::function<void(double, double)>>& mousePosition =
|
||||
detail::gMousePosition();
|
||||
static std::vector<std::function<bool(double, double)>>& mouseScrollWheel =
|
||||
detail::gMouseScrollWheel();
|
||||
static std::vector<std::function<bool(TouchInput)>>& touchDetected =
|
||||
detail::gTouchDetected();
|
||||
static std::vector<std::function<bool(TouchInput)>>& touchUpdated =
|
||||
detail::gTouchUpdated();
|
||||
static std::vector<std::function<void(TouchInput)>>& touchExit =
|
||||
detail::gTouchExit();
|
||||
inline std::vector<std::function<void()>>* initialize;
|
||||
inline std::vector<std::function<void()>>* deinitialize;
|
||||
inline std::vector<std::function<void()>>* initializeGL;
|
||||
inline std::vector<std::function<void()>>* deinitializeGL;
|
||||
inline std::vector<std::function<void()>>* preSync;
|
||||
inline std::vector<std::function<void()>>* postSyncPreDraw;
|
||||
inline std::vector<std::function<void()>>* render;
|
||||
inline std::vector<std::function<void()>>* draw2D;
|
||||
inline std::vector<std::function<void()>>* postDraw;
|
||||
inline std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>* keyboard;
|
||||
inline std::vector<std::function<bool(unsigned int, KeyModifier)>>* character;
|
||||
inline std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>*
|
||||
mouseButton;
|
||||
inline std::vector<std::function<void(double, double)>>* mousePosition;
|
||||
inline std::vector<std::function<bool(double, double)>>* mouseScrollWheel;
|
||||
inline std::vector<std::function<bool(TouchInput)>>* touchDetected;
|
||||
inline std::vector<std::function<bool(TouchInput)>>* touchUpdated;
|
||||
inline std::vector<std::function<void(TouchInput)>>* touchExit;
|
||||
|
||||
/**
|
||||
* If the framerate becomes slow, Chromium Embedded Framework (used in Web Browser Module)
|
||||
@@ -99,7 +63,8 @@ static std::vector<std::function<void(TouchInput)>>& touchExit =
|
||||
*/
|
||||
extern void (*webBrowserPerformanceHotfix)();
|
||||
|
||||
} // namespace callback
|
||||
void create();
|
||||
void destroy();
|
||||
|
||||
} // namespace openspace::global
|
||||
|
||||
|
||||
@@ -206,11 +206,11 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
|
||||
_visible = configuration.hasValue<bool>(VisibleInfo.identifier) &&
|
||||
configuration.value<bool>(VisibleInfo.identifier);
|
||||
|
||||
global::callback::initializeGL.emplace_back([this]() {
|
||||
global::callback::initializeGL->emplace_back([this]() {
|
||||
startOrStopGui();
|
||||
});
|
||||
|
||||
global::callback::draw2D.emplace_back([this](){
|
||||
global::callback::draw2D->emplace_back([this](){
|
||||
ZoneScopedN("CefWebGuiModule")
|
||||
|
||||
const bool isGuiWindow =
|
||||
@@ -233,7 +233,7 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
|
||||
}
|
||||
});
|
||||
|
||||
global::callback::deinitializeGL.emplace_back([this]() {
|
||||
global::callback::deinitializeGL->emplace_back([this]() {
|
||||
ZoneScopedN("CefWebGuiModule")
|
||||
|
||||
if (_endpointCallback != -1) {
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace openspace {
|
||||
GUIKeyboardHandler::GUIKeyboardHandler() {
|
||||
_keyConsumed = false;
|
||||
|
||||
global::callback::keyboard.emplace_back(
|
||||
global::callback::keyboard->emplace_back(
|
||||
[&](Key, KeyModifier, KeyAction) -> bool {
|
||||
const bool previous = _keyConsumed;
|
||||
_keyConsumed = false;
|
||||
|
||||
@@ -216,7 +216,7 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
|
||||
|
||||
// Initialize
|
||||
global::callback::initializeGL.emplace_back([&]() {
|
||||
global::callback::initializeGL->emplace_back([&]() {
|
||||
ZoneScopedN("GlobeBrowsingModule")
|
||||
|
||||
_tileCache = std::make_unique<cache::MemoryAwareTileCache>(_tileCacheSizeMB);
|
||||
@@ -232,7 +232,7 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
addPropertySubOwner(GdalWrapper::ref());
|
||||
});
|
||||
|
||||
global::callback::deinitializeGL.emplace_back([]() {
|
||||
global::callback::deinitializeGL->emplace_back([]() {
|
||||
ZoneScopedN("GlobeBrowsingModule")
|
||||
|
||||
tileprovider::deinitializeDefaultTile();
|
||||
@@ -240,14 +240,14 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
|
||||
|
||||
|
||||
// Render
|
||||
global::callback::render.emplace_back([&]() {
|
||||
global::callback::render->emplace_back([&]() {
|
||||
ZoneScopedN("GlobeBrowsingModule")
|
||||
|
||||
_tileCache->update();
|
||||
});
|
||||
|
||||
// Deinitialize
|
||||
global::callback::deinitialize.emplace_back([&]() {
|
||||
global::callback::deinitialize->emplace_back([&]() {
|
||||
ZoneScopedN("GlobeBrowsingModule")
|
||||
|
||||
GdalWrapper::destroy();
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace openspace {
|
||||
ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
addPropertySubOwner(gui);
|
||||
|
||||
global::callback::initialize.emplace_back([&]() {
|
||||
global::callback::initialize->emplace_back([&]() {
|
||||
LDEBUGC("ImGUIModule", "Initializing GUI");
|
||||
gui.initialize();
|
||||
|
||||
@@ -130,28 +130,28 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
);
|
||||
});
|
||||
|
||||
global::callback::deinitialize.emplace_back([&]() {
|
||||
global::callback::deinitialize->emplace_back([&]() {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
LDEBUGC("ImGui", "Deinitialize GUI");
|
||||
gui.deinitialize();
|
||||
});
|
||||
|
||||
global::callback::initializeGL.emplace_back([&]() {
|
||||
global::callback::initializeGL->emplace_back([&]() {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
LDEBUGC("ImGui", "Initializing GUI OpenGL");
|
||||
gui.initializeGL();
|
||||
});
|
||||
|
||||
global::callback::deinitializeGL.emplace_back([&]() {
|
||||
global::callback::deinitializeGL->emplace_back([&]() {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
LDEBUGC("ImGui", "Deinitialize GUI OpenGL");
|
||||
gui.deinitializeGL();
|
||||
});
|
||||
|
||||
global::callback::draw2D.emplace_back([&]() {
|
||||
global::callback::draw2D->emplace_back([&]() {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
WindowDelegate& delegate = *global::windowDelegate;
|
||||
@@ -179,7 +179,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
}
|
||||
});
|
||||
|
||||
global::callback::keyboard.emplace_back(
|
||||
global::callback::keyboard->emplace_back(
|
||||
[&](Key key, KeyModifier mod, KeyAction action) -> bool {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
@@ -193,7 +193,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::character.emplace_back(
|
||||
global::callback::character->emplace_back(
|
||||
[&](unsigned int codepoint, KeyModifier modifier) -> bool {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
@@ -207,13 +207,13 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::mousePosition.emplace_back(
|
||||
global::callback::mousePosition->emplace_back(
|
||||
[&](double x, double y) {
|
||||
_mousePosition = glm::vec2(static_cast<float>(x), static_cast<float>(y));
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::mouseButton.emplace_back(
|
||||
global::callback::mouseButton->emplace_back(
|
||||
[&](MouseButton button, MouseAction action, KeyModifier) -> bool {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
@@ -234,7 +234,7 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::mouseScrollWheel.emplace_back(
|
||||
global::callback::mouseScrollWheel->emplace_back(
|
||||
[&](double, double posY) -> bool {
|
||||
ZoneScopedN("ImGUI")
|
||||
|
||||
@@ -248,19 +248,19 @@ ImGUIModule::ImGUIModule() : OpenSpaceModule(Name) {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchDetected.emplace_back(
|
||||
global::callback::touchDetected->emplace_back(
|
||||
[&](TouchInput input) -> bool {
|
||||
return gui.touchDetectedCallback(input);
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchUpdated.emplace_back(
|
||||
global::callback::touchUpdated->emplace_back(
|
||||
[&](TouchInput input) -> bool {
|
||||
return gui.touchUpdatedCallback(input);
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchExit.emplace_back(
|
||||
global::callback::touchExit->emplace_back(
|
||||
[&](TouchInput input) {
|
||||
gui.touchExitCallback(input);
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
namespace openspace {
|
||||
|
||||
IswaModule::IswaModule() : OpenSpaceModule(Name) {
|
||||
global::callback::initialize.push_back([]() {
|
||||
global::callback::initialize->push_back([]() {
|
||||
ZoneScopedN("IswaModule")
|
||||
IswaManager::initialize();
|
||||
});
|
||||
|
||||
@@ -73,7 +73,7 @@ ServerInterface* ServerModule::serverInterfaceByIdentifier(const std::string& id
|
||||
}
|
||||
|
||||
void ServerModule::internalInitialize(const ghoul::Dictionary& configuration) {
|
||||
global::callback::preSync.emplace_back([this]() {
|
||||
global::callback::preSync->emplace_back([this]() {
|
||||
ZoneScopedN("ServerModule")
|
||||
|
||||
preSync();
|
||||
|
||||
@@ -191,7 +191,7 @@ TouchModule::~TouchModule() {
|
||||
void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){
|
||||
_ear.reset(new TuioEar());
|
||||
|
||||
global::callback::initializeGL.push_back([&]() {
|
||||
global::callback::initializeGL->push_back([&]() {
|
||||
LDEBUGC("TouchModule", "Initializing TouchMarker OpenGL");
|
||||
_markers.initialize();
|
||||
#ifdef WIN32
|
||||
@@ -204,33 +204,33 @@ void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){
|
||||
#endif
|
||||
});
|
||||
|
||||
global::callback::deinitializeGL.push_back([&]() {
|
||||
global::callback::deinitializeGL->push_back([&]() {
|
||||
LDEBUGC("TouchMarker", "Deinitialize TouchMarker OpenGL");
|
||||
_markers.deinitialize();
|
||||
});
|
||||
|
||||
// These are handled in UI thread, which (as of 20th dec 2019) is in main/rendering
|
||||
// thread so we don't need a mutex here
|
||||
global::callback::touchDetected.push_back(
|
||||
global::callback::touchDetected->push_back(
|
||||
[this](TouchInput i) {
|
||||
addTouchInput(i);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchUpdated.push_back(
|
||||
global::callback::touchUpdated->push_back(
|
||||
[this](TouchInput i) {
|
||||
updateOrAddTouchInput(i);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchExit.push_back(
|
||||
global::callback::touchExit->push_back(
|
||||
std::bind(&TouchModule::removeTouchInput, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
|
||||
global::callback::preSync.push_back([&]() {
|
||||
global::callback::preSync->push_back([&]() {
|
||||
_touch.setCamera(global::navigationHandler->camera());
|
||||
_touch.setFocusNode(global::navigationHandler->orbitalNavigator().anchorNode());
|
||||
|
||||
@@ -251,7 +251,7 @@ void TouchModule::internalInitialize(const ghoul::Dictionary& /*dictionary*/){
|
||||
clearInputs();
|
||||
});
|
||||
|
||||
global::callback::render.push_back([&]() {
|
||||
global::callback::render->push_back([&]() {
|
||||
_markers.render(_touchPoints);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ if (OS_MACOSX)
|
||||
# Helper executable target.
|
||||
add_executable(${CEF_HELPER_TARGET} MACOSX_BUNDLE ${WEBBROWSER_HELPER_SOURCES})
|
||||
SET_EXECUTABLE_TARGET_PROPERTIES(${CEF_HELPER_TARGET})
|
||||
add_cef_logical_target("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
||||
# add_cef_logical_target("libcef_lib" "${CEF_LIB_DEBUG}" "${CEF_LIB_RELEASE}")
|
||||
add_dependencies(${CEF_HELPER_TARGET} libcef_dll_wrapper)
|
||||
target_link_libraries(${CEF_HELPER_TARGET} libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||
set_target_properties(${CEF_HELPER_TARGET} PROPERTIES
|
||||
|
||||
@@ -77,7 +77,8 @@ function(run_cef_macosx_config CEF_ROOT module_path)
|
||||
|
||||
add_dependencies(${CEF_TARGET} libcef_dll_wrapper "${CEF_HELPER_TARGET}")
|
||||
|
||||
target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||
# target_link_libraries(${CEF_TARGET} PUBLIC libcef_lib libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||
target_link_libraries(${CEF_TARGET} PUBLIC libcef_dll_wrapper ${CEF_STANDARD_LIBS})
|
||||
set_target_properties(${CEF_TARGET} PROPERTIES
|
||||
RESOURCE "${WEBBROWSER_RESOURCES_SRCS}"
|
||||
MACOSX_BUNDLE_INFO_PLIST ${module_path}/mac/Info.plist
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace {
|
||||
namespace openspace {
|
||||
|
||||
void EventHandler::initialize() {
|
||||
global::callback::character.emplace_back(
|
||||
global::callback::character->emplace_back(
|
||||
[this](unsigned int charCode, KeyModifier mod) -> bool {
|
||||
if (_browserInstance) {
|
||||
return charCallback(charCode, mod);
|
||||
@@ -160,7 +160,7 @@ void EventHandler::initialize() {
|
||||
return false;
|
||||
}
|
||||
);
|
||||
global::callback::keyboard.emplace_back(
|
||||
global::callback::keyboard->emplace_back(
|
||||
[this](Key key, KeyModifier mod, KeyAction action) -> bool {
|
||||
if (_browserInstance) {
|
||||
return keyboardCallback(key, mod, action);
|
||||
@@ -168,7 +168,7 @@ void EventHandler::initialize() {
|
||||
return false;
|
||||
}
|
||||
);
|
||||
global::callback::mousePosition.emplace_back(
|
||||
global::callback::mousePosition->emplace_back(
|
||||
[this](double x, double y) -> bool {
|
||||
if (_browserInstance) {
|
||||
return mousePositionCallback(x, y);
|
||||
@@ -176,7 +176,7 @@ void EventHandler::initialize() {
|
||||
return false;
|
||||
}
|
||||
);
|
||||
global::callback::mouseButton.emplace_back(
|
||||
global::callback::mouseButton->emplace_back(
|
||||
[this](MouseButton button, MouseAction action, KeyModifier mods) -> bool {
|
||||
if (_browserInstance) {
|
||||
return mouseButtonCallback(button, action, mods);
|
||||
@@ -184,7 +184,7 @@ void EventHandler::initialize() {
|
||||
return false;
|
||||
}
|
||||
);
|
||||
global::callback::mouseScrollWheel.emplace_back(
|
||||
global::callback::mouseScrollWheel->emplace_back(
|
||||
[this](double x, double y) -> bool {
|
||||
if (_browserInstance) {
|
||||
const glm::ivec2 delta(x, y);
|
||||
@@ -194,7 +194,7 @@ void EventHandler::initialize() {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchDetected.emplace_back(
|
||||
global::callback::touchDetected->emplace_back(
|
||||
[&](TouchInput input) -> bool {
|
||||
if (!_browserInstance) {
|
||||
return false;
|
||||
@@ -236,7 +236,7 @@ void EventHandler::initialize() {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchUpdated.emplace_back(
|
||||
global::callback::touchUpdated->emplace_back(
|
||||
[&](TouchInput input) -> bool {
|
||||
if (!_browserInstance) {
|
||||
return false;
|
||||
@@ -278,7 +278,7 @@ void EventHandler::initialize() {
|
||||
}
|
||||
);
|
||||
|
||||
global::callback::touchExit.emplace_back(
|
||||
global::callback::touchExit->emplace_back(
|
||||
[&](TouchInput input) {
|
||||
if (!_browserInstance) {
|
||||
return;
|
||||
|
||||
@@ -73,7 +73,7 @@ WebBrowserModule::WebBrowserModule()
|
||||
, _updateBrowserBetweenRenderables(UpdateBrowserBetweenRenderablesInfo, true)
|
||||
, _browserUpdateInterval(BrowserUpdateIntervalInfo, 1.f, 1.0f, 1000.f)
|
||||
{
|
||||
global::callback::deinitialize.emplace_back([this]() {
|
||||
global::callback::deinitialize->emplace_back([this]() {
|
||||
ZoneScopedN("WebBrowserModule")
|
||||
|
||||
deinitialize();
|
||||
|
||||
+264
-3
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <openspace/engine/configuration.h>
|
||||
#include <openspace/engine/globalscallbacks.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/syncengine.h>
|
||||
@@ -63,6 +64,12 @@
|
||||
|
||||
namespace openspace {
|
||||
namespace {
|
||||
// This is kind of weird. Optimally, we would want to use the std::array also on
|
||||
// non-Windows platforms but that causes some issues with nullptrs being thrown
|
||||
// around and invalid accesses. Switching this to a std::vector with dynamic memory
|
||||
// allocation works on Linux, but it fails on Windows in some SGCT function and on Mac
|
||||
// in some random global randoms
|
||||
#ifdef WIN32
|
||||
constexpr const int TotalSize =
|
||||
sizeof(ghoul::fontrendering::FontManager) +
|
||||
sizeof(Dashboard) +
|
||||
@@ -96,6 +103,7 @@ namespace {
|
||||
sizeof(Profile);
|
||||
|
||||
std::array<std::byte, TotalSize> DataStorage;
|
||||
#endif // WIN32
|
||||
} // namespace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -104,133 +112,262 @@ namespace openspace::global {
|
||||
void create() {
|
||||
ZoneScoped
|
||||
|
||||
std::byte* currentPos = DataStorage.data();
|
||||
callback::create();
|
||||
|
||||
#ifdef WIN32
|
||||
std::fill(DataStorage.begin(), DataStorage.end(), std::byte(0));
|
||||
std::byte* currentPos = DataStorage.data();
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
fontManager = new (currentPos) ghoul::fontrendering::FontManager({ 1536, 1536, 1 });
|
||||
ghoul_assert(fontManager, "No fontManager");
|
||||
currentPos += sizeof(ghoul::fontrendering::FontManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
fontManager = new ghoul::fontrendering::FontManager({ 1536, 1536, 1 });
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
dashboard = new (currentPos) Dashboard;
|
||||
ghoul_assert(dashboard, "No dashboard");
|
||||
currentPos += sizeof(Dashboard);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
dashboard = new Dashboard;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
deferredcasterManager = new (currentPos) DeferredcasterManager;
|
||||
ghoul_assert(deferredcasterManager, "No deferredcasterManager");
|
||||
currentPos += sizeof(DeferredcasterManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
deferredcasterManager = new DeferredcasterManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
downloadManager = new (currentPos) DownloadManager;
|
||||
ghoul_assert(downloadManager, "No downloadManager");
|
||||
currentPos += sizeof(DownloadManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
downloadManager = new DownloadManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
luaConsole = new (currentPos) LuaConsole;
|
||||
ghoul_assert(luaConsole, "No luaConsole");
|
||||
currentPos += sizeof(LuaConsole);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
luaConsole = new LuaConsole;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
memoryManager = new (currentPos) MemoryManager;
|
||||
ghoul_assert(memoryManager, "No memoryManager");
|
||||
currentPos += sizeof(MemoryManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
memoryManager = new MemoryManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
missionManager = new (currentPos) MissionManager;
|
||||
ghoul_assert(missionManager, "No missionManager");
|
||||
currentPos += sizeof(MissionManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
missionManager = new MissionManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
moduleEngine = new (currentPos) ModuleEngine;
|
||||
ghoul_assert(moduleEngine, "No moduleEngine");
|
||||
currentPos += sizeof(ModuleEngine);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
moduleEngine = new ModuleEngine;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
openSpaceEngine = new (currentPos) OpenSpaceEngine;
|
||||
ghoul_assert(openSpaceEngine, "No openSpaceEngine");
|
||||
currentPos += sizeof(OpenSpaceEngine);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
openSpaceEngine = new OpenSpaceEngine;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
parallelPeer = new (currentPos) ParallelPeer;
|
||||
ghoul_assert(parallelPeer, "No parallelPeer");
|
||||
currentPos += sizeof(ParallelPeer);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
parallelPeer = new ParallelPeer;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
raycasterManager = new (currentPos) RaycasterManager;
|
||||
ghoul_assert(raycasterManager, "No raycasterManager");
|
||||
currentPos += sizeof(RaycasterManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
raycasterManager = new RaycasterManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
renderEngine = new (currentPos) RenderEngine;
|
||||
ghoul_assert(renderEngine, "No renderEngine");
|
||||
currentPos += sizeof(RenderEngine);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
renderEngine = new RenderEngine;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
screenSpaceRenderables =
|
||||
new (currentPos) std::vector<std::unique_ptr<ScreenSpaceRenderable>>;
|
||||
ghoul_assert(screenSpaceRenderables, "No screenSpaceRenderables");
|
||||
currentPos += sizeof(std::vector<std::unique_ptr<ScreenSpaceRenderable>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
screenSpaceRenderables = new std::vector<std::unique_ptr<ScreenSpaceRenderable>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
syncEngine = new (currentPos) SyncEngine(4096);
|
||||
ghoul_assert(syncEngine, "No syncEngine");
|
||||
currentPos += sizeof(SyncEngine);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
syncEngine = new SyncEngine(4096);
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
timeManager = new (currentPos) TimeManager;
|
||||
ghoul_assert(timeManager, "No timeManager");
|
||||
currentPos += sizeof(TimeManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
timeManager = new TimeManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
versionChecker = new (currentPos) VersionChecker;
|
||||
ghoul_assert(versionChecker, "No versionChecker");
|
||||
currentPos += sizeof(VersionChecker);
|
||||
#else
|
||||
versionChecker = new VersionChecker;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
virtualPropertyManager = new (currentPos) VirtualPropertyManager;
|
||||
ghoul_assert(virtualPropertyManager, "No virtualPropertyManager");
|
||||
currentPos += sizeof(VirtualPropertyManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
virtualPropertyManager = new VirtualPropertyManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
windowDelegate = new (currentPos) WindowDelegate;
|
||||
ghoul_assert(windowDelegate, "No windowDelegate");
|
||||
currentPos += sizeof(WindowDelegate);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
windowDelegate = new WindowDelegate;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
configuration = new (currentPos) configuration::Configuration;
|
||||
ghoul_assert(configuration, "No configuration");
|
||||
currentPos += sizeof(configuration::Configuration);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
configuration = new configuration::Configuration;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
interactionMonitor = new (currentPos) interaction::InteractionMonitor;
|
||||
ghoul_assert(interactionMonitor, "No interactionMonitor");
|
||||
currentPos += sizeof(interaction::InteractionMonitor);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
interactionMonitor = new interaction::InteractionMonitor;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
joystickInputStates = new (currentPos) interaction::JoystickInputStates;
|
||||
ghoul_assert(joystickInputStates, "No joystickInputStates");
|
||||
currentPos += sizeof(interaction::JoystickInputStates);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
joystickInputStates = new interaction::JoystickInputStates;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
websocketInputStates = new (currentPos) interaction::WebsocketInputStates;
|
||||
ghoul_assert(websocketInputStates, "No websocketInputStates");
|
||||
currentPos += sizeof(interaction::WebsocketInputStates);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
websocketInputStates = new interaction::WebsocketInputStates;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
keybindingManager = new (currentPos) interaction::KeybindingManager;
|
||||
ghoul_assert(keybindingManager, "No keybindingManager");
|
||||
currentPos += sizeof(interaction::KeybindingManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
keybindingManager = new interaction::KeybindingManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
navigationHandler = new (currentPos) interaction::NavigationHandler;
|
||||
ghoul_assert(navigationHandler, "No navigationHandler");
|
||||
currentPos += sizeof(interaction::NavigationHandler);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
navigationHandler = new interaction::NavigationHandler;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
sessionRecording = new (currentPos) interaction::SessionRecording(true);
|
||||
ghoul_assert(sessionRecording, "No sessionRecording");
|
||||
currentPos += sizeof(interaction::SessionRecording);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
sessionRecording = new interaction::SessionRecording(true);
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
shortcutManager = new (currentPos) interaction::ShortcutManager;
|
||||
ghoul_assert(shortcutManager, "No shortcutManager");
|
||||
currentPos += sizeof(interaction::ShortcutManager);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
shortcutManager = new interaction::ShortcutManager;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
rootPropertyOwner = new (currentPos) properties::PropertyOwner({ "" });
|
||||
ghoul_assert(rootPropertyOwner, "No rootPropertyOwner");
|
||||
currentPos += sizeof(properties::PropertyOwner);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
rootPropertyOwner = new properties::PropertyOwner({ "" });
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
screenSpaceRootPropertyOwner =
|
||||
new (currentPos) properties::PropertyOwner({ "ScreenSpace" });
|
||||
ghoul_assert(screenSpaceRootPropertyOwner, "No screenSpaceRootPropertyOwner");
|
||||
currentPos += sizeof(properties::PropertyOwner);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
screenSpaceRootPropertyOwner = new properties::PropertyOwner({ "ScreenSpace" });
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
scriptEngine = new (currentPos) scripting::ScriptEngine;
|
||||
ghoul_assert(scriptEngine, "No scriptEngine");
|
||||
currentPos += sizeof(scripting::ScriptEngine);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
scriptEngine = new scripting::ScriptEngine;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
scriptScheduler = new (currentPos) scripting::ScriptScheduler;
|
||||
ghoul_assert(scriptScheduler, "No scriptScheduler");
|
||||
currentPos += sizeof(scripting::ScriptScheduler);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
scriptScheduler = new scripting::ScriptScheduler;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
profile = new (currentPos) Profile;
|
||||
ghoul_assert(profile, "No profile");
|
||||
currentPos += sizeof(Profile);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
profile = new Profile;
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
void initialize() {
|
||||
@@ -262,99 +399,223 @@ void initializeGL() {
|
||||
|
||||
void destroy() {
|
||||
LDEBUGC("Globals", "Destroying 'Profile'");
|
||||
#ifdef WIN32
|
||||
profile->~Profile();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete profile;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ScriptScheduler'");
|
||||
#ifdef WIN32
|
||||
scriptScheduler->~ScriptScheduler();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete scriptScheduler;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ScriptEngine'");
|
||||
#ifdef WIN32
|
||||
scriptEngine->~ScriptEngine();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete scriptEngine;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ScreenSpace Root Owner'");
|
||||
#ifdef WIN32
|
||||
screenSpaceRootPropertyOwner->~PropertyOwner();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete screenSpaceRootPropertyOwner;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'Root Owner'");
|
||||
#ifdef WIN32
|
||||
rootPropertyOwner->~PropertyOwner();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete rootPropertyOwner;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ShortcutManager'");
|
||||
#ifdef WIN32
|
||||
shortcutManager->~ShortcutManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete shortcutManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'SessionRecording'");
|
||||
#ifdef WIN32
|
||||
sessionRecording->~SessionRecording();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete sessionRecording;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'NavigationHandler'");
|
||||
#ifdef WIN32
|
||||
navigationHandler->~NavigationHandler();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete navigationHandler;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'KeybindingManager'");
|
||||
#ifdef WIN32
|
||||
keybindingManager->~KeybindingManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete keybindingManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'WebsocketInputStates'");
|
||||
#ifdef WIN32
|
||||
websocketInputStates->~WebsocketInputStates();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete websocketInputStates;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'JoystickInputStates'");
|
||||
#ifdef WIN32
|
||||
joystickInputStates->~JoystickInputStates();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete joystickInputStates;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'InteractionMonitor'");
|
||||
#ifdef WIN32
|
||||
interactionMonitor->~InteractionMonitor();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete interactionMonitor;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'Configuration'");
|
||||
#ifdef WIN32
|
||||
configuration->~Configuration();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete configuration;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'WindowDelegate'");
|
||||
#ifdef WIN32
|
||||
windowDelegate->~WindowDelegate();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete windowDelegate;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'VirtualPropertyManager'");
|
||||
#ifdef WIN32
|
||||
virtualPropertyManager->~VirtualPropertyManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete virtualPropertyManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'VersionChecker'");
|
||||
#ifdef WIN32
|
||||
versionChecker->~VersionChecker();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete versionChecker;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'TimeManager'");
|
||||
#ifdef WIN32
|
||||
timeManager->~TimeManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete timeManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'SyncEngine'");
|
||||
#ifdef WIN32
|
||||
syncEngine->~SyncEngine();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete syncEngine;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ScreenSpaceRenderables'");
|
||||
screenSpaceRenderables->~vector<std::unique_ptr<ScreenSpaceRenderable>>();
|
||||
#ifdef WIN32
|
||||
screenSpaceRenderables->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete screenSpaceRenderables;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'RenderEngine'");
|
||||
#ifdef WIN32
|
||||
renderEngine->~RenderEngine();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete renderEngine;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'RaycasterManager'");
|
||||
#ifdef WIN32
|
||||
raycasterManager->~RaycasterManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete raycasterManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ParallelPeer'");
|
||||
#ifdef WIN32
|
||||
parallelPeer->~ParallelPeer();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete parallelPeer;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'OpenSpaceEngine'");
|
||||
#ifdef WIN32
|
||||
openSpaceEngine->~OpenSpaceEngine();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete openSpaceEngine;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'ModuleEngine'");
|
||||
#ifdef WIN32
|
||||
moduleEngine->~ModuleEngine();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete moduleEngine;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'MissionManager'");
|
||||
#ifdef WIN32
|
||||
missionManager->~MissionManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete missionManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'MemoryManager'");
|
||||
#ifdef WIN32
|
||||
memoryManager->~MemoryManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete memoryManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'LuaConsole'");
|
||||
#ifdef WIN32
|
||||
luaConsole->~LuaConsole();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete luaConsole;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'DownloadManager'");
|
||||
#ifdef WIN32
|
||||
downloadManager->~DownloadManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete downloadManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'DeferredcasterManager'");
|
||||
#ifdef WIN32
|
||||
deferredcasterManager->~DeferredcasterManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete deferredcasterManager;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'Dashboard'");
|
||||
#ifdef WIN32
|
||||
dashboard->~Dashboard();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete dashboard;
|
||||
#endif // WIN32
|
||||
|
||||
LDEBUGC("Globals", "Destroying 'FontManager'");
|
||||
#ifdef WIN32
|
||||
fontManager->~FontManager();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete fontManager;
|
||||
#endif // WIN32
|
||||
|
||||
std::fill(DataStorage.begin(), DataStorage.end(), std::byte(0));
|
||||
callback::destroy();
|
||||
}
|
||||
|
||||
void deinitialize() {
|
||||
|
||||
+286
-88
@@ -24,97 +24,295 @@
|
||||
|
||||
#include <openspace/engine/globalscallbacks.h>
|
||||
|
||||
namespace openspace::global::detail {
|
||||
|
||||
std::vector<std::function<void()>>& gInitialize() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gDeinitialize() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gInitializeGL() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gDeinitializeGL() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gPreSync() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gPostSyncPreDraw() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gRender() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gDraw2D() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void()>>& gPostDraw() {
|
||||
static std::vector<std::function<void()>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>& gKeyboard() {
|
||||
static std::vector<std::function<bool(Key, KeyModifier, KeyAction)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<bool(unsigned int, KeyModifier)>>& gCharacter() {
|
||||
static std::vector<std::function<bool(unsigned int, KeyModifier)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>& gMouseButton() {
|
||||
static std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void(double, double)>>& gMousePosition() {
|
||||
static std::vector<std::function<void(double, double)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<bool(double, double)>>& gMouseScrollWheel() {
|
||||
static std::vector<std::function<bool(double, double)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<bool(TouchInput)>>& gTouchDetected() {
|
||||
static std::vector<std::function<bool(TouchInput)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<bool(TouchInput)>>& gTouchUpdated() {
|
||||
static std::vector<std::function<bool(TouchInput)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
std::vector<std::function<void(TouchInput)>>& gTouchExit() {
|
||||
static std::vector<std::function<void(TouchInput)>> g;
|
||||
return g;
|
||||
}
|
||||
|
||||
} // namespace openspace::global::detail
|
||||
#include <ghoul/misc/profiling.h>
|
||||
#include <array>
|
||||
|
||||
namespace openspace::global::callback {
|
||||
|
||||
namespace {
|
||||
// Using the same mechanism as in the globals file
|
||||
#ifdef WIN32
|
||||
constexpr const int TotalSize =
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<void()>>) +
|
||||
sizeof(std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>) +
|
||||
sizeof(std::vector<std::function<bool(unsigned int, KeyModifier)>>) +
|
||||
sizeof(std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>) +
|
||||
sizeof(std::vector<std::function<void(double, double)>>) +
|
||||
sizeof(std::vector<std::function<bool(double, double)>>) +
|
||||
sizeof(std::vector<std::function<bool(TouchInput)>>) +
|
||||
sizeof(std::vector<std::function<bool(TouchInput)>>) +
|
||||
sizeof(std::vector<std::function<void(TouchInput)>>);
|
||||
|
||||
std::array<std::byte, TotalSize> DataStorage;
|
||||
#endif // WIN32
|
||||
|
||||
} // namespace
|
||||
|
||||
void create() {
|
||||
ZoneScoped
|
||||
|
||||
#ifdef WIN32
|
||||
std::fill(DataStorage.begin(), DataStorage.end(), std::byte(0));
|
||||
std::byte* currentPos = DataStorage.data();
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
initialize = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(initialize, "No initialize");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
initialize = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
deinitialize = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(deinitialize, "No deinitialize");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
deinitialize = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
initializeGL = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(initializeGL, "No initializeGL");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
initializeGL = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
deinitializeGL = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(deinitializeGL, "No deinitializeGL");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
deinitializeGL = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
preSync = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(preSync, "No preSync");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
preSync = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
postSyncPreDraw = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(postSyncPreDraw, "No postSyncPreDraw");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
postSyncPreDraw = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
render = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(render, "No render");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
render = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
draw2D = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(draw2D, "No draw2D");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
draw2D = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
postDraw = new (currentPos) std::vector<std::function<void()>>;
|
||||
ghoul_assert(postDraw, "No postDraw");
|
||||
currentPos += sizeof(std::vector<std::function<void()>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
postDraw = new std::vector<std::function<void()>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
keyboard =
|
||||
new (currentPos) std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>;
|
||||
ghoul_assert(keyboard, "No keyboard");
|
||||
currentPos += sizeof(std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
keyboard = new std::vector<std::function<bool(Key, KeyModifier, KeyAction)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
character =
|
||||
new (currentPos) std::vector<std::function<bool(unsigned int, KeyModifier)>>;
|
||||
ghoul_assert(character, "No character");
|
||||
currentPos += sizeof(std::vector<std::function<bool(unsigned int, KeyModifier)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
character = new std::vector<std::function<bool(unsigned int, KeyModifier)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
mouseButton =
|
||||
new (currentPos) std::vector<
|
||||
std::function<bool(MouseButton, MouseAction, KeyModifier)>
|
||||
>;
|
||||
ghoul_assert(mouseButton, "No mouseButton");
|
||||
currentPos += sizeof(
|
||||
std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>
|
||||
);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
mouseButton =
|
||||
new std::vector<std::function<bool(MouseButton, MouseAction, KeyModifier)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
mousePosition = new (currentPos) std::vector<std::function<void(double, double)>>;
|
||||
ghoul_assert(mousePosition, "No mousePosition");
|
||||
currentPos += sizeof(std::vector<std::function<void(double, double)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
mousePosition = new std::vector<std::function<void(double, double)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
mouseScrollWheel = new (currentPos) std::vector<std::function<bool(double, double)>>;
|
||||
ghoul_assert(mouseScrollWheel, "No mouseScrollWheel");
|
||||
currentPos += sizeof(std::vector<std::function<bool(double, double)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
mouseScrollWheel = new std::vector<std::function<bool(double, double)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
touchDetected = new (currentPos) std::vector<std::function<bool(TouchInput)>>;
|
||||
ghoul_assert(touchDetected, "No touchDetected");
|
||||
currentPos += sizeof(std::vector<std::function<bool(TouchInput)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
touchDetected = new std::vector<std::function<bool(TouchInput)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
touchUpdated = new (currentPos) std::vector<std::function<bool(TouchInput)>>;
|
||||
ghoul_assert(touchUpdated, "No touchUpdated");
|
||||
currentPos += sizeof(std::vector<std::function<bool(TouchInput)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
touchUpdated = new std::vector<std::function<bool(TouchInput)>>;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
touchExit = new (currentPos) std::vector<std::function<void(TouchInput)>>;
|
||||
ghoul_assert(touchExit, "No touchExit");
|
||||
currentPos += sizeof(std::vector<std::function<void(TouchInput)>>);
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
touchExit = new std::vector<std::function<void(TouchInput)>>;
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
#ifdef WIN32
|
||||
touchExit->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete touchExit;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
touchUpdated->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete touchUpdated;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
touchDetected->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete touchDetected;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
mouseScrollWheel->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete mouseScrollWheel;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
mousePosition->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete mousePosition;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
mouseButton->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete mouseButton;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
character->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete character;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
keyboard->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete keyboard;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
postDraw->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete postDraw;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
draw2D->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete draw2D;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
render->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete render;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
postSyncPreDraw->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete postSyncPreDraw;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
preSync->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete preSync;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
deinitializeGL->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete deinitializeGL;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
initializeGL->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete initializeGL;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
deinitialize->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete deinitialize;
|
||||
#endif // WIN32
|
||||
|
||||
#ifdef WIN32
|
||||
initialize->~vector();
|
||||
#else // ^^^ WIN32 / !WIN32 vvv
|
||||
delete initialize;
|
||||
#endif // WIN32
|
||||
}
|
||||
|
||||
void(*webBrowserPerformanceHotfix)() = nullptr;
|
||||
|
||||
} // namespace openspace::global::callback
|
||||
|
||||
@@ -370,7 +370,7 @@ void OpenSpaceEngine::initialize() {
|
||||
|
||||
global::renderEngine->initialize();
|
||||
|
||||
for (const std::function<void()>& func : global::callback::initialize) {
|
||||
for (const std::function<void()>& func : *global::callback::initialize) {
|
||||
ZoneScopedN("[Module] initialize")
|
||||
|
||||
func();
|
||||
@@ -663,7 +663,7 @@ void OpenSpaceEngine::initializeGL() {
|
||||
global::moduleEngine->initializeGL();
|
||||
|
||||
|
||||
for (const std::function<void()>& func : global::callback::initializeGL) {
|
||||
for (const std::function<void()>& func : *global::callback::initializeGL) {
|
||||
ZoneScopedN("[Module] initializeGL")
|
||||
func();
|
||||
}
|
||||
@@ -865,7 +865,7 @@ void OpenSpaceEngine::deinitialize() {
|
||||
|
||||
LTRACE("OpenSpaceEngine::deinitialize(begin)");
|
||||
|
||||
for (const std::function<void()>& func : global::callback::deinitialize) {
|
||||
for (const std::function<void()>& func : *global::callback::deinitialize) {
|
||||
func();
|
||||
}
|
||||
|
||||
@@ -914,7 +914,7 @@ void OpenSpaceEngine::deinitializeGL() {
|
||||
global::openSpaceEngine->_scene = nullptr;
|
||||
global::renderEngine->setScene(nullptr);
|
||||
|
||||
for (const std::function<void()>& func : global::callback::deinitializeGL) {
|
||||
for (const std::function<void()>& func : *global::callback::deinitializeGL) {
|
||||
func();
|
||||
}
|
||||
|
||||
@@ -1125,7 +1125,7 @@ void OpenSpaceEngine::preSynchronization() {
|
||||
global::interactionMonitor->updateActivityState();
|
||||
}
|
||||
|
||||
for (const std::function<void()>& func : global::callback::preSync) {
|
||||
for (const std::function<void()>& func : *global::callback::preSync) {
|
||||
ZoneScopedN("[Module] preSync")
|
||||
|
||||
func();
|
||||
@@ -1180,7 +1180,7 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
|
||||
_scene->camera()->invalidateCache();
|
||||
}
|
||||
|
||||
for (const std::function<void()>& func : global::callback::postSyncPreDraw) {
|
||||
for (const std::function<void()>& func : *global::callback::postSyncPreDraw) {
|
||||
ZoneScopedN("[Module] postSyncPreDraw")
|
||||
|
||||
func();
|
||||
@@ -1226,7 +1226,7 @@ void OpenSpaceEngine::render(const glm::mat4& sceneMatrix, const glm::mat4& view
|
||||
|
||||
global::renderEngine->render(sceneMatrix, viewMatrix, projectionMatrix);
|
||||
|
||||
for (const std::function<void()>& func : global::callback::render) {
|
||||
for (const std::function<void()>& func : *global::callback::render) {
|
||||
ZoneScopedN("[Module] render")
|
||||
|
||||
func();
|
||||
@@ -1251,7 +1251,7 @@ void OpenSpaceEngine::drawOverlays() {
|
||||
global::sessionRecording->render();
|
||||
}
|
||||
|
||||
for (const std::function<void()>& func : global::callback::draw2D) {
|
||||
for (const std::function<void()>& func : *global::callback::draw2D) {
|
||||
ZoneScopedN("[Module] draw2D")
|
||||
|
||||
func();
|
||||
@@ -1267,7 +1267,7 @@ void OpenSpaceEngine::postDraw() {
|
||||
|
||||
global::renderEngine->postDraw();
|
||||
|
||||
for (const std::function<void()>& func : global::callback::postDraw) {
|
||||
for (const std::function<void()>& func : *global::callback::postDraw) {
|
||||
ZoneScopedN("[Module] postDraw")
|
||||
|
||||
func();
|
||||
@@ -1317,7 +1317,7 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio
|
||||
}
|
||||
|
||||
using F = std::function<bool (Key, KeyModifier, KeyAction)>;
|
||||
for (const F& func : global::callback::keyboard) {
|
||||
for (const F& func : *global::callback::keyboard) {
|
||||
const bool isConsumed = func(key, mod, action);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1340,7 +1340,7 @@ void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier)
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<bool (unsigned int, KeyModifier)>;
|
||||
for (const F& func : global::callback::character) {
|
||||
for (const F& func : *global::callback::character) {
|
||||
bool isConsumed = func(codepoint, modifier);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1358,7 +1358,7 @@ void OpenSpaceEngine::mouseButtonCallback(MouseButton button,
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<bool (MouseButton, MouseAction, KeyModifier)>;
|
||||
for (const F& func : global::callback::mouseButton) {
|
||||
for (const F& func : *global::callback::mouseButton) {
|
||||
bool isConsumed = func(button, action, mods);
|
||||
if (isConsumed) {
|
||||
// If the mouse was released, we still want to forward it to the navigation
|
||||
@@ -1390,7 +1390,7 @@ void OpenSpaceEngine::mousePositionCallback(double x, double y) {
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<void (double, double)>;
|
||||
for (const F& func : global::callback::mousePosition) {
|
||||
for (const F& func : *global::callback::mousePosition) {
|
||||
func(x, y);
|
||||
}
|
||||
|
||||
@@ -1404,7 +1404,7 @@ void OpenSpaceEngine::mouseScrollWheelCallback(double posX, double posY) {
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<bool (double, double)>;
|
||||
for (const F& func : global::callback::mouseScrollWheel) {
|
||||
for (const F& func : *global::callback::mouseScrollWheel) {
|
||||
bool isConsumed = func(posX, posY);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1419,7 +1419,7 @@ void OpenSpaceEngine::touchDetectionCallback(TouchInput input) {
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<bool (TouchInput)>;
|
||||
for (const F& func : global::callback::touchDetected) {
|
||||
for (const F& func : *global::callback::touchDetected) {
|
||||
bool isConsumed = func(input);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1431,7 +1431,7 @@ void OpenSpaceEngine::touchUpdateCallback(TouchInput input) {
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<bool(TouchInput)>;
|
||||
for (const F& func : global::callback::touchUpdated) {
|
||||
for (const F& func : *global::callback::touchUpdated) {
|
||||
bool isConsumed = func(input);
|
||||
if (isConsumed) {
|
||||
return;
|
||||
@@ -1443,7 +1443,7 @@ void OpenSpaceEngine::touchExitCallback(TouchInput input) {
|
||||
ZoneScoped
|
||||
|
||||
using F = std::function<void(TouchInput)>;
|
||||
for (const F& func : global::callback::touchExit) {
|
||||
for (const F& func : *global::callback::touchExit) {
|
||||
func(input);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ NSArray* focusIdentifiers;
|
||||
if ([identifier isEqualToString:pauseResultId]) {
|
||||
NSButton* button = [NSButton
|
||||
buttonWithTitle:NSLocalizedString(
|
||||
(global::timeManager.isPaused() ? @"Resume" : @"Pause"),
|
||||
(global::timeManager->isPaused() ? @"Resume" : @"Pause"),
|
||||
@""
|
||||
)
|
||||
target:self action:@selector(pauseResumeButtonAction:)
|
||||
@@ -172,14 +172,14 @@ NSArray* focusIdentifiers;
|
||||
}
|
||||
|
||||
- (void)pauseResumeButtonAction:(id)sender {
|
||||
global::scriptEngine.queueScript(
|
||||
global::scriptEngine->queueScript(
|
||||
"openspace.time.togglePause();",
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
|
||||
NSButton* button = static_cast<NSButton*>(sender);
|
||||
// This check is inverted since the togglePause script has not run yet
|
||||
[button setTitle: global::timeManager.isPaused() ? @"Pause" : @"Resume"];
|
||||
[button setTitle: global::timeManager->isPaused() ? @"Pause" : @"Resume"];
|
||||
}
|
||||
|
||||
- (void)focusObjectAction:(id)sender {
|
||||
@@ -195,7 +195,7 @@ NSArray* focusIdentifiers;
|
||||
"NavigationHandler.OrbitalNavigator.Aim",
|
||||
"NavigationHandler.OrbitalNavigator.RetargetAnchor"
|
||||
);
|
||||
global::scriptEngine.queueScript(
|
||||
global::scriptEngine->queueScript(
|
||||
str,
|
||||
scripting::ScriptEngine::RemoteScripting::Yes
|
||||
);
|
||||
@@ -205,7 +205,7 @@ NSArray* focusIdentifiers;
|
||||
// Remove unused variable warning
|
||||
(void)sender;
|
||||
|
||||
global::scriptEngine.queueScript(
|
||||
global::scriptEngine->queueScript(
|
||||
"local isEnabled = openspace.getPropertyValue('Dashboard.IsEnabled');\
|
||||
openspace.setPropertyValueSingle('Dashboard.IsEnabled', not isEnabled);\
|
||||
openspace.setPropertyValueSingle('RenderEngine.ShowLog', not isEnabled);\
|
||||
@@ -218,7 +218,7 @@ NSArray* focusIdentifiers;
|
||||
- (void)hideGuiAction:(id)sender {
|
||||
// Remove unused variable warning
|
||||
(void)sender;
|
||||
global::scriptEngine.queueScript(
|
||||
global::scriptEngine->queueScript(
|
||||
"local isEnabled = openspace.getPropertyValue('Modules.CefWebGui.Visible');\
|
||||
openspace.setPropertyValueSingle('Modules.CefWebGui.Visible', not isEnabled);",
|
||||
scripting::ScriptEngine::RemoteScripting::No
|
||||
@@ -242,7 +242,7 @@ void showTouchbar() {
|
||||
[NSApplication sharedApplication].automaticCustomizeTouchBarMenuItemEnabled = YES;
|
||||
}
|
||||
|
||||
std::vector<SceneGraphNode*> ns = global::renderEngine.scene()->allSceneGraphNodes();
|
||||
std::vector<SceneGraphNode*> ns = global::renderEngine->scene()->allSceneGraphNodes();
|
||||
|
||||
std::sort(
|
||||
ns.begin(),
|
||||
|
||||
Reference in New Issue
Block a user