Skip to content

Commit

Permalink
Feature/thesis work merge (#566)
Browse files Browse the repository at this point in the history
Web GUI from Klas Eskilson (three new modules: webgui, webbrowser and cefwebgui)
Parallel connection refactorization
Wormhole server added to the main repository
Transfer function editor work from Cristoffer Särevall
Update ghoul
  • Loading branch information
emiax committed Mar 20, 2018
1 parent 35fe90c commit d64a0df
Show file tree
Hide file tree
Showing 340 changed files with 26,399 additions and 1,623 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Expand Up @@ -26,7 +26,12 @@ install_manifest.txt
.cproject
.project
shaders/ABuffer/constants.hglsl
ScriptLog.txt
*.idea/
.vs/
.build-vs/
*.dir
cmake-build-*
x64/
customization.lua
COMMIT.md
screenshots
12 changes: 12 additions & 0 deletions CMakeLists.txt
Expand Up @@ -79,6 +79,18 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)

# See if working directory is clean or not
execute_process(
COMMAND git diff-index --quiet HEAD --
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE OPENSPACE_GIT_STATUS_RETURN
)
if (NOT OPENSPACE_GIT_STATUS_RETURN EQUAL 0)
set(OPENSPACE_GIT_STATUS "uncomitted changes")
else()
set(OPENSPACE_GIT_STATUS "")
endif()

option(OPENSPACE_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)

include(src/CMakeLists.txt)
Expand Down
39 changes: 35 additions & 4 deletions apps/OpenSpace/CMakeLists.txt
Expand Up @@ -22,21 +22,20 @@
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
##########################################################################################

include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake)
include(${GHOUL_BASE_DIR}/support/cmake/copy_shared_libraries.cmake)
include(${OPENSPACE_CMAKE_EXT_DIR}/application_definition.cmake)
include(${OPENSPACE_CMAKE_EXT_DIR}/global_variables.cmake)


#####
# OpenVR
#####
option(OPENSPACE_OPENVR_SUPPORT "Build OpenSpace application with OpenVR support" OFF)

if (OPENSPACE_OPENVR_SUPPORT)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${OPENSPACE_EXT_DIR}/sgct/cmake/modules/")

find_package(OpenVR REQUIRED)

set(SGCT_OPENVR_DEFINITIONS OPENVR_SUPPORT)

if (NOT SGCT_OPENVR_INCLUDE_DIRECTORY)
Expand Down Expand Up @@ -111,6 +110,38 @@ target_compile_definitions(OpenSpace PRIVATE
${SPOUT_DEFINITIONS}
)


# Web Browser and Web gui
# Why not put these in the module's path? Because they do not have access to the
# target as of July 2017, which is needed.
if (OPENSPACE_MODULE_WEBBROWSER AND CEF_ROOT)
# wanted by CEF
set(CMAKE_BUILD_TYPE Debug CACHE INTERNAL "CMAKE_BUILD_TYPE")

if (WIN32)
set(RESOURCE_FILE ${OPENSPACE_APPS_DIR}/OpenSpace/openspace.rc)
endif ()

# Add the CEF binary distribution's cmake/ directory to the module path and
# find CEF to initialize it properly.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBBROWSER_MODULE_PATH}/cmake")
include(webbrowser_helpers)

set_cef_targets("${CEF_ROOT}" OpenSpace)
run_cef_platform_config("${CEF_ROOT}" "${CEF_TARGET}" "${WEBBROWSER_MODULE_PATH}")
elseif (OPENSPACE_MODULE_WEBBROWSER)
message(WARNING "Web configured to be included, but no CEF_ROOT was found, please try configuring CMake again.")
endif ()

if (OPENSPACE_MODULE_WEBGUI AND WEBGUI_MODULE_PATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBGUI_MODULE_PATH}/cmake")
include(webgui_helpers)
build_webgui_source(OpenSpace)
elseif(OPENSPACE_MODULE_WEBGUI)
message(WARNING "WebGui is configured to be included, but the web source could not be found. Try configuring CMake again.")
endif()
# End Web Browser and Web gui

if (MSVC)
# This library is used for being able to output the callstack if an exception escapes
target_link_libraries(OpenSpace Dbghelp.lib)
Expand Down
2 changes: 1 addition & 1 deletion apps/OpenSpace/main.cpp
Expand Up @@ -106,7 +106,7 @@ LONG WINAPI generateMiniDump(EXCEPTION_POINTERS* exceptionPointers) {

LINFO(fmt::format("Creating dump file: {}", dumpFile));

HANDLE hDumpFile = CreateFile(
HANDLE hDumpFile = CreateFileA(
dumpFile.c_str(),
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_WRITE | FILE_SHARE_READ,
Expand Down
45 changes: 45 additions & 0 deletions apps/Wormhole/CMakeLists.txt
@@ -0,0 +1,45 @@
##########################################################################################
# #
# OpenSpace #
# #
# Copyright (c) 2014-2018 #
# #
# 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. #
##########################################################################################

include(${OPENSPACE_CMAKE_EXT_DIR}/application_definition.cmake)

set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns
PROPERTIES MACOSX_PACKAGE_LOCATION "Resources"
)

set(MACOSX_BUNDLE_ICON_FILE openspace.icns)

create_new_application(
Wormhole
MACOSX_BUNDLE
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/openspace.rc
${CMAKE_CURRENT_SOURCE_DIR}/openspace.icns
)

target_link_libraries(
Wormhole
libOpenSpace
)
1 change: 1 addition & 0 deletions apps/Wormhole/include.cmake
@@ -0,0 +1 @@
set(DEFAULT_APPLICATION ON)
141 changes: 141 additions & 0 deletions apps/Wormhole/main.cpp
@@ -0,0 +1,141 @@
/*****************************************************************************************
* *
* OpenSpace *
* *
* Copyright (c) 2014-2018 *
* *
* 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. *
****************************************************************************************/


#include <ghoul/opengl/ghoul_gl.h>

#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/directory.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/logging/consolelog.h>
#include <ghoul/ghoul.h>
#include <ghoul/cmdparser/commandlineparser.h>
#include <ghoul/cmdparser/singlecommand.h>

#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/rendering/renderable.h>

#include <openspace/network/parallelserver.h>

#include <iostream>
#include <string>
#include <ghoul/glm.h>
#include <functional>
#include <sstream>
#include <iomanip>
#include <ios>

namespace {
const std::string _loggerCat = "Wormhole";
}

int main(int argc, char** argv) {
using namespace openspace;

std::vector<std::string> arguments(argv, argv + argc);

ghoul::cmdparser::CommandlineParser commandlineParser(
"Wormhole",
ghoul::cmdparser::CommandlineParser::AllowUnknownCommands::Yes
);

std::stringstream defaultPassword;
defaultPassword << std::hex << std::setfill('0') << std::setw(6) <<
(std::hash<size_t>{}(
std::chrono::system_clock::now().time_since_epoch().count()
) % 0xffffff);

std::stringstream defaultChangeHostPassword;
defaultChangeHostPassword << std::hex << std::setfill('0') << std::setw(6) <<
(std::hash<size_t>{}(
std::chrono::system_clock::now().time_since_epoch().count() + 1
) % 0xffffff);

std::string portString = "";
commandlineParser.addCommand(
std::make_unique<ghoul::cmdparser::SingleCommand<std::string>>(
portString,
"--port",
"-p",
"Sets the port to listen on"
)
);

std::string password = "";
commandlineParser.addCommand(
std::make_unique<ghoul::cmdparser::SingleCommand<std::string>>(
password,
"--password",
"-l",
"Sets the password to use"
)
);

if (password == "") {
password = defaultPassword.str();
LINFO(fmt::format("Connection password: {}", password));
}

std::string changeHostPassword = "";
commandlineParser.addCommand(
std::make_unique<ghoul::cmdparser::SingleCommand<std::string>>(
password,
"--hostpassword",
"-h",
"Sets the host password to use"
)
);

if (changeHostPassword == "") {
changeHostPassword = defaultChangeHostPassword.str();
LINFO(fmt::format("Host password: {}", changeHostPassword));
}

commandlineParser.setCommandLine(arguments);
commandlineParser.execute();

int port = 25001;

if (portString != "") {
try {
port = std::stoi(portString);
}
catch (...) {
LERROR(fmt::format("Invalid port: {}", portString));
}
}

ParallelServer server;
server.start(port, password, changeHostPassword);
server.setDefaultHostAddress("127.0.0.1");
LINFO(fmt::format("Server listening to port {}", port));

while (std::cin.get() != 'q') {}

server.stop();
LINFO("Server stopped");

return 0;
};
Binary file added apps/Wormhole/openspace.icns
Binary file not shown.
Binary file added apps/Wormhole/openspace.ico
Binary file not shown.
Binary file added apps/Wormhole/openspace.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/Wormhole/openspace.rc
@@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "openspace.ico"
1 change: 0 additions & 1 deletion data/assets/default.scene
Expand Up @@ -9,7 +9,6 @@ asset.require('scene/solarsystem/planets')
asset.require('scene/solarsystem/planets/mars/moons/phobos')
asset.require('scene/solarsystem/planets/mars/moons/deimos')
assetHelper.requestAll(asset, 'scene/digitaluniverse')

-- Load default key bindings applicable to most scenes
asset.require('util/default_keybindings')

Expand Down
4 changes: 1 addition & 3 deletions data/tasks/default.task
@@ -1,3 +1 @@
return {
"kameleonmetadatatojson"
}
return {}
13 changes: 12 additions & 1 deletion include/openspace/engine/configurationmanager.h
Expand Up @@ -86,6 +86,9 @@ class ConfigurationManager : public ghoul::Dictionary {

/// The key that stores the factory documentation values
static constexpr const char* KeyFactoryDocumentation = "FactoryDocumentation";
/// The key that decides whether or not we should require incoming web socket connections
/// to authorize or not
static constexpr const char* KeyRequireSocketAuthentication = "RequireSocketAuthentication";

/// The key that stores the location of the asset file that is initially loaded
static constexpr const char* KeyConfigAsset = "Asset";
Expand Down Expand Up @@ -200,7 +203,13 @@ class ConfigurationManager : public ghoul::Dictionary {
/// The part of the key storing whether the OpenGL state should be checked each call
static constexpr const char* KeyCheckOpenGLState = "CheckOpenGLState";

/// The part of the key storing whether each OpenGL call should be logged
/// The part of the key storing whether the OpenGL state should be checked each call
static constexpr const char* KeyServerPasskey = "ServerPasskey";

/// Whitelist of client addresses that won't need autorization
static constexpr const char* KeyServerClientAddressWhitelist =
"ClientAddressWhitelist";

static constexpr const char* KeyLogEachOpenGLCall = "LogEachOpenGLCall";

/// This key determines whether the scene graph nodes should initialized multithreaded
Expand Down Expand Up @@ -233,6 +242,8 @@ class ConfigurationManager : public ghoul::Dictionary {
/// The key used to specify whether screenshots should contain the current date
static constexpr const char* KeyScreenshotUseDate = "ScreenshotUseDate";

static constexpr const char* KeyWebHelperLocation = "WebHelperLocation";
static constexpr const char* KeyCefWebGuiUrl = "CefWebGuiUrl";

/**
* Iteratively walks the directory structure starting with \p filename to find the
Expand Down
6 changes: 3 additions & 3 deletions include/openspace/engine/openspaceengine.h
Expand Up @@ -51,7 +51,7 @@ class LoadingScreen;
class LuaConsole;
class ModuleEngine;
class NetworkEngine;
class ParallelConnection;
class ParallelPeer;
class RenderEngine;
class Scene;
class SyncEngine;
Expand Down Expand Up @@ -128,7 +128,7 @@ class OpenSpaceEngine {
ModuleEngine& moduleEngine();
LoadingScreen& loadingScreen();
NetworkEngine& networkEngine();
ParallelConnection& parallelConnection();
ParallelPeer& parallelPeer();
RenderEngine& renderEngine();
TimeManager& timeManager();
WindowWrapper& windowWrapper();
Expand Down Expand Up @@ -212,7 +212,7 @@ class OpenSpaceEngine {
std::unique_ptr<LuaConsole> _console;
std::unique_ptr<ModuleEngine> _moduleEngine;
std::unique_ptr<NetworkEngine> _networkEngine;
std::unique_ptr<ParallelConnection> _parallelConnection;
std::unique_ptr<ParallelPeer> _parallelPeer;
std::unique_ptr<RenderEngine> _renderEngine;
std::unique_ptr<SyncEngine> _syncEngine;
std::unique_ptr<TimeManager> _timeManager;
Expand Down
2 changes: 1 addition & 1 deletion include/openspace/interaction/keyframenavigator.h
Expand Up @@ -26,7 +26,7 @@
#define __OPENSPACE_CORE___KEYFRAMENAVIGATOR___H__

#include <openspace/util/timeline.h>
#include <openspace/network/parallelconnection.h>
#include <openspace/network/parallelpeer.h>

#include <ghoul/glm.h>
#include <glm/gtx/quaternion.hpp>
Expand Down
1 change: 1 addition & 0 deletions include/openspace/interaction/luaconsole.h
Expand Up @@ -25,6 +25,7 @@
#ifndef __OPENSPACE_CORE___LUACONSOLE___H__
#define __OPENSPACE_CORE___LUACONSOLE___H__

#include <openspace/network/parallelpeer.h>
#include <openspace/network/parallelconnection.h>
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
Expand Down

0 comments on commit d64a0df

Please sign in to comment.