mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-14 07:49:35 -06:00
Solve merge conflicts.
This commit is contained in:
@@ -46,6 +46,7 @@
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/syncbuffer.h>
|
||||
#include <openspace/util/transformationmanager.h>
|
||||
|
||||
#include <ghoul/ghoul.h>
|
||||
#include <ghoul/cmdparser/commandlineparser.h>
|
||||
@@ -67,6 +68,10 @@
|
||||
#include <modules/onscreengui/include/gui.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef OPENSPACE_ENABLE_VLD
|
||||
#include <vld.h>
|
||||
@@ -118,13 +123,15 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
))
|
||||
, _console(new LuaConsole)
|
||||
, _moduleEngine(new ModuleEngine)
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
, _gui(new gui::GUI)
|
||||
#endif
|
||||
, _parallelConnection(new network::ParallelConnection)
|
||||
, _windowWrapper(std::move(windowWrapper))
|
||||
, _globalPropertyNamespace(new properties::PropertyOwner)
|
||||
, _isMaster(false)
|
||||
, _runTime(0.0)
|
||||
, _syncBuffer(new SyncBuffer(1024))
|
||||
, _syncBuffer(new SyncBuffer(4096))
|
||||
{
|
||||
_interactionHandler->setPropertyOwner(_globalPropertyNamespace.get());
|
||||
_globalPropertyNamespace->addPropertySubOwner(_interactionHandler.get());
|
||||
@@ -138,10 +145,13 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName,
|
||||
SpiceManager::initialize();
|
||||
Time::initialize();
|
||||
ghoul::systemcapabilities::SystemCapabilities::initialize();
|
||||
TransformationManager::initialize();
|
||||
}
|
||||
|
||||
OpenSpaceEngine::~OpenSpaceEngine() {
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
_gui->deinitializeGL();
|
||||
#endif
|
||||
_renderEngine->deinitialize();
|
||||
|
||||
_globalPropertyNamespace = nullptr;
|
||||
@@ -155,7 +165,9 @@ OpenSpaceEngine::~OpenSpaceEngine() {
|
||||
_commandlineParser = nullptr;
|
||||
_console = nullptr;
|
||||
_moduleEngine = nullptr;
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
_gui = nullptr;
|
||||
#endif
|
||||
_syncBuffer = nullptr;
|
||||
}
|
||||
|
||||
@@ -358,6 +370,11 @@ bool OpenSpaceEngine::initialize() {
|
||||
_scriptEngine->addLibrary(LuaConsole::luaLibrary());
|
||||
_scriptEngine->addLibrary(gui::GUI::luaLibrary());
|
||||
_scriptEngine->addLibrary(network::ParallelConnection::luaLibrary());
|
||||
_scriptEngine->addLibrary(ModuleEngine::luaLibrary());
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
_scriptEngine->addLibrary(IswaManager::luaLibrary());
|
||||
#endif
|
||||
|
||||
// TODO: Maybe move all scenegraph and renderengine stuff to initializeGL
|
||||
scriptEngine().initialize();
|
||||
@@ -407,8 +424,14 @@ bool OpenSpaceEngine::initialize() {
|
||||
// Load a light and a monospaced font
|
||||
loadFonts();
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
LINFO("Initializing GUI");
|
||||
_gui->initialize();
|
||||
#endif
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
IswaManager::initialize();
|
||||
#endif
|
||||
|
||||
LINFO("Finished initializing");
|
||||
return true;
|
||||
@@ -645,6 +668,7 @@ void OpenSpaceEngine::configureLogging() {
|
||||
bool OpenSpaceEngine::initializeGL() {
|
||||
LINFO("Initializing Rendering Engine");
|
||||
bool success = _renderEngine->initializeGL();
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
LINFO("Initializing OnScreen GUI GL");
|
||||
try {
|
||||
_gui->initializeGL();
|
||||
@@ -652,6 +676,7 @@ bool OpenSpaceEngine::initializeGL() {
|
||||
catch (const ghoul::RuntimeError& e) {
|
||||
LERROR(e.what());
|
||||
}
|
||||
#endif
|
||||
LINFO("Finished initializing OpenGL");
|
||||
return success;
|
||||
}
|
||||
@@ -690,18 +715,32 @@ void OpenSpaceEngine::preSynchronization() {
|
||||
void OpenSpaceEngine::postSynchronizationPreDraw() {
|
||||
Time::ref().postSynchronizationPreDraw();
|
||||
|
||||
_scriptEngine->postSynchronizationPreDraw();
|
||||
_scriptEngine->postSynchronizationPreDraw();
|
||||
_renderEngine->postSynchronizationPreDraw();
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_isMaster && _gui->isEnabled() && _windowWrapper->isRegularRendering()) {
|
||||
glm::vec2 mousePosition = _windowWrapper->mousePosition();
|
||||
glm::ivec2 drawBufferResolution = _windowWrapper->currentDrawBufferResolution();
|
||||
glm::ivec2 windowSize = _windowWrapper->currentWindowSize();
|
||||
uint32_t mouseButtons = _windowWrapper->mouseButtons(2);
|
||||
|
||||
glm::vec2 windowBufferCorrectionFactor = glm::vec2(
|
||||
static_cast<float>(drawBufferResolution.x) / static_cast<float>(windowSize.x),
|
||||
static_cast<float>(drawBufferResolution.y) / static_cast<float>(windowSize.y)
|
||||
);
|
||||
|
||||
double dt = _windowWrapper->averageDeltaTime();
|
||||
|
||||
_gui->startFrame(static_cast<float>(dt), glm::vec2(drawBufferResolution), mousePosition, mouseButtons);
|
||||
_gui->startFrame(
|
||||
static_cast<float>(dt),
|
||||
glm::vec2(drawBufferResolution),
|
||||
windowBufferCorrectionFactor,
|
||||
mousePosition,
|
||||
mouseButtons
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Testing this every frame has minimal impact on the performance --- abock
|
||||
// Debug build: 1-2 us ; Release build: <= 1 us
|
||||
@@ -726,8 +765,10 @@ void OpenSpaceEngine::render(const glm::mat4 &projectionMatrix, const glm::mat4
|
||||
if (_isMaster && _windowWrapper->isRegularRendering()) {
|
||||
if (_console->isVisible())
|
||||
_console->render();
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_gui->isEnabled())
|
||||
_gui->endFrame();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -737,11 +778,13 @@ void OpenSpaceEngine::postDraw() {
|
||||
|
||||
void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction action) {
|
||||
if (_isMaster) {
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_gui->isEnabled()) {
|
||||
bool isConsumed = _gui->keyCallback(key, mod, action);
|
||||
if (isConsumed)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (key == _console->commandInputButton() && (action == KeyAction::Press || action == KeyAction::Repeat))
|
||||
_console->toggleVisibility();
|
||||
@@ -757,12 +800,13 @@ void OpenSpaceEngine::keyboardCallback(Key key, KeyModifier mod, KeyAction actio
|
||||
|
||||
void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier) {
|
||||
if (_isMaster) {
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_gui->isEnabled()) {
|
||||
const bool isConsumed = _gui->charCallback(codepoint, modifier);
|
||||
if (isConsumed)
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
if (_console->isVisible()) {
|
||||
_console->charCallback(codepoint, modifier);
|
||||
}
|
||||
@@ -771,12 +815,13 @@ void OpenSpaceEngine::charCallback(unsigned int codepoint, KeyModifier modifier)
|
||||
|
||||
void OpenSpaceEngine::mouseButtonCallback(MouseButton button, MouseAction action) {
|
||||
if (_isMaster) {
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_gui->isEnabled()) {
|
||||
const bool isConsumed = _gui->mouseButtonCallback(button, action);
|
||||
if (isConsumed && action != MouseAction::Release)
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
_interactionHandler->mouseButtonCallback(button, action);
|
||||
}
|
||||
}
|
||||
@@ -789,12 +834,13 @@ void OpenSpaceEngine::mousePositionCallback(double x, double y) {
|
||||
|
||||
void OpenSpaceEngine::mouseScrollWheelCallback(double pos) {
|
||||
if (_isMaster) {
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
if (_gui->isEnabled()) {
|
||||
const bool isConsumed = _gui->mouseWheelCallback(pos);
|
||||
if (isConsumed)
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
_interactionHandler->mouseScrollWheelCallback(pos);
|
||||
}
|
||||
}
|
||||
@@ -873,10 +919,12 @@ LuaConsole& OpenSpaceEngine::console() {
|
||||
return *_console;
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ONSCREENGUI_ENABLED
|
||||
gui::GUI& OpenSpaceEngine::gui() {
|
||||
ghoul_assert(_gui, "GUI must not be nullptr");
|
||||
return *_gui;
|
||||
}
|
||||
#endif
|
||||
|
||||
network::ParallelConnection& OpenSpaceEngine::parallelConnection() {
|
||||
ghoul_assert(_parallelConnection, "ParallelConnection must not be nullptr");
|
||||
|
||||
Reference in New Issue
Block a user