mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
Feature/globals (#690)
* Move global objects out of OpenSpaceEngine * General cleanup of main.cpp * Add default_joystick asset to all scenes * No longer suppress mouse interaction on slave nodes * Window delegate uses function pointers rather than subclassing * Fix for false overwriting of ImGUI configuration file * Change default color and tilt angle of fisheye rendering * Restructured performance manager * Simplify screenshot handling
This commit is contained in:
@@ -34,7 +34,7 @@
|
||||
#include <modules/server/include/topics/topic.h>
|
||||
#include <modules/server/include/topics/triggerpropertytopic.h>
|
||||
#include <openspace/engine/configuration.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <ghoul/io/socket/socket.h>
|
||||
#include <ghoul/io/socket/tcpsocketserver.h>
|
||||
#include <ghoul/io/socket/websocketserver.h>
|
||||
@@ -76,7 +76,7 @@ Connection::Connection(std::unique_ptr<ghoul::io::Socket> s, std::string address
|
||||
_topicFactory.registerClass<BounceTopic>(BounceTopicKey);
|
||||
|
||||
// see if the default config for requiring auth (on) is overwritten
|
||||
_requireAuthorization = OsEng.configuration().doesRequireSocketAuthentication;
|
||||
_requireAuthorization = global::configuration.doesRequireSocketAuthentication;
|
||||
}
|
||||
|
||||
void Connection::handleMessage(const std::string& message) {
|
||||
@@ -188,7 +188,7 @@ void Connection::setAuthorized(bool status) {
|
||||
}
|
||||
|
||||
bool Connection::isWhitelisted() const {
|
||||
const std::vector<std::string>& wl = OsEng.configuration().clientAddressWhitelist;
|
||||
const std::vector<std::string>& wl = global::configuration.clientAddressWhitelist;
|
||||
return std::find(wl.begin(), wl.end(), _address) != wl.end();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include <modules/server/include/connection.h>
|
||||
#include <openspace/engine/configuration.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
namespace {
|
||||
@@ -84,7 +84,7 @@ void AuthorizationTopic::handleJson(const nlohmann::json& json) {
|
||||
}
|
||||
|
||||
bool AuthorizationTopic::authorize(const std::string& key) {
|
||||
_isAuthenticated = (key == OsEng.configuration().serverPasskey);
|
||||
_isAuthenticated = (key == global::configuration.serverPasskey);
|
||||
return _isAuthenticated;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
#include <modules/server/include/connection.h>
|
||||
#include <modules/server/include/jsonconverters.h>
|
||||
#include <modules/volume/transferfunctionhandler.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/engine/virtualpropertymanager.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/engine/windowdelegate.h>
|
||||
#include <openspace/interaction/navigationhandler.h>
|
||||
#include <openspace/network/parallelpeer.h>
|
||||
#include <openspace/query/query.h>
|
||||
@@ -64,11 +64,11 @@ void GetPropertyTopic::handleJson(const nlohmann::json& json) {
|
||||
}
|
||||
else if (requestedKey == AllScreenSpaceRenderablesValue) {
|
||||
response = wrappedPayload({
|
||||
{ "value", OsEng.renderEngine().screenSpaceRenderables() }
|
||||
{ "value", global::renderEngine.screenSpaceRenderables() }
|
||||
});
|
||||
}
|
||||
else if (requestedKey == RootPropertyOwner) {
|
||||
response = wrappedPayload(OsEng.rootPropertyOwner());
|
||||
response = wrappedPayload(global::rootPropertyOwner);
|
||||
}
|
||||
else {
|
||||
response = propertyFromKey(requestedKey);
|
||||
@@ -85,12 +85,11 @@ json GetPropertyTopic::allProperties() {
|
||||
{
|
||||
"value",
|
||||
{
|
||||
OsEng.renderEngine(),
|
||||
OsEng.console(),
|
||||
OsEng.parallelPeer(),
|
||||
OsEng.windowWrapper(),
|
||||
OsEng.navigationHandler(),
|
||||
OsEng.virtualPropertyManager(),
|
||||
global::renderEngine,
|
||||
global::luaConsole,
|
||||
global::parallelPeer,
|
||||
global::navigationHandler,
|
||||
global::virtualPropertyManager,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <modules/server/include/topics/luascripttopic.h>
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
|
||||
@@ -40,7 +40,7 @@ void LuaScriptTopic::handleJson(const nlohmann::json& json) {
|
||||
try {
|
||||
std::string script = json.at(ScriptKey).get<std::string>();
|
||||
LDEBUG("Queueing Lua script: " + script);
|
||||
OsEng.scriptEngine().queueScript(
|
||||
global::scriptEngine.queueScript(
|
||||
std::move(script),
|
||||
scripting::ScriptEngine::RemoteScripting::No
|
||||
);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <modules/server/include/topics/setpropertytopic.h>
|
||||
|
||||
#include <openspace/json.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/properties/property.h>
|
||||
#include <openspace/query/query.h>
|
||||
#include <openspace/util/timemanager.h>
|
||||
@@ -49,7 +49,7 @@ void SetPropertyTopic::handleJson(const nlohmann::json& json) {
|
||||
if (propertyKey == SpecialKeyTime) {
|
||||
Time newTime;
|
||||
newTime.setTime(value);
|
||||
OsEng.timeManager().setTimeNextFrame(newTime);
|
||||
global::timeManager.setTimeNextFrame(newTime);
|
||||
}
|
||||
else {
|
||||
properties::Property* prop = property(propertyKey);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "modules/server/include/topics/timetopic.h"
|
||||
|
||||
#include <modules/server/include/connection.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/globals.h>
|
||||
#include <openspace/properties/property.h>
|
||||
#include <openspace/query/query.h>
|
||||
#include <openspace/util/timemanager.h>
|
||||
@@ -53,10 +53,10 @@ TimeTopic::TimeTopic()
|
||||
|
||||
TimeTopic::~TimeTopic() {
|
||||
if (_timeCallbackHandle != UnsetOnChangeHandle) {
|
||||
OsEng.timeManager().removeTimeChangeCallback(_timeCallbackHandle);
|
||||
global::timeManager.removeTimeChangeCallback(_timeCallbackHandle);
|
||||
}
|
||||
if (_deltaTimeCallbackHandle != UnsetOnChangeHandle) {
|
||||
OsEng.timeManager().removeDeltaTimeChangeCallback(_deltaTimeCallbackHandle);
|
||||
global::timeManager.removeDeltaTimeChangeCallback(_deltaTimeCallbackHandle);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void TimeTopic::handleJson(const nlohmann::json& json) {
|
||||
LDEBUG("Subscribing to " + requestedKey);
|
||||
|
||||
if (requestedKey == CurrentTimeKey) {
|
||||
_timeCallbackHandle = OsEng.timeManager().addTimeChangeCallback([this]() {
|
||||
_timeCallbackHandle = global::timeManager.addTimeChangeCallback([this]() {
|
||||
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
|
||||
if (now - _lastUpdateTime > TimeUpdateInterval) {
|
||||
_connection->sendJson(currentTime());
|
||||
@@ -85,7 +85,7 @@ void TimeTopic::handleJson(const nlohmann::json& json) {
|
||||
_connection->sendJson(currentTime());
|
||||
}
|
||||
else if (requestedKey == DeltaTimeKey) {
|
||||
_deltaTimeCallbackHandle = OsEng.timeManager().addDeltaTimeChangeCallback(
|
||||
_deltaTimeCallbackHandle = global::timeManager.addDeltaTimeChangeCallback(
|
||||
[this]() {
|
||||
_connection->sendJson(deltaTime());
|
||||
if (_timeCallbackHandle != UnsetOnChangeHandle) {
|
||||
@@ -103,12 +103,12 @@ void TimeTopic::handleJson(const nlohmann::json& json) {
|
||||
}
|
||||
|
||||
json TimeTopic::currentTime() {
|
||||
json timeJson = { { "time", OsEng.timeManager().time().ISO8601() } };
|
||||
json timeJson = { { "time", global::timeManager.time().ISO8601() } };
|
||||
return wrappedPayload(timeJson);
|
||||
}
|
||||
|
||||
json TimeTopic::deltaTime() {
|
||||
json timeJson = { { "deltaTime", OsEng.timeManager().deltaTime() } };
|
||||
json timeJson = { { "deltaTime", global::timeManager.deltaTime() } };
|
||||
return wrappedPayload(timeJson);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user