Merge branch 'master' into feature/jwst-update

This commit is contained in:
Malin E
2022-03-07 15:16:25 +01:00
180 changed files with 3153 additions and 1493 deletions

View File

@@ -27,9 +27,9 @@ cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(OpenSpace)
set(OPENSPACE_VERSION_MAJOR 0)
set(OPENSPACE_VERSION_MINOR 17)
set(OPENSPACE_VERSION_PATCH 1)
set(OPENSPACE_VERSION_STRING "Beta-10")
set(OPENSPACE_VERSION_MINOR 18)
set(OPENSPACE_VERSION_PATCH -1)
set(OPENSPACE_VERSION_STRING "Beta-11")
set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}")
set(OPENSPACE_CMAKE_EXT_DIR "${OPENSPACE_BASE_DIR}/support/cmake")

60
Jenkinsfile vendored
View File

@@ -29,42 +29,6 @@ def moduleCMakeFlags() {
modules = bat(returnStdout: true, script: '@dir modules /b /ad /on').trim().split('\r\n');
}
// def dirs = readDir();
// def currentDir = new File('.')
// def dirs = []
// currentDir.eachFile FileType.DIRECTORIES, {
// dirs << it.name
// }
// def moduleFlags = [
// 'atmosphere',
// 'base',
// // 'cefwebgui',
// 'debugging',
// 'digitaluniverse',
// 'fieldlines',
// 'fieldlinessequence',
// 'fitsfilereader',
// 'gaia',
// 'galaxy',
// 'globebrowsing',
// 'imgui',
// 'iswa',
// 'kameleon',
// 'kameleonvolume',
// 'multiresvolume',
// 'server',
// 'space',
// 'spacecraftinstruments',
// 'space',
// 'spout',
// 'sync',
// 'touch',
// 'toyvolume',
// 'volume',
// // 'webbrowser',
// // 'webgui'
// ];
def flags = '';
for (module in modules) {
flags += "-DOPENSPACE_MODULE_${module.toUpperCase()}=ON "
@@ -72,8 +36,6 @@ def moduleCMakeFlags() {
return flags;
}
// echo flags
//
// Pipeline start
//
@@ -114,8 +76,10 @@ linux_gcc_make: {
compileHelper.recordCompileIssues(compileHelper.Gcc());
}
stage('linux-gcc-make/test') {
testHelper.runUnitTests('bin/codegentest');
testHelper.runUnitTests('bin/SGCTTest');
testHelper.runUnitTests('bin/GhoulTest');
testHelper.runUnitTests('bin/OpenSpaceTest');
testHelper.runUnitTests('bin/codegentest')
}
cleanWs()
} // node('linux')
@@ -135,8 +99,10 @@ linux_gcc_ninja: {
compileHelper.build(compileHelper.Ninja(), compileHelper.Gcc(), cmakeCompileOptions, '', 'build-ninja');
}
stage('linux-gcc-ninja/test') {
testHelper.runUnitTests('bin/codegentest');
testHelper.runUnitTests('bin/SGCTTest');
testHelper.runUnitTests('bin/GhoulTest');
testHelper.runUnitTests('bin/OpenSpaceTest');
testHelper.runUnitTests('bin/codegentest')
}
cleanWs()
} // node('linux')
@@ -157,8 +123,10 @@ linux_clang_make: {
compileHelper.recordCompileIssues(compileHelper.Clang());
}
stage('linux-clang-make/test') {
testHelper.runUnitTests('bin/codegentest');
testHelper.runUnitTests('bin/SGCTTest');
testHelper.runUnitTests('bin/GhoulTest');
testHelper.runUnitTests('bin/OpenSpaceTest');
testHelper.runUnitTests('bin/codegentest')
}
cleanWs()
} // node('linux')
@@ -178,8 +146,10 @@ linux_clang_ninja: {
compileHelper.build(compileHelper.Ninja(), compileHelper.Clang(), cmakeCompileOptions, '', 'build-ninja');
}
stage('linux-clang-ninja/test') {
testHelper.runUnitTests('bin/codegentest');
testHelper.runUnitTests('bin/SGCTTest');
testHelper.runUnitTests('bin/GhoulTest');
testHelper.runUnitTests('bin/OpenSpaceTest');
testHelper.runUnitTests('bin/codegentest')
}
cleanWs()
} // node('linux')
@@ -197,8 +167,10 @@ windows_msvc: {
compileHelper.recordCompileIssues(compileHelper.VisualStudio());
}
stage('windows-msvc/test') {
testHelper.runUnitTests('bin\\Debug\\OpenSpaceTest')
testHelper.runUnitTests('bin\\Debug\\codegentest')
testHelper.runUnitTests('bin\\Debug\\codegentest');
testHelper.runUnitTests('bin\\Debug\\SGCTTest');
testHelper.runUnitTests('bin\\Debug\\GhoulTest');
testHelper.runUnitTests('bin\\Debug\\OpenSpaceTest');
}
cleanWs()
} // node('windows')

View File

@@ -123,6 +123,7 @@ set_folder_location(quat "External")
set_folder_location(tinyxml2static "External")
set_folder_location(vrpn "External")
set_folder_location(zlibstatic "External")
set_folder_location(SGCTTest "Unit Tests")
if (UNIX AND (NOT APPLE))
target_link_libraries(OpenSpace PRIVATE Xcursor Xinerama X11)

View File

@@ -546,7 +546,7 @@ void ActionDialog::actionSaved() {
// If we got this far, we have a new identifier and it is a new one, so we need to
// update other keybinds now
ghoul_assert(
_keybindingWidgets.list->count() == _keybindingsData.size(),
_keybindingWidgets.list->count() == static_cast<int>(_keybindingsData.size()),
"The list and data got out of sync"
);
for (int i = 0; i < _keybindingWidgets.list->count(); ++i) {

View File

@@ -419,15 +419,15 @@ void PropertiesDialog::selectLineFromScriptLog() {
// openspace.setPropertyValue('prop', value);
if (text.startsWith("openspace.setPropertyValueSingle")) {
using namespace std::string_view_literals;
_commandCombo->setCurrentIndex(0);
text = text.mid("openspace.setPropertyValueSingle"sv.size() + 1); // +1 for (
std::string_view prefix = "openspace.setPropertyValueSingle";
text = text.mid(static_cast<int>(prefix.size()) + 1); // +1 for (
}
else {
// command == "openspace.setPropertyValue"
using namespace std::string_view_literals;
_commandCombo->setCurrentIndex(1);
text = text.mid("openspace.setPropertyValue"sv.size() + 1); // +1 for (
std::string_view prefix = "openspace.setPropertyValue";
text = text.mid(static_cast<int>(prefix.size()) + 1); // +1 for (
}
// Remove everything past the closing brace

View File

@@ -79,7 +79,7 @@
#endif // OPENVR_SUPPORT
#ifdef OPENSPACE_HAS_SPOUT
#include "SpoutLibrary.h"
#include <modules/spout/spoutwrapper.h>
#endif // OPENSPACE_HAS_SPOUT
#ifdef OPENSPACE_HAS_NVTOOLS
@@ -120,16 +120,11 @@ Window* FirstOpenVRWindow = nullptr;
* the \c leftOrMain and \c right members respectively.
*/
struct SpoutWindow {
struct SpoutData {
SPOUTHANDLE handle = nullptr;
bool initialized = false;
};
/// The left framebuffer (or main, if there is no stereo rendering)
SpoutData leftOrMain;
openspace::spout::SpoutSender leftOrMain;
/// The right framebuffer
SpoutData right;
openspace::spout::SpoutSender right;
/// The window ID of this windows
size_t windowId = size_t(-1);
@@ -291,41 +286,33 @@ void mainInitFunc(GLFWwindow*) {
#ifdef OPENSPACE_HAS_SPOUT
SpoutWindow w;
w.windowId = i;
bool retValue = true;
std::string mainWindowName = window.name();
const Window::StereoMode sm = window.stereoMode();
const bool hasStereo = (sm != Window::StereoMode::NoStereo) &&
(sm < Window::StereoMode::SideBySide);
if (hasStereo) {
SpoutWindow::SpoutData& left = w.leftOrMain;
left.handle = GetSpout();
left.initialized = left.handle->CreateSender(
(window.name() + "_left").c_str(),
window.framebufferResolution().x,
window.framebufferResolution().y
);
SpoutWindow::SpoutData& right = w.right;
right.handle = GetSpout();
right.initialized = right.handle->CreateSender(
(window.name() + "_right").c_str(),
window.framebufferResolution().x,
window.framebufferResolution().y
);
}
else {
SpoutWindow::SpoutData& main = w.leftOrMain;
main.handle = GetSpout();
main.initialized = main.handle->CreateSender(
window.name().c_str(),
mainWindowName = window.name() + "_left";
retValue &= w.right.updateSenderName((window.name() + "_right").c_str());
retValue &= w.right.updateSenderSize(
window.framebufferResolution().x,
window.framebufferResolution().y
);
}
SpoutWindows.push_back(std::move(w));
retValue &= w.leftOrMain.updateSenderName(mainWindowName.c_str());
retValue &= w.leftOrMain.updateSenderSize(
window.framebufferResolution().x,
window.framebufferResolution().y
);
w.windowId = i;
if (retValue) {
SpoutWindows.push_back(std::move(w));
}
#else
LWARNING("Spout was requested, but program was compiled without Spout support");
#endif // OPENSPACE_HAS_SPOUT
@@ -513,6 +500,29 @@ void mainRenderFunc(const sgct::RenderData& data) {
currentModelMatrix = modelMatrix;
currentModelViewProjectionMatrix = modelMatrix * viewMatrix * projectionMatrix;
global::openSpaceEngine->render(modelMatrix, viewMatrix, projectionMatrix);
#ifdef OPENSPACE_HAS_SPOUT
for (SpoutWindow& w : SpoutWindows) {
sgct::Window& window = *Engine::instance().windows()[w.windowId];
int width = window.framebufferResolution().x;
int height = window.framebufferResolution().y;
w.leftOrMain.saveGLState();
if (w.leftOrMain.isCreated() && w.leftOrMain.updateSenderSize(width, height))
{
GLuint texId = window.frameBufferTexture(Window::TextureIndex::LeftEye);
w.leftOrMain.updateSender(texId, static_cast<int>(GL_TEXTURE_2D));
}
if (w.right.isCreated() && w.right.updateSenderSize(width, height)) {
GLuint texId = window.frameBufferTexture(Window::TextureIndex::RightEye);
w.right.updateSender(texId, static_cast<int>(GL_TEXTURE_2D));
}
w.leftOrMain.restoreGLState();
}
#endif // OPENSPACE_HAS_SPOUT
}
catch (const ghoul::RuntimeError& e) {
LERRORC(e.component, e.message);
@@ -564,34 +574,6 @@ void mainPostDrawFunc() {
global::openSpaceEngine->postDraw();
#ifdef OPENSPACE_HAS_SPOUT
for (const SpoutWindow& w : SpoutWindows) {
sgct::Window& window = *Engine::instance().windows()[w.windowId];
if (w.leftOrMain.initialized) {
const GLuint texId = window.frameBufferTexture(Window::TextureIndex::LeftEye);
glBindTexture(GL_TEXTURE_2D, texId);
w.leftOrMain.handle->SendTexture(
texId,
GLuint(GL_TEXTURE_2D),
window.framebufferResolution().x,
window.framebufferResolution().y
);
}
if (w.right.initialized) {
const GLuint tId = window.frameBufferTexture(Window::TextureIndex::RightEye);
glBindTexture(GL_TEXTURE_2D, tId);
w.right.handle->SendTexture(
tId,
GLuint(GL_TEXTURE_2D),
window.framebufferResolution().x,
window.framebufferResolution().y
);
}
}
glBindTexture(GL_TEXTURE_2D, 0);
#endif // OPENSPACE_HAS_SPOUT
LTRACE("main::mainPostDrawFunc(end)");
}
@@ -797,8 +779,8 @@ void setSgctDelegateFunctions() {
Viewport* viewport = currentWindow->viewports().front().get();
if (viewport != nullptr) {
if (viewport->hasSubViewports() && viewport->nonLinearProjection()) {
int res = viewport->nonLinearProjection()->cubemapResolution();
return glm::ivec2(res, res);
ivec2 dim = viewport->nonLinearProjection()->cubemapResolution();
return glm::ivec2(dim.x, dim.y);
}
else if (currentWindow->viewports().size() > 1) {
// @TODO (abock, 2020-04-09) This should probably be based on the current
@@ -1138,10 +1120,27 @@ int main(int argc, char* argv[]) {
std::filesystem::path base = configurationFilePath.parent_path();
FileSys.registerPathToken("${BASE}", base);
// The previous incarnation of this was initializing GLFW to get the primary
// monitor's resolution, but that had some massive performance implications as
// there was some issue with the swap buffer handling inside of GLFW. My
// assumption is that GLFW doesn't like being initialized, destroyed, and then
// initialized again. Therefore we are using the platform specific functions now
glm::ivec2 size = glm::ivec2(1920, 1080);
#ifdef WIN32
DEVMODEW dm = { 0 };
dm.dmSize = sizeof(DEVMODEW);
BOOL success = EnumDisplaySettingsW(nullptr, ENUM_CURRENT_SETTINGS, &dm);
if (success) {
size.x = dm.dmPelsWidth;
size.y = dm.dmPelsHeight;
}
#endif // WIN32
// Loading configuration from disk
LDEBUG("Loading configuration from disk");
*global::configuration = configuration::loadConfigurationFromFile(
configurationFilePath.string(),
size,
commandlineArguments.configurationOverride
);
@@ -1344,14 +1343,8 @@ int main(int argc, char* argv[]) {
#ifdef OPENSPACE_HAS_SPOUT
for (SpoutWindow& w : SpoutWindows) {
if (w.leftOrMain.handle) {
w.leftOrMain.handle->ReleaseReceiver();
w.leftOrMain.handle->Release();
}
if (w.right.handle) {
w.right.handle->ReleaseReceiver();
w.right.handle->Release();
}
w.leftOrMain.release();
w.right.release();
}
#endif // OPENSPACE_HAS_SPOUT

View File

@@ -77,6 +77,11 @@ int main(int argc, char** argv) {
)
);
ghoul::logging::LogManager::initialize(
ghoul::logging::LogLevel::Debug,
ghoul::logging::LogManager::ImmediateFlush::Yes
);
commandlineParser.setCommandLine(arguments);
commandlineParser.execute();
@@ -98,10 +103,6 @@ int main(int argc, char** argv) {
settings.changeHostPassword = defaultChangeHostPassword.str();
}
ghoul::logging::LogManager::initialize(
ghoul::logging::LogLevel::Debug,
ghoul::logging::LogManager::ImmediateFlush::Yes
);
LINFO(fmt::format("Connection password: {}", settings.password));
LINFO(fmt::format("Host password: {}", settings.changeHostPassword));

View File

@@ -0,0 +1,67 @@
{
"version": 1,
"masteraddress": "localhost",
"externalcontrolport": 20500,
"settings": {
"display": {
"swapinterval": 0
}
},
"nodes": [
{
"address": "localhost",
"port": 20401,
"windows": [
{
"name": "OpenSpace",
"pos": { "x": 50, "y": 50 },
"size": { "x": 1280, "y": 720 },
"stereo": "none",
"tags": [ "Spout" ],
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"tracked": true,
"projection": {
"type": "PlanarProjection",
"fov": {
"hfov": 80.0,
"vfov": 50.53401565551758
},
"orientation": { "yaw": 0.0, "pitch": 0.0, "roll": 0.0 }
}
}
]
},
{
"name": "GUI",
"pos": { "x": 50, "y": 50 },
"size": { "x": 1280, "y": 720 },
"stereo": "none",
"tags": [ "GUI" ],
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"projection": {
"type": "PlanarProjection",
"fov": {
"hfov": 80.0,
"vfov": 50.53401565551758
},
"orientation": { "yaw": 0.0, "pitch": 0.0, "roll": 0.0 }
}
}
]
}
]
}
],
"users": [
{
"eyeseparation": 0.06499999761581421,
"pos": { "x": 0.0, "y": 0.0, "z": 0.0 }
}
]
}

View File

@@ -1,36 +0,0 @@
{
"version": 1,
"masteraddress": "localhost",
"nodes": [
{
"address": "localhost",
"port": 20401,
"windows": [
{
"fullscreen": false,
"name": "OpenSpace",
"stereo": "none",
"size": { "x": 1024, "y": 1024 },
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"projection": {
"type": "SpoutOutputProjection",
"quality": "1k",
"mappingspoutname": "OpenSpace",
"background": { "r": 0.1, "g": 0.1, "b": 0.1, "a": 1.0 }
}
}
]
}
]
}
],
"users": [
{
"eyeseparation": 0.06,
"pos": { "x": 0.0, "y": 0.0, "z": 0.0 }
}
]
}

View File

@@ -0,0 +1,60 @@
{
"version": 1,
"masteraddress": "localhost",
"scene": {
"offset": { "x": 0.0, "y": 0.0, "z": 0.0 },
"orientation": { "yaw": 0.0, "pitch": -90.0, "roll": 0.0 },
"scale": 1.0
},
"settings": {
"display": {
"swapinterval": 1
}
},
"nodes": [
{
"address": "localhost",
"port": 20401,
"windows": [
{
"name": "OpenSpace",
"size": { "x": 1024, "y": 1024 },
"stereo": "none",
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"projection": {
"type": "SpoutOutputProjection",
"background": {
"r": 0.1,
"g": 0.1,
"b": 0.1,
"a": 1.0
},
"channels": {
"bottom": true,
"left": true,
"right": true,
"top": true,
"zleft": true,
"zright": true
},
"mapping": "cubemap",
"mappingspoutname": "OS_CUBEMAP",
"orientation": { "pitch": 0.0, "roll": 0.0, "yaw": 0.0 },
"quality": "1024"
}
}
]
}
]
}
],
"users": [
{
"eyeseparation": 0.05999999865889549,
"pos": { "x": 0.0, "y": 0.0, "z": 0.0 }
}
]
}

View File

@@ -0,0 +1,60 @@
{
"version": 1,
"masteraddress": "localhost",
"scene": {
"offset": { "x": 0.0, "y": 0.0, "z": 0.0 },
"orientation": { "yaw": 0.0, "pitch": -90.0, "roll": 0.0 },
"scale": 1.0
},
"settings": {
"display": {
"swapinterval": 1
}
},
"nodes": [
{
"address": "localhost",
"port": 20401,
"windows": [
{
"name": "OpenSpace",
"size": { "x": 1024, "y": 1024 },
"stereo": "none",
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"projection": {
"type": "SpoutOutputProjection",
"background": {
"r": 0.1,
"g": 0.1,
"b": 0.1,
"a": 1.0
},
"channels": {
"bottom": true,
"left": true,
"right": true,
"top": true,
"zleft": true,
"zright": true
},
"mapping": "equirectangular",
"mappingspoutname": "OS_EQUIRECTANGULAR",
"orientation": { "pitch": 0.0, "roll": 0.0, "yaw": 0.0 },
"quality": "1024"
}
}
]
}
]
}
],
"users": [
{
"eyeseparation": 0.06,
"pos": { "x": 0.0, "y": 0.0, "z": 0.0 }
}
]
}

View File

@@ -0,0 +1,60 @@
{
"version": 1,
"masteraddress": "localhost",
"scene": {
"offset": { "x": 0.0, "y": 0.0, "z": 0.0 },
"orientation": { "yaw": 0.0, "pitch": 0.0, "roll": 0.0 },
"scale": 1.0
},
"settings": {
"display": {
"swapinterval": 1
}
},
"nodes": [
{
"address": "localhost",
"port": 20401,
"windows": [
{
"name": "OpenSpace",
"size": { "x": 1024, "y": 1024 },
"stereo": "none",
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"projection": {
"type": "SpoutOutputProjection",
"background": {
"r": 0.1,
"g": 0.1,
"b": 0.1,
"a": 1.0
},
"channels": {
"bottom": false,
"left": true,
"right": true,
"top": true,
"zleft": true,
"zright": false
},
"mapping": "fisheye",
"mappingspoutname": "OS_FISHEYE",
"orientation": { "pitch": 0.0, "roll": 0.0, "yaw": 45.0 },
"quality": "1024"
}
}
]
}
]
}
],
"users": [
{
"eyeseparation": 0.06,
"pos": { "x": 0.0, "y": 0.0, "z": 0.0 }
}
]
}

View File

@@ -0,0 +1,59 @@
{
"version": 1,
"masteraddress": "localhost",
"scene": {
"offset": { "x": 0.0, "y": 0.0, "z": 0.0 },
"orientation": { "yaw": 0.0, "pitch": 0.0, "roll": 0.0 },
"scale": 1.0
},
"settings": {
"display": {
"swapinterval": 1
}
},
"nodes": [
{
"address": "localhost",
"port": 20401,
"windows": [
{
"name": "OpenSpace",
"size": { "x": 1440, "y": 810 },
"stereo": "none",
"viewports": [
{
"pos": { "x": 0.0, "y": 0.0 },
"size": { "x": 1.0, "y": 1.0 },
"projection": {
"PlanarProjection": {
"fov": {
"hfov": 80.0,
"vfov": 50.534015846724
},
"orientation": { "yaw": 0.0, "pitch": 0.0, "roll": 0.0 }
},
"background": {
"r": 0.1,
"g": 0.1,
"b": 0.1,
"a": 1.0
},
"drawMain": true,
"height": "1080",
"mappingspoutname": "OS_FLAT",
"type": "SpoutFlatProjection",
"width": "1920"
}
}
]
}
]
}
],
"users": [
{
"eyeseparation": 0.05999999865889549,
"pos": { "x": 0.0, "y": 0.0, "z": 0.0 }
}
]
}

View File

@@ -29,7 +29,7 @@ local wmap = {
Texture = textures .. "wmap_ilc_7yr_v4_200uK_RGB_sos.png",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {
@@ -55,7 +55,7 @@ local cbe = {
Texture = textures .. "COBErect.png",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {
@@ -81,7 +81,7 @@ local planck = {
Texture = textures .. "cmb4k.jpg",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {
@@ -107,7 +107,7 @@ local Halpha = {
Opacity = 0.4,
Texture = textures .. "mwHalpha-f.png",
Orientation = "Inside",
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
MirrorTexture = true,
FadeOutThreshold = 0.025,
Background = true

View File

@@ -26,7 +26,7 @@ local multiverse_planck_1 = {
Texture = textures .. "cmb4k.jpg",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {
@@ -56,7 +56,7 @@ local multiverse_planck_2 = {
Texture = textures .. "cmb4k.jpg",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {
@@ -86,7 +86,7 @@ local multiverse_planck_3 = {
Texture = textures .. "cmb4k.jpg",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {
@@ -116,7 +116,7 @@ local multiverse_planck_4 = {
Texture = textures .. "cmb4k.jpg",
Orientation = "Both",
MirrorTexture = true,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
FadeInThreshold = 0.4
},
GUI = {

View File

@@ -21,7 +21,7 @@ local sphere = {
Opacity = 0.35,
Texture = sphereTextures .. "DarkUniverse_mellinger_4k.jpg",
Orientation = "Inside",
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
MirrorTexture = true,
FadeOutThreshold = 0.0015,
Background = true

View File

@@ -19,7 +19,7 @@ local object = {
Segments = 40,
Opacity = 0.4,
Texture = textures .. "eso0932a_blend.png",
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
Orientation = "Inside",
MirrorTexture = true,
FadeOutThreshold = 0.01,

View File

@@ -41,7 +41,7 @@ local JWSTBand = {
DisableFadeInOut = true,
Orientation = "Inside",
Opacity = 0.05,
UseAdditiveBlending = true,
RenderBinMode = "PreDeferredTransparent",
},
Tag = { "mission_jwst_fov" },
GUI = {

View File

@@ -1,4 +1,5 @@
-- Color layers
asset.require("./layers/colorlayers/blue_marble")
local colorLayer = asset.require("./layers/colorlayers/esri_viirs_combo")
asset.require("./layers/colorlayers/esri_world_imagery")
asset.require("./layers/colorlayers/esri_imagery_world_2D")
@@ -13,9 +14,11 @@ asset.require("./layers/colorlayers/ghrsst_l4_g1sst_sea_surface_temperature_temp
asset.require("./layers/colorlayers/ghrsst_l4_mur_sea_surface_temperature_temporal")
-- Height layers
asset.require("./layers/heightlayers/blue_marble_height")
local heightLayer = asset.require("./layers/heightlayers/terrain_tileset")
-- Night layers
asset.require("./layers/nightlayers/earth_night_texture")
local nightLayer = asset.require("./layers/nightlayers/earth_at_night_2012")
asset.require("./layers/nightlayers/earth_at_night_temporal")

View File

@@ -39,7 +39,7 @@ local L1 = {
Parent = L1Position.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
RenderableType = "Opaque",
RenderBinMode = "Opaque",
Billboard = true,
Size = 700E5,
Texture = circle .. "circle.png",

View File

@@ -39,7 +39,7 @@ local L2Small = {
Parent = L2Position.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
RenderableType = "Opaque",
RenderBinMode = "Opaque",
Billboard = true,
Size = 400E4,
Texture = circle .. "circle.png",
@@ -57,7 +57,7 @@ local L2 = {
Parent = L2Position.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
RenderableType = "Opaque",
RenderBinMode = "Opaque",
Billboard = true,
Size = 700E5,
Texture = circle .. "circle.png",

View File

@@ -39,7 +39,7 @@ local L4 = {
Parent = L4Position.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
RenderableType = "Opaque",
RenderBinMode = "Opaque",
Billboard = true,
Size = 800E6,
Texture = circle .. "circle.png",

View File

@@ -39,7 +39,7 @@ local L5 = {
Parent = L5Position.Identifier,
Renderable = {
Type = "RenderablePlaneImageLocal",
RenderableType = "Opaque",
RenderBinMode = "Opaque",
Billboard = true,
Size = 800E6,
Texture = circle .. "circle.png",

View File

@@ -1,4 +1,4 @@
local globeIdentifier = asset.require("../../../earth").Earth.Identifier
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local texturesPath = asset.syncedResource({
Name = "Earth Textures",
@@ -14,6 +14,15 @@ local layer = {
Description = [[ Earth image from Blue Marble Next Generation ]],
}
asset.onInitialize(function()
openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer)
end)
asset.onDeinitialize(function()
openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer)
end)
asset.export("layer", layer)

View File

@@ -1,7 +1,5 @@
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local fallBackLayer = asset.require("./fallbacks/blue_marble").layer
local layer = {
Identifier = "ESRI_VIIRS_Combo",
Name = "ESRI VIIRS Combo",
@@ -41,7 +39,6 @@ local layer = {
},
},
PadTiles = false,
Fallback = fallBackLayer,
Description = [[Level based layer combining "VIIRS SNPP (Temporal)" and ESRI World
Imagery. "VIIRS SNPP (Temporal)" is faded out at tile level 4]]
}

View File

@@ -0,0 +1,18 @@
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local layer = {
Identifier = "TextureSpout",
SpoutName = "SPOUT_TERRA_RECEIVER",
Type = "SpoutImageTileLayer"
}
asset.onInitialize(function ()
openspace.globebrowsing.addLayer(globeIdentifier, "ColorLayers", layer)
end)
asset.onDeinitialize(function()
openspace.globebrowsing.deleteLayer(globeIdentifier, "ColorLayers", layer)
end)
asset.export("layer", layer)

View File

@@ -1,3 +1,5 @@
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local texturesPath = asset.syncedResource({
Name = "Earth Textures",
Type = "HttpSynchronization",
@@ -12,6 +14,14 @@ local layer = {
Description = [[ Topographic layer from Blue Marble Next Generation]]
}
asset.onInitialize(function()
openspace.globebrowsing.addLayer(globeIdentifier, "HeightLayers", layer)
end)
asset.onDeinitialize(function()
openspace.globebrowsing.deleteLayer(globeIdentifier, "HeightLayers", layer)
end)
asset.export("layer", layer)

View File

@@ -1,12 +1,10 @@
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local fallBackLayer = asset.require("./fallbacks/blue_marble_height").layer
local layer = {
Identifier = "Terrain_tileset",
Name = "Terrain tileset",
FilePath = asset.localResource("terrain_tileset.wms"),
TilePixelSize = 64,
Fallback = fallBackLayer,
Description = [[This globe layer presents elevation data at approximately 90m or 1km
per pixel resolution for the world. The elevation data includes 90m Shuttle Radar
Topography Mission (SRTM) elevation data from NASA and National

View File

@@ -1,12 +1,9 @@
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local fallBackLayer = asset.require("./fallbacks/earth_night_texture").layer
local layer = {
Identifier = "Earth_at_Night_2012",
Name = "Earth at Night 2012",
FilePath = asset.localResource("earth_at_night_2012.wms"),
Fallback = fallBackLayer,
Description = [[ The lights of cities and villages trace the outlines of civilization
in this global view. ]],
}

View File

@@ -1,3 +1,5 @@
local globeIdentifier = asset.require("../../earth").Earth.Identifier
local texturesPath = asset.syncedResource({
Name = "Earth Textures",
Type = "HttpSynchronization",
@@ -12,6 +14,14 @@ local layer = {
Description = [[ Earth's city lights are clearly visible from space ]]
}
asset.onInitialize(function()
openspace.globebrowsing.addLayer(globeIdentifier, "NightLayers", layer)
end)
asset.onDeinitialize(function()
openspace.globebrowsing.deleteLayer(globeIdentifier, "NightLayers", layer)
end)
asset.export("layer", layer)

View File

@@ -23,6 +23,7 @@ local initializeAndAddNodes = function()
local iss = {
Identifier = "ISS",
Parent = transforms.EarthInertial.Identifier,
BoundingSphere = 54.5, -- half the width
InteractionSphere = 30,
Transform = {
Translation = {
@@ -88,8 +89,8 @@ local initializeAndAddNodes = function()
Observer = transforms.EarthInertial.Identifier,
File = path,
LineNumber = 1,
RenderBinMode = "PostDeferredTransparent"
},
RenderBinMode = "PostDeferredTransparent",
Color = { 0.9, 0.6715, 0.0 },
Fade = 1.5,
Period = period,

View File

@@ -49,8 +49,8 @@ asset.onInitialize(function ()
Observer = transforms.EarthInertial.Identifier,
File = path,
LineNumber = 1,
RenderBinMode = "PostDeferredTransparent"
},
RenderBinMode = "PostDeferredTransparent"
Color = { 0.9, 0.6715, 0.0 },
Fade = 1.5,
Period = period,

View File

@@ -51,8 +51,8 @@ asset.onInitialize(function ()
Observer = transforms.EarthInertial.Identifier,
File = path,
LineNumber = 1,
RenderBinMode = "PostDeferredTransparent"
},
RenderBinMode = "PostDeferredTransparent"
Color = { 0.9, 0.6715, 0.0 },
Fade = 1.5,
Period = period,

View File

@@ -1,6 +1,7 @@
-- Color layer
local colorLayer = asset.require("./layers/colorlayers/moc_wa_color_utah") -- TODO: fallback
asset.require("./layers/colorlayers/moc_wa_color_sweden") -- TODO: fallback
asset.require("./layers/colorlayers/mars_texture")
local colorLayer = asset.require("./layers/colorlayers/moc_wa_color_utah")
asset.require("./layers/colorlayers/moc_wa_color_sweden")
asset.require("./layers/colorlayers/viking_mdim_utah")
asset.require("./layers/colorlayers/viking_mdim_sweden")
asset.require("./layers/colorlayers/mola_pseudo_color_utah")

View File

@@ -1,24 +0,0 @@
local texturesPath = asset.syncedResource({
Name = "Mars Textures",
Type = "HttpSynchronization",
Identifier = "mars_textures",
Version = 1
})
local layer = {
Identifier = "Mars_Texture",
Name = "Mars Texture",
FilePath = texturesPath .. "mars.jpg",
}
asset.export("layer", layer)
asset.meta = {
Name = "Mars Texutre",
Version = "1.0",
Description = [[ Default jpg texture for Mars]],
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT license"
}

View File

@@ -1,7 +1,5 @@
local globeIdentifier = asset.require("../../mars").Mars.Identifier
local fallbackLayer = asset.require("./fallbacks/mars_texture").layer
local layer = {
Identifier = "MOC_WA_Color_LiU",
Name = "MOC WA Color [Sweden]",
@@ -10,7 +8,6 @@ local layer = {
Gamma = 1.6,
Multiplier = 1.07
},
Fallback = fallbackLayer,
Description = [[This map is an AMNH version of the global mossaic produced by the
Mars Global Surveyor Wide Angle Camera. This version has color added and the
shadows subdued based on the MOLA DTM. Data Reference:

View File

@@ -1,7 +1,5 @@
local globeIdentifier = asset.require("../../mars").Mars.Identifier
local fallbackLayer = asset.require("./fallbacks/mars_texture").layer
local layer = {
Identifier = "MOC_WA_Color_Utah",
Name = "MOC WA Color [Utah]",
@@ -10,7 +8,6 @@ local layer = {
Gamma = 1.6,
Multiplier = 1.07
},
Fallback = fallbackLayer,
Description = [[This map is an AMNH version of the global mossaic produced by the
Mars Global Surveyor Wide Angle Camera. This version has color added and the
shadows subdued based on the MOLA DTM. Data Reference:

View File

@@ -13,7 +13,7 @@ local layer = {
latitude. <br><br> Reference: * Edwards, C.S., K. J. Nowicki, P. R. Christensen,
J. Hill, N. Gorelick, and K. Murray (2011), Mosaicking of global planetary image
datasets: 1. Techniques and data processing for Thermal Emission Imaging System
(THEMIS) multispectral data, J. Geophys. Res., 116, E10008,
(THEMIS) multi-spectral data, J. Geophys. Res., 116, E10008,
doi:10.1029/2010JE003755. http://dx.doi.org/10.1029/2010JE003755 (Description from
URL).]],
}

View File

@@ -5,13 +5,12 @@ local layer = {
Name = "HRSC MOLA Blended DEM Global 200m v2",
FilePath = asset.localResource("mdem200m.wms"),
Description = [[ Blend of data derived from the Mars Orbiter Laser Altimeter
(MOLA, an instrument aboard NASAs
Mars Global Surveyor spacecraft), and data derived from the High-Resolution
Stereo Camera (HRSC, an instrument aboard the European Space Agencys Mars
Express spacecraft). The average accuracy is ~100 meters in horizontal
position and the elevation uncertainty is at least ±3 m. This
tiled elevation layer, hosted by Esri, is made available using
lossless LERC compression. (Description from URL).]],
(MOLA, an instrument aboard NASA's Mars Global Surveyor spacecraft), and data derived
from the High-Resolution Stereo Camera (HRSC, an instrument aboard the European Space
Agency's Mars Express spacecraft). The average accuracy is ~100 meters in horizontal
position and the elevation uncertainty is at least ±3 m. This tiled elevation layer,
hosted by ESRI, is made available using lossless LERC compression.
(Description from URL).]],
}
asset.onInitialize(function()

View File

@@ -7,11 +7,11 @@ local layer = {
Description = [[ HiRISE (High Resolution Imaging Science Experiment) is the most
powerful camera ever sent to another planet, one of six instruments onboard the
Mars Reconnaissance Orbiter. We launched in 2005, arrived at Mars in 2006 and have
been imaging ever since. Our cameras high resolution capability (imaging up to 30
been imaging ever since. Our camera's high resolution capability (imaging up to 30
centimeters per pixel) remains unprecedented for any existing orbiter in the study
of the Red Planet, as well as being an indispensable instrument for helping to
select landing sites for robotic and future human exploration. In the past decade,
weve also imaged avalanches in progress, and discovered dark flows that may or
we've also imaged avalanches in progress, and discovered dark flows that may or
may not be briny seeps. Hundreds of science papers have been published with our
data. (Description from URL). This map contains a subet set of the HiRISE
DEM where available as of 2018.]],

View File

@@ -20,7 +20,7 @@ local SunGlare = {
Texture = textures .. "halo.png",
BlendMode = "Additive",
Opacity = 0.65,
RenderableType = "PreDeferredTransparency"
RenderBinMode = "PreDeferredTransparent"
},
GUI = {
Name = "Sun Glare",

View File

@@ -3,7 +3,7 @@ asset.require("./static_server")
local guiCustomization = asset.require("customization/gui")
-- Select which commit hashes to use for the frontend and backend
local frontendHash = "fb2452108b203fea41990a174e05aaa75f2ae2bb"
local frontendHash = "8c3d18a4a2cb1df526e1c3f2ea228013ce89099e"
local dataProvider = "data.openspaceproject.com/files/webgui"
local frontend = asset.syncedResource({

View File

@@ -141,7 +141,7 @@ struct Configuration {
std::filesystem::path findConfiguration(const std::string& filename = "openspace.cfg");
Configuration loadConfigurationFromFile(const std::filesystem::path& filename,
const std::string& overrideScript);
const glm::ivec2& primaryMonitorResolution, const std::string& overrideScript);
} // namespace openspace::configuration

View File

@@ -107,6 +107,12 @@ public:
bool setMode(Mode newMode);
void resetMode();
using CallbackHandle = int;
using ModeChangeCallback = std::function<void()>;
CallbackHandle addModeChangeCallback(ModeChangeCallback cb);
void removeModeChangeCallback(CallbackHandle handle);
// Guaranteed to return a valid pointer
AssetManager& assetManager();
LoadingScreen* loadingScreen();
@@ -151,6 +157,10 @@ private:
bool _isRenderingFirstFrame = true;
Mode _currentMode = Mode::UserControl;
Mode _modeLastFrame = Mode::UserControl;
int _nextCallbackHandle = 0;
std::vector<std::pair<CallbackHandle, ModeChangeCallback>> _modeChangeCallbacks;
};
/**

View File

@@ -671,7 +671,6 @@ protected:
bool isPropertyAllowedForBaseline(const std::string& propString);
unsigned int findIndexOfLastCameraKeyframeInTimeline();
bool doesTimelineEntryContainCamera(unsigned int index) const;
std::vector<std::pair<CallbackHandle, StateChangeCallback>> _stateChangeCallbacks;
bool doesStartWithSubstring(const std::string& s, const std::string& matchSubstr);
void trimCommandsFromScriptIfFound(std::string& script);
void replaceCommandsFromScriptIfFound(std::string& script);
@@ -800,6 +799,7 @@ protected:
double _cameraFirstInTimeline_timestamp = 0;
int _nextCallbackHandle = 0;
std::vector<std::pair<CallbackHandle, StateChangeCallback>> _stateChangeCallbacks;
DataMode _conversionDataMode = DataMode::Binary;
int _conversionLineNum = 1;

View File

@@ -155,16 +155,6 @@ private:
properties::FloatProperty _followAnchorNodeRotationDistance;
properties::FloatProperty _minimumAllowedDistance;
struct LinearFlight : public properties::PropertyOwner {
LinearFlight();
properties::BoolProperty apply;
properties::FloatProperty destinationDistance;
properties::DoubleProperty destinationFactor;
properties::FloatProperty velocitySensitivity;
};
LinearFlight _linearFlight;
properties::FloatProperty _mouseSensitivity;
properties::FloatProperty _joystickSensitivity;
properties::FloatProperty _websocketSensitivity;
@@ -291,20 +281,6 @@ private:
const glm::dvec3& objectPosition, const glm::dquat& globalCameraRotation,
const SurfacePositionHandle& positionHandle) const;
/**
* Moves the camera along a vector, camPosToCenterPosDiff, until it reaches the
* focusLimit. The velocity of the zooming depend on distFromCameraToFocus and the
* final frame where the camera stops moving depends on the distance set in the
* variable focusLimit. The bool determines whether to move/fly towards the focus node
* or away from it.
*
* \return a new position of the camera, closer to the focusLimit than the previous
* position
*/
glm::dvec3 moveCameraAlongVector(const glm::dvec3& camPos,
double distFromCameraToFocus, const glm::dvec3& camPosToCenterPosDiff,
double destination, double deltaTime) const;
/*
* Adds rotation to the camera position so that it follows the rotation of the anchor
* node defined by the differential anchorNodeRotationDiff.

View File

@@ -92,24 +92,50 @@ public:
*/
CameraPose interpolatedPose(double distance) const;
/**
* Reset variables used to play back path
*/
void resetPlaybackVariables();
private:
/**
* Interpolate between the paths start and end rotation using the approach that
* corresponds to the path's curve type. The interpolation parameter \p t is the
* same as for the position interpolation, i.e. the relative traveled in distance
* same as for the position interpolation, i.e. the relative traveled distance
* along the path, in [0, 1]
*
* \param t The interpolation parameter, given as the relative traveled distance
along the path, in [0, 1]
*/
glm::dquat interpolateRotation(double t) const;
/**
* Compute the interpolated rotation quaternion using an eased SLERP approach
*
* \param t The interpolation variable for the rotatation interpolation.
* Should be the relative traveled distance, in [0, 1]
*/
glm::dquat easedSlerpRotation(double t) const;
/**
* Compute the interpolated rotation quaternion using a method that is customized
* for linear paths. The camera will first interpoalte to look at the targetted
* node, and keep doing so for most of the path. At the end, when within a certain
* distance from the target, the rotation is interpolated so that the camera ends up
* in the target pose at the end of the path.
*
* \param t The interpolation variable for the rotatation interpolation.
* Should be the relative traveled distance, in [0, 1]
*/
glm::dquat linearPathRotation(double t) const;
/**
* Compute the interpolated rotation quaternion using an approach that first
* interpolates to look at the start node, and then the end node, before
* interpolating to the end rotation
*
* \param t The interpolation variable for the rotatation interpolation.
* Should be the relative traveled distance, in [0, 1]
*/
glm::dquat lookAtTargetsRotation(double t) const;
@@ -117,6 +143,8 @@ private:
* Evaluate the current traversal speed along the path, based on the currently
* traveled distance. The final speed will be scaled to match the desired duration
* for the path (which might have been specified by the user)
*
* \param traveledDistance The current distance traveled along the path, in meters
*/
double speedAlongPath(double traveledDistance) const;
@@ -129,15 +157,23 @@ private:
double _speedFactorFromDuration = 1.0;
// Playback variables
double _traveledDistance = 0.0;
double _progressedTime = 0.0; // Time since playback started
double _traveledDistance = 0.0; // Meters
double _progressedTime = 0.0; // Time since playback started (seconds)
bool _shouldQuit = false;
CameraPose _prevPose;
};
// Create a path of the given type based on an instruction given as a dictionary.
// See top of cpp file for documentation on keys and values for the dictionary.
// Returns the created path.
Path createPathFromDictionary(const ghoul::Dictionary& dictionary, Path::Type type);
/**
* Create a path based on an instruction given as a dictionary. (See top of cpp file
* for documentation on keys and values for the dictionary.)
* If /p forceType is specified, that type will primarily be used as the type for the
* created path. Secondly, the type will be read from the dictionary, and lastly it will
* use the default from PathNavigator.
*
* \return the created path
*/
Path createPathFromDictionary(const ghoul::Dictionary& dictionary,
std::optional<Path::Type> forceType = std::nullopt);
} // namespace openspace::interaction

View File

@@ -26,6 +26,7 @@
#define __OPENSPACE_CORE___PATHCURVE___H__
#include <ghoul/glm.h>
#include <ghoul/misc/exception.h>
#include <vector>
namespace openspace::interaction {
@@ -34,21 +35,38 @@ class Waypoint;
class PathCurve {
public:
struct InsufficientPrecisionError : public ghoul::RuntimeError {
explicit InsufficientPrecisionError(std::string msg);
};
struct TooShortPathError : public ghoul::RuntimeError {
explicit TooShortPathError(std::string msg);
};
virtual ~PathCurve() = 0;
/**
* Return the length of the curve, in meters
*/
double length() const;
/**
* Compute and return the position along the path at the specified relative
* distance. The input parameter should be in range [0, 1], where 1 correspond to
* the full length of the path
* the full length of the path.
*
* Can be overridden by subclasses that want more control over the position
* interpolation
*/
glm::dvec3 positionAt(double relativeDistance) const;
virtual glm::dvec3 positionAt(double relativeDistance) const;
/**
* Get the intorlatied position along the spline, based on the given curve parameter
* u in range [0, 1]. A curve parameter of 0 returns the start position and 1 the end
* position. Note that u does not correspond to the relatively traveled distance.
*
* Can be overridden by subclasses that want more control over the position
* interpolation
*/
virtual glm::dvec3 interpolate(double u) const;
@@ -59,16 +77,16 @@ public:
protected:
/**
* Precompute information related to the spline parameters, that are
* Precompute information related to the spline parameters that are
* needed for arc length reparameterization. Must be called after
* control point creation
* control point creation.
*/
void initializeParameterData();
/**
* Compute curve parameter u that matches the input arc length s.
* Input s is a length value, in the range [0, _totalLength]. The returned curve
* parameter u is in range [0, 1]
* Input s is a length value in meters, in the range [0, _totalLength].
* The returned curve parameter u is in range [0, 1].
*/
double curveParameter(double s) const;
@@ -81,7 +99,7 @@ protected:
std::vector<double> _curveParameterSteps; // per segment
std::vector<double> _lengthSums; // per segment
double _totalLength = 0.0;
double _totalLength = 0.0; // meters
struct ParameterPair {
double u; // curve parameter
@@ -94,6 +112,9 @@ protected:
class LinearCurve : public PathCurve {
public:
LinearCurve(const Waypoint& start, const Waypoint& end);
glm::dvec3 positionAt(double relativeDistance) const override;
glm::dvec3 interpolate(double u) const override;
};
} // namespace openspace::interaction

View File

@@ -58,6 +58,7 @@ public:
const SceneGraphNode* anchor() const;
const Path* currentPath() const;
double speedScale() const;
double arrivalDistanceFactor() const;
bool hasCurrentPath() const;
bool hasFinished() const;
@@ -71,7 +72,10 @@ public:
void pausePath();
void continuePath();
Path::Type defaultPathType() const;
double minValidBoundingSphere() const;
double findValidBoundingSphere(const SceneGraphNode* node) const;
const std::vector<SceneGraphNode*>& relevantNodes();
/**
@@ -98,6 +102,7 @@ private:
properties::BoolProperty _includeRoll;
properties::FloatProperty _speedScale;
properties::BoolProperty _applyIdleBehaviorOnFinish;
properties::DoubleProperty _arrivalDistanceFactor;
properties::DoubleProperty _minValidBoundingSphere;
properties::StringListProperty _relevantNodeTags;

View File

@@ -41,8 +41,6 @@ public:
Waypoint(const glm::dvec3& pos, const glm::dquat& rot, const std::string& ref);
explicit Waypoint(const NavigationState& ns);
static double findValidBoundingSphere(const SceneGraphNode* node);
CameraPose pose() const;
glm::dvec3 position() const;
glm::dquat rotation() const;

View File

@@ -117,6 +117,7 @@ protected:
double _interactionSphere = 0.0;
SceneGraphNode* _parent = nullptr;
bool _shouldUpdateIfDisabled = false;
RenderBin _renderBin = RenderBin::Opaque;
private:
// We only want the SceneGraphNode to be able manipulate the parent, so we don't want
@@ -124,8 +125,6 @@ private:
// parentage and that's no bueno
friend ghoul::mm_unique_ptr<SceneGraphNode> SceneGraphNode::createFromDictionary(
const ghoul::Dictionary&);
RenderBin _renderBin = RenderBin::Opaque;
};
} // namespace openspace

View File

@@ -59,7 +59,7 @@ struct LuaLibrary {
/// A list of script files that are executed for each Lua state
std::vector<std::filesystem::path> scripts = std::vector<std::filesystem::path>();
/// A list of all libraries that are children for this library
std::vector<LuaLibrary> subLibraries;
std::vector<LuaLibrary> subLibraries = std::vector<LuaLibrary>();
/// This struct contains information about a function or constant that is defined in
/// a Lua script

View File

@@ -56,6 +56,8 @@ public:
void enqueue(std::function<void()> f);
void clearTasks();
bool hasOutstandingTasks() const;
private:
friend class Worker;

View File

@@ -147,20 +147,10 @@ namespace {
namespace openspace {
documentation::Documentation DashboardItemDistance::Documentation() {
documentation::Documentation doc =
codegen::doc<Parameters>("base_dashboarditem_distance");
// @TODO cleanup
// Insert the parent's documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = DashboardTextItem::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
return codegen::doc<Parameters>(
"base_dashboarditem_distance",
DashboardTextItem::Documentation()
);
return doc;
}
DashboardItemDistance::DashboardItemDistance(const ghoul::Dictionary& dictionary)

View File

@@ -157,20 +157,10 @@ namespace {
namespace openspace {
documentation::Documentation DashboardItemFramerate::Documentation() {
documentation::Documentation doc =
codegen::doc<Parameters>("base_dashboarditem_framerate");
// @TODO cleanup
// Insert the parent's documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = DashboardTextItem::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
return codegen::doc<Parameters>(
"base_dashboarditem_framerate",
DashboardTextItem::Documentation()
);
return doc;
}
DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictionary)

View File

@@ -62,20 +62,10 @@ namespace {
namespace openspace {
documentation::Documentation DashboardItemPropertyValue::Documentation() {
documentation::Documentation doc =
codegen::doc<Parameters>("base_dashboarditem_propertyvalue");
// @TODO cleanup
// Insert the parent's documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = DashboardTextItem::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
return codegen::doc<Parameters>(
"base_dashboarditem_propertyvalue",
DashboardTextItem::Documentation()
);
return doc;
}
DashboardItemPropertyValue::DashboardItemPropertyValue(

View File

@@ -101,20 +101,10 @@ namespace {
namespace openspace {
documentation::Documentation DashboardItemSimulationIncrement::Documentation() {
documentation::Documentation doc =
codegen::doc<Parameters>("base_dashboarditem_simulationincrement");
// @TODO cleanup
// Insert the parent's documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = DashboardTextItem::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
return codegen::doc<Parameters>(
"base_dashboarditem_simulationincrement",
DashboardTextItem::Documentation()
);
return doc;
}
DashboardItemSimulationIncrement::DashboardItemSimulationIncrement(

View File

@@ -50,20 +50,10 @@ namespace {
namespace openspace {
documentation::Documentation DashboardItemText::Documentation() {
documentation::Documentation doc =
codegen::doc<Parameters>("base_dashboarditem_text");
// @TODO cleanup
// Insert the parent's documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = DashboardTextItem::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
return codegen::doc<Parameters>(
"base_dashboarditem_text",
DashboardTextItem::Documentation()
);
return doc;
}
DashboardItemText::DashboardItemText(const ghoul::Dictionary& dictionary)

View File

@@ -82,20 +82,10 @@ namespace {
namespace openspace {
documentation::Documentation DashboardItemVelocity::Documentation() {
documentation::Documentation doc =
codegen::doc<Parameters>("base_dashboarditem_velocity");
// @TODO cleanup
// Insert the parent's documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = DashboardTextItem::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
return codegen::doc<Parameters>(
"base_dashboarditem_velocity",
DashboardTextItem::Documentation()
);
return doc;
}
DashboardItemVelocity::DashboardItemVelocity(const ghoul::Dictionary& dictionary)

View File

@@ -39,8 +39,6 @@
#include <optional>
namespace {
constexpr const char _loggerCat[] = "RenderableDisc";
constexpr const std::array<const char*, 4> UniformNames = {
"modelViewProjectionTransform", "opacity", "width", "colorTexture"
};

View File

@@ -586,10 +586,7 @@ void RenderableModel::render(const RenderData& data, RendererTasks&) {
glm::translate(glm::dmat4(1.0), data.modelTransform.translation) *
glm::dmat4(data.modelTransform.rotation) *
glm::scale(glm::dmat4(1.0), glm::dvec3(data.modelTransform.scale)) *
glm::scale(
glm::dmat4(_modelTransform.value()),
glm::dvec3(_modelScale) // Model scale unit
);
glm::scale(_modelTransform.value(), glm::dvec3(_modelScale));
const glm::dmat4 modelViewTransform = data.camera.combinedViewMatrix() *
modelTransform;

View File

@@ -117,11 +117,9 @@ RenderableNodeLine::RenderableNodeLine(const ghoul::Dictionary& dictionary)
const Parameters p = codegen::bake<Parameters>(dictionary);
_start = p.startNode.value_or(_start);
_start.onChange([&]() { validateNodes(); });
addProperty(_start);
_end = p.endNode.value_or(_end);
_end.onChange([&]() { validateNodes(); });
addProperty(_end);
_lineColor = p.color.value_or(_lineColor);
@@ -203,15 +201,26 @@ void RenderableNodeLine::bindGL() {
}
void RenderableNodeLine::updateVertexData() {
SceneGraphNode* startNode = global::renderEngine->scene()->sceneGraphNode(_start);
SceneGraphNode* endNode = global::renderEngine->scene()->sceneGraphNode(_end);
if (!startNode || !endNode) {
LERRORC(
"RenderableNodeLine",
fmt::format(
"Could not find starting '{}' or ending '{}'",
_start.value(), _end.value()
)
);
return;
}
_vertexArray.clear();
// Update the positions of the nodes
_startPos = coordinatePosFromAnchorNode(
global::renderEngine->scene()->sceneGraphNode(_start)->worldPosition()
);
_endPos = coordinatePosFromAnchorNode(
global::renderEngine->scene()->sceneGraphNode(_end)->worldPosition()
);
_startPos = coordinatePosFromAnchorNode(startNode->worldPosition());
_endPos = coordinatePosFromAnchorNode(endNode->worldPosition());
_vertexArray.push_back(static_cast<float>(_startPos.x));
_vertexArray.push_back(static_cast<float>(_startPos.y));
@@ -235,9 +244,11 @@ void RenderableNodeLine::updateVertexData() {
unbindGL();
}
void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
void RenderableNodeLine::update(const UpdateData&) {
updateVertexData();
}
void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
_program->activate();
glm::dmat4 anchorTranslation(1.0);
@@ -278,19 +289,4 @@ void RenderableNodeLine::render(const RenderData& data, RendererTasks&) {
global::renderEngine->openglStateCache().resetLineState();
}
void RenderableNodeLine::validateNodes() {
if (!global::renderEngine->scene()->sceneGraphNode(_start)) {
LERROR(fmt::format(
"There is no scenegraph node with id {}, defaults to 'Root'", _start
));
_start = Root;
}
if (!global::renderEngine->scene()->sceneGraphNode(_end)) {
LERROR(fmt::format(
"There is no scenegraph node with id {}, defaults to 'Root'", _end
));
_end = Root;
}
}
} // namespace openspace

View File

@@ -62,8 +62,8 @@ private:
bool isReady() const override;
void updateVertexData();
void update(const UpdateData& data) override;
void render(const RenderData& data, RendererTasks& rendererTask) override;
void validateNodes();
void unbindGL();
void bindGL();

View File

@@ -45,28 +45,10 @@ namespace {
"that is applied to this plane. This image has to be square."
};
constexpr openspace::properties::Property::PropertyInfo RenderableTypeInfo = {
"RenderableType",
"RenderableType",
"This value specifies if the plane should be rendered in the Background,"
"Opaque, Transparent, or Overlay rendering step."
};
struct [[codegen::Dictionary(RenderablePlaneImageLocal)]] Parameters {
// [[codegen::verbatim(TextureInfo.description)]]
std::string texture;
enum class [[codegen::map(openspace::Renderable::RenderBin)]] RenderType {
Background,
Opaque,
PreDeferredTransparent [[codegen::key("PreDeferredTransparency")]],
PostDeferredTransparent [[codegen::key("PostDeferredTransparency")]],
Overlay
};
// [[codegen::verbatim(RenderableTypeInfo.description)]]
std::optional<RenderType> renderType [[codegen::key("RenderableType")]];
// If this value is set to 'true', the image for this plane will not be loaded at
// startup but rather when image is shown for the first time. Additionally, if the
// plane is hidden, the image will automatically be unloaded
@@ -78,20 +60,10 @@ namespace {
namespace openspace {
documentation::Documentation RenderablePlaneImageLocal::Documentation() {
documentation::Documentation doc = codegen::doc<Parameters>(
"base_renderable_plane_image_local"
return codegen::doc<Parameters>(
"base_renderable_plane_image_local",
RenderablePlane::Documentation()
);
// @TODO cleanup
// Insert the parents documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = RenderablePlane::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
);
return doc;
}
RenderablePlaneImageLocal::RenderablePlaneImageLocal(const ghoul::Dictionary& dictionary)
@@ -109,13 +81,6 @@ RenderablePlaneImageLocal::RenderablePlaneImageLocal(const ghoul::Dictionary& di
_texturePath.onChange([this]() { loadTexture(); });
_textureFile->setCallback([this]() { _textureIsDirty = true; });
if (p.renderType.has_value()) {
setRenderBin(codegen::map<Renderable::RenderBin>(*p.renderType));
}
else {
setRenderBin(Renderable::RenderBin::Opaque);
}
_isLoadingLazily = p.lazyLoading.value_or(_isLoadingLazily);
if (_isLoadingLazily) {
_enabled.onChange([this]() {

View File

@@ -52,20 +52,10 @@ namespace {
namespace openspace {
documentation::Documentation RenderablePlaneImageOnline::Documentation() {
documentation::Documentation doc = codegen::doc<Parameters>(
"base_renderable_plane_image_online"
return codegen::doc<Parameters>(
"base_renderable_plane_image_online",
RenderablePlane::Documentation()
);
// @TODO cleanup
// Insert the parents documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = RenderablePlane::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
);
return doc;
}
RenderablePlaneImageOnline::RenderablePlaneImageOnline(

View File

@@ -76,20 +76,10 @@ namespace {
namespace openspace {
documentation::Documentation RenderablePlaneTimeVaryingImage::Documentation() {
documentation::Documentation doc = codegen::doc<Parameters>(
"base_renderable_plane_time_varying_image"
return codegen::doc<Parameters>(
"base_renderable_plane_time_varying_image",
RenderablePlane::Documentation()
);
// Insert the parents documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = RenderablePlane::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
);
return doc;
}
RenderablePlaneTimeVaryingImage::RenderablePlaneTimeVaryingImage(
@@ -291,7 +281,7 @@ void RenderablePlaneTimeVaryingImage::computeSequenceEndTime() {
const double lastTriggerTime = _startTimes[_sourceFiles.size() - 1];
const double sequenceDuration = lastTriggerTime - _startTimes[0];
const double averageStateDuration = sequenceDuration /
(static_cast<double>(_sourceFiles.size() - 1.0));
static_cast<double>(_sourceFiles.size() - 1);
_sequenceEndTime = lastTriggerTime + averageStateDuration;
}
}

View File

@@ -36,8 +36,6 @@
#include <optional>
namespace {
constexpr const char _loggerCat[] = "RenderablePrism";
constexpr const std::array<const char*, 2> UniformNames = {
"modelViewProjectionTransform", "vs_color"
};

View File

@@ -75,12 +75,6 @@ namespace {
"outside of the sphere, or both."
};
constexpr openspace::properties::Property::PropertyInfo UseAdditiveBlendingInfo = {
"UseAdditiveBlending",
"Use Additive Blending",
"Render the object using additive blending."
};
constexpr openspace::properties::Property::PropertyInfo SegmentsInfo = {
"Segments",
"Number of Segments",
@@ -113,12 +107,6 @@ namespace {
"Enables/Disables the Fade-In/Out effects."
};
constexpr openspace::properties::Property::PropertyInfo BackgroundInfo = {
"Background",
"Sets the current sphere rendering as a background rendering type",
"Enables/Disables background rendering."
};
struct [[codegen::Dictionary(RenderableSphere)]] Parameters {
// [[codegen::verbatim(SizeInfo.description)]]
float size;
@@ -138,9 +126,6 @@ namespace {
// [[codegen::verbatim(OrientationInfo.description)]]
std::optional<Orientation> orientation;
// [[codegen::verbatim(UseAdditiveBlendingInfo.description)]]
std::optional<bool> useAdditiveBlending;
// [[codegen::verbatim(MirrorTextureInfo.description)]]
std::optional<bool> mirrorTexture;
@@ -152,9 +137,6 @@ namespace {
// [[codegen::verbatim(DisableFadeInOutInfo.description)]]
std::optional<bool> disableFadeInOut;
// [[codegen::verbatim(BackgroundInfo.description)]]
std::optional<bool> background;
};
#include "renderablesphere_codegen.cpp"
} // namespace
@@ -172,9 +154,7 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
, _size(SizeInfo, 1.f, 0.f, 1e25f)
, _segments(SegmentsInfo, 8, 4, 1000)
, _mirrorTexture(MirrorTextureInfo, false)
, _useAdditiveBlending(UseAdditiveBlendingInfo, false)
, _disableFadeInDistance(DisableFadeInOutInfo, true)
, _backgroundRendering(BackgroundInfo, false)
, _fadeInThreshold(FadeInThresholdInfo, -1.f, 0.f, 1.f)
, _fadeOutThreshold(FadeOutThresholdInfo, -1.f, 0.f, 1.f)
{
@@ -215,14 +195,8 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
_texturePath.onChange([this]() { loadTexture(); });
addProperty(_mirrorTexture);
addProperty(_useAdditiveBlending);
_mirrorTexture = p.mirrorTexture.value_or(_mirrorTexture);
_useAdditiveBlending = p.useAdditiveBlending.value_or(_useAdditiveBlending);
if (_useAdditiveBlending) {
setRenderBin(Renderable::RenderBin::PreDeferredTransparent);
}
bool hasGivenFadeOut = p.fadeOutThreshold.has_value();
if (hasGivenFadeOut) {
@@ -241,12 +215,6 @@ RenderableSphere::RenderableSphere(const ghoul::Dictionary& dictionary)
addProperty(_disableFadeInDistance);
}
_backgroundRendering = p.background.value_or(_backgroundRendering);
if (_backgroundRendering) {
setRenderBin(Renderable::RenderBin::Background);
}
setBoundingSphere(_size);
setRenderBinFromOpacity();
}
@@ -371,7 +339,8 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
ghoul::opengl::TextureUnit unit;
unit.activate();
_texture->bind();
bindTexture();
defer{ unbindTexture(); };
_shader->setUniform(_uniformCache.colorTexture, unit);
// Setting these states should not be necessary,
@@ -386,14 +355,14 @@ void RenderableSphere::render(const RenderData& data, RendererTasks&) {
glDisable(GL_CULL_FACE);
}
if (_useAdditiveBlending) {
if (_renderBin == Renderable::RenderBin::PreDeferredTransparent) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDepthMask(false);
}
_sphere->render();
if (_useAdditiveBlending) {
if (_renderBin == Renderable::RenderBin::PreDeferredTransparent) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(true);
}
@@ -422,6 +391,12 @@ void RenderableSphere::update(const UpdateData&) {
}
}
void RenderableSphere::bindTexture() {
_texture->bind();
}
void RenderableSphere::unbindTexture() {}
void RenderableSphere::loadTexture() {
if (!_texturePath.value().empty()) {
std::unique_ptr<ghoul::opengl::Texture> texture =

View File

@@ -60,6 +60,10 @@ public:
static documentation::Documentation Documentation();
protected:
virtual void bindTexture();
virtual void unbindTexture();
private:
void loadTexture();
@@ -70,9 +74,7 @@ private:
properties::IntProperty _segments;
properties::BoolProperty _mirrorTexture;
properties::BoolProperty _useAdditiveBlending;
properties::BoolProperty _disableFadeInDistance;
properties::BoolProperty _backgroundRendering;
properties::FloatProperty _fadeInThreshold;
properties::FloatProperty _fadeOutThreshold;

View File

@@ -44,7 +44,7 @@
namespace {
constexpr const char* ProgramName = "Timevarying Sphere";
constexpr const char* _loggerCat = "RenderableTimeVaryingSphere";
constexpr const std::array<const char*, 5> UniformNames = {
"opacity", "modelViewProjection", "modelViewRotation", "colorTexture",
"mirrorTexture"
@@ -77,12 +77,6 @@ namespace {
"outside of the sphere, or both."
};
constexpr openspace::properties::Property::PropertyInfo UseAdditiveBlendingInfo = {
"UseAdditiveBlending",
"Use Additive Blending",
"Render the object using additive blending."
};
constexpr openspace::properties::Property::PropertyInfo SegmentsInfo = {
"Segments",
"Number of Segments",
@@ -115,14 +109,6 @@ namespace {
"Enables/Disables the Fade-In/Out effects."
};
constexpr openspace::properties::Property::PropertyInfo BackgroundInfo = {
"Background",
"Render as Background",
"If this value is set, the sphere is rendered in the background rendering bin, "
"causing it to be rendered before most other scene graph nodes"
};
struct [[codegen::Dictionary(RenerableTimeVaryingSphere)]] Parameters {
// [[codegen::verbatim(SizeInfo.description)]]
float size;
@@ -142,9 +128,6 @@ namespace {
// [[codegen::verbatim(OrientationInfo.description)]]
std::optional<Orientation> orientation;
// [[codegen::verbatim(UseAdditiveBlendingInfo.description)]]
std::optional<bool> useAdditiveBlending;
// [[codegen::verbatim(MirrorTextureInfo.description)]]
std::optional<bool> mirrorTexture;
@@ -156,9 +139,6 @@ namespace {
// [[codegen::verbatim(DisableFadeInOutInfo.description)]]
std::optional<bool> disableFadeInOut;
// [[codegen::verbatim(BackgroundInfo.description)]]
std::optional<bool> background;
};
#include "renderabletimevaryingsphere_codegen.cpp"
} // namespace
@@ -179,9 +159,7 @@ RenderableTimeVaryingSphere::RenderableTimeVaryingSphere(
, _size(SizeInfo, 1.f, 0.f, 1e35f)
, _segments(SegmentsInfo, 8, 4, 1000)
, _mirrorTexture(MirrorTextureInfo, false)
, _useAdditiveBlending(UseAdditiveBlendingInfo, false)
, _disableFadeInDistance(DisableFadeInOutInfo, true)
, _backgroundRendering(BackgroundInfo, false)
, _fadeInThreshold(FadeInThresholdInfo, -1.f, -1.f, 1.f)
, _fadeOutThreshold(FadeOutThresholdInfo, -1.f, -1.f, 1.f)
{
@@ -219,30 +197,18 @@ RenderableTimeVaryingSphere::RenderableTimeVaryingSphere(
_segments.onChange([this]() { _sphereIsDirty = true; });
addProperty(_mirrorTexture);
addProperty(_useAdditiveBlending);
addProperty(_fadeOutThreshold);
addProperty(_fadeInThreshold);
_mirrorTexture = p.mirrorTexture.value_or(_mirrorTexture);
_useAdditiveBlending = p.useAdditiveBlending.value_or(_useAdditiveBlending);
_fadeOutThreshold = p.fadeOutThreshold.value_or(_fadeOutThreshold);
_fadeInThreshold = p.fadeInThreshold.value_or(_fadeInThreshold);
if (_useAdditiveBlending) {
setRenderBin(Renderable::RenderBin::PreDeferredTransparent);
}
if (_fadeOutThreshold || _fadeInThreshold) {
_disableFadeInDistance = false;
addProperty(_disableFadeInDistance);
}
_backgroundRendering = p.background.value_or(_backgroundRendering);
if (_backgroundRendering) {
setRenderBin(Renderable::RenderBin::Background);
}
setBoundingSphere(_size);
setRenderBinFromOpacity();
}
@@ -383,14 +349,14 @@ void RenderableTimeVaryingSphere::render(const RenderData& data, RendererTasks&)
glDisable(GL_CULL_FACE);
}
if (_useAdditiveBlending) {
if (_renderBin == Renderable::RenderBin::PreDeferredTransparent) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
glDepthMask(false);
}
_sphere->render();
if (_useAdditiveBlending) {
if (_renderBin == Renderable::RenderBin::PreDeferredTransparent) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask(true);
}

View File

@@ -83,9 +83,7 @@ private:
properties::IntProperty _segments;
properties::BoolProperty _mirrorTexture;
properties::BoolProperty _useAdditiveBlending;
properties::BoolProperty _disableFadeInDistance;
properties::BoolProperty _backgroundRendering;
properties::FloatProperty _fadeInThreshold;
properties::FloatProperty _fadeOutThreshold;

View File

@@ -71,20 +71,6 @@ namespace {
{ "Points+Lines", RenderingModeLinesPoints }
};
// Fragile! Keep in sync with documentation
const std::map<std::string, openspace::Renderable::RenderBin> RenderBinConversion = {
{ "Background", openspace::Renderable::RenderBin::Background },
{ "Opaque", openspace::Renderable::RenderBin::Opaque },
{
"PreDeferredTransparent",
openspace::Renderable::RenderBin::PreDeferredTransparent
},
{
"PostDeferredTransparent",
openspace::Renderable::RenderBin::PostDeferredTransparent
}
};
static const openspace::properties::PropertyOwner::PropertyOwnerInfo
AppearanceInfo = {
"Appearance",
@@ -139,13 +125,6 @@ namespace {
"corresponding points (and subpoints) are shown. 'Lines+Points' shows both parts."
};
constexpr openspace::properties::Property::PropertyInfo RenderBinModeInfo = {
"RenderBinMode",
"RenderBin Mode",
"Determines if the trails will be rendered after all other elements, including"
"atmospheres if needed."
};
struct [[codegen::Dictionary(RenderableTrail)]] Parameters {
// This object is used to compute locations along the path. Any Translation object
// can be used here
@@ -251,12 +230,6 @@ RenderableTrail::RenderableTrail(const ghoul::Dictionary& dictionary)
addPropertySubOwner(_appearance);
if (dictionary.hasValue<std::string>(RenderBinModeInfo.identifier)) {
openspace::Renderable::RenderBin cfgRenderBin = RenderBinConversion.at(
dictionary.value<std::string>(RenderBinModeInfo.identifier)
);
setRenderBin(cfgRenderBin);
}
}
void RenderableTrail::initializeGL() {

View File

@@ -136,20 +136,10 @@ namespace {
namespace openspace {
documentation::Documentation RenderableTrailOrbit::Documentation() {
documentation::Documentation doc = codegen::doc<Parameters>(
"base_renderable_renderabletrailorbit"
return codegen::doc<Parameters>(
"base_renderable_renderabletrailorbit",
RenderableTrail::Documentation()
);
// Insert the parents documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = RenderableTrail::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
);
return doc;
}
RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)

View File

@@ -105,21 +105,10 @@ namespace {
namespace openspace {
documentation::Documentation RenderableTrailTrajectory::Documentation() {
documentation::Documentation doc = codegen::doc<Parameters>(
"base_renderable_renderabletrailtrajectory"
return codegen::doc<Parameters>(
"base_renderable_renderabletrailtrajectory",
RenderableTrail::Documentation()
);
// @TODO cleanup
// Insert the parents documentation entries until we have a verifier that can deal
// with class hierarchy
documentation::Documentation parentDoc = RenderableTrail::Documentation();
doc.entries.insert(
doc.entries.end(),
parentDoc.entries.begin(),
parentDoc.entries.end()
);
return doc;
}
RenderableTrailTrajectory::RenderableTrailTrajectory(const ghoul::Dictionary& dictionary)

View File

@@ -108,7 +108,7 @@ int renderCameraPath(lua_State* L) {
return fmt::format("Point_{}", i);
};
auto addPoint = [pointIdentifier] (const std::string& id, glm::dvec3 p) {
auto addPoint = [](const std::string& id, glm::dvec3 p) {
const std::string pointNode = "{"
"Identifier = '" + id + "',"
"Parent = '" + RenderedPathIdentifier + "',"
@@ -126,10 +126,8 @@ int renderCameraPath(lua_State* L) {
);
};
auto addLineBetweenPoints = [pointIdentifier] (const std::string& id1,
const std::string& id2,
const glm::vec3& color,
float lineWidth)
auto addLineBetweenPoints = [](const std::string& id1, const std::string& id2,
const glm::vec3& color, float lineWidth)
{
const std::string lineNode = "{"
"Identifier = '" + fmt::format("Line{}", id1) + "',"

View File

@@ -67,8 +67,6 @@ namespace {
"hasColorMap", "enabledRectSizeControl", "hasDvarScaling"
};
constexpr double PARSEC = 0.308567756E17;
enum RenderOption {
ViewDirection = 0,
PositionNormal

View File

@@ -59,8 +59,6 @@ namespace {
constexpr const int RenderOptionViewDirection = 0;
constexpr const int RenderOptionPositionNormal = 1;
constexpr const double PARSEC = 0.308567756E17;
constexpr openspace::properties::Property::PropertyInfo TextColorInfo = {
"TextColor",
"Text Color",

View File

@@ -55,8 +55,6 @@ namespace {
"spriteTexture", "hasColorMap"
};
constexpr double PARSEC = 0.308567756E17;
constexpr openspace::properties::Property::PropertyInfo SpriteTextureInfo = {
"Texture",
"Point Sprite Texture",
@@ -79,7 +77,7 @@ namespace {
constexpr openspace::properties::Property::PropertyInfo ColorMapInfo = {
"ColorMap",
"Color Map File",
"The path to the color map file of the astronomical onject."
"The path to the color map file of the astronomical object."
};
struct [[codegen::Dictionary(RenderablePoints)]] Parameters {

View File

@@ -494,6 +494,11 @@ void RenderableGalaxy::deinitializeGL() {
_raycaster = nullptr;
}
global::renderEngine->removeRenderProgram(_pointsProgram.get());
_pointsProgram = nullptr;
global::renderEngine->removeRenderProgram(_billboardsProgram.get());
_billboardsProgram = nullptr;
glDeleteVertexArrays(1, &_pointsVao);
glDeleteBuffers(1, &_positionVbo);
glDeleteBuffers(1, &_colorVbo);

View File

@@ -63,6 +63,7 @@ set(HEADER_FILES
src/tileprovider/imagesequencetileprovider.h
src/tileprovider/singleimagetileprovider.h
src/tileprovider/sizereferencetileprovider.h
src/tileprovider/spoutimageprovider.h
src/tileprovider/temporaltileprovider.h
src/tileprovider/texttileprovider.h
src/tileprovider/tileindextileprovider.h
@@ -102,6 +103,7 @@ set(SOURCE_FILES
src/tileprovider/imagesequencetileprovider.cpp
src/tileprovider/singleimagetileprovider.cpp
src/tileprovider/sizereferencetileprovider.cpp
src/tileprovider/spoutimageprovider.cpp
src/tileprovider/temporaltileprovider.cpp
src/tileprovider/texttileprovider.cpp
src/tileprovider/tileindextileprovider.cpp

View File

@@ -39,6 +39,7 @@
#include <modules/globebrowsing/src/tileprovider/imagesequencetileprovider.h>
#include <modules/globebrowsing/src/tileprovider/singleimagetileprovider.h>
#include <modules/globebrowsing/src/tileprovider/sizereferencetileprovider.h>
#include <modules/globebrowsing/src/tileprovider/spoutimageprovider.h>
#include <modules/globebrowsing/src/tileprovider/temporaltileprovider.h>
#include <modules/globebrowsing/src/tileprovider/tileindextileprovider.h>
#include <modules/globebrowsing/src/tileprovider/tileprovider.h>
@@ -306,6 +307,9 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) {
fTileProvider->registerClass<ImageSequenceTileProvider>(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::ImageSequenceTileLayer)]
);
fTileProvider->registerClass<SpoutImageProvider>(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::SpoutImageTileLayer)]
);
fTileProvider->registerClass<TemporalTileProvider>(
LAYER_TYPE_NAMES[static_cast<int>(TypeID::TemporalTileLayer)]
);

View File

@@ -322,10 +322,21 @@ int flyToGeo(lua_State* L) {
altitude
);
const glm::dvec3 currentPosW = global::navigationHandler->camera()->positionVec3();
const glm::dvec3 currentPosModelCoords =
glm::inverse(globe->modelTransform()) * glm::dvec4(currentPosW, 1.0);
constexpr const double LengthEpsilon = 10.0; // meters
if (glm::distance(currentPosModelCoords, positionModelCoords) < LengthEpsilon) {
LINFOC("GlobeBrowsing", "flyToGeo: Already at the requested position");
return 0;
}
ghoul::Dictionary instruction;
instruction.setValue("TargetType", std::string("Node"));
instruction.setValue("Target", n->identifier());
instruction.setValue("Position", positionModelCoords);
instruction.setValue("PathType", std::string("ZoomOutOverview"));
// Handle the two optional arguments: duration and use target's up direction argument
// The user can either provide both, or one of them

View File

@@ -2,4 +2,9 @@ set (OPENSPACE_DEPENDENCIES
debugging
)
# Don't **actually** add it as a dependency. Only mark it as a dependency if it was already enabled anyway. We need to do this as the GlobeBrowsing partially depends on being able to detect if OpenSpace was compiled with Spout support or not
if (OPENSPACE_MODULE_SPOUT)
set(OPENSPACE_DEPENDENCIES ${OPENSPACE_DEPENDENCIES} spout)
endif (OPENSPACE_MODULE_SPOUT)
set (DEFAULT_MODULE ON)

View File

@@ -163,7 +163,8 @@ vec4 getSample#{layerGroup}#{i}(vec2 uv, vec3 levelWeights,
c = getTexVal(#{layerGroup}[#{i}].pile, levelWeights, uv, #{layerGroup}[#{i}].padding);
#elif (#{#{layerGroup}#{i}LayerType} == 8) // SolidColor
c.rgb = #{layerGroup}[#{i}].color;
#elif (#{#{layerGroup}#{i}LayerType} == 9) // SpoutImageTileLayer
c = getTexVal(#{layerGroup}[#{i}].pile, levelWeights, uv, #{layerGroup}[#{i}].padding);
#endif
return c;

View File

@@ -365,7 +365,7 @@ bool GlobeLabelsComponent::readLabelsFile(const std::filesystem::path& file) {
// atlas)
// Once this limitation is fixed, we can remove the next piece of code
// Removing non ASCII characters:
strncpy(lEntry.feature, token.c_str(), 256);
strncpy(lEntry.feature, token.c_str(), 255);
int tokenChar = 0;
while (tokenChar < 256) {
if (lEntry.feature[tokenChar] < 0 && lEntry.feature[tokenChar] != '\0') {

View File

@@ -130,7 +130,7 @@ GlobeRotation::GlobeRotation(const ghoul::Dictionary& dictionary)
void GlobeRotation::findGlobe() {
SceneGraphNode* n = sceneGraphNode(_globe);
if (n->renderable() && dynamic_cast<RenderableGlobe*>(n->renderable())) {
if (n && n->renderable() && dynamic_cast<RenderableGlobe*>(n->renderable())) {
_globeNode = dynamic_cast<RenderableGlobe*>(n->renderable());
}
else {

View File

@@ -133,7 +133,7 @@ GlobeTranslation::GlobeTranslation(const ghoul::Dictionary& dictionary)
void GlobeTranslation::fillAttachedNode() {
SceneGraphNode* n = sceneGraphNode(_globe);
if (n->renderable() && dynamic_cast<RenderableGlobe*>(n->renderable())) {
if (n && n->renderable() && dynamic_cast<RenderableGlobe*>(n->renderable())) {
_attachedNode = dynamic_cast<RenderableGlobe*>(n->renderable());
}
else {
@@ -142,7 +142,7 @@ void GlobeTranslation::fillAttachedNode() {
"Could not set attached node as it does not have a RenderableGlobe"
);
if (_attachedNode) {
// Reset the globe name to it's previous name
// Reset the globe name to its previous name
_globe = _attachedNode->identifier();
}
}

View File

@@ -68,6 +68,7 @@ void GPULayerGroup::setValue(ghoul::opengl::ProgramObject& program,
// Intentional fall through. Same for all tile layers
case layergroupid::TypeID::DefaultTileLayer:
case layergroupid::TypeID::SingleImageTileLayer:
case layergroupid::TypeID::SpoutImageTileLayer:
case layergroupid::TypeID::ImageSequenceTileLayer:
case layergroupid::TypeID::SizeReferenceTileLayer:
case layergroupid::TypeID::TemporalTileLayer:
@@ -149,6 +150,7 @@ void GPULayerGroup::bind(ghoul::opengl::ProgramObject& p,
// Intentional fall through. Same for all tile layers
case layergroupid::TypeID::DefaultTileLayer:
case layergroupid::TypeID::SingleImageTileLayer:
case layergroupid::TypeID::SpoutImageTileLayer:
case layergroupid::TypeID::ImageSequenceTileLayer:
case layergroupid::TypeID::SizeReferenceTileLayer:
case layergroupid::TypeID::TemporalTileLayer:

View File

@@ -115,7 +115,7 @@ namespace {
std::optional<std::string> type [[codegen::inlist("DefaultTileLayer",
"SingleImageTileLayer", "ImageSequenceTileLayer", "SizeReferenceTileLayer",
"TemporalTileLayer", "TileIndexTileLayer", "ByIndexTileLayer",
"ByLevelTileLayer", "SolidColor")]];
"ByLevelTileLayer", "SolidColor", "SpoutImageTileLayer")]];
// Determine whether the layer is enabled or not. If this value is not specified,
// the layer is disabled
@@ -302,6 +302,7 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict,
// Intentional fall through. Same for all tile layers
case layergroupid::TypeID::DefaultTileLayer:
case layergroupid::TypeID::SingleImageTileLayer:
case layergroupid::TypeID::SpoutImageTileLayer:
case layergroupid::TypeID::ImageSequenceTileLayer:
case layergroupid::TypeID::SizeReferenceTileLayer:
case layergroupid::TypeID::TemporalTileLayer:
@@ -470,6 +471,7 @@ void Layer::initializeBasedOnType(layergroupid::TypeID id, ghoul::Dictionary ini
// Intentional fall through. Same for all tile layers
case layergroupid::TypeID::DefaultTileLayer:
case layergroupid::TypeID::SingleImageTileLayer:
case layergroupid::TypeID::SpoutImageTileLayer:
case layergroupid::TypeID::ImageSequenceTileLayer:
case layergroupid::TypeID::SizeReferenceTileLayer:
case layergroupid::TypeID::TemporalTileLayer:
@@ -502,6 +504,7 @@ void Layer::addVisibleProperties() {
// Intentional fall through. Same for all tile layers
case layergroupid::TypeID::DefaultTileLayer:
case layergroupid::TypeID::SingleImageTileLayer:
case layergroupid::TypeID::SpoutImageTileLayer:
case layergroupid::TypeID::ImageSequenceTileLayer:
case layergroupid::TypeID::SizeReferenceTileLayer:
case layergroupid::TypeID::TemporalTileLayer:

View File

@@ -34,7 +34,6 @@
namespace {
constexpr const char* _loggerCat = "LayerGroup";
constexpr const char* KeyFallback = "Fallback";
constexpr openspace::properties::Property::PropertyInfo BlendTileInfo = {
"BlendTileLevels",
@@ -68,18 +67,6 @@ void LayerGroup::setLayersFromDict(const ghoul::Dictionary& dict) {
}
catch (const ghoul::RuntimeError& e) {
LERRORC(e.component, e.message);
if (layerDict.hasValue<ghoul::Dictionary>(KeyFallback)) {
LWARNING("Unable to create layer. Initializing fallback layer.");
ghoul::Dictionary fallbackLayerDict =
layerDict.value<ghoul::Dictionary>(KeyFallback);
try {
addLayer(fallbackLayerDict);
}
catch (const ghoul::RuntimeError& except) {
LERRORC(except.component, except.message);
}
}
}
}
}

View File

@@ -56,7 +56,7 @@ enum GroupID {
Unknown
};
static constexpr const int NUM_LAYER_TYPES = 9;
static constexpr const int NUM_LAYER_TYPES = 10;
static constexpr const char* LAYER_TYPE_NAMES[NUM_LAYER_TYPES] = {
"DefaultTileLayer",
"SingleImageTileLayer",
@@ -66,7 +66,8 @@ static constexpr const char* LAYER_TYPE_NAMES[NUM_LAYER_TYPES] = {
"TileIndexTileLayer",
"ByIndexTileLayer",
"ByLevelTileLayer",
"SolidColor"
"SolidColor",
"SpoutImageTileLayer"
};
/**
@@ -82,7 +83,8 @@ enum class TypeID {
TileIndexTileLayer = 5,
ByIndexTileLayer = 6,
ByLevelTileLayer = 7,
SolidColor = 8
SolidColor = 8,
SpoutImageTileLayer = 9
};
static constexpr int NUM_ADJUSTMENT_TYPES = 3;

View File

@@ -2033,6 +2033,14 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
SceneGraphNode* casterNode =
global::renderEngine->scene()->sceneGraphNode(caster);
if ((sourceNode == nullptr) || (casterNode == nullptr)) {
LERRORC(
"Renderableglobe",
"Invalid scenegraph node for the shadow's caster or shadow's receiver."
);
return;
}
const double sourceRadiusScale = std::max(
glm::compMax(sourceNode->scale()),
1.0
@@ -2043,14 +2051,6 @@ void RenderableGlobe::calculateEclipseShadows(ghoul::opengl::ProgramObject& prog
1.0
);
if ((sourceNode == nullptr) || (casterNode == nullptr)) {
LERRORC(
"Renderableglobe",
"Invalid scenegraph node for the shadow's caster or shadow's receiver."
);
return;
}
// First we determine if the caster is shadowing the current planet (all
// calculations in World Coordinates):
const glm::dvec3 planetCasterVec = casterPos - data.modelTransform.translation;

View File

@@ -608,10 +608,18 @@ void RingsComponent::update(const UpdateData& data) {
_textureIsDirty = false;
}
_sunPosition = glm::normalize(
global::renderEngine->scene()->sceneGraphNode("Sun")->worldPosition() -
data.modelTransform.translation
);
// @TODO (abock, 2022-02-20) This should be replaced with the more general light
// source solution that we are using in other places
SceneGraphNode* sun = global::renderEngine->scene()->sceneGraphNode("Sun");
if (sun) {
_sunPosition = glm::normalize(
sun->worldPosition() - data.modelTransform.translation
);
}
else {
// If the Sun node is not found, we assume the light source to be in the origin
_sunPosition = glm::normalize(-data.modelTransform.translation);
}
}
void RingsComponent::loadTexture() {
@@ -619,7 +627,6 @@ void RingsComponent::loadTexture() {
using namespace ghoul::opengl;
if (!_texturePath.value().empty()) {
std::unique_ptr<Texture> texture = TextureReader::ref().loadTexture(
absPath(_texturePath).string(),
1

View File

@@ -356,7 +356,13 @@ void ShadowComponent::end() {
void ShadowComponent::update(const UpdateData&) {
ZoneScoped
_sunPosition = global::renderEngine->scene()->sceneGraphNode("Sun")->worldPosition();
SceneGraphNode* sun = global::renderEngine->scene()->sceneGraphNode("Sun");
if (sun) {
_sunPosition = sun->worldPosition();
}
else {
_sunPosition = glm::dvec3(0.0);
}
glm::ivec2 renderingResolution = global::renderEngine->renderingResolution();
if (_dynamicDepthTextureRes && ((_shadowDepthTextureWidth != renderingResolution.x) ||

View File

@@ -195,6 +195,11 @@ void DefaultTileProvider::reset() {
_asyncTextureDataProvider->prepareToBeDeleted();
}
int DefaultTileProvider::minLevel() {
ghoul_assert(_asyncTextureDataProvider, "No data provider");
return 1;
}
int DefaultTileProvider::maxLevel() {
ghoul_assert(_asyncTextureDataProvider, "No data provider");
return _asyncTextureDataProvider->rawTileDataReader().maxChunkLevel();

View File

@@ -41,6 +41,7 @@ public:
TileDepthTransform depthTransform() override final;
void update() override final;
void reset() override final;
int minLevel() override final;
int maxLevel() override final;
float noDataValueAsFloat() override final;

View File

@@ -112,7 +112,7 @@ TileDepthTransform ImageSequenceTileProvider::depthTransform() {
void ImageSequenceTileProvider::update() {
if (_isImageDirty && !_imagePaths.empty() &&
_index >= 0 && _index < _imagePaths.size())
_index >= 0 && _index < static_cast<int>(_imagePaths.size()))
{
if (_currentTileProvider) {
_currentTileProvider->deinitialize();
@@ -149,6 +149,10 @@ void ImageSequenceTileProvider::reset() {
}
}
int ImageSequenceTileProvider::minLevel() {
return 1;
}
int ImageSequenceTileProvider::maxLevel() {
return _currentTileProvider ? _currentTileProvider->maxLevel() : 0;
}

View File

@@ -40,6 +40,7 @@ public:
TileDepthTransform depthTransform() override final;
void update() override final;
void reset() override final;
int minLevel() override final;
int maxLevel() override final;
float noDataValueAsFloat() override final;

Some files were not shown because too many files have changed in this diff Show More