diff --git a/.gitattributes b/.gitattributes index 6f15cde045..1be02425ca 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,18 @@ * text=auto +# Correct GitHub's language detection shenanigans + +# Asset files are not Unity, but Lua instead +*.asset linguist-language=Lua +# We have some SPICE frame kernels that get misclassified as code +*.tf -linguist-detectable +# We don't want to index the GDAL csv and xml files +modules/globebrowsing/gdal_data/* linguist-vendored +# No need to index any external files +*/ext/* linguist-vendored +# No C allowed +*.h linguist-language=C++ + # GitHub files ATTRIBUTION text AUTHORS text diff --git a/CMakeLists.txt b/CMakeLists.txt index b4b73947d7..f66c1d9122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ project(OpenSpace) set(OPENSPACE_VERSION_MAJOR 0) set(OPENSPACE_VERSION_MINOR 17) -set(OPENSPACE_VERSION_PATCH 0) +set(OPENSPACE_VERSION_PATCH 1) set(OPENSPACE_VERSION_STRING "Beta-10") set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}") @@ -132,8 +132,6 @@ if (MSVC) set(GHOUL_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS ${OPENSPACE_OPTIMIZATION_ENABLE_OTHER_OPTIMIZATIONS} CACHE BOOL "" FORCE) endif () -option(OPENSPACE_WITH_ABUFFER_RENDERER "Compile ABuffer Renderer" OFF) - if (UNIX) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++") diff --git a/CREDITS.md b/CREDITS.md index c7201a953d..f12695c25d 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -4,17 +4,17 @@ Emil Axelsson Kalle Bladin Jonathas Costa Gene Payne -Jonas Strandstedt -Michal Marcinkowski -Elon Olsson Emma Broman +Jonas Strandstedt Micah Acinapura +Michal Marcinkowski +Malin Ejdbo +Elon Olsson Joakim Kilby Lovisa Hassler Mikael Petterson Erik Sundén Stefan Lindblad -Malin Ejdbo Corrie Roe Eric Myers diff --git a/README.md b/README.md index 19d721dd2a..1e17b0e290 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,47 @@ -[OpenSpace](http://openspaceproject.com) is an open source, non-commercial, and freely available interactive data visualization software designed to visualize the entire known universe and portray our ongoing efforts to investigate the cosmos. Bringing the latest techniques from data visualization research to the general public, OpenSpace supports interactive presentation of dynamic data from observations, simulations, and space mission planning and operations. The software works on multiple operating systems (Windows, Linux, MacOS) with an extensible architecture powering high resolution tiled displays and planetarium domes, making use of the latest graphic card technologies for rapid data throughput. In addition, OpenSpace enables simultaneous connections across the globe creating opportunity for shared experiences among audiences worldwide. +![OpenSpace Logo](/data/openspace-horiz-logo-crop.png) +[OpenSpace](http://openspaceproject.com) is an open source, non-commercial, and freely available interactive data visualization software designed to visualize the entire known universe and portray our ongoing efforts to investigate the cosmos. Bringing the latest techniques from data visualization research to the general public, OpenSpace supports interactive presentation of dynamic data from observations, simulations, and space mission planning and operations. The software works on multiple operating systems (Windows, Linux, MacOS) with an extensible architecture capable of powering both personal computers and also high resolution tiled displays and planetarium domes. In addition, OpenSpace enables simultaneous connections across the globe creating opportunity for shared experiences among audiences worldwide. The target audience of the software reaches from the general public who wishes to explore our universe, enthusiasts interested in hacking the underlying components in OpenSpace to create unique experiences, informal science institutions wishing to create a low-cost, yet powerful exhibition piece, but also scientists desiring to visualize their datasets in a contextualized, powerful software. -The project stems from the same academic collaboration between Sweden’s [Linköping University](https://www.liu.se) (LiU) and the [American Museum of Natural History](https://www.amnh.org) (AMNH) that led to the creation of Uniview and its parent company [SCISS](http://sciss.se). Development of the software began several years ago through a close collaboration with NASA Goddard’s [Community Coordinated Modeling Center](https://ccmc.gsfc.nasa.gov) (CCMC) to model space weather forecasting and continued with visualizations of NASA’s New Horizons mission to Pluto and ESA’s Rosetta mission. This promising set of preliminary work provided a foundation for recent NASA funding, which has extended the collaboration to include the University of Utah’s [Scientific Computing and Imaging](https://www.sci.utah.edu) (SCI) Institute, [New York University](https://www.nyu.edu)’s Tandon School of Engineering, multiple informal science institutions across the United States, and multiple, international vendors. Current areas of focus within OpenSpace include: +[![License](https://img.shields.io/badge/License-MIT-purple.svg?style=flat-square)](LICENSE) +[![Download](https://img.shields.io/github/v/tag/OpenSpace/OpenSpace?label=Version&color=maroon&style=flat-square)](https://www.openspaceproject.com/installation) +![Size](https://img.shields.io/github/repo-size/OpenSpace/OpenSpace?style=flat-square&color=red) -- Visualization of dynamic simulations via interactive volumetric rendering, as a priority for communicating research in astrophysics. -- Utilization of NASA’s SPICE observational geometry system with its Planetary Data Service (PDS) to enable space mission visualizations that reveal how missions are designed to gather science. -- Globe browsing techniques across spatial and temporal scales to examine scientific campaigns on multiple planets, including close up surface exploration. +[![System Paper](https://img.shields.io/badge/System%20Paper-10.1109%2FTVCG.2019.2934259-blue?style=flat-square)](https://doi.org/10.1109/TVCG.2019.2934259) +[![GlobeBrowsing Paper](https://img.shields.io/badge/GlobeBrowsing%20Paper-https%3A%2F%2Fdoi.org%2F10.1109%2FTVCG.2017.2743958-blue?style=flat-square)](https://doi.org/10.1109/TVCG.2017.2743958) -OpenSpace requires graphics support for [OpenGL](https://www.opengl.org/) version 3.3. +![Contributors](https://img.shields.io/github/contributors/OpenSpace/OpenSpace?style=flat-square) +![Commits](https://img.shields.io/github/commit-activity/m/OpenSpace/OpenSpace?color=green&style=flat-square) -This repository contains the source code and example scenes for OpenSpace, but does not contain any data. To build and install the client, we refer to the [OpenSpace Wiki](http://wiki.openspaceproject.com/), specifically [building](http://wiki.openspaceproject.com/docs/developers/compiling/general) for [Windows](http://wiki.openspaceproject.com/docs/developers/compiling/windows), [Linux (Ubuntu)](http://wiki.openspaceproject.com/docs/developers/compiling/ubuntu), and [MacOS](http://wiki.openspaceproject.com/docs/developers/compiling/macos). Required preexisting dependencies are: [Boost](http://www.boost.org/) and [Qt](http://www.qt.io/download). Feel free to create issues for missing features, bug reports, or compile problems or contact us via [email](mailto:alexander.bock@me.com?subject=OpenSpace:). +![Image](https://github.com/OpenSpace/openspace.github.io/raw/master/assets/images/collection.jpg) -Regarding any issues, you are very welcome on our [Slack support channel](https://openspacesupport.slack.com) to which you can freely [sign-up](https://join.slack.com/t/openspacesupport/shared_invite/zt-37niq6y9-T0JaCIk4UoFLI4VF5U9Vsw). +# Background +OpenSpace started as a collaboration between Sweden's [Linköping University](https://scivis.github.io) (LiU) and the [American Museum of Natural History](https://www.amnh.org) (AMNH). Development of the software began several years ago through a close collaboration with NASA Goddard's [Community Coordinated Modeling Center](https://ccmc.gsfc.nasa.gov) (CCMC) to model space weather forecasting and continued with visualizations of NASA's New Horizons mission to Pluto and ESA's Rosetta mission to 67P/Churyumov–Gerasimenko. This promising set of preliminary work provided a foundation for continued funding from NASA, the Swedish eScience Research Centre, and the Knut and Alice Wallenberg foundation, which has extended the collaboration to include the University of Utah's [Scientific Computing and Imaging](https://www.sci.utah.edu) (SCI) Institute, [New York University](https://www.nyu.edu)'s Tandon School of Engineering, multiple informal science institutions across the world, and multiple, international vendors. + +![Image](https://github.com/OpenSpace/openspace.github.io/raw/master/assets/images/presentation.jpg) + +# Features +Some of the high-level features supported in OpenSpace are: + - AMNH's Digital Universe catalog of extrasolar datasets (stars, galaxies, quasars, ...) + - High-resolution planetary images for major objects in the solar system (Earth, Moon, Mars, Venus, ...) + - Animated 3D models representing space missions (ISS, New Horizons, JWST, ...) + - Support for custom profiles with arbitrary user-defined content + - Ability to drive any type of display environment (flat screen, multi-projector, planetariums, ...) + - Lua and JavaScript interface into the engine allowing highly customized controls + - Native support to export an interactive sessions as individual frames for video export + - much much more (see our [Changelog](http://wiki.openspaceproject.com/docs/general/releases)) + +OpenSpace requires at least support for [OpenGL](https://www.opengl.org/) version 3.3, some custom components require at least version 4.2. + +![Image](https://github.com/OpenSpace/openspace.github.io/raw/master/assets/images/display-systems.jpg) + +# Getting Started +This repository contains the source code and example profiles for OpenSpace, but does not contain any data. To build and install the application, please check out the [OpenSpace Wiki](http://wiki.openspaceproject.com/). Here, you will find two pages, a [build instruction](http://wiki.openspaceproject.com/docs/developers/compiling/general) for all operating systems and then additional instructions for [Windows](http://wiki.openspaceproject.com/docs/developers/compiling/windows), [Linux (Ubuntu)](http://wiki.openspaceproject.com/docs/developers/compiling/ubuntu), and [MacOS](http://wiki.openspaceproject.com/docs/developers/compiling/macos). + +Requirements for compiling are: + - CMake version 3.10 or above + - C++ compiler supporting C++17 (MSVC 16.10, GCC9, Clang10) + - [Boost](http://www.boost.org/) + - [Qt](http://www.qt.io/download) + +Feel free to create issues for missing features, bug reports, or compile problems or contact us via [email](mailto:openspace@amnh.org?subject=OpenSpace:). Regarding any issues, you are very welcome on our [Slack support channel](https://openspacesupport.slack.com) to which you can freely [sign-up](https://join.slack.com/t/openspacesupport/shared_invite/zt-37niq6y9-T0JaCIk4UoFLI4VF5U9Vsw). + +![Image](https://github.com/OpenSpace/openspace.github.io/raw/master/assets/images/himalaya-nkpg-dome.jpg) diff --git a/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h b/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h index 34097a0b2a..91dd07972c 100644 --- a/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h +++ b/apps/OpenSpace/ext/launcher/include/profile/keybindingsdialog.h @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -68,6 +69,7 @@ private slots: void parseSelections(); void chooseScripts(); void keySelected(int index); + void keyModSelected(int index); /** * Adds scripts to the _scriptEdit from outside dialogs @@ -83,12 +85,16 @@ private: int indexInKeyMapping(std::vector& mapVector, int keyInt); bool areRequiredFormsFilled(); bool isLineEmpty(int index); + void addStringToErrorDisplay(const QString& newString); + void checkForNumberKeyConflict(int key); + void checkForBindingConflict(int selectedModKey, int selectedKey); openspace::Profile& _profile; std::vector _data; std::vector _mapModKeyComboBoxIndexToKeyValue; std::vector _mapKeyComboBoxIndexToKeyValue; bool _editModeNewItem = false; + int _currentKeybindingSelection = 0; QListWidget* _list = nullptr; QLabel* _keyModLabel = nullptr; diff --git a/apps/OpenSpace/ext/launcher/resources/qss/launcher.qss b/apps/OpenSpace/ext/launcher/resources/qss/launcher.qss index 032ac15ccc..1b31494beb 100644 --- a/apps/OpenSpace/ext/launcher/resources/qss/launcher.qss +++ b/apps/OpenSpace/ext/launcher/resources/qss/launcher.qss @@ -115,6 +115,7 @@ PropertiesDialog QListWidget { */ AssetsDialog QTreeView { min-width: 40em; + min-height: 40em; } /* diff --git a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp index 21f15343cc..d30eac9af3 100644 --- a/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp +++ b/apps/OpenSpace/ext/launcher/src/launcherwindow.cpp @@ -314,8 +314,24 @@ void LauncherWindow::setBackgroundImage(const std::string& syncPath) { std::mt19937 g(rd()); std::shuffle(files.begin(), files.end(), g); // We know there has to be at least one folder, so it's fine to just pick the first - std::string image = files.front(); - _backgroundImage->setPixmap(QPixmap(QString::fromStdString(image))); + while (!files.empty()) { + std::string p = files.front(); + if (std::filesystem::path(p).extension() == ".png") { + // If the top path starts with the png extension, we have found our candidate + break; + } + else { + // There shouldn't be any non-png images in here, but you never know. So we + // just remove non-image files here + files.erase(files.begin()); + } + } + + // There better be at least one file left, but just in in case + if (!files.empty()) { + std::string image = files.front(); + _backgroundImage->setPixmap(QPixmap(QString::fromStdString(image))); + } } void LauncherWindow::populateProfilesList(std::string preset) { @@ -464,7 +480,7 @@ std::string LauncherWindow::selectedWindowConfig() const { int idx = _windowConfigBox->currentIndex(); if (idx == 0) { return _sgctConfigName; - } else if (idx > _userAssetCount) { + } else if (idx > _userConfigCount) { return "${CONFIG}/" + _windowConfigBox->currentText().toStdString(); } else { diff --git a/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp index ecaba582da..19671a9587 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/assetsdialog.cpp @@ -130,10 +130,7 @@ AssetsDialog::AssetsDialog(openspace::Profile& profile, const std::string& asset { setWindowTitle("Assets"); _assetTreeModel.importModelData(assetBasePath, userAssetBasePath); - createWidgets(); -} -void AssetsDialog::createWidgets() { QBoxLayout* layout = new QVBoxLayout(this); { QLabel* heading = new QLabel("Select assets from /data/assets"); @@ -174,18 +171,19 @@ void AssetsDialog::createWidgets() { nRows, _assetTreeModel.index(-1, 0) ); - layout->addWidget(_assetTree); + layout->addWidget(_assetTree, 4); } { + QWidget* box = new QWidget; + QBoxLayout* boxLayout = new QVBoxLayout(box); QLabel* summaryHeading = new QLabel("Selection summary"); summaryHeading->setObjectName("heading"); - layout->addWidget(summaryHeading); - } - { + boxLayout->addWidget(summaryHeading); _summary = new QTextEdit; _summary->setReadOnly(true); _summary->setText(createTextSummary()); - layout->addWidget(_summary); + boxLayout->addWidget(_summary); + layout->addWidget(box, 1); } layout->addWidget(new Line); diff --git a/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp b/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp index 273dde9ab6..b4cb0c7cb6 100644 --- a/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp +++ b/apps/OpenSpace/ext/launcher/src/profile/keybindingsdialog.cpp @@ -28,7 +28,6 @@ #include "profile/scriptlogdialog.h" #include -#include #include #include #include @@ -167,6 +166,10 @@ void KeybindingsDialog::createWidgets() { _mapModKeyComboBoxIndexToKeyValue.push_back(modIdx++); } _keyModCombo->addItems(comboModKeysStringList); + connect( + _keyModCombo, QOverload::of(&QComboBox::currentIndexChanged), + this, &KeybindingsDialog::keyModSelected + ); box->addWidget(_keyModCombo, 0, 1); @@ -286,6 +289,7 @@ void KeybindingsDialog::createWidgets() { void KeybindingsDialog::listItemSelected() { QListWidgetItem *item = _list->currentItem(); int index = _list->row(item); + _currentKeybindingSelection = index; if (_data.size() > 0) { Profile::Keybinding& k = _data[index]; @@ -317,21 +321,25 @@ void KeybindingsDialog::listItemSelected() { } void KeybindingsDialog::keySelected(int index) { - const QString numKeyWarning = "Warning: Using a number key may conflict with the " - "keybindings for simulation time increments."; + _errorMsg->clear(); + int selectedKey = _mapKeyComboBoxIndexToKeyValue[index]; + checkForNumberKeyConflict(selectedKey); + checkForBindingConflict(_keyModCombo->currentIndex(), selectedKey); +} + +void KeybindingsDialog::keyModSelected(int index) { + _errorMsg->clear(); + int selectedKey = _mapModKeyComboBoxIndexToKeyValue[index]; + checkForBindingConflict(selectedKey, + _mapKeyComboBoxIndexToKeyValue.at(_keyCombo->currentIndex())); +} + +void KeybindingsDialog::addStringToErrorDisplay(const QString& newString) { QString errorContents = _errorMsg->text(); - bool alreadyContainsWarning = (errorContents.length() >= numKeyWarning.length() && - errorContents.left(numKeyWarning.length()) == numKeyWarning); - if (_mapKeyComboBoxIndexToKeyValue[index] >= static_cast(Key::Num0) - && _mapKeyComboBoxIndexToKeyValue[index] <= static_cast(Key::Num9)) - { - if (!alreadyContainsWarning) { - errorContents = numKeyWarning + errorContents; - _errorMsg->setText(errorContents); - } - } - else if (alreadyContainsWarning) { - _errorMsg->setText(errorContents.mid(numKeyWarning.length())); + bool alreadyContainsString = (errorContents.indexOf(newString, 0) != -1); + if (!alreadyContainsString) { + errorContents = newString + errorContents; + _errorMsg->setText(errorContents); } } @@ -371,10 +379,37 @@ void KeybindingsDialog::listItemAdded() { _documentationEdit->setText(QString::fromStdString(_data.back().documentation)); _localCheck->setChecked(false); _scriptEdit->setText(QString::fromStdString(_data.back().script)); - + _currentKeybindingSelection = static_cast(_data.size() - 1); _editModeNewItem = true; } +void KeybindingsDialog::checkForNumberKeyConflict(int key) { + const QString numKeyWarning = "Warning: Using a number key may conflict with the " + "keybindings for simulation time increments.\n"; + if (key >= static_cast(Key::Num0) && key <= static_cast(Key::Num9)) { + addStringToErrorDisplay(numKeyWarning); + } +} + +void KeybindingsDialog::checkForBindingConflict(int selectedModKey, int selectedKey) { + const QString localWarn = "Warning: New selection conflicts with binding '"; + if (_currentKeybindingSelection >= static_cast(_data.size())) { + return; + } + KeyModifier newModifier = static_cast(selectedModKey); + Key newKey = static_cast(selectedKey); + for (int i = 0; i < static_cast(_data.size()); ++i) { + if (i == _currentKeybindingSelection) { + continue; + } + openspace::Profile::Keybinding k = _data[i]; + if ((k.key.key == newKey) && (k.key.modifier == newModifier)) { + addStringToErrorDisplay(localWarn + QString::fromStdString(k.name) + "'.\n"); + break; + } + } +} + void KeybindingsDialog::listItemSave() { if (!areRequiredFormsFilled()) { return; diff --git a/data/assets/examples/globetranslation.asset b/data/assets/examples/globetranslation.asset index aedc5f5901..1bf8d0089a 100644 --- a/data/assets/examples/globetranslation.asset +++ b/data/assets/examples/globetranslation.asset @@ -2,19 +2,11 @@ local assetHelper = asset.require('util/asset_helper') local earth = asset.require('scene/solarsystem/planets/earth/earth') local sunTransforms = asset.require('scene/solarsystem/sun/transforms') - -local textures = asset.syncedResource({ - Name = "New Horizons Textures", - Type = "HttpSynchronization", - Identifier = "newhorizons_textures", - Version = 3 -}) - local models = asset.syncedResource({ Name = "New Horizons Model", Type = "HttpSynchronization", Identifier = "newhorizons_model", - Version = 1 + Version = 2 }) local Example_Fixed_Height = { @@ -24,19 +16,15 @@ local Example_Fixed_Height = { Translation = { Type = "GlobeTranslation", Globe = earth.Earth.Identifier, - Longitude = 0.0, - Latitude = 0.0, - FixedAltitude = 10000000.0 + Longitude = -74.006, + Latitude = 40.7128, + Altitude = 100000.0 } }, Renderable = { Type = "RenderableModel", Body = "NEW HORIZONS", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/NewHorizonsCleanModel.obj", - ColorTexture = textures .. "/NHTexture.jpg" - }} + GeometryFile = models .. "/NewHorizonsCleanModel.obj" }, GUI = { Path = "/Example" @@ -51,17 +39,14 @@ local Example_Adaptive_Height = { Type = "GlobeTranslation", Globe = earth.Earth.Identifier, Longitude = -74.006, - Latitude = 40.7128 + Latitude = 40.7128, + UseHeightmap = true } }, Renderable = { Type = "RenderableModel", Body = "NEW HORIZONS", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/NewHorizonsCleanModel.obj", - ColorTexture = textures .. "/NHTexture.jpg" - }} + GeometryFile = models .. "/NewHorizonsCleanModel.obj" }, GUI = { Path = "/Example" diff --git a/data/assets/examples/slidedeck.asset b/data/assets/examples/slidedeck.asset index fdd3756450..7d054dd2c1 100644 --- a/data/assets/examples/slidedeck.asset +++ b/data/assets/examples/slidedeck.asset @@ -15,17 +15,18 @@ asset.onInitialize(function () local interpolationDuration = 0.5 - function nextSlide() - helper.goToNextSlide(deck, interpolationDuration) - end + -- Add global functions for controlling slide deck and bind to keys + rawset(_G, "nextSlide", function() + helper.goToNextSlide(deck, interpolationDuration) + end) - function previousSlide() + rawset(_G, "previousSlide", function() helper.goToPreviousSlide(deck, interpolationDuration) - end + end) - function toggleSlides() + rawset(_G, "toggleSlides", function() helper.toggleSlides(deck, interpolationDuration) - end + end) helper.setCurrentSlide(deck, 1) openspace.bindKey("KP_6", "nextSlide()", "Next slide", "Next slide", "/Slides") diff --git a/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset b/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset index 79e51abc09..9e5e6545e8 100644 --- a/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/boulder_models.asset @@ -2,7 +2,7 @@ local models = asset.syncedResource({ Name = "Apollo Boulders Models", Type = "HttpSynchronization", Identifier = "apollo_boulders", - Version = 1 + Version = 2 }) asset.export('models', models) diff --git a/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset index ecf428a649..79d44f2fe0 100644 --- a/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation2.asset @@ -47,11 +47,7 @@ local Station2Boulder1Model = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/b1-v2.obj", - ColorTexture = models .. "/b1-v2_u1_v1.jpeg" - }}, + GeometryFile = models .. "/b1-v2.obj", RotationVector = { 243.243256 ,206.270264, 309.677429 }, LightSources = LightSources, PerformShading = false, @@ -93,11 +89,7 @@ local Station2Boulder2Model = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/b2model.obj", - ColorTexture = models .. "/b2model_u1_v1.jpeg" - }}, + GeometryFile = models .. "/b2model.obj", RotationVector = { 66.162155, 7.783780, 114.193550 }, LightSources = LightSources, PerformShading = false, @@ -139,11 +131,7 @@ local Station2Boulder3Model = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/b3model.obj", - ColorTexture = models .. "/b3model_u1_v1.jpeg" - }}, + GeometryFile = models .. "/b3model.obj", RotationVector = { 161.513519 ,243.243256, 65.806450 }, LightSources = LightSources, PerformShading = false, diff --git a/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset index 4f476305d2..8574725776 100644 --- a/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation6.asset @@ -58,11 +58,7 @@ local Station6Frag1Model = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/A17-S6-frag1.obj", - ColorTexture = models .. "/A17-S6-frag1.png" - }}, + GeometryFile = models .. "/A17-S6-frag1.obj", RotationVector = { 235.909088,165.000000,286.299194 }, LightSources = LightSources, PerformShading = false, @@ -105,11 +101,7 @@ local Station6Frag2Model = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/station6_boulder_frag2.obj", - ColorTexture = models .. "/frag2crop_u1_v1.jpeg" - }}, + GeometryFile = models .. "/station6_boulder_frag2.obj", RotationVector = { 336.959991,210.239990,325.984253 }, LightSources = LightSources, PerformShading = false, @@ -140,11 +132,7 @@ local Station6Frag3Model = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/station6_boulder_frag3.obj", - ColorTexture = models .. "/frag3crop_u1_v1.jpeg" - }}, + GeometryFile = models .. "/station6_boulder_frag3.obj", RotationVector = { 293.181824,255.000000,4.090910 }, LightSources = LightSources, PerformShading = false, diff --git a/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset index 26605a4a2a..7a185e33d8 100644 --- a/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset +++ b/data/assets/scene/solarsystem/missions/apollo/17/bouldersstation7.asset @@ -47,11 +47,7 @@ local Station7BoulderModel = { }, Renderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = models .. "/b7model.obj", - ColorTexture = models .. "/b7model_u1_v1.jpeg" - }}, + GeometryFile = models .. "/b7model.obj", RotationVector = { 1.945950,274.378387,212.903214 }, LightSources = LightSources, PerformShading = false, diff --git a/data/assets/scene/solarsystem/missions/gaia/gaia.asset b/data/assets/scene/solarsystem/missions/gaia/gaia.asset index 2268aa01bd..638ad5833f 100644 --- a/data/assets/scene/solarsystem/missions/gaia/gaia.asset +++ b/data/assets/scene/solarsystem/missions/gaia/gaia.asset @@ -20,7 +20,7 @@ local Gaia = { XAxis = { 1.0, 0.0, 0.0 }, XAxisOrthogonal = true, YAxis = "Sun", - YAxisInverted = true + YAxisInvert = true }, Scale = { Type = "StaticScale", diff --git a/data/assets/scene/solarsystem/missions/gaia/trail.asset b/data/assets/scene/solarsystem/missions/gaia/trail.asset index ee00ea2a6c..64b8dfd8de 100644 --- a/data/assets/scene/solarsystem/missions/gaia/trail.asset +++ b/data/assets/scene/solarsystem/missions/gaia/trail.asset @@ -11,7 +11,7 @@ local trail = asset.syncedResource({ local GaiaTrail = { Identifier = "GaiaTrail", - Parent = earthTransforms.EarthBarycenter.Identifier, + Parent = earthTransforms.EarthCenter.Identifier, Renderable = { Type = "RenderableTrailTrajectory", Translation = { @@ -36,7 +36,7 @@ local GaiaTrail = { local GaiaTrailEclip = { Identifier = "GaiaTrail_Eclip", - Parent = sunTransforms.SolarSystemBarycenter.Identifier, + Parent = sunTransforms.SunCenter.Identifier, Renderable = { Type = "RenderableTrailTrajectory", Enabled = false, diff --git a/data/assets/scene/solarsystem/missions/gaia/transforms.asset b/data/assets/scene/solarsystem/missions/gaia/transforms.asset index 5db3a1205c..83441604d5 100644 --- a/data/assets/scene/solarsystem/missions/gaia/transforms.asset +++ b/data/assets/scene/solarsystem/missions/gaia/transforms.asset @@ -11,7 +11,7 @@ local trail = asset.syncedResource({ local GaiaPosition = { Identifier = "GaiaPosition", - Parent = earthTransforms.EarthBarycenter.Identifier, + Parent = earthTransforms.EarthCenter.Identifier, Transform = { Translation = { Type = "HorizonsTranslation", diff --git a/data/assets/scene/solarsystem/missions/pioneer/pioneermodel.asset b/data/assets/scene/solarsystem/missions/pioneer/pioneermodel.asset index 2663f7fb32..f414337170 100644 --- a/data/assets/scene/solarsystem/missions/pioneer/pioneermodel.asset +++ b/data/assets/scene/solarsystem/missions/pioneer/pioneermodel.asset @@ -5,16 +5,12 @@ local modelFolder = asset.syncedResource({ Name = "Pioneer 10/11 Models", Type = "HttpSynchronization", Identifier = "pioneer_10_11_model", - Version = 2 + Version = 3 }) local ModelRenderable = { Type = "RenderableModel", - Geometry = {{ - Type = "MultiModelGeometry", - GeometryFile = modelFolder .. "/Pioneer.obj", - ColorTexture = modelFolder .. "/gray.png" - }}, + GeometryFile = modelFolder .. "/pioneer.fbx", LightSources = assetHelper.getDefaultLightSources( sunTransforms.SolarSystemBarycenter.Identifier ) diff --git a/data/assets/scene/solarsystem/planets/mars/atmosphere.asset b/data/assets/scene/solarsystem/planets/mars/atmosphere.asset index a3f30d278d..e76b1afd57 100644 --- a/data/assets/scene/solarsystem/planets/mars/atmosphere.asset +++ b/data/assets/scene/solarsystem/planets/mars/atmosphere.asset @@ -42,7 +42,6 @@ local Atmosphere = { G = 0.85 }, Debug = { - -- PreCalculatedTextureScale is a float from 1.0 to N, with N > 0.0 and N in Naturals (i.e., 1, 2, 3, 4, 5....) PreCalculatedTextureScale = 1.0, SaveCalculatedTextures = false } diff --git a/data/assets/scene/solarsystem/planets/venus/atmosphere.asset b/data/assets/scene/solarsystem/planets/venus/atmosphere.asset index a8d28ff7e4..7e39382692 100644 --- a/data/assets/scene/solarsystem/planets/venus/atmosphere.asset +++ b/data/assets/scene/solarsystem/planets/venus/atmosphere.asset @@ -42,7 +42,6 @@ local Atmosphere = { G = 0.85 }, Debug = { - -- PreCalculatedTextureScale is a float from 1.0 to N, with N > 0.0 and N in Naturals (i.e., 1, 2, 3, 4, 5....) PreCalculatedTextureScale = 1.0, SaveCalculatedTextures = false } diff --git a/data/assets/scene/solarsystem/sun/transforms.asset b/data/assets/scene/solarsystem/sun/transforms.asset index 29ab4120b8..ffa77be444 100644 --- a/data/assets/scene/solarsystem/sun/transforms.asset +++ b/data/assets/scene/solarsystem/sun/transforms.asset @@ -20,6 +20,24 @@ local SolarSystemBarycenter = { } } +local SunCenter = { + Identifier = "SunCenter", + Parent = SolarSystemBarycenter.Identifier, + Transform = { + Translation = { + Type = "SpiceTranslation", + Target = "SUN", + Observer = "SSB" + } + }, + GUI = { + Name = "SUN Center", + Path = "/Solar System/Sun", + Description = [[Spice frame for the Sun]], + Hidden = true + } +} + -- Spice frame for the Sun local SunIAU = { Identifier = "SunIAU", @@ -67,7 +85,7 @@ local SunECLIPJ2000 = { } } -assetHelper.registerSceneGraphNodesAndExport(asset, { SolarSystemBarycenter, SunIAU, SunECLIPJ2000 }) +assetHelper.registerSceneGraphNodesAndExport(asset, { SolarSystemBarycenter, SunCenter, SunIAU, SunECLIPJ2000 }) asset.meta = { diff --git a/data/assets/util/debug_helper.asset b/data/assets/util/debug_helper.asset index 6c75714d06..9b10fb04c6 100644 --- a/data/assets/util/debug_helper.asset +++ b/data/assets/util/debug_helper.asset @@ -67,7 +67,7 @@ local addCartesianAxes = function (specification) Parent = parent, Transform = { Scale = { - Type = "StaticScale", + Type = "NonUniformStaticScale", Scale = scale }, Translation = { diff --git a/data/assets/util/launcher_images.asset b/data/assets/util/launcher_images.asset index 32098b0c64..d2fd2efe90 100644 --- a/data/assets/util/launcher_images.asset +++ b/data/assets/util/launcher_images.asset @@ -2,6 +2,6 @@ local DataPath = asset.syncedResource({ Name = "Launcher Images", Type = "HttpSynchronization", Identifier = "launcher_images", - Version = 1 + Version = 2 }) asset.export("DataPath", DataPath) diff --git a/data/openspace-horiz-logo-crop.png b/data/openspace-horiz-logo-crop.png new file mode 100644 index 0000000000..05ae6643e0 Binary files /dev/null and b/data/openspace-horiz-logo-crop.png differ diff --git a/ext/ghoul b/ext/ghoul index 19cd82452a..57e96a6a8d 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 19cd82452a7139a6e8ed84a5c2fb6e4d5cb35452 +Subproject commit 57e96a6a8d10003eb22aaa471de8eec60d89df2c diff --git a/include/openspace/engine/configuration.h b/include/openspace/engine/configuration.h index eed5c055c5..f20b2d8900 100644 --- a/include/openspace/engine/configuration.h +++ b/include/openspace/engine/configuration.h @@ -98,18 +98,17 @@ struct Configuration { bool usePerProfileCache = false; bool isRenderingOnMasterDisabled = false; - glm::dvec3 globalRotation = glm::dvec3(0.0); - glm::dvec3 screenSpaceRotation = glm::dvec3(0.0); - glm::dvec3 masterRotation = glm::dvec3(0.0); + glm::vec3 globalRotation = glm::vec3(0.0); + glm::vec3 screenSpaceRotation = glm::vec3(0.0); + glm::vec3 masterRotation = glm::vec3(0.0); bool isConsoleDisabled = false; bool bypassLauncher = false; std::map moduleConfigurations; - std::string renderingMethod = "Framebuffer"; - struct OpenGLDebugContext { bool isActive = false; + bool printStacktrace = false; bool isSynchronous = true; struct IdentifierFilter { std::string type; diff --git a/include/openspace/interaction/sessionrecording.h b/include/openspace/interaction/sessionrecording.h index 69e7026102..bf3c1da067 100644 --- a/include/openspace/interaction/sessionrecording.h +++ b/include/openspace/interaction/sessionrecording.h @@ -145,6 +145,19 @@ public: */ std::chrono::steady_clock::time_point currentPlaybackInterpolationTime() const; + /** + * Returns the simulated application time. This simulated application time is only + * used when playback is set to be in the mode where a screenshot is captured with + * every rendered frame (enableTakeScreenShotDuringPlayback() is used to enable this + * mode). At the start of playback, this timer is set to the value of the current + * applicationTime function provided by the window delegate (used during normal + * mode or playback). However, during playback it is incremented by the fixed + * framerate of the playback rather than the actual clock value. + * + * \returns application time in seconds, for use in playback-with-frames mode + */ + double currentApplicationInterpolationTime() const; + /** * Starts a recording session, which will save data to the provided filename * according to the data format specified, and will continue until recording is @@ -719,6 +732,7 @@ protected: double _saveRenderingCurrentRecordedTime; std::chrono::steady_clock::duration _saveRenderingDeltaTime_interpolation_usec; std::chrono::steady_clock::time_point _saveRenderingCurrentRecordedTime_interpolation; + double _saveRenderingCurrentApplicationTime_interpolation; long long _saveRenderingClockInterpolation_countsPerSec; bool _saveRendering_isFirstFrame = true; diff --git a/include/openspace/rendering/abufferrenderer.h b/include/openspace/rendering/abufferrenderer.h deleted file mode 100644 index 5769c1e28c..0000000000 --- a/include/openspace/rendering/abufferrenderer.h +++ /dev/null @@ -1,183 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2021 * - * * - * 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___ABUFFERRENDERER___H__ -#define __OPENSPACE_CORE___ABUFFERRENDERER___H__ - -#ifdef OPENSPACE_WITH_ABUFFER_RENDERER - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace ghoul::filesystem { class File; } - -namespace ghoul::opengl { - class ProgramObject; - class Texture; -} // namespace ghoul::opengl - -namespace openspace { - -struct RaycasterTask; -class RenderableVolume; -class Camera; -class Scene; -struct RaycastData; - -class ABufferRenderer : public Renderer, public RaycasterListener { -public: - virtual ~ABufferRenderer() = default; - - void initialize() override; - void deinitialize() override; - - void setResolution(glm::ivec2 res) override; - void setNAaSamples(int nAaSamples) override; - void setBlurrinessLevel(int level) override; - void setHDRExposure(float hdrExposure) override; - void setGamma(float gamma) override; - void setMaxWhite(float maxWhite) override; - void setToneMapOperator(int tmOp) override; - void setBloomThreMin(float minV) override; - void setBloomThreMax(float maxV) override; - void setBloomOrigFactor(float origFactor) override; - void setBloomNewFactor(float newFactor) override; - void setKey(float key) override; - void setYwhite(float white) override; - void setTmoSaturation(float sat) override; - void setHue(float hue) override; - void setValue(float value) override; - void setSaturation(float sat) override; - void setLightness(float lightness) override; - void setColorSpace(unsigned int colorspace) override; - - void enableBloom(bool enable) override; - void enableHistogram(bool enable) override; - - int nAaSamples() const override; - const std::vector& mSSAPattern() const override; - - using Renderer::preRaycast; - void preRaycast(const RaycasterTask& raycasterTask); - using Renderer::postRaycast; - void postRaycast(const RaycasterTask& raycasterTask); - - void update() override; - void render(Scene* scene, Camera* camera, float blackoutFactor) override; - - /** - * Update render data - * Responsible for calling renderEngine::setRenderData - */ - virtual void updateRendererData() override; - virtual void raycastersChanged(VolumeRaycaster& raycaster, - IsAttached attached) override; - -private: - void clear(); - void updateResolution(); - void updateRaycastData(); - void updateResolveDictionary(); - void updateMSAASamplingPattern(); - void saveTextureToMemory(GLenum color_buffer_attachment, int width, int height, - std::vector & memory) const; - - glm::ivec2 _resolution = glm::ivec2(0); - - bool _dirtyResolution = true; - bool _dirtyRendererData = true; - bool _dirtyRaycastData = true; - bool _dirtyResolveDictionary = true; - - std::unique_ptr _resolveProgram = nullptr; - - /** - * When a volume is attached or detached from the scene graph, - * the resolve program needs to be recompiled. - * The _volumes map keeps track of which volumes that can - * be rendered using the current resolve program, along with their raycast data - * (id, namespace, etc) - */ - std::map _raycastData; - std::map< - VolumeRaycaster*, std::unique_ptr - > _boundsPrograms; - std::vector _helperPaths; - - ghoul::Dictionary _resolveDictionary; - - GLuint _mainColorTexture; - GLuint _mainDepthTexture; - - GLuint _mainFramebuffer; - GLuint _screenQuad; - GLuint _anchorPointerTexture; - GLuint _anchorPointerTextureInitializer; - GLuint _atomicCounterBuffer; - GLuint _fragmentBuffer; - GLuint _fragmentTexture; - GLuint _vertexPositionBuffer; - int _nAaSamples; - int _blurrinessLevel = 1; - - float _hdrExposure = 0.4f; - float _hdrBackground = 2.8f; - float _gamma = 2.2f; - float _maxWhite = 1.f; - float _blackoutFactor; - bool _bloomEnabled = false; - float _bloomThresholdMin = 0.0; - float _bloomThresholdMax = 1.0; - float _bloomOrigFactor = 1.0; - float _bloomNewFactor = 1.0; - int _toneMapOperator = 0; - bool _histogramEnabled = false; - int _numberOfBins = 1024; // JCC TODO: Add a parameter control for this. - float _tmoKey = 0.18f; - float _tmoYwhite = 1e6f; - float _tmoSaturation = 1.0f; - float _hue = 1.f; - float _saturation = 1.f; - float _value = 1.f; - float _lightness = 1.f; - unsigned int _colorSpace = 1; - - std::vector _mSAAPattern; - - ghoul::Dictionary _rendererData; -}; - -} // namespace openspace - -#endif // OPENSPACE_WITH_ABUFFER_RENDERER - -#endif // __OPENSPACE_CORE___ABUFFERRENDERER___H__ diff --git a/include/openspace/rendering/deferredcaster.h b/include/openspace/rendering/deferredcaster.h index 3d9f476848..c0b2f12d1e 100644 --- a/include/openspace/rendering/deferredcaster.h +++ b/include/openspace/rendering/deferredcaster.h @@ -51,8 +51,6 @@ public: const DeferredcastData& /*deferredData*/, ghoul::opengl::ProgramObject& /*program*/) {}; - virtual std::filesystem::path deferredcastPath() const = 0; - virtual std::filesystem::path deferredcastVSPath() const = 0; virtual std::filesystem::path deferredcastFSPath() const = 0; diff --git a/include/openspace/rendering/framebufferrenderer.h b/include/openspace/rendering/framebufferrenderer.h index d76c2c5d88..f88e6460c3 100644 --- a/include/openspace/rendering/framebufferrenderer.h +++ b/include/openspace/rendering/framebufferrenderer.h @@ -25,8 +25,6 @@ #ifndef __OPENSPACE_CORE___FRAMEBUFFERRENDERER___H__ #define __OPENSPACE_CORE___FRAMEBUFFERRENDERER___H__ -#include -#include #include #include @@ -56,14 +54,14 @@ struct RaycasterTask; class Scene; struct UpdateStructures; -class FramebufferRenderer : public Renderer, public RaycasterListener, +class FramebufferRenderer : public RaycasterListener, public DeferredcasterListener { public: virtual ~FramebufferRenderer() = default; - void initialize() override; - void deinitialize() override; + void initialize(); + void deinitialize(); void updateResolution(); void updateRaycastData(); @@ -72,33 +70,33 @@ public: void updateFXAA(); void updateDownscaledVolume(); - void setResolution(glm::ivec2 res) override; - void setHDRExposure(float hdrExposure) override; - void setGamma(float gamma) override; - void setHue(float hue) override; - void setValue(float value) override; - void setSaturation(float sat) override; + void setResolution(glm::ivec2 res); + void setHDRExposure(float hdrExposure); + void setGamma(float gamma); + void setHue(float hue); + void setValue(float value); + void setSaturation(float sat); - void enableFXAA(bool enable) override; - void setDisableHDR(bool disable) override; + void enableFXAA(bool enable); + void setDisableHDR(bool disable); - void update() override; + void update(); void performRaycasterTasks(const std::vector& tasks, const glm::ivec4& viewport); void performDeferredTasks(const std::vector& tasks, const glm::ivec4& viewport); - void render(Scene* scene, Camera* camera, float blackoutFactor) override; + void render(Scene* scene, Camera* camera, float blackoutFactor); /** * Update render data * Responsible for calling renderEngine::setRenderData */ - virtual void updateRendererData() override; + virtual void updateRendererData(); virtual void raycastersChanged(VolumeRaycaster& raycaster, - RaycasterListener::IsAttached attached) override; + RaycasterListener::IsAttached attached); virtual void deferredcastersChanged(Deferredcaster& deferredcaster, - DeferredcasterListener::IsAttached isAttached) override; + DeferredcasterListener::IsAttached isAttached); private: using RaycasterProgObjMap = std::map< diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h index 28cee7e43a..388e0c8044 100644 --- a/include/openspace/rendering/renderengine.h +++ b/include/openspace/rendering/renderengine.h @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -54,7 +55,6 @@ namespace scripting { struct LuaLibrary; } class Camera; class RaycasterManager; class DeferredcasterManager; -class Renderer; class Scene; class SceneManager; class ScreenLog; @@ -63,12 +63,6 @@ struct ShutdownInformation; class RenderEngine : public properties::PropertyOwner { public: - enum class RendererImplementation { - Framebuffer = 0, - ABuffer, - Invalid - }; - RenderEngine(); ~RenderEngine(); @@ -80,9 +74,6 @@ public: Scene* scene(); void updateScene(); - const Renderer& renderer() const; - RendererImplementation rendererImplementation() const; - ghoul::opengl::OpenGLStateCache& openglStateCache(); void updateShaderPrograms(); @@ -120,24 +111,11 @@ public: void removeRenderProgram(ghoul::opengl::ProgramObject* program); - /** - * Set raycasting uniforms on the program object, and setup raycasting. - */ - void preRaycast(ghoul::opengl::ProgramObject& programObject); - - /** - * Tear down raycasting for the specified program object. - */ - void postRaycast(ghoul::opengl::ProgramObject& programObject); - /** * Set the camera to use for rendering */ void setCamera(Camera* camera); - - void setRendererFromString(const std::string& renderingMethod); - /** * Lets the renderer update the data to be brought into the rendererer programs * as a 'rendererData' variable in the dictionary. @@ -176,9 +154,6 @@ public: uint64_t frameNumber() const; private: - void setRenderer(std::unique_ptr renderer); - RendererImplementation rendererFromString(const std::string& renderingMethod) const; - void renderScreenLog(); void renderVersionInformation(); void renderCameraInformation(); @@ -188,13 +163,12 @@ private: Camera* _camera = nullptr; Scene* _scene = nullptr; - std::unique_ptr _renderer; - RendererImplementation _rendererImplementation = RendererImplementation::Invalid; + FramebufferRenderer _renderer; ghoul::Dictionary _rendererData; ghoul::Dictionary _resolveData; ScreenLog* _log = nullptr; - ghoul::opengl::OpenGLStateCache* _openglStateCache; + ghoul::opengl::OpenGLStateCache* _openglStateCache = nullptr; properties::BoolProperty _showOverlayOnSlaves; properties::BoolProperty _showLog; diff --git a/include/openspace/rendering/renderer.h b/include/openspace/rendering/renderer.h deleted file mode 100644 index 6a9243592d..0000000000 --- a/include/openspace/rendering/renderer.h +++ /dev/null @@ -1,83 +0,0 @@ -/***************************************************************************************** - * * - * OpenSpace * - * * - * Copyright (c) 2014-2021 * - * * - * 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___RENDERER___H__ -#define __OPENSPACE_CORE___RENDERER___H__ - -#include -#include - -namespace ghoul { class Dictionary; } -namespace ghoul::filesystem { class File; } -namespace ghoul::opengl { - class ProgramObject; - class Texture; -} // namespace ghoul::opengl - -namespace openspace { - -class RenderableVolume; -class Camera; -class Scene; - -class Renderer { -public: - virtual ~Renderer() = default; - - virtual void initialize() = 0; - virtual void deinitialize() = 0; - - virtual void setResolution(glm::ivec2 res) = 0; - virtual void setHDRExposure(float hdrExposure) = 0; - virtual void setGamma(float gamma) = 0; - virtual void setHue(float hue) = 0; - virtual void setValue(float value) = 0; - virtual void setSaturation(float sat) = 0; - virtual void enableFXAA(bool enable) = 0; - virtual void setDisableHDR(bool disable) = 0; - - /** - * Set raycasting uniforms on the program object, and setup raycasting. - */ - virtual void preRaycast(ghoul::opengl::ProgramObject& /*programObject*/) {}; - - /** - * Tear down raycasting for the specified program object. - */ - virtual void postRaycast(ghoul::opengl::ProgramObject& /*programObject*/) {}; - - - virtual void update() = 0; - - virtual void render(Scene* scene, Camera* camera, float blackoutFactor) = 0; - /** - * Update render data - * Responsible for calling renderEngine::setRenderData - */ - virtual void updateRendererData() = 0; -}; - -} // openspace - -#endif // __OPENSPACE_CORE___RENDERER___H__ diff --git a/include/openspace/scene/scene.h b/include/openspace/scene/scene.h index fc22f6d1e2..f1a03be8e5 100644 --- a/include/openspace/scene/scene.h +++ b/include/openspace/scene/scene.h @@ -238,7 +238,7 @@ private: * Update dependencies. */ void updateNodeRegistry(); - + std::chrono::steady_clock::time_point currentTimeForInterpolation(); void sortTopologically(); std::unique_ptr _camera; diff --git a/include/openspace/util/concurrentjobmanager.inl b/include/openspace/util/concurrentjobmanager.inl index a49dff3da9..0816b910c2 100644 --- a/include/openspace/util/concurrentjobmanager.inl +++ b/include/openspace/util/concurrentjobmanager.inl @@ -36,7 +36,7 @@ template void ConcurrentJobManager

::enqueueJob(std::shared_ptr> job) { threadPool.enqueue([this, job]() { job->execute(); - std::lock_guard lock(_finishedJobsMutex); + std::lock_guard lock(_finishedJobsMutex); _finishedJobs.push(job); }); } @@ -50,7 +50,7 @@ template std::shared_ptr> ConcurrentJobManager

::popFinishedJob() { ghoul_assert(!_finishedJobs.empty(), "There is no finished job to pop!"); - std::lock_guard lock(_finishedJobsMutex); + std::lock_guard lock(_finishedJobsMutex); return _finishedJobs.pop(); } diff --git a/include/openspace/util/timeline.h b/include/openspace/util/timeline.h index 60e71f25cc..86363f6d5b 100644 --- a/include/openspace/util/timeline.h +++ b/include/openspace/util/timeline.h @@ -32,16 +32,16 @@ namespace openspace { /** -* Base class for keyframes -*/ + * Base class for keyframes + */ struct KeyframeBase { size_t id; double timestamp; }; /** -* Templated class for keyframes containing data -*/ + * Templated class for keyframes containing data + */ template struct Keyframe : public KeyframeBase { Keyframe(size_t i, double t, T d); @@ -54,8 +54,8 @@ struct Keyframe : public KeyframeBase { }; /** -* Templated class for timelines -*/ + * Templated class for timelines + */ template class Timeline { public: @@ -81,20 +81,30 @@ private: }; /** -* Return true if the timestamp of a is smaller the timestamp of b. -*/ + * Return true if the timestamp of a is smaller the timestamp of b. + */ bool compareKeyframeTimes(const KeyframeBase& a, const KeyframeBase& b); /** -* Return true if a is smaller than the timestamp of b. -*/ + * Return true if a is smaller than the timestamp of b. + */ bool compareTimeWithKeyframeTime(double a, const KeyframeBase& b); /** -* Return true if the timestamp of a is smaller than b. -*/ + * Return true if the timestamp of a is smaller than b. + */ bool compareKeyframeTimeWithTime(const KeyframeBase& a, double b); +/** + * Return true if the timestamp of a is smaller than or equal to b. + * This is used only in the mode of saving render frames during session recording + * playback. This was necessary to correct a small timing issue caused by fixing + * the application time according to the playback framerate. In normal operation, + * the application time at the instant the keyframes are evaluated is always a + * little bit newer than the first keyframe in the timeline. + */ +bool compareKeyframeTimeWithTime_playbackWithFrames(const KeyframeBase& a, double b); + } // namespace openspace #include "timeline.inl" diff --git a/include/openspace/util/timemanager.h b/include/openspace/util/timemanager.h index d7500939c6..5914841073 100644 --- a/include/openspace/util/timemanager.h +++ b/include/openspace/util/timemanager.h @@ -121,12 +121,14 @@ public: private: void progressTime(double dt); - void applyKeyframeData(const TimeKeyframeData& keyframe); + void applyKeyframeData(const TimeKeyframeData& keyframe, double dt); TimeKeyframeData interpolate(const Keyframe& past, const Keyframe& future, double time); void addDeltaTimesKeybindings(); void clearDeltaTimesKeybindings(); + double currentApplicationTimeForInterpolation() const; + double previousApplicationTimeForInterpolation() const; Timeline _timeline; SyncData