Files
OpenSpace/include/openspace/engine/windowdelegate.h
Ylva Selling aed2c0b0c8 Issue/2244 different mouse cursors (#3388)
* Update CEF version number

* Set OpenSpace_Helper version of C++ to 20

* Update C++ syntax to v 20

* Remove deprecated function (now default)

* Set the cache folder for cef

* Make static function in webbrowsermodule that determines if we can use accelerated rendering

* Add flag for accelerated rendering to webrenderhandler

* Use accelerated rendering

* Implement function to see if gui should absorb click

* Adhere to 80 char linewidth

* Make only the UI GPU accelerated

* Use dirty rects size for the texture to remove crash

* Better comments

* Make has content function work for GPU acceleration

* Make it so all browsers can be accelerated

Tried making it so only the gui was accelerated for simplicity. Performance plummeted, so reverted that

* Tidy up

* Add accelerated rendering flag to the screenspacerenderable shader

* Add temporary fix to make the sky browser work

* Remove flag from gui render handler

* Enable webgl in a nicer way

* Unbind texture in screenspacerenderable

* Add better comments for error handling

* Tidy up

* Address PR comments

* Make the acceleration Windows only

* Remove unnecessary setting of shader dictionary

* Add display handler to browser client

* Make glfw change mouse cursor depending on cef cursor

* formatting

* Add switch to main

* Update modules/webbrowser/src/browserclient.cpp

Co-authored-by: Alexander Bock <alexander.bock@liu.se>

* Address comments on PR

* Update again

* Update modules/webbrowser/src/browserclient.cpp

Co-authored-by: Emma Broman <emma.broman@liu.se>

* Address PR comments

---------

Co-authored-by: Ylva Selling <ylva.selling@liu.se>
Co-authored-by: Alexander Bock <alexander.bock@liu.se>
Co-authored-by: Emma Broman <emma.broman@liu.se>
2024-08-28 10:44:17 +02:00

139 lines
5.4 KiB
C++

/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2024 *
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
* software and associated documentation files (the "Software"), to deal in the Software *
* without restriction, including without limitation the rights to use, copy, modify, *
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
* permit persons to whom the Software is furnished to do so, subject to the following *
* conditions: *
* *
* The above copyright notice and this permission notice shall be included in all copies *
* or substantial portions of the Software. *
* *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __OPENSPACE_CORE__WINDOWDELEGATE___H__
#define __OPENSPACE_CORE__WINDOWDELEGATE___H__
#include <ghoul/glm.h>
#include <glbinding/glbinding.h>
#include <vector>
namespace openspace {
struct WindowDelegate {
enum class Frustum { Mono, LeftEye, RightEye };
enum class Cursor { Arrow, IBeam, CrossHair, PointingHand, ResizeEW, ResizeNS,
ResizeNWSE, ResizeNESW, ResizeAll, NotAllowed };
void (*terminate)() = [](){};
void (*setBarrier)(bool enabled) = [](bool) {};
void (*setSynchronization)(bool enabled) = [](bool) {};
bool (*windowHasResized)() = []() { return false; };
double (*averageDeltaTime)() = []() { return 0.0; };
double (*minDeltaTime)() = []() { return 0.0; };
double (*maxDeltaTime)() = []() { return 0.0; };
double (*deltaTimeStandardDeviation)() = []() { return 0.0; };
double (*deltaTime)() = []() { return 0.0; };
double (*applicationTime)() = []() { return 0.0; };
glm::ivec2 (*currentWindowSize)() = []() { return glm::ivec2(0); };
glm::ivec2 (*currentSubwindowSize)() = []() { return glm::ivec2(0); };
glm::ivec2 (*currentDrawBufferResolution)() = []() { return glm::ivec2(0); };
glm::ivec2 (*currentViewportSize)() = []() { return glm::ivec2(0); };
glm::ivec2(*currentViewportResolution)() = []() { return glm::ivec2(0); };
glm::vec2 (*dpiScaling)() = []() { return glm::vec2(1.f); };
glm::ivec2(*firstWindowResolution)() = []() { return glm::ivec2(0); };
glm::ivec2(*guiWindowResolution)() = []() { return glm::ivec2(0); };
float (*osDpiScaling)() = []() { return 1.f; };
bool (*hasGuiWindow)() = []() { return false; };
bool (*isGuiWindow)() = []() { return false; };
bool (*isMaster)() = []() { return true; };
glm::mat4 (*modelMatrix)() = []() { return glm::mat4(1.f); };
void (*setNearFarClippingPlane)(float near, float far) = [](float, float) {};
bool (*isFisheyeRendering)() = []() { return false; };
unsigned int (*takeScreenshot)(bool applyWarping, std::vector<int> windowIds) =
[](bool, std::vector<int>) { return 0u; };
void (*resetScreenshotNumber)() = []() {};
void (*swapBuffer)() = []() {};
int (*nWindows)() = []() { return 0; };
int (*currentWindowId)() = []() { return 0; };
int (*firstWindowId)() = []() { return 0; };
double (*getHorizFieldOfView)() = []() { return 0.0; };
void (*setHorizFieldOfView)(float hFovDeg) = [](float) { };
void* (*getNativeWindowHandle)(size_t windowIndex) = [](size_t) -> void* {
return nullptr;
};
using GLProcAddress = void(*)(void);
GLProcAddress (*openGLProcedureAddress)(const char*) =
[](const char*) -> GLProcAddress { return []() {}; };
Frustum (*frustumMode)() = []() { return Frustum::Mono; };
uint64_t (*swapGroupFrameNumber)() = []() { return uint64_t(0); };
void (*setScreenshotFolder)(std::filesystem::path) = [](std::filesystem::path) {};
void (*showStatistics)(bool) = [](bool) {};
int (*numberOfNodes)() = []() { return 0; };
int (*currentNode)() = []() { return 0; };
glm::vec2 (*mousePositionViewportRelative)(const glm::vec2& mousePosition) =
[](const glm::vec2&) { return glm::vec2(0); };
void (*setStatisticsGraphScale)(float scale) = [](float) {};
void (*setMouseCursor)(Cursor cursor) = [](Cursor) {};
};
} // namespace openspace
#endif // __OPENSPACE_CORE__WINDOWDELEGATE___H__