mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-08 04:31:08 -06:00
Merge branch 'master' into thesis/2018/dsn
This commit is contained in:
@@ -57,6 +57,12 @@ namespace {
|
||||
"GUI URL",
|
||||
"The URL of the webpage that is used to load the WebGUI from."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo GuiScaleInfo = {
|
||||
"GuiScale",
|
||||
"Gui Scale",
|
||||
"GUI scale multiplier."
|
||||
};
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
@@ -66,10 +72,12 @@ CefWebGuiModule::CefWebGuiModule()
|
||||
, _enabled(EnabledInfo, true)
|
||||
, _visible(VisibleInfo, true)
|
||||
, _url(GuiUrlInfo, "")
|
||||
, _guiScale(GuiScaleInfo, 1.0, 0.1, 3.0)
|
||||
{
|
||||
addProperty(_enabled);
|
||||
addProperty(_visible);
|
||||
addProperty(_url);
|
||||
addProperty(_guiScale);
|
||||
}
|
||||
|
||||
void CefWebGuiModule::startOrStopGui() {
|
||||
@@ -95,6 +103,9 @@ void CefWebGuiModule::startOrStopGui() {
|
||||
if (_visible) {
|
||||
webBrowserModule->attachEventHandler(_instance.get());
|
||||
}
|
||||
|
||||
_instance->setZoom(_guiScale);
|
||||
|
||||
webBrowserModule->addBrowser(_instance.get());
|
||||
} else if (_instance) {
|
||||
_instance->close(true);
|
||||
@@ -124,6 +135,12 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
|
||||
}
|
||||
});
|
||||
|
||||
_guiScale.onChange([this]() {
|
||||
if (_instance) {
|
||||
_instance->setZoom(_guiScale);
|
||||
}
|
||||
});
|
||||
|
||||
_visible.onChange([this, webBrowserModule]() {
|
||||
if (_visible && _instance) {
|
||||
webBrowserModule->attachEventHandler(_instance.get());
|
||||
@@ -132,7 +149,6 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (configuration.hasValue<std::string>(GuiUrlInfo.identifier)) {
|
||||
_url = configuration.value<std::string>(GuiUrlInfo.identifier);
|
||||
} else {
|
||||
@@ -141,6 +157,10 @@ void CefWebGuiModule::internalInitialize(const ghoul::Dictionary& configuration)
|
||||
std::to_string(webGuiModule->port()) + "/#/onscreen";
|
||||
}
|
||||
|
||||
if (configuration.hasValue<float>(GuiScaleInfo.identifier)) {
|
||||
_guiScale = configuration.value<float>(GuiScaleInfo.identifier);
|
||||
}
|
||||
|
||||
_enabled = configuration.hasValue<bool>(EnabledInfo.identifier) &&
|
||||
configuration.value<bool>(EnabledInfo.identifier);
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
|
||||
#include <openspace/properties/scalar/boolproperty.h>
|
||||
#include <openspace/properties/scalar/floatproperty.h>
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
|
||||
namespace openspace {
|
||||
@@ -48,6 +49,7 @@ private:
|
||||
properties::BoolProperty _enabled;
|
||||
properties::BoolProperty _visible;
|
||||
properties::StringProperty _url;
|
||||
properties::FloatProperty _guiScale;
|
||||
std::unique_ptr<BrowserInstance> _instance;
|
||||
};
|
||||
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "OctreeCuller";
|
||||
} // namespace
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -95,14 +95,6 @@ namespace {
|
||||
"Tooltip Delay (in s)",
|
||||
"This value determines the delay in seconds after which the tooltip is shown."
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo HiddenInfo = {
|
||||
"IsHidden",
|
||||
"Is Hidden",
|
||||
"If this value is true, all GUI items will not be rendered, regardless of their "
|
||||
"status"
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace openspace::gui {
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <ghoul/misc/templatefactory.h>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "ServerModule";
|
||||
constexpr const char* KeyInterfaces = "Interfaces";
|
||||
} // namespace
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ Connection::Connection(std::unique_ptr<ghoul::io::Socket> s,
|
||||
|
||||
_topicFactory.registerClass(
|
||||
AuthenticationTopicKey,
|
||||
[password](bool useDictionary, const ghoul::Dictionary& dict) {
|
||||
[password](bool, const ghoul::Dictionary&) {
|
||||
return new AuthorizationTopic(password);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -89,22 +89,22 @@ namespace {
|
||||
namespace openspace {
|
||||
|
||||
std::unique_ptr<ServerInterface> ServerInterface::createFromDictionary(
|
||||
const ghoul::Dictionary& config)
|
||||
const ghoul::Dictionary& config)
|
||||
{
|
||||
// TODO: Use documentation to verify dictionary
|
||||
std::unique_ptr<ServerInterface> si = std::make_unique<ServerInterface>(config);
|
||||
return std::move(si);
|
||||
return si;
|
||||
}
|
||||
|
||||
ServerInterface::ServerInterface(const ghoul::Dictionary& config)
|
||||
: properties::PropertyOwner({ "", "", "" })
|
||||
, _type(TypeInfo)
|
||||
, _port(PortInfo, 0)
|
||||
, _defaultAccess(DefaultAccessInfo)
|
||||
, _enabled(EnabledInfo)
|
||||
, _allowAddresses(AllowAddressesInfo)
|
||||
, _requirePasswordAddresses(RequirePasswordAddressesInfo)
|
||||
, _denyAddresses(DenyAddressesInfo)
|
||||
, _enabled(EnabledInfo)
|
||||
, _defaultAccess(DefaultAccessInfo)
|
||||
, _password(PasswordInfo)
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ ServerInterface::ServerInterface(const ghoul::Dictionary& config)
|
||||
|
||||
const std::string identifier = config.value<std::string>(KeyIdentifier);
|
||||
|
||||
std::function readList =
|
||||
auto readList =
|
||||
[config](const std::string& key, properties::StringListProperty& list) {
|
||||
if (config.hasValue<ghoul::Dictionary>(key)) {
|
||||
const ghoul::Dictionary& dict = config.value<ghoul::Dictionary>(key);
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace {
|
||||
constexpr const char* _loggerCat = "RenderableStars";
|
||||
|
||||
@@ -56,27 +58,39 @@ namespace {
|
||||
|
||||
constexpr int8_t CurrentCacheVersion = 2;
|
||||
|
||||
struct CommonDataLayout {
|
||||
struct ColorVBOLayout {
|
||||
std::array<float, 4> position; // (x,y,z,e)
|
||||
float value;
|
||||
float luminance;
|
||||
float absoluteMagnitude;
|
||||
};
|
||||
|
||||
struct VelocityVBOLayout {
|
||||
std::array<float, 4> position; // (x,y,z,e)
|
||||
float value;
|
||||
float luminance;
|
||||
float absoluteMagnitude;
|
||||
|
||||
};
|
||||
|
||||
struct ColorVBOLayout : public CommonDataLayout {};
|
||||
|
||||
struct VelocityVBOLayout : public CommonDataLayout {
|
||||
float vx; // v_x
|
||||
float vy; // v_y
|
||||
float vz; // v_z
|
||||
};
|
||||
|
||||
struct SpeedVBOLayout : public CommonDataLayout {
|
||||
struct SpeedVBOLayout {
|
||||
std::array<float, 4> position; // (x,y,z,e)
|
||||
float value;
|
||||
float luminance;
|
||||
float absoluteMagnitude;
|
||||
|
||||
float speed;
|
||||
};
|
||||
|
||||
struct OtherDataLayout : public CommonDataLayout {};
|
||||
struct OtherDataLayout {
|
||||
std::array<float, 4> position; // (x,y,z,e)
|
||||
float value;
|
||||
float luminance;
|
||||
float absoluteMagnitude;
|
||||
};
|
||||
|
||||
constexpr openspace::properties::Property::PropertyInfo SpeckFileInfo = {
|
||||
"SpeckFile",
|
||||
@@ -407,7 +421,7 @@ void RenderableStars::initializeGL() {
|
||||
LERROR(fmt::format("Could not find other data column {}", _queuedOtherData));
|
||||
}
|
||||
else {
|
||||
_otherDataOption = std::distance(_dataNames.begin(), it);
|
||||
_otherDataOption = static_cast<int>(std::distance(_dataNames.begin(), it));
|
||||
_queuedOtherData.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,17 @@
|
||||
#pragma warning (disable : 4100)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#endif // __clang__
|
||||
|
||||
#include <include/cef_client.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
@@ -90,6 +99,13 @@ public:
|
||||
* \return if this scroll should be blocked or not
|
||||
*/
|
||||
bool sendMouseWheelEvent(const CefMouseEvent& event, const glm::ivec2& delta);
|
||||
|
||||
/**
|
||||
* Set the browser zoom level.
|
||||
* 1.0 = default, 2.0 = double, etc.
|
||||
*/
|
||||
void setZoom(float ratio);
|
||||
|
||||
void reloadBrowser();
|
||||
|
||||
const CefRefPtr<CefBrowser>& getBrowser() const;
|
||||
@@ -102,6 +118,7 @@ private:
|
||||
CefRefPtr<BrowserClient> _client;
|
||||
CefRefPtr<CefBrowser> _browser;
|
||||
bool _isInitialized = false;
|
||||
double _zoomLevel = 1.0;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -35,8 +35,17 @@
|
||||
#pragma warning (disable : 4100)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#endif // __clang__
|
||||
|
||||
#include <include/cef_browser.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
@@ -36,8 +36,17 @@
|
||||
#pragma warning (disable : 4100)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#endif // __clang__
|
||||
|
||||
#include <include/cef_client.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
@@ -30,8 +30,18 @@
|
||||
#pragma warning (disable : 4100)
|
||||
#endif // _MSC_VER
|
||||
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-parameter"
|
||||
#endif // __clang__
|
||||
|
||||
#include <include/cef_keyboard_handler.h>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif // __clang__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
@@ -97,6 +97,9 @@ void BrowserInstance::reshape(const glm::ivec2& windowSize) {
|
||||
}
|
||||
|
||||
void BrowserInstance::draw() {
|
||||
if (_zoomLevel != _browser->GetHost()->GetZoomLevel()) {
|
||||
_browser->GetHost()->SetZoomLevel(_zoomLevel);
|
||||
}
|
||||
_renderHandler->draw();
|
||||
}
|
||||
|
||||
@@ -142,6 +145,13 @@ bool BrowserInstance::sendMouseWheelEvent(const CefMouseEvent& event,
|
||||
return hasContent(event.x, event.y);
|
||||
}
|
||||
|
||||
void BrowserInstance::setZoom(float ratio) {
|
||||
//Zooming in CEF is non-linear according to this:
|
||||
//https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11491
|
||||
_zoomLevel = glm::log(static_cast<double>(ratio))/glm::log(1.2);
|
||||
_browser->GetHost()->SetZoomLevel(_zoomLevel);
|
||||
}
|
||||
|
||||
void BrowserInstance::reloadBrowser() {
|
||||
_browser->Reload();
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ WebGuiModule::WebGuiModule()
|
||||
, _enabled(ServerProcessEnabledInfo, false)
|
||||
, _entryPoint(ServerProcessEntryPointInfo)
|
||||
, _webDirectory(WebDirectoryInfo)
|
||||
, _address(AddressInfo, DefaultAddress)
|
||||
, _port(PortInfo, DefaultPort)
|
||||
, _address(AddressInfo, DefaultAddress)
|
||||
, _webSocketInterface(WebSocketInterfaceInfo, "")
|
||||
{
|
||||
addProperty(_enabled);
|
||||
|
||||
@@ -122,6 +122,7 @@ ModuleConfigurations = {
|
||||
},
|
||||
CefWebGui = {
|
||||
-- GuiUrl = "http://localhost:4680/#/onscreen/",
|
||||
-- GuiScale = 2.0,
|
||||
Enabled = true,
|
||||
Visible = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user