Fix viewport & window issues (#2630)

* Add support for multiple windows & viewports
With correct rendering of both Scene and Overlays/GUI.
GUI is restricted to either the first window or any other windows tagged
with "GUI", overlays are drawn on all windows/viewports.

Closes #2542 and #1645
This commit is contained in:
Joakim Kilby
2023-05-17 22:02:47 +02:00
committed by GitHub
parent f613b6651d
commit ca4b6d2ce2
9 changed files with 112 additions and 37 deletions

View File

@@ -111,7 +111,7 @@ void CefWebGuiModule::startOrStopGui() {
);
_instance->initialize();
_instance->reshape(static_cast<glm::ivec2>(
static_cast<glm::vec2>(global::windowDelegate->currentSubwindowSize()) *
static_cast<glm::vec2>(global::windowDelegate->guiWindowResolution()) *
global::windowDelegate->dpiScaling()
));
if (!_url.value().empty()) {
@@ -226,12 +226,13 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
const bool isGuiWindow =
global::windowDelegate->hasGuiWindow() ?
global::windowDelegate->isGuiWindow() :
true;
global::windowDelegate->currentWindowId()
== global::windowDelegate->firstWindowId();
const bool isMaster = global::windowDelegate->isMaster();
if (isGuiWindow && isMaster && _instance) {
if (global::windowDelegate->windowHasResized() || _instance->_shouldReshape) {
glm::ivec2 csws = global::windowDelegate->currentSubwindowSize();
glm::ivec2 csws = global::windowDelegate->guiWindowResolution();
_instance->reshape(static_cast<glm::ivec2>(
static_cast<glm::vec2>(csws) * global::windowDelegate->dpiScaling()
));