Merge branch 'master' into feature/session-recording-addons

This commit is contained in:
GPayne
2021-04-16 14:29:24 -06:00
168 changed files with 4432 additions and 5035 deletions

View File

@@ -134,9 +134,19 @@ endif ()
option(OPENSPACE_WITH_ABUFFER_RENDERER "Compile ABuffer Renderer" OFF)
if (UNIX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
if (UNIX)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -lc++ -lc++abi")
else ()
if(NOT CMAKE_BUILD_TYPE)
#Can set to "RelWithDebInfo" or "Debug" also, but problems occur if this is blank by default
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Default build type" FORCE)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLM_ENABLE_EXPERIMENTAL" CACHE STRING "" FORCE)
set(OpenGL_GL_PREFERENCE "GLVND" CACHE STRING "OpenGL Preference setting necessary for linux" FORCE)
set(ASSIMP_BUILD_MINIZIP ON CACHE BOOL "Set to have assimp build minizip" FORCE)
endif ()
endif ()
add_subdirectory(ext)

3
Jenkinsfile vendored
View File

@@ -107,7 +107,8 @@ linux_gcc_make: {
}
stage('linux-gcc-make/build') {
def cmakeCompileOptions = moduleCMakeFlags();
cmakeCompileOptions += ' -DMAKE_BUILD_TYPE=Release';
cmakeCompileOptions += ' -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS:STRING="-DGLM_ENABLE_EXPERIMENTAL"';
cmakeCompileOptions += ' -DOpenGL_GL_PREFERENCE:STRING=GLVND -DASSIMP_BUILD_MINIZIP=1';
// Not sure why the linking of OpenSpaceTest takes so long
compileHelper.build(compileHelper.Make(), compileHelper.Gcc(), cmakeCompileOptions, 'OpenSpace', 'build-make');
compileHelper.recordCompileIssues(compileHelper.Gcc());

View File

@@ -34,6 +34,7 @@ set(HEADER_FILES
include/profile/cameradialog.h
include/profile/deltatimesdialog.h
include/profile/keybindingsdialog.h
include/profile/scriptlogdialog.h
include/profile/line.h
include/profile/marknodesdialog.h
include/profile/metadialog.h
@@ -53,6 +54,7 @@ set(SOURCE_FILES
src/profile/cameradialog.cpp
src/profile/deltatimesdialog.cpp
src/profile/keybindingsdialog.cpp
src/profile/scriptlogdialog.cpp
src/profile/line.cpp
src/profile/marknodesdialog.cpp
src/profile/metadialog.cpp
@@ -74,6 +76,7 @@ qt5_wrap_cpp(
include/profile/cameradialog.h
include/profile/deltatimesdialog.h
include/profile/keybindingsdialog.h
include/profile/scriptlogdialog.h
include/profile/marknodesdialog.h
include/profile/metadialog.h
include/profile/modulesdialog.h

View File

@@ -58,6 +58,13 @@ public:
*/
virtual void keyPressEvent(QKeyEvent* evt) override;
/**
* Adds scripts to the _scriptEdit from outside dialogs
*
* \param scripts #std::string scripts to be appended
*/
void appendScriptsToKeybind(const std::string& scripts);
private slots:
void listItemSelected();
void listItemAdded();
@@ -66,6 +73,7 @@ private slots:
void listItemCancelSave();
void transitionToEditMode();
void parseSelections();
void chooseScripts();
void keySelected(int index);
private:
@@ -99,6 +107,7 @@ private:
QPushButton* _addButton = nullptr;
QPushButton* _removeButton = nullptr;
QPushButton* _chooseScriptsButton = nullptr;
QPushButton* _saveButton = nullptr;
QPushButton* _cancelButton = nullptr;
QDialogButtonBox* _buttonBox = nullptr;

View File

@@ -0,0 +1,53 @@
/*****************************************************************************************
* *
* 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_UI_LAUNCHER___SCRIPTLOG___H__
#define __OPENSPACE_UI_LAUNCHER___SCRIPTLOG___H__
#include "profile/keybindingsdialog.h"
#include <QDialog>
#include <QListWidget>
class ScriptlogDialog : public QDialog {
Q_OBJECT
public:
/**
* Constructor for ScriptlogDialog class
*
* \param bindingDialog keybindingDialog that openend this window.
* \param parent Pointer to parent Qt widget
*/
ScriptlogDialog(KeybindingsDialog* bindingDialog, QWidget* parent);
private slots:
void saveChosenScripts();
private:
void createWidgets();
KeybindingsDialog* _bindingDialog = nullptr;
QListWidget* _scriptlogList = nullptr;
};
#endif // __OPENSPACE_UI_LAUNCHER___SCRIPTLOG___H__

View File

@@ -149,7 +149,9 @@ void AssetTreeModel::importModelData(const std::string& assetBasePath,
const std::string& userAssetBasePath) {
FileSystemAccess assets(
".asset",
{ "scene", "global", "customization", "examples", "util" },
// @TODO (abock, 2021-03-24) We need some better solution for this; what is the
// problem of just including all subfolders instead?
{ "scene", "global", "customization", "dashboard", "examples", "util" },
true,
true
);

View File

@@ -25,6 +25,8 @@
#include "profile/keybindingsdialog.h"
#include "profile/line.h"
#include "profile/scriptlogdialog.h"
#include <openspace/scene/profile.h>
#include <openspace/util/keys.h>
#include <qevent.h>
@@ -106,6 +108,10 @@ KeybindingsDialog::KeybindingsDialog(Profile& profile, QWidget *parent)
transitionFromEditMode();
}
void KeybindingsDialog::appendScriptsToKeybind(const std::string& scripts) {
_scriptEdit->append(QString::fromStdString(scripts));
}
void KeybindingsDialog::createWidgets() {
QBoxLayout* layout = new QVBoxLayout(this);
{
@@ -220,6 +226,14 @@ void KeybindingsDialog::createWidgets() {
_scriptLabel = new QLabel("Script");
box->addWidget(_scriptLabel, 6, 0, 1, 2);
_chooseScriptsButton = new QPushButton("Choose Scripts");
connect(
_chooseScriptsButton, &QPushButton::clicked,
this, &KeybindingsDialog::chooseScripts
);
box->addWidget(_chooseScriptsButton, 6, 1, 1, 1);
_scriptEdit = new QTextEdit;
_scriptEdit->setAcceptRichText(false);
_scriptEdit->setToolTip("Command(s) to execute at keypress event");
@@ -497,6 +511,7 @@ void KeybindingsDialog::editBoxDisabled(bool disabled) {
_scriptEdit->setDisabled(disabled);
_cancelButton->setDisabled(disabled);
_saveButton->setDisabled(disabled);
_chooseScriptsButton->setDisabled(disabled);
}
void KeybindingsDialog::parseSelections() {
@@ -508,6 +523,11 @@ void KeybindingsDialog::parseSelections() {
accept();
}
void KeybindingsDialog::chooseScripts() {
_errorMsg->clear();
ScriptlogDialog(this, this).exec();
}
void KeybindingsDialog::keyPressEvent(QKeyEvent* evt) {
if (evt->key() == Qt::Key_Enter || evt->key() == Qt::Key_Return) {
return;

View File

@@ -0,0 +1,99 @@
/*****************************************************************************************
* *
* 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. *
****************************************************************************************/
#include "profile/scriptlogdialog.h"
#include "profile/line.h"
#include <openspace/engine/configuration.h>
#include <openspace/scene/profile.h>
#include <ghoul/filesystem/filesystem.h>
#include <QDialogButtonBox>
#include <QLabel>
#include <QFile>
#include <QTextStream>
#include <QVBoxLayout>
ScriptlogDialog::ScriptlogDialog(KeybindingsDialog* bindingDialog,
QWidget* parent)
: QDialog(parent)
, _bindingDialog(bindingDialog)
{
setWindowTitle("Scriptlog");
createWidgets();
QFile file(QString::fromStdString(absPath("${LOGS}/scriptLog.txt")));
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream in(&file);
while (!in.atEnd()) {
QString line = in.readLine();
// removing return from a few statments
// these are usually generated by gui panels
line.remove(QRegularExpression("^return "));
if (!line.isEmpty()) {
_scriptlogList->addItem(line);
}
}
}
}
void ScriptlogDialog::createWidgets() {
QBoxLayout* layout = new QVBoxLayout(this);
{
QLabel* heading = new QLabel("Choose commands from log/scriptLog.txt");
heading->setObjectName("heading");
layout->addWidget(heading);
}
_scriptlogList = new QListWidget;
_scriptlogList->setSelectionMode(QAbstractItemView::SelectionMode::MultiSelection);
layout->addWidget(_scriptlogList);
layout->addWidget(new Line);
{
QDialogButtonBox* buttons = new QDialogButtonBox;
buttons->setStandardButtons(QDialogButtonBox::Save | QDialogButtonBox::Cancel);
connect(
buttons, &QDialogButtonBox::accepted,
this, &ScriptlogDialog::saveChosenScripts
);
connect(
buttons, &QDialogButtonBox::rejected,
this, &ScriptlogDialog::reject
);
layout->addWidget(buttons);
}
}
void ScriptlogDialog::saveChosenScripts() {
std::string chosenScripts;
QList<QListWidgetItem*> itemList = _scriptlogList->selectedItems();
for (int i = 0; i < itemList.size(); ++i) {
chosenScripts += itemList.at(i)->text().toStdString();
if (i < itemList.size()) {
chosenScripts += "\n";
}
}
_bindingDialog->appendScriptsToKeybind(chosenScripts);
accept();
}

View File

@@ -218,6 +218,15 @@ void mainInitFunc(GLFWwindow*) {
LTRACE("main::mainInitFunc(begin)");
//
// Screenshots
//
// We save the startup value of the screenshots just in case we want to add a date
// to them later in the RenderEngine
std::string screenshotPath = absPath("${SCREENSHOTS}");
FileSys.registerPathToken("${STARTUP_SCREENSHOT}", screenshotPath);
Settings::instance().setCapturePath(screenshotPath);
LDEBUG("Initializing OpenSpace Engine started");
global::openSpaceEngine->initialize();
LDEBUG("Initializing OpenSpace Engine finished");
@@ -321,27 +330,6 @@ void mainInitFunc(GLFWwindow*) {
#endif // OPENSPACE_HAS_SPOUT
}
//
// Screenshots
//
std::string screenshotPath = "${SCREENSHOTS}";
if (global::configuration->shouldUseScreenshotDate) {
std::time_t now = std::time(nullptr);
std::tm* nowTime = std::localtime(&now);
char mbstr[128];
strftime(mbstr, sizeof(mbstr), "%Y-%m-%d-%H-%M", nowTime);
FileSys.registerPathToken(
"${SCREENSHOTS}",
absPath(screenshotPath + '/' + std::string(mbstr)),
ghoul::filesystem::FileSystem::Override::Yes
);
}
Settings::instance().setCapturePath(absPath(screenshotPath));
LTRACE("main::mainInitFunc(end)");
}
@@ -1117,22 +1105,17 @@ int main(int argc, char* argv[]) {
}
LINFO(fmt::format("Configuration Path: '{}'", configurationFilePath));
// Register the base path as the directory where the configuration file lives
std::string base = ghoul::filesystem::File(configurationFilePath).directoryName();
constexpr const char* BasePathToken = "${BASE}";
FileSys.registerPathToken(BasePathToken, base);
// Loading configuration from disk
LDEBUG("Loading configuration from disk");
*global::configuration = configuration::loadConfigurationFromFile(
configurationFilePath
configurationFilePath,
commandlineArguments.configurationOverride
);
// If the user requested a commandline-based configuration script that should
// overwrite some of the values, this is the time to do it
if (!commandlineArguments.configurationOverride.empty()) {
LDEBUG("Executing Lua script passed through the commandline:");
LDEBUG(commandlineArguments.configurationOverride);
ghoul::lua::runScript(
global::configuration->state,
commandlineArguments.configurationOverride
);
parseLuaState(*global::configuration);
}
// Determining SGCT configuration file
LDEBUG("SGCT Configuration file: " + global::configuration->windowConfiguration);

View File

@@ -122,7 +122,13 @@ int main(int argc, char** argv) {
);
std::string configFile = configuration::findConfiguration();
*global::configuration = configuration::loadConfigurationFromFile(configFile);
// Register the base path as the directory where the configuration file lives
std::string base = ghoul::filesystem::File(configFile).directoryName();
constexpr const char* BasePathToken = "${BASE}";
FileSys.registerPathToken(BasePathToken, base);
*global::configuration = configuration::loadConfigurationFromFile(configFile, "");
openspace::global::openSpaceEngine->registerPathTokens();
global::openSpaceEngine->initialize();
@@ -131,7 +137,7 @@ int main(int argc, char** argv) {
ghoul::cmdparser::CommandlineParser::AllowUnknownCommands::Yes
);
std::string tasksPath = "";
std::string tasksPath;
commandlineParser.addCommand(
std::make_unique<ghoul::cmdparser::SingleCommand<std::string>>(
tasksPath,
@@ -146,7 +152,7 @@ int main(int argc, char** argv) {
//FileSys.setCurrentDirectory(launchDirectory);
if (tasksPath != "") {
if (!tasksPath.empty()) {
performTasks(tasksPath);
return 0;
}

View File

@@ -4,7 +4,7 @@
<Display swapInterval="0" />
</Settings>
<Node address="localhost" port="20401">
<Window fullScreen="true" monitor="1" name="OpenSpace" draw2d="false">
<Window fullscreen="true" monitor="1" name="OpenSpace" draw2d="false">
<Stereo type="none" />
<Size x="1920" y="1080" />
<Pos x="0" y="0" />
@@ -17,7 +17,7 @@
</PlanarProjection>
</Viewport>
</Window>
<Window fullScreen="false" border="false" name="GUI" tags="GUI" draw3D="false">
<Window fullscreen="false" border="false" name="GUI" tags="GUI" draw3D="false">
<Stereo type="none" />
<Size x="1920" y="1080" />
<Pos x="0" y="0" />

View File

@@ -19,7 +19,7 @@
-->
<!-- mesh path is relative to working directory-->
<!-- NOTE, if no working directory is set, mesh must be absolute path -->
<Viewport name="warped fisheye" mesh="config/mesh/standard_16x9.data">
<Viewport name="warped fisheye" mesh="mesh/standard_16x9.data">
<Pos x="0.0" y="0.0" />
<Size x="1.0" y="1.0" />
<FisheyeProjection fov="180" quality="2k" tilt="30.0">

View File

@@ -8,8 +8,8 @@ local propertyHelper = asset.require('util/property_helper')
asset.require('spice/base')
-- Load default key bindings applicable to most scenes
asset.require('dashboard/default_dashboard')
asset.require('util/default_keybindings')
asset.require('util/default_dashboard')
asset.require('util/default_joystick')
-- Load web gui

View File

@@ -0,0 +1,13 @@
local item = {
Type = "DashboardItemDate",
Identifier = "Date",
GuiName = "Date"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -0,0 +1,8 @@
local assetHelper = asset.require('util/asset_helper')
asset.require('./date')
asset.require('./simulationincrement')
asset.require('./distance')
asset.require('./framerate')
asset.require('./parallelconnection')
asset.require('./globelocation')

View File

@@ -0,0 +1,13 @@
local item = {
Type = "DashboardItemDistance",
Identifier = "Distance",
GuiName = "Distance"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -0,0 +1,13 @@
local item = {
Type = "DashboardItemFramerate",
Identifier = "Framerate",
GuiName = "Framerate"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -0,0 +1,13 @@
local item = {
Type = "DashboardItemGlobeLocation",
Identifier = "GlobeLocation",
GuiName = "Globe Location"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -0,0 +1,13 @@
local item = {
Type = "DashboardItemParallelConnection",
Identifier = "ParallelConnection",
GuiName = "Parallel Connection"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -0,0 +1,13 @@
local item = {
Type = "DashboardItemSimulationIncrement",
Identifier = "SimulationIncrement",
GuiName = "Simulation Increment"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -0,0 +1,14 @@
local item = {
Type = "DashboardItemVelocity",
Identifier = "GlobeLocation",
Simplification = true,
GuiName = "Velocity"
}
asset.onInitialize(function()
openspace.dashboard.addDashboardItem(item)
end)
asset.onDeinitialize(function()
openspace.dashboard.removeDashboardItem(item.Identifier)
end)

View File

@@ -18,7 +18,7 @@ for z=1,3 do
Size = 0.20 + i * 0.01,
Segments = 80,
Opacity = 1,
Texture = "${DATA}/test2.jpg",
Texture = openspace.absPath("${DATA}/test2.jpg"),
Orientation = "Both",
},
GUI = {

View File

@@ -104,12 +104,6 @@ local ecliptic = {
local eclipticLabels = {
Identifier = "EclipticSphereLabels",
Parent = transforms.SolarSystemBarycenter.Name,
Transform = {
Rotation = {
Type = "StaticRotation",
Rotation = eclipticRotationMatrix
}
},
Renderable = {
Type = "RenderableBillboardsCloud",
Enabled = false,
@@ -122,6 +116,12 @@ local eclipticLabels = {
TextMinSize = 1.3,
TextMaxSize = 50.0,
Unit = "pc",
TransformationMatrix = {
-0.05487554, 0.4941095, -0.8676661, 0.0,
-0.9938214 , -0.1109906, -0.0003515167, 0.0,
-0.09647644, 0.8622859, 0.4971472, 0.0,
0.0, 0.0, 0.0, 1.0
}
},
GUI = {
Name = "Ecliptic Sphere Labels",
@@ -158,12 +158,6 @@ local equatorial = {
local equatorialLabels = {
Identifier = "EquatorialSphereLabels",
Parent = transforms.SolarSystemBarycenter.Name,
Transform = {
Rotation = {
Type = "StaticRotation",
Rotation = equatorialRotationMatrix
}
},
Renderable = {
Type = "RenderableBillboardsCloud",
Enabled = false,
@@ -176,6 +170,12 @@ local equatorialLabels = {
TextMinSize = 1.7,
TextMaxSize = 70.0,
Unit = "pc",
TransformationMatrix = {
-0.05487554, 0.4941095, -0.8676661, 0.0,
-0.8734371 , -0.4448296, -0.1980764, 0.0,
-0.483835 , 0.7469823, 0.4559838, 0.0,
0.0 , 0.0 , 0.0 , 1.0
}
},
GUI = {
Name = "Equatorial Sphere Labels",

View File

@@ -13,7 +13,7 @@ local speck = asset.syncedResource({
Name = "Kepler Speck Files",
Type = "HttpSynchronization",
Identifier = "digitaluniverse_kepler_speck",
Version = 2
Version = 3
})
local object = {

View File

@@ -1,6 +1,6 @@
local assetHelper = asset.require('util/asset_helper')
local colorLUT = asset.require('./stars_colormap').BvColorLUT
local textures = asset.syncedResource({
Name = "Stars Textures",
@@ -23,13 +23,6 @@ local sunspeck = asset.syncedResource({
Version = 1
})
local colorLUT = asset.syncedResource({
Name = "Stars Color Table",
Type = "HttpSynchronization",
Identifier = "stars_colormap",
Version = 2
})
local stars = {
Identifier = "Stars",
Renderable = {

View File

@@ -0,0 +1,22 @@
local assetHelper = asset.require('util/asset_helper')
local BvColorLUT = asset.syncedResource({
Name = "Stars Color Table",
Type = "HttpSynchronization",
Identifier = "stars_colormap",
Version = 2
})
asset.export("BvColorLUT", BvColorLUT)
asset.meta = {
Name = "Stars B-V Colormap",
Version = "2.0",
Description = [[A lookup table that maps a B-V color index to an RGB color.
The B-V values are in the range (-0.4, 2.0) and each line maps a value
in that range to a color]],
Author = "OpenSpace Team",
URL = "https://www.amnh.org/research/hayden-planetarium/digital-universe",
License = "AMNH Digital Universe"
}

View File

@@ -5,7 +5,7 @@ local images = asset.syncedResource({
Name = "Constellation Images",
Type = "HttpSynchronization",
Identifier = "constellation_images",
Version = 2
Version = 3
})
--function that reads the file

View File

@@ -0,0 +1,40 @@
local scene_helper = asset.require('util/scene_helper')
local Keybindings = {
{
Key = "v",
Name = "Show Constellation Art",
Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0);" ..
"openspace.setPropertyValue('{zodiac}.Renderable.Enabled',true);" ..
"openspace.setPropertyValue('{zodiac}.Renderable.Opacity', 1, 2);",
Documentation = "Enables and fades up zodiac art work",
GuiPath = "/Rendering",
Local = false
},
{
Key = "Shift+v",
Name = "Show Constellation Art",
Command = "openspace.setPropertyValue('{zodiac}.Renderable.Opacity', 0, 2);",
Documentation = "fades down zodiac art work",
GuiPath = "/Rendering",
Local = false
},
}
asset.onInitialize(function ()
scene_helper.bindKeys(Keybindings)
end)
asset.onDeinitialize(function ()
scene_helper.unbindKeys(Keybindings)
end)
asset.meta = {
Name = "Constellation Image Extra Keybinds",
Version = "1.0",
Description = "Artistic images depicting the constellations",
Author = "James Hedberg",
URL = "http://jameshedberg.com",
License = "CC-BY"
}

View File

@@ -6,7 +6,7 @@ local Keybindings = {
Name = "Show Constellation Art",
Command = "openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0);" ..
"openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Enabled', true);" ..
"openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0.1, 2);",
"openspace.setPropertyValue('Scene.ConstellationArt*.Renderable.Opacity', 0.2, 2);",
Documentation = "Enables and fades up constellation art work",
GuiPath = "/Rendering",
Local = false
@@ -39,10 +39,10 @@ end)
asset.meta = {
Name = "Constellation Image Keybinds",
Version = "1.0",
Description = "Keybinds for fading in and out the constellations",
Author = "OpenSpace Team",
URL = "http://openspaceproject.com",
License = "MIT License"
Name = "Constellation Image Keybinds",
Version = "1.0",
Description = "Artistic images depicting the constellations",
Author = "James Hedberg",
URL = "http://jameshedberg.com",
License = "CC-BY"
}

View File

@@ -1,3 +1,5 @@
local bvColorLUT = asset.require('scene/digitaluniverse/stars_colormap').BvColorLUT
local DataPath = asset.syncedResource({
Name = "Exoplanet Data Files",
Type = "HttpSynchronization",
@@ -7,9 +9,14 @@ local DataPath = asset.syncedResource({
asset.onInitialize(function ()
local p = "Modules.Exoplanets.DataFolder";
if(openspace.getPropertyValue(p) == "") then
if (openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, DataPath)
end
p = "Modules.Exoplanets.BvColormap";
if (openspace.getPropertyValue(p) == "") then
openspace.setPropertyValueSingle(p, bvColorLUT .. "/colorbv.cmap")
end
end)
asset.export("DataPath", DataPath)
@@ -22,5 +29,5 @@ asset.meta = {
Archive]],
Author = "OpenSpace Team",
URL = "https://exoplanetarchive.ipac.caltech.edu/docs/data.html",
License = "MIT license",
License = "MIT license"
}

View File

@@ -13,8 +13,7 @@ local Charon = {
Translation = {
Type = "SpiceTranslation",
Target = "CHARON",
Observer = "PLUTO BARYCENTER",
Kernels = NewHorizonsKernels
Observer = "PLUTO BARYCENTER"
},
Rotation = {
Type = "SpiceRotation",

View File

@@ -11,8 +11,7 @@ local Kerberos = {
Translation = {
Type = "SpiceTranslation",
Target = "KERBEROS",
Observer = "PLUTO BARYCENTER",
Kernels = PlutoKernels
Observer = "PLUTO BARYCENTER"
}
},
Renderable = {

View File

@@ -11,8 +11,7 @@ local Nix = {
Translation = {
Type = "SpiceTranslation",
Target = "NIX",
Observer = "PLUTO BARYCENTER",
Kernels = PlutoKernels
Observer = "PLUTO BARYCENTER"
}
},
Renderable = {

View File

@@ -3,7 +3,6 @@ local transforms = asset.require('../transforms')
local kernels = asset.require('../kernels').PlutoKernels
local Styx = {
Identifier = "Styx",
Parent = transforms.PlutoBarycenter.Identifier,
@@ -11,8 +10,7 @@ local Styx = {
Translation = {
Type = "SpiceTranslation",
Target = "STYX",
Observer = "PLUTO BARYCENTER",
Kernels = PlutoKernels
Observer = "PLUTO BARYCENTER"
}
},
Renderable = {

View File

@@ -13,8 +13,7 @@ local Pluto = {
Translation = {
Type = "SpiceTranslation",
Target = "PLUTO",
Observer = "PLUTO BARYCENTER",
Kernels = NewHorizonsKernels
Observer = "PLUTO BARYCENTER"
},
Rotation = {
Type = "SpiceRotation",

View File

@@ -18,13 +18,8 @@ asset.onInitialize(function ()
openspace.globebrowsing.addBlendingLayersFromDirectory(vrts, assetGlobe);
flipbook = helper.createFlipbook(assetPrefix, assetGlobe, 19);
function nextFlip()
helper.nextFlipbookPage(flipbook);
end
function previousFlip()
helper.previousFlipbookPage(flipbook);
end
rawset(_G, "nextFlip", function() helper.nextFlipbookPage(flipbook) end)
rawset(_G, "previousFlip", function() helper.previousFlipbookPage(flipbook) end)
openspace.bindKey("p", "nextFlip()", "Show the next Apollo 11 flipbook image.", "Next A11 flip", "/Missions/Apollo/11")
openspace.bindKey("o", "previousFlip()","Show the previous Apollo 11 flipbook image.", "Prev A11 flip", "/Missions/Apollo/11")

View File

@@ -1,8 +1,8 @@
local assetHelper = asset.require('util/asset_helper')
local moon_transforms = asset.require('scene/solarsystem/planets/earth/moon/moon')
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
local csm = asset.require('../apollo_csm')
asset.require('spice/base')
local models = asset.require('scene/solarsystem/missions/apollo/csm_model').models
local kernels = asset.require('scene/solarsystem/missions/apollo/15/kernels').kernels
@@ -47,6 +47,20 @@ local Apollo15 = {
DestinationFrame = "GALACTIC"
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = models .. "/ApolloCSM.fbx",
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sun_transforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
TimeFrame = {
Type = "TimeFrameInterval",
Start = "1971-07-30T02:22:00.00",
@@ -101,13 +115,6 @@ local Apollo15Trail = {
}
}
local model_part = csm.createCsmModel(Apollo15.Identifier)
local list = { Apollo15, Apollo15Trail }
for k,v in pairs(model_part) do
v.GUI.Path = "/Solar System/Missions/Apollo/15/Model"
table.insert(list, v)
end
assetHelper.registerSceneGraphNodesAndExport(asset, list)

View File

@@ -1,7 +1,8 @@
local asset_helper = asset.require('util/asset_helper')
local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms')
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
local kernels = asset.require('./kernels').kernels
local csm = asset.require('../apollo_csm')
local models = asset.require('scene/solarsystem/missions/apollo/csm_model').models
local apolloSpiceId = "-908"
@@ -47,6 +48,20 @@ local Apollo8LaunchModel = {
Rotation = {0.0, 0.0, -3.1415 / 2}
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = models .. "/ApolloCSM.fbx",
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sun_transforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Hidden = true,
Name = "Apollo 8 Launch Model",
@@ -54,12 +69,6 @@ local Apollo8LaunchModel = {
}
}
local launch_model_part = csm.createCsmModel(Apollo8LaunchModel.Identifier)
local list = { Apollo8Launch, Apollo8LaunchModel }
for k,v in pairs(launch_model_part) do
v.GUI.Path = "/Solar System/Missions/Apollo/8/Model"
table.insert(list, v)
end
asset_helper.registerSceneGraphNodesAndExport(asset, list)

View File

@@ -1,7 +1,8 @@
local asset_helper = asset.require('util/asset_helper')
local earth_transforms = asset.require('scene/solarsystem/planets/earth/transforms')
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
local kernels = asset.require('./kernels').kernels
local csm = asset.require('../apollo_csm')
local models = asset.require('scene/solarsystem/missions/apollo/csm_model').models
local apolloSpiceId = "-908"
@@ -59,6 +60,20 @@ local Apollo8Model = {
Rotation = {0.0, 0.0, -3.1415 / 2}
}
},
Renderable = {
Type = "RenderableModel",
GeometryFile = models .. "/ApolloCSM.fbx",
LightSources = {
{
Type = "SceneGraphLightSource",
Identifier = "Sun",
Node = sun_transforms.SolarSystemBarycenter.Identifier,
Intensity = 1.0
}
},
PerformShading = true,
DisableFaceCulling = true
},
GUI = {
Hidden = true,
Name = "Apollo 8 Model",
@@ -82,12 +97,6 @@ local Apollo8Pivot = {
}
}
local model_part = csm.createCsmModel(Apollo8Model.Identifier)
local list = { Apollo8, Apollo8Model, Apollo8Pivot }
for k,v in pairs(model_part) do
v.GUI.Path = "/Solar System/Missions/Apollo/8/Model"
table.insert(list, v)
end
asset_helper.registerSceneGraphNodesAndExport(asset, list)

View File

@@ -1,280 +0,0 @@
-- This asset exports a function to create an Apollo Command and Service Module (CSM).
-- Instead of hard-coding the scene graph node parent,
-- client assets can decide which object that the CSM should be attached to.
-- Usage example: createCsmModel(asset, Apollo8.Idenfitier)
-- ...where Apollo8 is the scene graph node identifier to attach the CSM to.
local asset_helper = asset.require('util/asset_helper')
local sun_transforms = asset.require('scene/solarsystem/sun/transforms')
local models = asset.syncedResource({
Name = "Apollo Models",
Type = "HttpSynchronization",
Identifier = "apollo_models",
Version = 1
})
local partsInfo = {
-- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading
-- Exterior
{ "AP08_cone_command_module", "Command_module_diff.png", true },
{ "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true },
{ "AP08_cone_vent_ports_black", "black.png", true },
{ "AP08_cone_vent_ports_red", "red.png", true },
{ "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false },
{ "AP08_service_black", "black.png", true },
{ "AP08_service_brown", "brown.png", true },
{ "AP08_service_grey", "gray.png", true },
{ "AP08_service_high_gain_antenna", "Antenna_diff.png", true },
{ "AP08_service_module", "Service_module_diff.png", true },
{ "AP08_service_nozzle", "Nozzle_diff.png", true },
{ "AP08_service_pink", "pink.png", true },
{ "AP08_service_red", "red.png", true },
{ "AP08_service_scratched_metal", "scratched_metal_gloss.png", true },
{ "AP08_service_white", "white.png", true },
-- Interior
-- { "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false},
-- { "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false },
-- { "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false },
-- { "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false },
-- { "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false },
-- { "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false },
-- { "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false },
-- { "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false },
-- { "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false },
-- { "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false },
-- { "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false },
-- { "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false },
-- { "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false },
-- { "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false },
-- { "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false },
-- { "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false },
-- { "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false },
-- { "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false },
-- { "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false },
-- { "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false },
-- { "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false },
-- { "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false },
-- { "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false },
-- { "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false },
-- { "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false },
-- { "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false },
-- { "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false },
-- { "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false },
-- { "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false },
-- { "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false },
-- { "AP11_interior_grey", "gray.png", false },
-- { "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false },
-- { "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false },
-- { "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false },
-- { "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false },
-- { "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false },
-- { "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false },
-- { "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false },
-- { "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false },
-- { "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false },
-- { "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false },
-- { "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false },
-- { "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false },
-- { "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false },
-- { "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false },
-- { "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false },
-- { "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false },
-- { "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false },
-- { "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false },
-- { "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false },
-- { "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false },
-- { "AP11_interior_pole_end_02", "pole_end_02.png", false },
-- { "AP11_interior_pole_end_03", "pole_end_03.png", false },
-- { "AP11_interior_pole_tex_03", "pole_tex_03.png", false },
-- { "AP11_interior_pole_tex_04", "pole_tex_04.png", false },
-- { "AP11_interior_pole_tex_05", "pole_tex_05.png", false },
-- { "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false },
-- { "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false },
-- { "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false },
-- { "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false },
-- { "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false },
-- { "AP11_interior_red", "red.png", false },
-- { "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false },
-- { "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false },
-- { "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false },
-- { "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false },
-- { "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false },
-- { "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false },
-- { "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false },
-- { "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false },
-- { "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false },
-- { "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false },
-- { "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false },
-- { "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false },
-- { "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false },
-- { "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false },
-- { "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false },
-- { "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false },
-- { "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false },
-- { "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false }
}
local partsInfoFull = {
-- Data is structured as: Geometry file name (except .obj suffix), texture file name, shading
-- Exterior
{ "AP08_cone_command_module", "Command_module_diff.png", true },
{ "AP08_cone_hatchdoor_handle_scratched_metal", "scratched_metal_gloss.png", true },
{ "AP08_cone_vent_ports_black", "black.png", true },
{ "AP08_cone_vent_ports_red", "red.png", true },
{ "AP08_cone_hatchdoor_interior", "apollo_hatchdoor_interior.jpg", false },
{ "AP08_service_black", "black.png", true },
{ "AP08_service_brown", "brown.png", true },
{ "AP08_service_grey", "gray.png", true },
{ "AP08_service_high_gain_antenna", "Antenna_diff.png", true },
{ "AP08_service_module", "Service_module_diff.png", true },
{ "AP08_service_nozzle", "Nozzle_diff.png", true },
{ "AP08_service_pink", "pink.png", true },
{ "AP08_service_red", "red.png", true },
{ "AP08_service_scratched_metal", "scratched_metal_gloss.png", true },
{ "AP08_service_white", "white.png", true },
-- Interior
{ "AP11_int_back_wall_left", "AP11_int_back_wall_left.png", false },
{ "AP11_int_back_wall_right", "AP11_int_back_wall_right.png", false },
{ "AP11_interior_back_wall_top_0Shape3", "back_wall_top_0Shape3_tpAmbient_paint_03.png", false },
{ "AP11_interior_belt_buckles_02_L2", "belt_buckles_02_L2Shape_tpAmbient.png", false },
{ "AP11_interior_belt_straps_02", "belt_straps_02Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_black_push_buttons", "push_buttonsShape_tpAmbient.png", false },
{ "AP11_interior_bottom_boxes_03", "bottom_boxes_03_paint_01.png", false },
{ "AP11_interior_bottom_floor_tp", "bottom_floor_tpAmbient_paint_v002.png", false },
{ "AP11_interior_box_back_01", "box_back_01_paint_v001.png", false },
{ "AP11_interior_box_back_02", "box_back_02_paint_v001.png", false },
{ "AP11_interior_box_back_04", "box_back_04_paint_v001.png", false },
{ "AP11_interior_box_lft_lower_01", "box_lft_lower_01Shape_Diffuse_paint_v002.png", false },
{ "AP11_interior_box_lft_top", "box_lft_topShape_Diffuse_paint_v009.png", false },
{ "AP11_interior_box_mid_tp", "box_mid_tpDiffuse_paint_v001.png", false },
{ "AP11_interior_box_rt_top_02", "box_rt_top_02_paint_04.png", false },
{ "AP11_interior_brushed_blue_ano", "brushed_blue_ano_paint_01.png", false },
{ "AP11_interior_brushed_brass", "brushed_brass_paint_01.png", false },
{ "AP11_interior_brushed_grey_ano", "brushed_grey_ano_paint_02.png", false },
{ "AP11_interior_canvas_cover", "canvas_coverShape_tpAmbient_paint_01.png", false },
{ "AP11_interior_Channel_attachment", "Channel_attachment_Diffuse.png", false },
{ "AP11_interior_Channel_baseMetal", "Channel_baseMetal_Diffuse.png", false },
{ "AP11_interior_Channel_Material", "Channel_Material_Diffuse.png", false },
{ "AP11_interior_Channel_rsMaterial2", "Channel_rsMaterial2_Diffuse.png", false },
{ "AP11_interior_cloth_01", "cloth_01Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_coiled_hose", "coiled_hoseShape_tpAmbient.png", false },
{ "AP11_interior_control_panel_left_win_plates", "control_panel_left_win_platesShape_tpAmbient.png", false },
{ "AP11_interior_control_panel_rt_win_plates", "control_panel_rt_win_platesShape_tpAmbient.png", false },
{ "AP11_interior_copper_parts_main_cp", "copper_parts_main_cpShape_tpAmbient.png", false },
{ "AP11_interior_dials_main2", "dials_main2Shape_tpAmbient.png", false },
{ "AP11_interior_dials_t2", "dials_t2Shape_tpAmbient.png", false },
{ "AP11_interior_dial_fixes_01", "dial_fixes_01Shape_tpAmbient.png", false },
{ "AP11_interior_fire_ex_02", "fire_ex_02_paint_v001.png", false },
{ "AP11_interior_floor_panels_3", "floor_panels_3Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_floor_tile_tex_01", "floor_tile_tex_01.png", false },
{ "AP11_interior_grey", "gray.png", false },
{ "AP11_interior_handholds_cp", "handholds_cpShape_tpAmbient_paint_05.png", false },
{ "AP11_interior_hatch_release_0Shape5", "hatch_release_0Shape5_tpAmbient_paint_02.png", false },
{ "AP11_interior_headrests_02", "headrests_02Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_hoses_black_01", "hoses_black_01Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_hoses_white_0Shape1", "hoses_white_0Shape1_tpAmbient_paint_01.png", false },
{ "AP11_interior_josticks1", "joysticks1Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_joysticks_fabric1", "joysticks_fabric1_Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_joystick_poles_lft_05", "joystick_poles_lft_05_paint_v002.png", false },
{ "AP11_interior_joystick_poles_lft_long_05", "joystick_poles_lft_long_05_paint_v002.png", false },
{ "AP11_interior_joystick_poles_rt_05", "joystick_poles_rt_05_paint_v002.png", false },
{ "AP11_interior_latch_mechanisms_01", "latch_mechanisms_01Shape_tpAmbient.png", false },
{ "AP11_interior_lower_push_buttons", "lower_push_buttonsShape_tpAmbient.png", false },
{ "AP11_interior_lower_walls_back", "lower_walls_back_paint_04.png", false },
{ "AP11_interior_lower_walls_boxes_head", "lower_walls_boxes_headShape_tpAmbient_paint_v001.png", false },
{ "AP11_interior_main_cp_left_smth_03", "main_cp_left_0Shape3_tpAmbient_paint_02.png", false },
{ "AP11_interior_main_cp_mid_smth_02", "main_cp_mid_smth_02Shape_tpAmbient_paint_02.png", false },
{ "AP11_interior_main_cp_rt_smth", "main_cp_rt_smthShape_tpAmbient_paint_02.png", false },
{ "AP11_interior_main_cp_wheels", "main_cp_wheelsShape_tpAmbient.png", false },
{ "AP11_interior_metal_brackets_under_hatch", "metal_brackets_under_hatchShape_tpAmbient.png", false },
{ "AP11_interior_metal_tunnel_parts", "metal_tunnel_partsShape_tpAmbient_paint_01.png", false },
{ "AP11_interior_metal_window_parts", "metal_window_partsShape_tpAmbient_paint_01.png", false },
{ "AP11_interior_middle_walls_05", "middle_walls_05_tpAmbient_paint_02.png", false },
{ "AP11_interior_middle_walls_0Shape8", "middle_walls_0Shape8_tpAmbient_paint_01.png", false },
{ "AP11_interior_mid_tunnel_parts", "mid_tunnel_parts_03Shape_tpAmbient_paint_02.png", false },
{ "AP11_interior_new_switch_rails1", "new_switch_rails1Shape_tpAmbient.png", false },
{ "AP11_interior_nozzles_02", "nozzles_02Shape_tpAmbient_paint_01.png", false },
{ "AP11_interior_outlet_fabric3", "outlet_fabric3Shape_tpAmbient_paint_02.png", false },
{ "AP11_interior_pole_end_02", "pole_end_02.png", false },
{ "AP11_interior_pole_end_03", "pole_end_03.png", false },
{ "AP11_interior_pole_tex_03", "pole_tex_03.png", false },
{ "AP11_interior_pole_tex_04", "pole_tex_04.png", false },
{ "AP11_interior_pole_tex_05", "pole_tex_05.png", false },
{ "AP11_interior_pole_tex_lower_01", "pole_tex_lower_01.png", false },
{ "AP11_interior_pole_under_seat_paint_01", "pole_under_seat_paint_01.png", false },
{ "AP11_interior_pole_under_seat_square_bar", "pole_under_seat_square_bar_paint_01.png", false },
{ "AP11_interior_push_switches_lft1", "push_switches_lft1Shape_tpAmbient.png", false },
{ "AP11_interior_random_small_parts_01", "random_small_parts_01Shape_tpAmbient_paint_02.png", false },
{ "AP11_interior_red", "red.png", false },
{ "AP11_interior_reticle_wheel_tp", "reticle_wheel_tpAmbient_paint_01.png", false },
{ "AP11_interior_rivet_paint_v001", "rivet_paint_v001.png", false },
{ "AP11_interior_seats_fabric", "seats_fabric_paint_01.png", false },
{ "AP11_interior_seat_left_tp", "seat_left_tpAmbient_paint_v001.png", false },
{ "AP11_interior_seat_lights_left", "seat_lights_left_Shape_tpAmbient_paint_v001.png", false },
{ "AP11_interior_seat_lights_rt", "seat_lights_rt_Shape_tpAmbient_paint_v001.png", false },
{ "AP11_interior_seat_middle_tp", "seat_middle_tpAmbient_paint_v001.png", false },
{ "AP11_interior_seat_poles_0Shape1", "seat_poles_0Shape1_tpAmbient_paint_01.png", false },
{ "AP11_interior_seat_pole_mirror_0Shape1", "seat_pole_mirror_0Shape1_tpAmbient_paint_01.png", false },
{ "AP11_interior_seat_rt_tp", "seat_rt_tpAmbient_paint_v001.png", false },
{ "AP11_interior_sextant_0Shape2", "sextant_0Shape2_tpAmbient.png", false },
{ "AP11_interior_switch_covers_main_middle1", "switch_covers_main_middle1Shape_tpAmbient.png", false },
{ "AP11_interior_switch_rails_lft", "switch_rails_lftShape_tpAmbient.png", false },
{ "AP11_interior_tunnel_main_cylinder1", "switch_rails_lftShape_tpAmbient.png", false },
{ "AP11_interior_tunnel_switches_01", "tunnel_switches_01Shape_tpAmbient.png", false },
{ "AP11_interior_tunnel_wheelsShape", "tunnel_wheelsShape_tpAmbient.png", false },
{ "AP11_interior_walls_mid_left", "walls_mid_leftShape_tpAmbient_paint_01.png", false },
{ "AP11_interior_windows_front_0Shape4", "windows_front_0Shape4_tpAmbient_paint_01.png", false }
}
asset.export("createCsmModel", function (parentNodeIdentifier)
local parts = {}
for i, info in ipairs(partsInfo) do
parts[#parts + 1] = asset_helper.createModelPart(
parentNodeIdentifier,
sun_transforms.SolarSystemBarycenter.Identifier,
models,
info[1],
info[2],
info[3]
)
end
return parts
end)
asset.export("createCsmModelFull", function (parentNodeIdentifier)
local parts = {}
for i, info in ipairs(partsInfoFull) do
parts[#parts + 1] = asset_helper.createModelPart(
parentNodeIdentifier,
sun_transforms.SolarSystemBarycenter.Identifier,
models,
info[1],
info[2],
info[3]
)
end
return parts
end)

View File

@@ -0,0 +1,8 @@
local models = asset.syncedResource({
Name = "Apollo Models",
Type = "HttpSynchronization",
Identifier = "apollo_models",
Version = 2
})
asset.export('models', models)

View File

@@ -172,7 +172,7 @@ local MessengerTrail = {
Type = "SpiceTranslation",
Target = "MESSENGER",
Observer = "MERCURY BARYCENTER",
Kernels = Kernels
Kernels = LocalKernels
},
Color = { 0.288, 0.375, 0.934 },
EnableFade = false,

View File

@@ -348,8 +348,8 @@ local Rex = {
Target = "EARTH",
Instrument = "NH_REX",
Color = {
Start = { 1.0, 0.7, 0.0, 1.0},
End = {0.0, 0.0, 0.0, 0.0 }
Start = { 1.0, 0.7, 0.0, 1.0 },
End = { 0.0, 0.0, 0.0, 0.0 }
}
},
Transform = {

View File

@@ -1,6 +1,7 @@
local assetHelper = asset.require('util/asset_helper')
local transforms = asset.require('./transforms')
local sunTransforms = asset.require('scene/solarsystem/sun/transforms')
local NewHorizonsKernels = asset.require('./kernels').NewHorizonsKernels
local assets = asset.syncedResource({
Name = "Pluto Assets",

View File

@@ -1,5 +1,5 @@
local models = asset.syncedResource({
Name = "New Horizons Model",
Name = "Voyager Model",
Type = "HttpSynchronization",
Identifier = "voyager_model",
Version = 1

View File

@@ -0,0 +1,15 @@
local moonAsset = asset.require("./../../moon").Moon
local globeIdentifier = moonAsset.Identifier
local layer ={
Identifier = "Size_Reference",
Name = "Size Reference",
Type = "SizeReferenceTileLayer",
Radii = moonAsset.Renderable.Radii
}
asset.onInitialize(function ()
openspace.globebrowsing.addLayer(globeIdentifier, "Overlays", layer)
end)
asset.export("layer", layer)

View File

@@ -13,7 +13,7 @@ local models = asset.syncedResource({
Name = "ISS Models",
Type = "HttpSynchronization",
Identifier = "iss_model",
Version = 2
Version = 3
})
local initializeAndAddNodes = function()
@@ -59,37 +59,7 @@ local initializeAndAddNodes = function()
},
Renderable = {
Type = "RenderableModel",
GeometryFile = {
models .. "/0.obj",
models .. "/1.obj",
models .. "/2.obj",
models .. "/3.obj",
models .. "/4.obj",
models .. "/5.obj",
models .. "/6.obj",
models .. "/7.obj",
models .. "/8.obj",
models .. "/10.obj",
models .. "/11.obj",
models .. "/13.obj",
models .. "/14.obj",
models .. "/15.obj",
models .. "/16.obj",
models .. "/17.obj",
models .. "/19.obj",
models .. "/21.obj",
models .. "/22.obj",
models .. "/23.obj",
models .. "/24.obj",
models .. "/25.obj",
models .. "/foilsilver.obj",
models .. "/olive.obj",
models .. "/basemetal.obj",
models .. "/white_20.obj",
models .. "/plasticblack.obj",
models .. "/ecostresswhite.obj",
models .. "/plain.obj"
},
GeometryFile = models .. "/ISS.fbx",
LightSources = {
{
Type = "SceneGraphLightSource",

View File

@@ -3,7 +3,7 @@ local proceduralGlobes = asset.require('util/procedural_globe')
local transforms = asset.require('./transforms')
local kernels = asset.require('./kernels')
local kernel081 = kernels.nep081
local kernel087 = kernels.nep087
local kernel086 = kernels.nep086
local kernel088 = kernels.nep088

View File

@@ -13,7 +13,7 @@ local registerSpiceKernels = function (spiceAsset, kernels)
end)
spiceAsset.onDeinitialize(function ()
for i = #kernels, 1, -1 do
kernel = kernels[i]
local kernel = kernels[i]
openspace.spice.unloadKernel(kernel)
end
end)
@@ -75,7 +75,7 @@ local registerDashboardItems = function (dashboardAsset, items)
)
dashboardAsset.onDeinitialize(function ()
for i = #items, 1, -1 do
item = items[i]
local item = items[i]
openspace.dashboard.removeDashboardItem(item.Identifier)
end
end)
@@ -103,7 +103,7 @@ local registerSceneGraphNodesAndExport = function (sceneAsset, nodes, override)
end)
sceneAsset.onDeinitialize(function ()
for i = #nodes, 1, -1 do
node = nodes[i]
local node = nodes[i]
openspace.removeSceneGraphNode(node.Identifier)
end
end)

View File

@@ -1,34 +0,0 @@
local assetHelper = asset.require('util/asset_helper')
assetHelper.registerDashboardItems(asset, {
{
Type = "DashboardItemDate",
Identifier = "Date",
GuiName = "Date"
},
{
Type = "DashboardItemSimulationIncrement",
Identifier = "SimulationIncrement",
GuiName = "Simulation Increment"
},
{
Type = "DashboardItemDistance",
Identifier = "Distance",
GuiName = "Distance"
},
{
Type = "DashboardItemFramerate",
Identifier = "Framerate",
GuiName = "Framerate"
},
{
Type = "DashboardItemParallelConnection",
Identifier = "ParallelConnection",
GuiName = "Parallel Connection"
},
{
Type = "DashboardItemGlobeLocation",
Identifier = "GlobeLocation",
GuiName = "Globe Location"
}
})

View File

@@ -68,7 +68,7 @@ local createGlobes = function(t)
end
end
result = {}
local result = {}
for i, v in ipairs(t) do
local globe = nil

View File

@@ -10,7 +10,7 @@ local backend = asset.syncedResource({
asset.onInitialize(function ()
-- Unzip the server bundle
dest = backend .. "/backend"
local dest = backend .. "/backend"
if not openspace.directoryExists(dest) then
openspace.unzipFile(backend .. "/backend.zip", dest, true)
end

View File

@@ -24,7 +24,7 @@ end
-- Check format of a set of 3 TLE file lines and return nonzero if there is a format error
function isValidTLEFileFormat(lineArr)
function isEmpty(s) return s == nil or s == '' end
local function isEmpty(s) return s == nil or s == '' end
if isEmpty(lineArr[1]) or isEmpty(lineArr[2]) or isEmpty(lineArr[3]) then
return false

View File

@@ -29,6 +29,7 @@
#include <ghoul/glm.h>
#include <functional>
#include <type_traits>
#include <variant>
namespace openspace::documentation {
@@ -155,7 +156,17 @@ struct IntVerifier : public TemplateVerifier<int> {
* <code>std::string</code>. No implicit conversion is considered in this testing.
*/
struct StringVerifier : public TemplateVerifier<std::string> {
StringVerifier(bool mustBeNotEmpty = false);
TestResult operator()(const ghoul::Dictionary& dictionary,
const std::string& key) const override;
std::string type() const override;
bool mustBeNotEmpty() const;
private:
bool _mustBeNotEmpty = false;
};
/**
@@ -994,8 +1005,15 @@ struct OrVerifier : public Verifier {
* \param values The list of Verifiers that are to be tested
*
* \pre values must contain at least two values
*
* \todo: The use of the variant to use both raw pointers and shared pointers is
* definitely undesired. At the momement we are not handling the ownership of
* the verifiers very well and this must be cleaned up when doing a pass over
* the entire ownership model of the documentation/verifiers. For now it was
* necessary to make the codegen work in all cases without complications there
*/
OrVerifier(const std::vector<Verifier*> values);
OrVerifier(const std::vector<std::variant<Verifier*,
std::shared_ptr<Verifier>>> values);
/**
* Checks whether the \p dictionary contains the \p key and whether this key passes

View File

@@ -45,17 +45,27 @@ template <typename T>
TestResult TemplateVerifier<T>::operator()(const ghoul::Dictionary& dict,
const std::string& key) const
{
TestResult res;
if (dict.hasValue<Type>(key)) {
return { true, {}, {} };
res.success = true;
}
else {
res.success = false;
if (dict.hasKey(key)) {
return { false, { { key, TestResult::Offense::Reason::WrongType } }, {} };
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
res.offenses.push_back(o);
}
else {
return { false, { { key, TestResult::Offense::Reason::MissingKey } }, {} };
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::MissingKey;
res.offenses.push_back(o);
}
}
return res;
}
template <typename T>
@@ -143,7 +153,13 @@ TestResult OperatorVerifier<T, Operator>::operator()(const ghoul::Dictionary& di
val = static_cast<int>(d);
}
else {
return { false, { { key, TestResult::Offense::Reason::WrongType } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -153,7 +169,13 @@ TestResult OperatorVerifier<T, Operator>::operator()(const ghoul::Dictionary& di
return { true, {}, {} };
}
else {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -210,7 +232,13 @@ TestResult InListVerifier<T>::operator()(const ghoul::Dictionary& dict,
return { true, {}, {} };
}
else {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -256,7 +284,13 @@ TestResult NotInListVerifier<T>::operator()(const ghoul::Dictionary& dict,
return { true, {}, {} };
}
else {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -306,7 +340,13 @@ TestResult InRangeVerifier<T>::operator()(const ghoul::Dictionary& dict,
val = static_cast<int>(d);
}
else {
return { false, { { key, TestResult::Offense::Reason::WrongType } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -317,7 +357,13 @@ TestResult InRangeVerifier<T>::operator()(const ghoul::Dictionary& dict,
return { true, {}, {} };
}
else {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -353,7 +399,13 @@ TestResult NotInRangeVerifier<T>::operator()(const ghoul::Dictionary& dict,
val = static_cast<int>(d);
}
else {
return { false, { { key, TestResult::Offense::Reason::WrongType } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::WrongType;
r.offenses.push_back(o);
return r;
}
}
else {
@@ -361,7 +413,13 @@ TestResult NotInRangeVerifier<T>::operator()(const ghoul::Dictionary& dict,
}
if (val >= lower && val <= upper) {
return { false, { { key, TestResult::Offense::Reason::Verification } }, {} };
TestResult r;
r.success = false;
TestResult::Offense o;
o.offender = key;
o.reason = TestResult::Offense::Reason::Verification;
r.offenses.push_back(o);
return r;
}
else {
return { true, {}, {} };
@@ -396,9 +454,10 @@ TestResult DeprecatedVerifier<T>::operator()(const ghoul::Dictionary& dict,
const std::string& key) const
{
TestResult res = T::operator()(dict, key);
res.warnings.push_back(
TestResult::Warning{ key, TestResult::Warning::Reason::Deprecated }
);
TestResult::Warning w;
w.offender = key;
w.reason = TestResult::Warning::Reason::Deprecated;
res.warnings.push_back(w);
return res;
}

View File

@@ -43,7 +43,6 @@ struct Configuration {
Configuration& operator=(Configuration&&) = default;
std::string windowConfiguration = "${CONFIG}/single.xml";
std::string sgctConfigNameInitialized;
std::string asset;
std::string profile;
std::vector<std::string> readOnlyProfiles;
@@ -93,7 +92,6 @@ struct Configuration {
glm::dvec3 screenSpaceRotation = glm::dvec3(0.0);
glm::dvec3 masterRotation = glm::dvec3(0.0);
bool isConsoleDisabled = false;
bool usingProfile = false;
bool bypassLauncher = false;
std::map<std::string, ghoul::Dictionary> moduleConfigurations;
@@ -123,6 +121,9 @@ struct Configuration {
};
HTTPProxy httpProxy;
// Values not read from the openspace.cfg file
bool usingProfile = false;
std::string sgctConfigNameInitialized;
static documentation::Documentation Documentation;
ghoul::lua::LuaState state;
@@ -130,9 +131,8 @@ struct Configuration {
std::string findConfiguration(const std::string& filename = "openspace.cfg");
Configuration loadConfigurationFromFile(const std::string& filename);
void parseLuaState(Configuration& configuration);
Configuration loadConfigurationFromFile(const std::string& filename,
const std::string& overrideScript);
} // namespace openspace::configuration

View File

@@ -144,7 +144,7 @@ private:
// Lua functions - exposed for testing
namespace openspace::luascriptfunctions {
int createSingeColorImage(lua_State* L);
int createSingleColorImage(lua_State* L);
} // openspace::luascriptfunctions

View File

@@ -28,12 +28,9 @@
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalar/boolproperty.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/stringproperty.h>
#include <ghoul/glm.h>
namespace ghoul { class Dictionary; }
namespace ghoul::fontrendering { class Font; }
namespace openspace {
@@ -58,22 +55,6 @@ protected:
properties::BoolProperty _isEnabled;
};
class DashboardTextItem : public DashboardItem {
public:
static documentation::Documentation Documentation();
DashboardTextItem(const ghoul::Dictionary& dictionary, float fontSize = 10.f,
const std::string& fontName = "Mono");
protected:
properties::StringProperty _fontName;
properties::FloatProperty _fontSize;
std::shared_ptr<ghoul::fontrendering::Font> _font;
};
} // openspace
#endif // __OPENSPACE_CORE___DASHBOARDITEM___H__

View File

@@ -0,0 +1,56 @@
/*****************************************************************************************
* *
* 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___DASHBOARDTEXTITEM___H__
#define __OPENSPACE_CORE___DASHBOARDTEXTITEM___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/properties/scalar/floatproperty.h>
#include <openspace/properties/stringproperty.h>
namespace ghoul { class Dictionary; }
namespace ghoul::fontrendering { class Font; }
namespace openspace {
namespace documentation { struct Documentation; }
class DashboardTextItem : public DashboardItem {
public:
static documentation::Documentation Documentation();
DashboardTextItem(const ghoul::Dictionary& dictionary, float fontSize = 10.f,
const std::string& fontName = "Mono");
protected:
properties::StringProperty _fontName;
properties::FloatProperty _fontSize;
std::shared_ptr<ghoul::fontrendering::Font> _font;
};
} // openspace
#endif // __OPENSPACE_CORE___DASHBOARDTEXTITEM___H__

View File

@@ -201,6 +201,7 @@ private:
properties::BoolProperty _showCameraInfo;
properties::BoolProperty _applyWarping;
properties::BoolProperty _screenshotUseDate;
properties::BoolProperty _showFrameInformation;
properties::BoolProperty _disableMasterRendering;

View File

@@ -47,6 +47,8 @@ struct LuaLibrary;
class ScriptScheduler {
public:
struct ScheduledScript {
ScheduledScript() = default;
ScheduledScript(const ghoul::Dictionary& dict);
double time = -std::numeric_limits<double>::max();
std::string forwardScript;

View File

@@ -179,7 +179,8 @@ namespace {
// A list of objects that cast light on this atmosphere
std::vector<CasterElement> casters;
};
// Declares shadow groups, meaning which nodes are considered in shadow calculations
// Declares shadow groups, meaning which nodes are considered in shadow
// calculations
std::optional<ShadowGroup> shadowGroup;
// [[codegen::verbatim(AtmosphereHeightInfo.description)]]
@@ -360,7 +361,7 @@ RenderableAtmosphere::RenderableAtmosphere(const ghoul::Dictionary& dictionary)
_mieScatteringExtinctionPropCoefficient.onChange(updateWithCalculation);
addProperty(_mieScatteringExtinctionPropCoefficient);
if (p.debug.has_value()) {
_preCalculatedTexturesScale =
p.debug->preCalculatedTextureScale.value_or(_preCalculatedTexturesScale);

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMANGLE___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMANGLE___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/stringproperty.h>

View File

@@ -55,7 +55,7 @@ namespace {
struct [[codegen::Dictionary(DashboardItemDate)]] Parameters {
// [[codegen::verbatim(FormatStringInfo.description)]]
std::optional<std::string> formatString;
// [[codegen::verbatim(TimeFormatInfo.description)]]
std::optional<std::string> timeFormat;
};

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMDATE___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMDATE___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/stringproperty.h>

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMDISTANCE___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMDISTANCE___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/stringproperty.h>

View File

@@ -132,7 +132,8 @@ namespace {
DtAvg [[codegen::key("Average Deltatime")]],
DtExtremes [[codegen::key("Deltatime extremes")]],
DtStandardDeviation [[codegen::key("Deltatime standard deviation")]],
DtCoefficientOfVariation [[codegen::key("Deltatime coefficient of variation")]],
DtCoefficientOfVariation
[[codegen::key("Deltatime coefficient of variation")]],
FPS [[codegen::key("Frames per second")]],
FPSAvg [[codegen::key("Average frames per second")]]
};
@@ -187,7 +188,8 @@ DashboardItemFramerate::DashboardItemFramerate(const ghoul::Dictionary& dictiona
_frametimeType = static_cast<int>(FrametimeType::DtStandardDeviation);
break;
case Parameters::Type::DtCoefficientOfVariation:
_frametimeType = static_cast<int>(FrametimeType::DtCoefficientOfVariation);
_frametimeType =
static_cast<int>(FrametimeType::DtCoefficientOfVariation);
break;
case Parameters::Type::FPS:
_frametimeType = static_cast<int>(FrametimeType::FPS);

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMFRAMERATE___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMFRAMERATE___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/triggerproperty.h>

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMMISSION___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMMISSION___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
namespace openspace {

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMPARALLELCONNECTION___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMPARALLELCONNECTION___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
namespace openspace {

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMPROPERTYVALUE___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMPROPERTYVALUE___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/stringproperty.h>

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMSIMULATIONINCREMENT___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMSIMULATIONINCREMENT___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/stringproperty.h>

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMTEXT___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMTEXT___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/stringproperty.h>

View File

@@ -25,7 +25,7 @@
#ifndef __OPENSPACE_MODULE_BASE___DASHBOARDITEMVELOCITY___H__
#define __OPENSPACE_MODULE_BASE___DASHBOARDITEMVELOCITY___H__
#include <openspace/rendering/dashboarditem.h>
#include <openspace/rendering/dashboardtextitem.h>
#include <openspace/properties/optionproperty.h>
#include <openspace/properties/scalar/boolproperty.h>

View File

@@ -80,7 +80,7 @@ documentation::Documentation RenderableBoxGrid::Documentation() {
RenderableBoxGrid::RenderableBoxGrid(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
, _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f)
, _size(SizeInfo, glm::vec3(1.f), glm::vec3(1.f), glm::vec3(100.f))
{
const Parameters p = codegen::bake<Parameters>(dictionary);

View File

@@ -91,7 +91,7 @@ RenderableGrid::RenderableGrid(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
, _segments(SegmentsInfo, glm::uvec2(10), glm::uvec2(1), glm::uvec2(200))
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
, _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f)
, _size(SizeInfo, glm::vec2(1e20f), glm::vec2(1.f), glm::vec2(1e35f))
{
const Parameters p = codegen::bake<Parameters>(dictionary);

View File

@@ -113,7 +113,7 @@ RenderableRadialGrid::RenderableRadialGrid(const ghoul::Dictionary& dictionary)
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
, _gridSegments(GridSegmentsInfo, glm::ivec2(1), glm::ivec2(1), glm::ivec2(200))
, _circleSegments(CircleSegmentsInfo, 36, 4, 200)
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
, _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f)
, _maxRadius(OuterRadiusInfo, 1.f, 0.f, 20.f)
, _minRadius(InnerRadiusInfo, 0.f, 0.f, 20.f)
{

View File

@@ -83,7 +83,7 @@ RenderableSphericalGrid::RenderableSphericalGrid(const ghoul::Dictionary& dictio
, _gridProgram(nullptr)
, _color(ColorInfo, glm::vec3(0.5f), glm::vec3(0.f), glm::vec3(1.f))
, _segments(SegmentsInfo, 36, 4, 200)
, _lineWidth(LineWidthInfo, 0.5f, 0.f, 20.f)
, _lineWidth(LineWidthInfo, 0.5f, 1.f, 20.f)
{
const Parameters p = codegen::bake<Parameters>(dictionary);

View File

@@ -148,7 +148,8 @@ namespace {
struct [[codegen::Dictionary(RenderableTrail)]] Parameters {
// This object is used to compute locations along the path. Any Translation object
// can be used here
std::monostate translation [[codegen::reference("core_transform_translation")]];
ghoul::Dictionary translation
[[codegen::reference("core_transform_translation")]];
// [[codegen::verbatim(LineColorInfo.description)]]
glm::vec3 color [[codegen::color()]];

View File

@@ -30,6 +30,7 @@
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/programobject.h>
#include <numeric>
#include <optional>
// This class is using a VBO ring buffer + a constantly updated point as follows:
// Structure of the array with a _resolution of 16. FF denotes the floating position that
@@ -104,36 +105,32 @@ namespace {
"Opaque, Transparent, or Overlay rendering step. Default is Transparent."
};
struct [[codegen::Dictionary(RenderableTrailOrbit)]] Parameters {
// [[codegen::verbatim(PeriodInfo.description)]]
double period;
// [[codegen::verbatim(ResolutionInfo.description)]]
int resolution;
enum class RenderableType {
Background,
Opaque,
PreDeferredTransparent,
PostDeferredTransparent,
Overlay
};
// [[codegen::verbatim(RenderableTypeInfo.description)]]
std::optional<RenderableType> renderableType;
};
#include "renderabletrailorbit_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation RenderableTrailOrbit::Documentation() {
using namespace documentation;
documentation::Documentation doc {
"RenderableTrailOrbit",
"base_renderable_renderabletrailorbit",
{
{
PeriodInfo.identifier,
new DoubleVerifier,
Optional::No,
PeriodInfo.description
},
{
ResolutionInfo.identifier,
new IntVerifier,
Optional::No,
ResolutionInfo.description
},
{
RenderableTypeInfo.identifier,
new StringVerifier,
Optional::Yes,
RenderableTypeInfo.description
}
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "base_renderable_renderabletrailorbit";
// Insert the parents documentation entries until we have a verifier that can deal
// with class hierarchy
@@ -152,46 +149,42 @@ RenderableTrailOrbit::RenderableTrailOrbit(const ghoul::Dictionary& dictionary)
, _period(PeriodInfo, 0.0, 0.0, 1e9)
, _resolution(ResolutionInfo, 10000, 1, 1000000)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableTrailOrbit"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
_translation->onParameterChange([this]() { _needsFullSweep = true; });
// Period is in days
using namespace std::chrono;
const long long sph = duration_cast<seconds>(hours(24)).count();
_period = dictionary.value<double>(PeriodInfo.identifier) * sph;
_period = p.period * duration_cast<seconds>(hours(24)).count();
_period.onChange([&] { _needsFullSweep = true; _indexBufferDirty = true; });
addProperty(_period);
_resolution = static_cast<int>(dictionary.value<double>(ResolutionInfo.identifier));
_resolution = p.resolution;
_resolution.onChange([&] { _needsFullSweep = true; _indexBufferDirty = true; });
addProperty(_resolution);
// We store the vertices with (excluding the wrapping) decending temporal order
_primaryRenderInformation.sorting = RenderInformation::VertexSorting::NewestFirst;
if (dictionary.hasKey(RenderableTypeInfo.identifier)) {
std::string renderType = dictionary.value<std::string>(
RenderableTypeInfo.identifier
);
if (renderType == "Background") {
setRenderBin(Renderable::RenderBin::Background);
}
else if (renderType == "Opaque") {
setRenderBin(Renderable::RenderBin::Opaque);
}
else if (renderType == "PreDeferredTransparent") {
setRenderBin(Renderable::RenderBin::PreDeferredTransparent);
}
else if (renderType == "PostDeferredTransparent") {
setRenderBin(Renderable::RenderBin::PostDeferredTransparent);
}
else if (renderType == "Overlay") {
setRenderBin(Renderable::RenderBin::Overlay);
if (p.renderableType.has_value()) {
switch (*p.renderableType) {
case Parameters::RenderableType::Background:
setRenderBin(Renderable::RenderBin::Background);
break;
case Parameters::RenderableType::Opaque:
setRenderBin(Renderable::RenderBin::Opaque);
break;
case Parameters::RenderableType::PreDeferredTransparent:
setRenderBin(Renderable::RenderBin::PreDeferredTransparent);
break;
case Parameters::RenderableType::PostDeferredTransparent:
setRenderBin(Renderable::RenderBin::PostDeferredTransparent);
break;
case Parameters::RenderableType::Overlay:
setRenderBin(Renderable::RenderBin::Overlay);
break;
default:
throw ghoul::MissingCaseException();
}
}
else {

View File

@@ -29,6 +29,7 @@
#include <openspace/scene/translation.h>
#include <openspace/util/spicemanager.h>
#include <openspace/util/updatestructures.h>
#include <optional>
// This class creates the entire trajectory at once and keeps it in memory the entire
// time. This means that there is no need for updating the trail at runtime, but also that
@@ -81,49 +82,31 @@ namespace {
"If this value is set to 'true', the entire trail will be rendered; if it is "
"'false', only the trail until the current time in the application will be shown."
};
struct [[codegen::Dictionary(RenderableTrailTrajectory)]] Parameters {
// [[codegen::verbatim(StartTimeInfo.description)]]
std::string startTime [[codegen::annotation("A valid date in ISO 8601 format")]];
// [[codegen::verbatim(EndTimeInfo.description)]]
std::string endTime [[codegen::annotation("A valid date in ISO 8601 format")]];
// [[codegen::verbatim(SampleIntervalInfo.description)]]
double sampleInterval;
// [[codegen::verbatim(TimeSubSampleInfo.description)]]
std::optional<int> timeStampSubsampleFactor;
// [[codegen::verbatim(RenderFullPathInfo.description)]]
std::optional<bool> showFullTrail;
};
#include "renderabletrailtrajectory_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation RenderableTrailTrajectory::Documentation() {
using namespace documentation;
documentation::Documentation doc {
"RenderableTrailTrajectory",
"base_renderable_renderabletrailtrajectory",
{
{
StartTimeInfo.identifier,
new StringAnnotationVerifier("A valid date in ISO 8601 format"),
Optional::No,
StartTimeInfo.description
},
{
EndTimeInfo.identifier,
new StringAnnotationVerifier("A valid date in ISO 8601 format"),
Optional::No,
EndTimeInfo.description
},
{
SampleIntervalInfo.identifier,
new DoubleVerifier,
Optional::No,
SampleIntervalInfo.description
},
{
TimeSubSampleInfo.identifier,
new IntVerifier,
Optional::Yes,
TimeSubSampleInfo.description
},
{
RenderFullPathInfo.identifier,
new BoolVerifier,
Optional::Yes,
RenderFullPathInfo.description
}
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "base_renderable_renderabletrailtrajectory";
// @TODO cleanup
// Insert the parents documentation entries until we have a verifier that can deal
@@ -146,37 +129,28 @@ RenderableTrailTrajectory::RenderableTrailTrajectory(const ghoul::Dictionary& di
, _timeStampSubsamplingFactor(TimeSubSampleInfo, 1, 1, 1000000000)
, _renderFullTrail(RenderFullPathInfo, false)
{
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableTrailTrajectory"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
_translation->onParameterChange([this]() { _needsFullSweep = true; });
_startTime = dictionary.value<std::string>(StartTimeInfo.identifier);
_startTime = p.startTime;
_startTime.onChange([this] { _needsFullSweep = true; });
addProperty(_startTime);
_endTime = dictionary.value<std::string>(EndTimeInfo.identifier);
_endTime = p.endTime;
_endTime.onChange([this] { _needsFullSweep = true; });
addProperty(_endTime);
_sampleInterval = dictionary.value<double>(SampleIntervalInfo.identifier);
_sampleInterval = p.sampleInterval;
_sampleInterval.onChange([this] { _needsFullSweep = true; });
addProperty(_sampleInterval);
if (dictionary.hasValue<double>(TimeSubSampleInfo.identifier)) {
_timeStampSubsamplingFactor = static_cast<int>(
dictionary.value<double>(TimeSubSampleInfo.identifier)
);
}
_timeStampSubsamplingFactor =
p.timeStampSubsampleFactor.value_or(_timeStampSubsamplingFactor);
_timeStampSubsamplingFactor.onChange([this] { _subsamplingIsDirty = true; });
addProperty(_timeStampSubsamplingFactor);
if (dictionary.hasValue<bool>(RenderFullPathInfo.identifier)) {
_renderFullTrail = dictionary.value<bool>(RenderFullPathInfo.identifier);
}
_renderFullTrail = p.showFullTrail.value_or(_renderFullTrail);
addProperty(_renderFullTrail);
// We store the vertices with ascending temporal order

View File

@@ -185,7 +185,7 @@ namespace {
struct [[codegen::Dictionary(FixedRotation)]] Parameters {
// This value specifies the direction of the new X axis. If this value is not
// specified, it will be computed by completing a right handed coordinate system
// from the Y and Z axis, which must be specified instead. If this value is a
// from the Y and Z axis, which must be specified instead. If this value is a
// string, it is interpreted as the identifier of another scenegraph node. If this
// value is a 3-vector, it is interpreted as a direction vector
std::optional<std::variant<std::string, glm::vec3>> xAxis;

View File

@@ -30,48 +30,32 @@
#include <openspace/util/time.h>
namespace {
constexpr const char* KeyKeyframes = "Keyframes";
struct [[codegen::Dictionary(TimelineRotation)]] Parameters {
// A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values
// that are valid Rotation objects
std::map<std::string, ghoul::Dictionary> keyframes
[[codegen::reference("core_transform_rotation")]];
};
#include "timelinerotation_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation TimelineRotation::Documentation() {
using namespace documentation;
return {
"Timeline Rotation",
"base_transform_rotation_keyframe",
{
{
KeyKeyframes,
new TableVerifier({
{ "*", new TableVerifier(), Optional::No, "Any translation object" }
}),
Optional::No,
"A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS"
"and values that are valid Rotation objects."
}
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "base_transform_rotation_keyframe";
return doc;
}
TimelineRotation::TimelineRotation(const ghoul::Dictionary& dictionary) {
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"TimelineTranslation"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
const ghoul::Dictionary& keyframes =
dictionary.value<ghoul::Dictionary>(KeyKeyframes);
for (std::string_view timeString : keyframes.keys()) {
const double t = Time::convertTime(std::string(timeString));
ghoul::mm_unique_ptr<Rotation> rotation =
Rotation::createFromDictionary(
keyframes.value<ghoul::Dictionary>(timeString)
);
for (const std::pair<const std::string, ghoul::Dictionary>& kf : p.keyframes) {
const double t = Time::convertTime(kf.first);
ghoul::mm_unique_ptr<Rotation> rotation = Rotation::createFromDictionary(
kf.second
);
if (rotation) {
_timeline.addKeyframe(t, std::move(rotation));
}

View File

@@ -41,7 +41,8 @@ namespace {
struct [[codegen::Dictionary(TimeFrameUnion)]] Parameters {
// [[codegen::verbatim(TimeFramesInfo.description)]]
std::vector<std::monostate> timeFrames [[codegen::reference("core_time_frame")]];
std::vector<ghoul::Dictionary> timeFrames
[[codegen::reference("core_time_frame")]];
};
#include "timeframeunion_codegen.cpp"
} // namespace

View File

@@ -30,48 +30,31 @@
#include <openspace/util/time.h>
namespace {
constexpr const char* KeyKeyframes = "Keyframes";
struct [[codegen::Dictionary(TimelineTranslation)]] Parameters {
// A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS and values
// that are valid Translation objects
std::map<std::string, ghoul::Dictionary> keyframes
[[codegen::reference("core_transform_translation")]];
};
#include "timelinetranslation_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation TimelineTranslation::Documentation() {
using namespace documentation;
return {
"Timeline Translation",
"base_transform_translation_keyframe",
{
{
KeyKeyframes,
new TableVerifier({
{ "*", new TableVerifier(), Optional::No, "Any translation object" }
}),
Optional::No,
"A table of keyframes, with keys formatted as YYYY-MM-DDTHH:MM:SS"
"and values that are valid Translation objects."
}
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "base_transform_translation_keyframe";
return doc;
}
TimelineTranslation::TimelineTranslation(const ghoul::Dictionary& dictionary) {
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"TimelineTranslation"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
const ghoul::Dictionary& keyframes =
dictionary.value<ghoul::Dictionary>(KeyKeyframes);
for (std::string_view timeString : keyframes.keys()) {
const double t = Time::convertTime(std::string(timeString));
for (const std::pair<const std::string, ghoul::Dictionary>& kf : p.keyframes) {
const double t = Time::convertTime(kf.first);
ghoul::mm_unique_ptr<Translation> translation =
Translation::createFromDictionary(
keyframes.value<ghoul::Dictionary>(timeString)
);
Translation::createFromDictionary(kf.second);
if (translation) {
_timeline.addKeyframe(t, std::move(translation));
}

View File

@@ -37,6 +37,7 @@
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
#include <optional>
namespace {
enum Origin {
@@ -72,47 +73,38 @@ namespace {
"Texture Coordinate Origin",
"The origin of the texture coorinate system."
};
struct [[codegen::Dictionary(RenderableDebugPlane)]] Parameters {
// [[codegen::verbatim(TextureInfo.description)]]
std::optional<int> texture;
// [[codegen::verbatim(BillboardInfo.description)]]
std::optional<bool> billboard;
// [[codegen::verbatim(SizeInfo.description)]]
std::optional<float> size;
enum class Origin {
LowerLeft,
LowerRight,
UpperLeft,
UpperRight,
Center
};
// [[codegen::verbatim(OriginInfo.description)]]
std::optional<Origin> origin;
};
#include "renderabledebugplane_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation RenderableDebugPlane::Documentation() {
using namespace documentation;
return {
"RenderableDebugPlane",
"debugging_renderable_debugplane",
{
{
TextureInfo.identifier,
new IntVerifier,
Optional::Yes,
TextureInfo.description
},
{
BillboardInfo.identifier,
new BoolVerifier,
Optional::Yes,
BillboardInfo.description
},
{
SizeInfo.identifier,
new DoubleVerifier,
Optional::Yes,
SizeInfo.description
},
{
OriginInfo.identifier,
new StringInListVerifier(
{ "LowerLeft", "LowerRight", "UpperLeft", "UpperRight", "Center" }
),
Optional::Yes,
OriginInfo.description
}
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "debugging_renderable_debugplane";
return doc;
}
RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _texture(TextureInfo, -1, -1, 512)
@@ -120,17 +112,18 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
, _size(SizeInfo, 10.f, 0.f, 1e25f)
, _origin(OriginInfo, properties::OptionProperty::DisplayType::Dropdown)
{
if (dictionary.hasKey(TextureInfo.identifier)) {
_texture = static_cast<int>(dictionary.value<double>(TextureInfo.identifier));
}
const Parameters p = codegen::bake<Parameters>(dictionary);
if (dictionary.hasKey(SizeInfo.identifier)) {
_size = static_cast<float>(dictionary.value<double>(SizeInfo.identifier));
}
if (dictionary.hasKey(BillboardInfo.identifier)) {
_billboard = dictionary.value<bool>(BillboardInfo.identifier);
}
_texture = p.texture.value_or(_texture);
addProperty(_texture);
_size.onChange([this](){ _planeIsDirty = true; });
_size = p.size.value_or(_size);
setBoundingSphere(_size);
addProperty(_size);
_billboard = p.billboard.value_or(_billboard);
addProperty(_billboard);
_origin.addOptions({
{ LowerLeft, "LowerLeft" },
@@ -141,36 +134,30 @@ RenderableDebugPlane::RenderableDebugPlane(const ghoul::Dictionary& dictionary)
});
_origin.setValue(Center);
if (dictionary.hasKey(OriginInfo.identifier)) {
const std::string origin = dictionary.value<std::string>(OriginInfo.identifier);
if (origin == "LowerLeft") {
_origin = LowerLeft;
}
else if (origin == "LowerRight") {
_origin = LowerRight;
}
else if (origin == "UpperLeft") {
_origin = UpperLeft;
}
else if (origin == "UpperRight") {
_origin = UpperRight;
}
else if (origin == "Center") {
_origin = Center;
if (p.origin.has_value()) {
switch (*p.origin) {
case Parameters::Origin::LowerLeft:
_origin = LowerLeft;
break;
case Parameters::Origin::LowerRight:
_origin = LowerRight;
break;
case Parameters::Origin::UpperLeft:
_origin = UpperLeft;
break;
case Parameters::Origin::UpperRight:
_origin = UpperRight;
break;
case Parameters::Origin::Center:
_origin = Center;
break;
default:
throw ghoul::MissingCaseException();
}
}
else {
_origin = Center;
}
addProperty(_texture);
addProperty(_billboard);
addProperty(_size);
_size.onChange([this](){ _planeIsDirty = true; });
setBoundingSphere(_size);
}
bool RenderableDebugPlane::isReady() const {

View File

@@ -68,7 +68,7 @@ private:
properties::FloatProperty _size;
properties::OptionProperty _origin;
bool _planeIsDirty;
bool _planeIsDirty = true;
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;

View File

@@ -273,32 +273,32 @@ namespace {
// The number of sides for the polygon used to represent the astronomical object
std::optional<int> polygonSides;
// [[codgen::verbatim(DrawLabelInfo.description)]]
// [[codegen::verbatim(DrawLabelInfo.description)]]
std::optional<bool> drawLabels;
// [[codgen::verbatim(TextColorInfo.description)]]
// [[codegen::verbatim(TextColorInfo.description)]]
std::optional<glm::vec3> textColor [[codegen::color()]];
// [[codgen::verbatim(TextOpacityInfo.description)]]
// [[codegen::verbatim(TextOpacityInfo.description)]]
std::optional<float> textOpacity;
// [[codgen::verbatim(TextSizeInfo.description)]]
// [[codegen::verbatim(TextSizeInfo.description)]]
std::optional<float> textSize;
// The path to the label file that contains information about the astronomical
// objects being rendered
std::optional<std::string> labelFile;
// [[codgen::verbatim(LabelMinSizeInfo.description)]]
// [[codegen::verbatim(LabelMinSizeInfo.description)]]
std::optional<float> textMinSize;
// [[codgen::verbatim(LabelMaxSizeInfo.description)]]
// [[codegen::verbatim(LabelMaxSizeInfo.description)]]
std::optional<float> textMaxSize;
// [[codgen::verbatim(ColorOptionInfo.description)]]
// [[codegen::verbatim(ColorOptionInfo.description)]]
std::optional<std::vector<std::string>> colorOption;
// [[codgen::verbatim(SizeOptionInfo.description)]]
// [[codegen::verbatim(SizeOptionInfo.description)]]
std::optional<std::vector<std::string>> sizeOption;
// This value determines the colormap ranges for the color parameters of the
@@ -308,28 +308,28 @@ namespace {
// Transformation matrix to be applied to each astronomical object
std::optional<glm::dmat4x4> transformationMatrix;
// [[codgen::verbatim(FadeInDistancesInfo.description)]]
// [[codegen::verbatim(FadeInDistancesInfo.description)]]
std::optional<glm::dvec2> fadeInDistances;
// [[codgen::verbatim(DisableFadeInInfo.description)]]
// [[codegen::verbatim(DisableFadeInInfo.description)]]
std::optional<bool> disableFadeIn;
// [[codgen::verbatim(BillboardMaxSizeInfo.description)]]
// [[codegen::verbatim(BillboardMaxSizeInfo.description)]]
std::optional<float> billboardMaxSize;
// [[codgen::verbatim(BillboardMinSizeInfo.description)]]
// [[codegen::verbatim(BillboardMinSizeInfo.description)]]
std::optional<float> billboardMinSize;
// [[codgen::verbatim(CorrectionSizeEndDistanceInfo.description)]]
// [[codegen::verbatim(CorrectionSizeEndDistanceInfo.description)]]
std::optional<float> correctionSizeEndDistance;
// [[codgen::verbatim(CorrectionSizeFactorInfo.description)]]
// [[codegen::verbatim(CorrectionSizeFactorInfo.description)]]
std::optional<float> correctionSizeFactor;
// [[codgen::verbatim(PixelSizeControlInfo.description)]]
// [[codegen::verbatim(PixelSizeControlInfo.description)]]
std::optional<bool> enablePixelSizeControl;
// [[codgen::verbatim(UseLinearFiltering.description)]]
// [[codegen::verbatim(UseLinearFiltering.description)]]
std::optional<bool> useLinearFiltering;
};
#include "renderablebillboardscloud_codegen.cpp"
@@ -1492,6 +1492,11 @@ void RenderableBillboardsCloud::createDataSlice() {
ZoneScoped
_slicedData.clear();
if (_fullData.empty() || _nValuesPerAstronomicalObject == 0) {
return;
}
if (_hasColorMapFile) {
_slicedData.reserve(8 * (_fullData.size() / _nValuesPerAstronomicalObject));
}

View File

@@ -194,7 +194,7 @@ RenderableDUMeshes::RenderableDUMeshes(const ghoul::Dictionary& dictionary)
, _drawLabels(DrawLabelInfo, false)
, _textMinSize(LabelMinSizeInfo, 8.f, 0.5f, 24.f)
, _textMaxSize(LabelMaxSizeInfo, 500.f, 0.f, 1000.f)
, _lineWidth(LineWidthInfo, 2.f, 0.f, 16.f)
, _lineWidth(LineWidthInfo, 2.f, 1.f, 16.f)
, _renderOption(RenderOptionInfo, properties::OptionProperty::DisplayType::Dropdown)
{
const Parameters p = codegen::bake<Parameters>(dictionary);

View File

@@ -24,6 +24,9 @@
#include <modules/exoplanets/exoplanetshelper.h>
#include <modules/exoplanets/exoplanetsmodule.h>
#include <openspace/engine/globals.h>
#include <openspace/engine/moduleengine.h>
#include <openspace/util/spicemanager.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/fmt.h>
@@ -36,8 +39,6 @@
namespace {
constexpr const char* _loggerCat = "ExoplanetsModule";
constexpr const char* BvColormapPath = "${SYNC}/http/stars_colormap/2/colorbv.cmap";
}
namespace openspace::exoplanets {
@@ -57,19 +58,37 @@ bool hasSufficientData(const ExoplanetDataEntry& p) {
}
glm::vec3 computeStarColor(float bv) {
std::ifstream colorMap(absPath(BvColormapPath), std::ios::in);
const ExoplanetsModule* module = global::moduleEngine->module<ExoplanetsModule>();
const std::string bvColormapPath = module->bvColormapPath();
std::ifstream colorMap(absPath(bvColormapPath), std::ios::in);
if (!colorMap.good()) {
LERROR(fmt::format(
"Failed to open colormap data file: '{}'",
absPath(BvColormapPath)
absPath(bvColormapPath)
));
return glm::vec3(0.f, 0.f, 0.f);
return glm::vec3(0.f);
}
const int t = static_cast<int>(round(((bv + 0.4) / (2.0 + 0.4)) * 255));
// Interpret the colormap cmap file
std::string line;
while (std::getline(colorMap, line)) {
if (line.empty() || (line[0] == '#')) {
continue;
}
break;
}
// The first line is the width of the image, i.e number of values
std::istringstream ss(line);
int nValues;
ss >> nValues;
// Find the line matching the input B-V value (B-V is in [-0.4,2.0])
const int t = static_cast<int>(round(((bv + 0.4) / (2.0 + 0.4)) * (nValues - 1)));
std::string color;
for (int i = 0; i < t + 12; i++) {
for (int i = 0; i < t + 1; i++) {
getline(colorMap, color);
}
colorMap.close();

View File

@@ -44,6 +44,12 @@ namespace {
"The path to the folder containing the exoplanets data and lookup table"
};
constexpr const openspace::properties::Property::PropertyInfo BvColorMapInfo = {
"BvColormap",
"B-V Colormap",
"The path to a cmap file that maps a B-V color index to an RGB color"
};
constexpr const openspace::properties::Property::PropertyInfo StarTextureInfo = {
"StarTexture",
"Star Texture",
@@ -123,6 +129,9 @@ namespace {
// [[codegen::verbatim(DataFolderInfo.description)]]
std::optional<std::filesystem::path> dataFolder [[codegen::directory()]];
// [[codegen::verbatim(BvColorMapInfo.description)]]
std::optional<std::filesystem::path> bvColormap;
// [[codegen::verbatim(StarTextureInfo.description)]]
std::optional<std::filesystem::path> starTexture;
@@ -160,6 +169,7 @@ using namespace exoplanets;
ExoplanetsModule::ExoplanetsModule()
: OpenSpaceModule(Name)
, _exoplanetsDataFolder(DataFolderInfo)
, _bvColorMapPath(BvColorMapInfo)
, _starTexturePath(StarTextureInfo)
, _starGlareTexturePath(StarGlareTextureInfo)
, _noDataTexturePath(NoDataTextureInfo)
@@ -173,6 +183,7 @@ ExoplanetsModule::ExoplanetsModule()
_exoplanetsDataFolder.setReadOnly(true);
addProperty(_exoplanetsDataFolder);
addProperty(_bvColorMapPath);
addProperty(_starTexturePath);
addProperty(_starGlareTexturePath);
addProperty(_noDataTexturePath);
@@ -198,6 +209,10 @@ std::string ExoplanetsModule::lookUpTablePath() const {
);
};
std::string ExoplanetsModule::bvColormapPath() const {
return _bvColorMapPath;
}
std::string ExoplanetsModule::starTexturePath() const {
return _starTexturePath;
}
@@ -280,6 +295,10 @@ void ExoplanetsModule::internalInitialize(const ghoul::Dictionary& dict) {
_exoplanetsDataFolder = p.dataFolder.value().string();
}
if (p.bvColormap.has_value()) {
_bvColorMapPath = p.bvColormap.value().string();
}
if (p.starTexture.has_value()) {
_starTexturePath = p.starTexture.value().string();
}

View File

@@ -43,6 +43,7 @@ public:
std::string exoplanetsDataPath() const;
std::string lookUpTablePath() const;
std::string bvColormapPath() const;
std::string starTexturePath() const;
std::string starGlareTexturePath() const;
std::string noDataTexturePath() const;
@@ -60,6 +61,7 @@ protected:
void internalInitialize(const ghoul::Dictionary& dict) override;
properties::StringProperty _exoplanetsDataFolder;
properties::StringProperty _bvColorMapPath;
properties::StringProperty _starTexturePath;
properties::StringProperty _starGlareTexturePath;
properties::StringProperty _noDataTexturePath;

View File

@@ -56,7 +56,8 @@ namespace openspace::exoplanets::luascriptfunctions {
constexpr const float AU = static_cast<float>(distanceconstants::AstronomicalUnit);
constexpr const float SolarRadius = static_cast<float>(distanceconstants::SolarRadius);
constexpr const float JupiterRadius = static_cast<float>(distanceconstants::JupiterRadius);
constexpr const float JupiterRadius =
static_cast<float>(distanceconstants::JupiterRadius);
ExoplanetSystem findExoplanetSystemInData(std::string_view starName) {
const ExoplanetsModule* module = global::moduleEngine->module<ExoplanetsModule>();

View File

@@ -126,7 +126,7 @@ RenderableFieldlines::RenderableFieldlines(const ghoul::Dictionary& dictionary)
else {
_vectorFieldInfo = dictionary.value<ghoul::Dictionary>(KeyVectorField);
}
if (!dictionary.hasValue<ghoul::Dictionary>(KeyFieldlines)) {
LERROR(fmt::format("Renderable does not contain a key for '{}'", KeyFieldlines));
}

View File

@@ -300,199 +300,123 @@ namespace {
"Report GL Errors",
"If set to true, any OpenGL errors will be reported if encountered"
};
struct [[codegen::Dictionary(RenderableGaiaStars)]] Parameters {
// [[codegen::verbatim(FilePathInfo.description)]]
std::string file;
enum class FileReader {
Fits,
Speck,
BinaryRaw,
BinaryOctree,
StreamOctree
};
// [[codegen::verbatim(FileReaderOptionInfo.description)]]
FileReader fileReaderOption;
enum class RenderOption {
Static,
Color,
Motion
};
// [[codegen::verbatim(RenderOptionInfo.description)]]
std::optional<RenderOption> renderOption;
enum class ShaderOption {
PointSSBO [[codegen::key("Point_SSBO")]],
PointVBO [[codegen::key("Point_VBO")]],
BillboardSSBO [[codegen::key("Billboard_SSBO")]],
BillboardVBO [[codegen::key("Billboard_VBO")]],
BillboardSSBONoFBO [[codegen::key("Billboard_SSBO_noFBO")]]
};
// [codegen::verbatim(ShaderOptionInfo.description)]]
std::optional<ShaderOption> shaderOption;
// [codegen::verbatim(PsfTextureInfo.description)]]
std::string texture;
// [codegen::verbatim(ColorTextureInfo.description)]]
std::string colorMap;
// [codegen::verbatim(LuminosityMultiplierInfo.description)]]
std::optional<float> luminosityMultiplier;
// [codegen::verbatim(MagnitudeBoostInfo.description)]]
std::optional<float> magnitudeBoost;
// [codegen::verbatim(CutOffThresholdInfo.description)]]
std::optional<float> cutOffThreshold;
// [codegen::verbatim(SharpnessInfo.description)]]
std::optional<float> sharpness;
// [codegen::verbatim(BillboardSizeInfo.description)]]
std::optional<float> billboardSize;
// [codegen::verbatim(CloseUpBoostDistInfo.description)]]
std::optional<float> closeUpBoostDist;
// [codegen::verbatim(TmPointFilterSizeInfo.description)]]
std::optional<int> filterSize;
// [codegen::verbatim(TmPointSigmaInfo.description)]]
std::optional<float> sigma;
// [codegen::verbatim(AdditionalNodesInfo.description)]]
std::optional<glm::ivec2> additionalNodes;
// [codegen::verbatim(TmPointPxThresholdInfo.description)]]
std::optional<float> pixelWeightThreshold;
// [codegen::verbatim(FirstRowInfo.description)]]
std::optional<int> firstRow;
// [codegen::verbatim(LastRowInfo.description)]]
std::optional<int> lastRow;
// [codegen::verbatim(ColumnNamesInfo.description)]]
std::optional<std::vector<std::string>> columnNames;
// [codegen::verbatim(LodPixelThresholdInfo.description)]]
std::optional<float> lodPixelThreshold;
// [codegen::verbatim(MaxGpuMemoryPercentInfo.description)]]
std::optional<float> maxGpuMemoryPercent;
// [codegen::verbatim(MaxCpuMemoryPercentInfo.description)]]
std::optional<float> maxCpuMemoryPercent;
// [codegen::verbatim(FilterPosXInfo.description)]]
std::optional<glm::vec2> filterPosX;
// [codegen::verbatim(FilterPosYInfo.description)]]
std::optional<glm::vec2> filterPosY;
// [codegen::verbatim(FilterPosZInfo.description)]]
std::optional<glm::vec2> filterPosZ;
// [codegen::verbatim(FilterGMagInfo.description)]]
std::optional<glm::vec2> filterGMag;
// [codegen::verbatim(FilterBpRpInfo.description)]]
std::optional<glm::vec2> filterBpRp;
// [codegen::verbatim(FilterDistInfo.description)]]
std::optional<glm::vec2> filterDist;
// [codegen::verbatim(ReportGlErrorsInfo.description)]]
std::optional<bool> reportGlErrors;
};
#include "renderablegaiastars_codegen.cpp"
} // namespace
namespace openspace {
documentation::Documentation RenderableGaiaStars::Documentation() {
using namespace documentation;
return {
"RenderableGaiaStars",
"gaiamission_renderablegaiastars",
{
{
FilePathInfo.identifier,
new StringVerifier,
Optional::No,
FilePathInfo.description
},
{
FileReaderOptionInfo.identifier,
new StringInListVerifier({
"Fits", "Speck", "BinaryRaw", "BinaryOctree", "StreamOctree"
}),
Optional::No,
FileReaderOptionInfo.description
},
{
RenderOptionInfo.identifier,
new StringInListVerifier({
"Static", "Color", "Motion"
}),
Optional::Yes,
RenderOptionInfo.description
},
{
ShaderOptionInfo.identifier,
new StringInListVerifier({
"Point_SSBO", "Point_VBO", "Billboard_SSBO", "Billboard_VBO",
"Billboard_SSBO_noFBO"
}),
Optional::Yes,
ShaderOptionInfo.description
},
{
PsfTextureInfo.identifier,
new StringVerifier,
Optional::No,
PsfTextureInfo.description
},
{
ColorTextureInfo.identifier,
new StringVerifier,
Optional::No,
ColorTextureInfo.description
},
{
LuminosityMultiplierInfo.identifier,
new DoubleVerifier,
Optional::Yes,
LuminosityMultiplierInfo.description
},
{
MagnitudeBoostInfo.identifier,
new DoubleVerifier,
Optional::Yes,
MagnitudeBoostInfo.description
},
{
CutOffThresholdInfo.identifier,
new DoubleVerifier,
Optional::Yes,
CutOffThresholdInfo.description
},
{
SharpnessInfo.identifier,
new DoubleVerifier,
Optional::Yes,
SharpnessInfo.description
},
{
BillboardSizeInfo.identifier,
new DoubleVerifier,
Optional::Yes,
BillboardSizeInfo.description
},
{
CloseUpBoostDistInfo.identifier,
new DoubleVerifier,
Optional::Yes,
CloseUpBoostDistInfo.description
},
{
TmPointFilterSizeInfo.identifier,
new IntVerifier,
Optional::Yes,
TmPointFilterSizeInfo.description
},
{
TmPointSigmaInfo.identifier,
new DoubleVerifier,
Optional::Yes,
TmPointSigmaInfo.description
},
{
AdditionalNodesInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
AdditionalNodesInfo.description
},
{
TmPointPxThresholdInfo.identifier,
new DoubleVerifier,
Optional::Yes,
TmPointPxThresholdInfo.description
},
{
FirstRowInfo.identifier,
new IntVerifier,
Optional::Yes,
FirstRowInfo.description
},
{
LastRowInfo.identifier,
new IntVerifier,
Optional::Yes,
LastRowInfo.description
},
{
ColumnNamesInfo.identifier,
new StringListVerifier,
Optional::Yes,
ColumnNamesInfo.description
},
{
LodPixelThresholdInfo.identifier,
new DoubleVerifier,
Optional::Yes,
LodPixelThresholdInfo.description
},
{
MaxGpuMemoryPercentInfo.identifier,
new DoubleVerifier,
Optional::Yes,
MaxGpuMemoryPercentInfo.description
},
{
MaxCpuMemoryPercentInfo.identifier,
new DoubleVerifier,
Optional::Yes,
MaxCpuMemoryPercentInfo.description
},
{
FilterPosXInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
FilterPosXInfo.description
},
{
FilterPosYInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
FilterPosYInfo.description
},
{
FilterPosZInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
FilterPosZInfo.description
},
{
FilterGMagInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
FilterGMagInfo.description
},
{
FilterBpRpInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
FilterBpRpInfo.description
},
{
FilterDistInfo.identifier,
new Vector2Verifier<double>,
Optional::Yes,
FilterDistInfo.description
},
{
ReportGlErrorsInfo.identifier,
new BoolVerifier,
Optional::Yes,
ReportGlErrorsInfo.description
}
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "gaiamission_renderablegaiastars";
return doc;
}
RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
@@ -536,13 +460,9 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
{
using File = ghoul::filesystem::File;
documentation::testSpecificationAndThrow(
Documentation(),
dictionary,
"RenderableGaiaStars"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
_filePath = absPath(dictionary.value<std::string>(FilePathInfo.identifier));
_filePath = absPath(p.file);
_dataFile = std::make_unique<File>(_filePath);
_dataFile->setCallback([&](const File&) { _dataIsDirty = true; });
@@ -556,25 +476,24 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
{ gaia::FileReaderOption::BinaryOctree, "BinaryOctree" },
{ gaia::FileReaderOption::StreamOctree, "StreamOctree" }
});
if (dictionary.hasKey(FileReaderOptionInfo.identifier)) {
const std::string fileReaderOption = dictionary.value<std::string>(
FileReaderOptionInfo.identifier
);
if (fileReaderOption == "Fits") {
switch (p.fileReaderOption) {
case Parameters::FileReader::Fits:
_fileReaderOption = gaia::FileReaderOption::Fits;
}
else if (fileReaderOption == "Speck") {
break;
case Parameters::FileReader::Speck:
_fileReaderOption = gaia::FileReaderOption::Speck;
}
else if (fileReaderOption == "BinaryRaw") {
break;
case Parameters::FileReader::BinaryRaw:
_fileReaderOption = gaia::FileReaderOption::BinaryRaw;
}
else if (fileReaderOption == "BinaryOctree") {
break;
case Parameters::FileReader::BinaryOctree:
_fileReaderOption = gaia::FileReaderOption::BinaryOctree;
}
else {
break;
case Parameters::FileReader::StreamOctree:
_fileReaderOption = gaia::FileReaderOption::StreamOctree;
}
break;
default:
throw ghoul::MissingCaseException();
}
_renderOption.addOptions({
@@ -582,18 +501,19 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
{ gaia::RenderOption::Color, "Color" },
{ gaia::RenderOption::Motion, "Motion" }
});
if (dictionary.hasKey(RenderOptionInfo.identifier)) {
const std::string renderOption = dictionary.value<std::string>(
RenderOptionInfo.identifier
);
if (renderOption == "Static") {
_renderOption = gaia::RenderOption::Static;
}
else if (renderOption == "Color") {
_renderOption = gaia::RenderOption::Color;
}
else {
_renderOption = gaia::RenderOption::Motion;
if (p.renderOption.has_value()) {
switch (*p.renderOption) {
case Parameters::RenderOption::Static:
_renderOption = gaia::RenderOption::Static;
break;
case Parameters::RenderOption::Color:
_renderOption = gaia::RenderOption::Color;
break;
case Parameters::RenderOption::Motion:
_renderOption = gaia::RenderOption::Motion;
break;
default:
throw ghoul::MissingCaseException();
}
}
_renderOption.onChange([&]() { _buffersAreDirty = true; });
@@ -614,31 +534,31 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
});
#endif // __APPLE__
if (dictionary.hasKey(ShaderOptionInfo.identifier)) {
// Default shader option:
_shaderOption = gaia::ShaderOption::Billboard_VBO;
const std::string shaderOption = dictionary.value<std::string>(
ShaderOptionInfo.identifier
);
#ifndef __APPLE__
if (shaderOption == "Point_SSBO") {
_shaderOption = gaia::ShaderOption::Point_SSBO;
}
else if (shaderOption == "Billboard_SSBO") {
_shaderOption = gaia::ShaderOption::Billboard_SSBO;
}
else if (shaderOption == "Billboard_SSBO_noFBO") {
_shaderOption = gaia::ShaderOption::Billboard_SSBO_noFBO;
}
if (p.shaderOption.has_value()) {
switch (*p.shaderOption) {
case Parameters::ShaderOption::PointSSBO:
_shaderOption = gaia::ShaderOption::Point_SSBO;
break;
case Parameters::ShaderOption::PointVBO:
#ifdef __APPLE__
throw ghoul::RuntimeError("Shader option is not supported on MacOS");
#endif // __APPLE__
if (shaderOption == "Point_VBO") {
_shaderOption = gaia::ShaderOption::Point_VBO;
}
else if (shaderOption == "Billboard_VBO") {
_shaderOption = gaia::ShaderOption::Billboard_VBO;
_shaderOption = gaia::ShaderOption::Point_VBO;
break;
case Parameters::ShaderOption::BillboardSSBO:
_shaderOption = gaia::ShaderOption::Billboard_SSBO;
break;
case Parameters::ShaderOption::BillboardVBO:
#ifdef __APPLE__
throw ghoul::RuntimeError("Shader option is not supported on MacOS");
#endif // __APPLE__
_shaderOption = gaia::ShaderOption::Billboard_VBO;
break;
case Parameters::ShaderOption::BillboardSSBONoFBO:
_shaderOption = gaia::ShaderOption::Billboard_SSBO_noFBO;
break;
default:
throw ghoul::MissingCaseException();
}
}
_shaderOption.onChange([&]() {
@@ -647,95 +567,34 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
});
addProperty(_shaderOption);
_pointSpreadFunctionTexturePath = absPath(dictionary.value<std::string>(
PsfTextureInfo.identifier
));
_pointSpreadFunctionFile = std::make_unique<File>(_pointSpreadFunctionTexturePath);
_pointSpreadFunctionTexturePath = absPath(p.texture);
_pointSpreadFunctionTexturePath.onChange(
[&](){ _pointSpreadFunctionTextureIsDirty = true; }
);
_pointSpreadFunctionFile = std::make_unique<File>(_pointSpreadFunctionTexturePath);
_pointSpreadFunctionFile->setCallback(
[&](const File&) { _pointSpreadFunctionTextureIsDirty = true; }
);
_colorTexturePath = absPath(dictionary.value<std::string>(
ColorTextureInfo.identifier
));
_colorTexturePath = absPath(p.colorMap);
_colorTextureFile = std::make_unique<File>(_colorTexturePath);
_colorTexturePath.onChange([&]() { _colorTextureIsDirty = true; });
_colorTextureFile->setCallback([&](const File&) { _colorTextureIsDirty = true; });
if (dictionary.hasKey(LuminosityMultiplierInfo.identifier)) {
_luminosityMultiplier = static_cast<float>(
dictionary.value<double>(LuminosityMultiplierInfo.identifier)
);
}
_luminosityMultiplier = p.luminosityMultiplier.value_or(_luminosityMultiplier);
_magnitudeBoost = p.magnitudeBoost.value_or(_magnitudeBoost);
_cutOffThreshold = p.cutOffThreshold.value_or(_cutOffThreshold);
_sharpness = p.sharpness.value_or(_sharpness);
_billboardSize = p.billboardSize.value_or(_billboardSize);
_closeUpBoostDist = p.closeUpBoostDist.value_or(_closeUpBoostDist);
_tmPointFilterSize = p.filterSize.value_or(_tmPointFilterSize);
_tmPointSigma = p.sigma.value_or(_tmPointSigma);
_tmPointPixelWeightThreshold =
p.pixelWeightThreshold.value_or(_tmPointPixelWeightThreshold);
_additionalNodes = p.additionalNodes.value_or(_additionalNodes);
_lodPixelThreshold = p.lodPixelThreshold.value_or(_lodPixelThreshold);
if (dictionary.hasKey(MagnitudeBoostInfo.identifier)) {
_magnitudeBoost = static_cast<float>(
dictionary.value<double>(MagnitudeBoostInfo.identifier)
);
}
if (dictionary.hasKey(CutOffThresholdInfo.identifier)) {
_cutOffThreshold = static_cast<float>(
dictionary.value<double>(CutOffThresholdInfo.identifier)
);
}
if (dictionary.hasKey(SharpnessInfo.identifier)) {
_sharpness = static_cast<float>(
dictionary.value<double>(SharpnessInfo.identifier)
);
}
if (dictionary.hasKey(BillboardSizeInfo.identifier)) {
_billboardSize = static_cast<float>(
dictionary.value<double>(BillboardSizeInfo.identifier)
);
}
if (dictionary.hasKey(CloseUpBoostDistInfo.identifier)) {
_closeUpBoostDist = static_cast<float>(
dictionary.value<double>(CloseUpBoostDistInfo.identifier)
);
}
if (dictionary.hasKey(TmPointFilterSizeInfo.identifier)) {
_tmPointFilterSize = static_cast<int>(
dictionary.value<double>(TmPointFilterSizeInfo.identifier)
);
}
if (dictionary.hasKey(TmPointSigmaInfo.identifier)) {
_tmPointSigma = static_cast<float>(
dictionary.value<double>(TmPointSigmaInfo.identifier)
);
}
if (dictionary.hasKey(TmPointPxThresholdInfo.identifier)) {
_tmPointPixelWeightThreshold = static_cast<float>(
dictionary.value<double>(TmPointPxThresholdInfo.identifier)
);
}
if (dictionary.hasKey(AdditionalNodesInfo.identifier)) {
_additionalNodes = static_cast<glm::ivec2>(
dictionary.value<glm::dvec2>(AdditionalNodesInfo.identifier)
);
}
if (dictionary.hasKey(LodPixelThresholdInfo.identifier)) {
_lodPixelThreshold = static_cast<float>(
dictionary.value<double>(LodPixelThresholdInfo.identifier)
);
}
if (dictionary.hasKey(MaxGpuMemoryPercentInfo.identifier)) {
_maxGpuMemoryPercent = static_cast<float>(
dictionary.value<double>(MaxGpuMemoryPercentInfo.identifier)
);
}
_maxGpuMemoryPercent = p.maxGpuMemoryPercent.value_or(_maxGpuMemoryPercent);
_maxGpuMemoryPercent.onChange([&]() {
if (_ssboData != 0) {
glDeleteBuffers(1, &_ssboData);
@@ -761,59 +620,36 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
_maxStreamingBudgetInBytes = 0;
});
if (dictionary.hasKey(MaxCpuMemoryPercentInfo.identifier)) {
_maxCpuMemoryPercent = static_cast<float>(
dictionary.value<double>(MaxCpuMemoryPercentInfo.identifier)
);
}
if (dictionary.hasKey(FilterPosXInfo.identifier)) {
_posXThreshold = dictionary.value<glm::dvec2>(FilterPosXInfo.identifier);
}
_maxCpuMemoryPercent = p.maxCpuMemoryPercent.value_or(_maxCpuMemoryPercent);
_posXThreshold = p.filterPosX.value_or(_posXThreshold);
addProperty(_posXThreshold);
if (dictionary.hasKey(FilterPosYInfo.identifier)) {
_posXThreshold = dictionary.value<glm::dvec2>(FilterPosYInfo.identifier);
}
_posYThreshold = p.filterPosY.value_or(_posYThreshold);
addProperty(_posYThreshold);
if (dictionary.hasKey(FilterPosZInfo.identifier)) {
_posZThreshold = dictionary.value<glm::dvec2>(FilterPosZInfo.identifier);
}
_posZThreshold = p.filterPosZ.value_or(_posZThreshold);
addProperty(_posZThreshold);
if (dictionary.hasKey(FilterGMagInfo.identifier)) {
_gMagThreshold = dictionary.value<glm::dvec2>(FilterGMagInfo.identifier);
}
_gMagThreshold = p.filterGMag.value_or(_gMagThreshold);
addProperty(_gMagThreshold);
if (dictionary.hasKey(FilterBpRpInfo.identifier)) {
_bpRpThreshold = dictionary.value<glm::dvec2>(FilterBpRpInfo.identifier);
}
_bpRpThreshold = p.filterBpRp.value_or(_bpRpThreshold);
addProperty(_bpRpThreshold);
if (dictionary.hasKey(FilterDistInfo.identifier)) {
_distThreshold = dictionary.value<glm::dvec2>(FilterDistInfo.identifier);
}
_distThreshold = p.filterDist.value_or(_distThreshold);
addProperty(_distThreshold);
// Only add properties correlated to fits files if we're reading from a fits file.
if (_fileReaderOption == gaia::FileReaderOption::Fits) {
if (dictionary.hasKey(FirstRowInfo.identifier)) {
_firstRow = static_cast<int>(
dictionary.value<double>(FirstRowInfo.identifier)
);
}
_firstRow = p.firstRow.value_or(_firstRow);
_firstRow.onChange([&]() { _dataIsDirty = true; });
addProperty(_firstRow);
if (dictionary.hasKey(LastRowInfo.identifier)) {
_lastRow = static_cast<int>(dictionary.value<double>(LastRowInfo.identifier));
}
_lastRow = p.lastRow.value_or(_lastRow);
_lastRow.onChange([&]() { _dataIsDirty = true; });
addProperty(_lastRow);
if (dictionary.hasKey(ColumnNamesInfo.identifier)) {
if (p.columnNames.has_value()) {
ghoul::Dictionary tmpDict = dictionary.value<ghoul::Dictionary>(
ColumnNamesInfo.identifier
);
@@ -834,13 +670,11 @@ RenderableGaiaStars::RenderableGaiaStars(const ghoul::Dictionary& dictionary)
}
if (_firstRow > _lastRow) {
throw ghoul::RuntimeError("User defined FirstRow is bigger than LastRow.");
throw ghoul::RuntimeError("User defined FirstRow is bigger than LastRow");
}
}
if (dictionary.hasKey(ReportGlErrorsInfo.identifier)) {
_reportGlErrors = dictionary.value<bool>(ReportGlErrorsInfo.identifier);
}
_reportGlErrors = p.reportGlErrors.value_or(_reportGlErrors);
addProperty(_reportGlErrors);
// Add a read-only property for the number of rendered stars per frame.

View File

@@ -35,164 +35,263 @@
#include <thread>
namespace {
constexpr const char* KeyInFileOrFolderPath = "InFileOrFolderPath";
constexpr const char* KeyOutFileOrFolderPath = "OutFileOrFolderPath";
constexpr const char* KeyMaxDist = "MaxDist";
constexpr const char* KeyMaxStarsPerNode = "MaxStarsPerNode";
constexpr const char* KeySingleFileInput = "SingleFileInput";
constexpr const char* KeyFilterPosX = "FilterPosX";
constexpr const char* KeyFilterPosY = "FilterPosY";
constexpr const char* KeyFilterPosZ = "FilterPosZ";
constexpr const char* KeyFilterGMag = "FilterGMag";
constexpr const char* KeyFilterBpRp = "FilterBpRp";
constexpr const char* KeyFilterVelX = "FilterVelX";
constexpr const char* KeyFilterVelY = "FilterVelY";
constexpr const char* KeyFilterVelZ = "FilterVelZ";
constexpr const char* KeyFilterBpMag = "FilterBpMag";
constexpr const char* KeyFilterRpMag = "FilterRpMag";
constexpr const char* KeyFilterBpG = "FilterBpG";
constexpr const char* KeyFilterGRp = "FilterGRp";
constexpr const char* KeyFilterRa = "FilterRa";
constexpr const char* KeyFilterRaError = "FilterRaError";
constexpr const char* KeyFilterDec = "FilterDec";
constexpr const char* KeyFilterDecError = "FilterDecError";
constexpr const char* KeyFilterParallax = "FilterParallax";
constexpr const char* KeyFilterParallaxError = "FilterParallaxError";
constexpr const char* KeyFilterPmra = "FilterPmra";
constexpr const char* KeyFilterPmraError = "FilterPmraError";
constexpr const char* KeyFilterPmdec = "FilterPmdec";
constexpr const char* KeyFilterPmdecError = "FilterPmdecError";
constexpr const char* KeyFilterRv = "FilterRv";
constexpr const char* KeyFilterRvError = "FilterRvError";
constexpr const char* _loggerCat = "ConstructOctreeTask";
struct [[codegen::Dictionary(ConstructOctreeTask)]] Parameters {
// If SingleFileInput is set to true then this specifies the path to a single BIN
// file containing a full dataset. Otherwise this specifies the path to a folder
// with multiple BIN files containing subsets of sorted star data
std::string inFileOrFolderPath;
// If SingleFileInput is set to true then this specifies the output file name
// (including full path). Otherwise this specifies the path to the folder which to
// save all files
std::string outFileOrFolderPath;
// If set it determines what MAX_DIST to use when creating Octree
std::optional<int> maxDist;
// If set it determines what MAX_STAR_PER_NODE to use when creating Octree
std::optional<int> maxStarsPerNode;
// If true then task will read from a single file and output a single binary file
// with the full Octree. If false then task will read all files in specified
// folder and output multiple files for the Octree
std::optional<bool> singleFileInput;
// If defined then only stars with Position X values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterPosX;
// If defined then only stars with Position Y values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterPosY;
// If defined then only stars with Position Z values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterPosZ;
// If defined then only stars with G mean magnitude values between [min, max] will
// be inserted into Octree (if min is set to 20.0 it is read as -Inf, if max is
// set to 20.0 it is read as +Inf). If min = max then all values equal min|max
// will be filtered away. Default GMag = 20.0 if no value existed
std::optional<glm::vec2> filterGMag;
// If defined then only stars with Bp-Rp color values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterBpRp;
// If defined then only stars with Velocity X values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterVelX;
// If defined then only stars with Velocity Y values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterVelY;
// If defined then only stars with Velocity Z values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterVelZ;
// If defined then only stars with Bp mean magnitude values between [min, max]
// will be inserted into Octree (if min is set to 20.0 it is read as -Inf, if max
// is set to 20.0 it is read as +Inf). If min = max then all values equal min|max
// will be filtered away. Default BpMag = 20.0 if no value existed
std::optional<glm::vec2> filterBpMag;
// If defined then only stars with Rp mean magnitude values between [min, max]
// will be inserted into Octree (if min is set to 20.0 it is read as -Inf, if max
// is set to 20.0 it is read as +Inf). If min = max then all values equal min|max
// will be filtered away. Default RpMag = 20.0 if no value existed
std::optional<glm::vec2> filterRpMag;
// If defined then only stars with Bp-G color values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterBpG;
// If defined then only stars with G-Rp color values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterGRp;
// If defined then only stars with RA values between [min, max] will be inserted
// into Octree (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it
// is read as +Inf). If min = max then all values equal min|max will be filtered
// away
std::optional<glm::vec2> filterRa;
// If defined then only stars with RA Error values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterRaError;
// If defined then only stars with DEC values between [min, max] will be inserted
// into Octree (if min is set to 0.0 it is read as -Inf, if max is set to 0.0 it
// is read as +Inf). If min = max then all values equal min|max will be filtered
// away
std::optional<glm::vec2> filterDec;
// If defined then only stars with DEC Error values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterDecError;
// If defined then only stars with Parallax values between [min, max] will be
// inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set to
// 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterParallax;
// If defined then only stars with Parallax Error values between [min, max] will
// be inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set
// to 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterParallaxError;
// If defined then only stars with Proper Motion RA values between [min, max] will
// be inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set
// to 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterPmra;
// If defined then only stars with Proper Motion RA Error values between
// [min, max] will be inserted into Octree (if min is set to 0.0 it is read as
// -Inf, if max is set to 0.0 it is read as +Inf). If min = max then all values
// equal min|max will be filtered away
std::optional<glm::vec2> filterPmraError;
// If defined then only stars with Proper Motion DEC values between [min, max]
// will be inserted into Octree (if min is set to 0.0 it is read as -Inf, if max
// is set to 0.0 it is read as +Inf). If min = max then all values equal min|max
// will be filtered away
std::optional<glm::vec2> filterPmdec;
// If defined then only stars with Proper Motion DEC Error values between
// [min, max] will be inserted into Octree (if min is set to 0.0 it is read as
// -Inf, if max is set to 0.0 it is read as +Inf). If min = max then all values
// equal min|max will be filtered away
std::optional<glm::vec2> filterPmdecError;
// If defined then only stars with Radial Velocity values between [min, max] will
// be inserted into Octree (if min is set to 0.0 it is read as -Inf, if max is set
// to 0.0 it is read as +Inf). If min = max then all values equal min|max will be
// filtered away
std::optional<glm::vec2> filterRv;
// If defined then only stars with Radial Velocity Error values between [min, max]
// will be inserted into Octree (if min is set to 0.0 it is read as -Inf, if max
// is set to 0.0 it is read as +Inf). If min = max then all values equal min|max
// will be filtered away
std::optional<glm::vec2> filterRvError;
};
#include "constructoctreetask_codegen.cpp"
} // namespace
namespace openspace {
ConstructOctreeTask::ConstructOctreeTask(const ghoul::Dictionary& dictionary) {
openspace::documentation::testSpecificationAndThrow(
documentation(),
dictionary,
"ConstructOctreeTask"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
_inFileOrFolderPath = absPath(dictionary.value<std::string>(KeyInFileOrFolderPath));
_outFileOrFolderPath = absPath(dictionary.value<std::string>(KeyOutFileOrFolderPath));
if (dictionary.hasKey(KeyMaxDist)) {
_maxDist = static_cast<int>(dictionary.value<double>(KeyMaxDist));
}
if (dictionary.hasKey(KeyMaxStarsPerNode)) {
_maxStarsPerNode = static_cast<int>(dictionary.value<double>(KeyMaxStarsPerNode));
}
if (dictionary.hasKey(KeySingleFileInput)) {
_singleFileInput = dictionary.value<bool>(KeySingleFileInput);
}
_inFileOrFolderPath = absPath(p.inFileOrFolderPath);
_outFileOrFolderPath = absPath(p.outFileOrFolderPath);
_maxDist = p.maxDist.value_or(_maxDist);
_maxStarsPerNode = p.maxStarsPerNode.value_or(_maxStarsPerNode);
_singleFileInput = p.singleFileInput.value_or(_singleFileInput);
_octreeManager = std::make_shared<OctreeManager>();
_indexOctreeManager = std::make_shared<OctreeManager>();
// Check for filter params.
if (dictionary.hasKey(KeyFilterPosX)) {
_posX = dictionary.value<glm::dvec2>(KeyFilterPosX);
_filterPosX = true;
}
if (dictionary.hasKey(KeyFilterPosY)) {
_posY = dictionary.value<glm::dvec2>(KeyFilterPosY);
_filterPosY = true;
}
if (dictionary.hasKey(KeyFilterPosZ)) {
_posZ = dictionary.value<glm::dvec2>(KeyFilterPosZ);
_filterPosZ = true;
}
if (dictionary.hasKey(KeyFilterGMag)) {
_gMag = dictionary.value<glm::dvec2>(KeyFilterGMag);
_filterGMag = true;
}
if (dictionary.hasKey(KeyFilterBpRp)) {
_bpRp = dictionary.value<glm::dvec2>(KeyFilterBpRp);
_filterBpRp = true;
}
if (dictionary.hasKey(KeyFilterVelX)) {
_velX = dictionary.value<glm::dvec2>(KeyFilterVelX);
_filterVelX = true;
}
if (dictionary.hasKey(KeyFilterVelY)) {
_velY = dictionary.value<glm::dvec2>(KeyFilterVelY);
_filterVelY = true;
}
if (dictionary.hasKey(KeyFilterVelZ)) {
_velZ = dictionary.value<glm::dvec2>(KeyFilterVelZ);
_filterVelZ = true;
}
if (dictionary.hasKey(KeyFilterBpMag)) {
_bpMag = dictionary.value<glm::dvec2>(KeyFilterBpMag);
_filterBpMag = true;
}
if (dictionary.hasKey(KeyFilterRpMag)) {
_rpMag = dictionary.value<glm::dvec2>(KeyFilterRpMag);
_filterRpMag = true;
}
if (dictionary.hasKey(KeyFilterBpG)) {
_bpG = dictionary.value<glm::dvec2>(KeyFilterBpG);
_filterBpG = true;
}
if (dictionary.hasKey(KeyFilterGRp)) {
_gRp = dictionary.value<glm::dvec2>(KeyFilterGRp);
_filterGRp = true;
}
if (dictionary.hasKey(KeyFilterRa)) {
_ra = dictionary.value<glm::dvec2>(KeyFilterRa);
_filterRa = true;
}
if (dictionary.hasKey(KeyFilterRaError)) {
_raError = dictionary.value<glm::dvec2>(KeyFilterRaError);
_filterRaError = true;
}
if (dictionary.hasKey(KeyFilterDec)) {
_dec = dictionary.value<glm::dvec2>(KeyFilterDec);
_filterDec = true;
}
if (dictionary.hasKey(KeyFilterDecError)) {
_decError = dictionary.value<glm::dvec2>(KeyFilterDecError);
_filterDecError = true;
}
if (dictionary.hasKey(KeyFilterParallax)) {
_parallax = dictionary.value<glm::dvec2>(KeyFilterParallax);
_filterParallax = true;
}
if (dictionary.hasKey(KeyFilterParallaxError)) {
_parallaxError = dictionary.value<glm::dvec2>(KeyFilterParallaxError);
_filterParallaxError = true;
}
if (dictionary.hasKey(KeyFilterPmra)) {
_pmra = dictionary.value<glm::dvec2>(KeyFilterPmra);
_filterPmra = true;
}
if (dictionary.hasKey(KeyFilterPmraError)) {
_pmraError = dictionary.value<glm::dvec2>(KeyFilterPmraError);
_filterPmraError = true;
}
if (dictionary.hasKey(KeyFilterPmdec)) {
_pmdec = dictionary.value<glm::dvec2>(KeyFilterPmdec);
_filterPmdec = true;
}
if (dictionary.hasKey(KeyFilterPmdecError)) {
_pmdecError = dictionary.value<glm::dvec2>(KeyFilterPmdecError);
_filterPmdecError = true;
}
if (dictionary.hasKey(KeyFilterRv)) {
_rv = dictionary.value<glm::dvec2>(KeyFilterRv);
_filterRv = true;
}
if (dictionary.hasKey(KeyFilterRvError)) {
_rvError = dictionary.value<glm::dvec2>(KeyFilterRvError);
_filterRvError = true;
}
_posX = p.filterPosX.value_or(_posX);
_filterPosX = p.filterPosX.has_value();
_posY = p.filterPosY.value_or(_posY);
_filterPosY = p.filterPosY.has_value();
_posZ = p.filterPosZ.value_or(_posZ);
_filterPosZ = p.filterPosZ.has_value();
_gMag = p.filterGMag.value_or(_gMag);
_filterGMag = p.filterGMag.has_value();
_bpRp = p.filterBpRp.value_or(_bpRp);
_filterBpRp = p.filterBpRp.has_value();
_velX = p.filterVelX.value_or(_velX);
_filterVelX = p.filterVelX.has_value();
_velY = p.filterVelY.value_or(_velY);
_filterVelY = p.filterVelY.has_value();
_velZ = p.filterVelZ.value_or(_velZ);
_filterVelZ = p.filterVelZ.has_value();
_bpMag = p.filterBpMag.value_or(_bpMag);
_filterBpMag = p.filterBpMag.has_value();
_rpMag = p.filterRpMag.value_or(_rpMag);
_filterRpMag = p.filterRpMag.has_value();
_bpG = p.filterBpG.value_or(_bpG);
_filterBpG = p.filterBpG.has_value();
_gRp = p.filterGRp.value_or(_gRp);
_filterGRp = p.filterGRp.has_value();
_ra = p.filterRa.value_or(_ra);
_filterRa = p.filterRa.has_value();
_raError = p.filterRaError.value_or(_raError);
_filterRaError = p.filterRaError.has_value();
_dec = p.filterDec.value_or(_dec);
_filterDec = p.filterDec.has_value();
_decError = p.filterDecError.value_or(_decError);
_filterDecError = p.filterDecError.has_value();
_parallax = p.filterParallax.value_or(_parallax);
_filterParallax = p.filterParallax.has_value();
_parallaxError = p.filterParallaxError.value_or(_parallaxError);
_filterParallaxError = p.filterParallaxError.has_value();
_pmra = p.filterPmra.value_or(_pmra);
_filterPmra = p.filterPmra.has_value();
_pmraError = p.filterPmraError.value_or(_pmraError);
_filterPmraError = p.filterPmraError.has_value();
_pmdec = p.filterPmdec.value_or(_pmdec);
_filterPmdec = p.filterPmdec.has_value();
_pmdecError = p.filterPmdecError.value_or(_pmdecError);
_filterPmdecError = p.filterPmdecError.has_value();
_rv = p.filterRv.value_or(_rv);
_filterRv = p.filterRv.has_value();
_rvError = p.filterRvError.value_or(_rvError);
_filterRvError = p.filterRvError.has_value();
}
std::string ConstructOctreeTask::description() {
@@ -201,7 +300,7 @@ std::string ConstructOctreeTask::description() {
}
void ConstructOctreeTask::perform(const Task::ProgressCallback& onProgress) {
onProgress(0.0f);
onProgress(0.f);
if (_singleFileInput) {
constructOctreeFromSingleFile(onProgress);
@@ -210,7 +309,7 @@ void ConstructOctreeTask::perform(const Task::ProgressCallback& onProgress) {
constructOctreeFromFolder(onProgress);
}
onProgress(1.0f);
onProgress(1.f);
}
void ConstructOctreeTask::constructOctreeFromSingleFile(
@@ -543,269 +642,9 @@ bool ConstructOctreeTask::filterStar(const glm::vec2& range, float filterValue,
}
documentation::Documentation ConstructOctreeTask::Documentation() {
using namespace documentation;
return {
"ConstructOctreeTask",
"gaiamission_constructoctreefrombin",
{
{
KeyInFileOrFolderPath,
new StringVerifier,
Optional::No,
"If SingleFileInput is set to true then this specifies the path to a "
"single BIN file containing a full dataset. Otherwise this specifies the "
"path to a folder with multiple BIN files containing subsets of sorted "
"star data.",
},
{
KeyOutFileOrFolderPath,
new StringVerifier,
Optional::No,
"If SingleFileInput is set to true then this specifies the output file "
"name (including full path). Otherwise this specifies the path to the "
"folder which to save all files.",
},
{
KeyMaxDist,
new IntVerifier,
Optional::Yes,
"If set it determines what MAX_DIST to use when creating Octree."
},
{
KeyMaxStarsPerNode,
new IntVerifier,
Optional::Yes,
"If set it determines what MAX_STAR_PER_NODE to use when creating Octree."
},
{
KeySingleFileInput,
new BoolVerifier,
Optional::Yes,
"If true then task will read from a single file and output a single "
"binary file with the full Octree. If false then task will read all "
"files in specified folder and output multiple files for the Octree."
},
{
KeyFilterPosX,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Position X values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterPosY,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Position Y values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterPosZ,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Position Z values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterGMag,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with G mean magnitude values between "
"[min, max] will be inserted into Octree (if min is set to 20.0 it is "
"read as -Inf, if max is set to 20.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away. Default "
"GMag = 20.0 if no value existed."
},
{
KeyFilterBpRp,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Bp-Rp color values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterVelX,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Velocity X values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterVelY,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Velocity Y values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterVelZ,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Velocity Z values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterBpMag,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Bp mean magnitude values between "
"[min, max] will be inserted into Octree (if min is set to 20.0 it is "
"read as -Inf, if max is set to 20.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away. Default "
"BpMag = 20.0 if no value existed."
},
{
KeyFilterRpMag,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Rp mean magnitude values between "
"[min, max] will be inserted into Octree (if min is set to 20.0 it is "
"read as -Inf, if max is set to 20.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away. Default RpMag = "
"20.0 if no value existed."
},
{
KeyFilterBpG,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Bp-G color values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterGRp,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with G-Rp color values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterRa,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with RA values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterRaError,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with RA Error values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterDec,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with DEC values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterDecError,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with DEC Error values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterParallax,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Parallax values between [min, max] "
"will be inserted into Octree (if min is set to 0.0 it is read as -Inf, "
"if max is set to 0.0 it is read as +Inf). If min = max then all values "
"equal min|max will be filtered away."
},
{
KeyFilterParallaxError,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Parallax Error values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
{
KeyFilterPmra,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Proper Motion RA values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
{
KeyFilterPmraError,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Proper Motion RA Error values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
{
KeyFilterPmdec,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Proper Motion DEC values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
{
KeyFilterPmdecError,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Proper Motion DEC Error values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
{
KeyFilterRv,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Radial Velocity values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
{
KeyFilterRvError,
new Vector2Verifier<double>,
Optional::Yes,
"If defined then only stars with Radial Velocity Error values between "
"[min, max] will be inserted into Octree (if min is set to 0.0 it is "
"read as -Inf, if max is set to 0.0 it is read as +Inf). If min = max "
"then all values equal min|max will be filtered away."
},
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "gaiamission_constructoctreefrombin";
return doc;
}
} // namespace openspace

View File

@@ -36,55 +36,61 @@
#include <fstream>
#include <set>
#include <optional>
namespace {
constexpr const char* KeyInFileOrFolderPath = "InFileOrFolderPath";
constexpr const char* KeyOutFileOrFolderPath = "OutFileOrFolderPath";
constexpr const char* KeySingleFileProcess = "SingleFileProcess";
constexpr const char* KeyThreadsToUse = "ThreadsToUse";
constexpr const char* KeyFirstRow = "FirstRow";
constexpr const char* KeyLastRow = "LastRow";
constexpr const char* KeyFilterColumnNames = "FilterColumnNames";
constexpr const char* _loggerCat = "ReadFitsTask";
struct [[codegen::Dictionary(ReadFitsTask)]] Parameters {
// If SingleFileProcess is set to true then this specifies the path to a single
// FITS file that will be read. Otherwise it specifies the path to a folder with
// multiple FITS files that are to be read
std::string inFileOrFolderPath;
// If SingleFileProcess is set to true then this specifies the name (including
// entire path) to the output file. Otherwise it specifies the path to the output
// folder which to export binary star data to
std::string outFileOrFolderPath;
// If true then task will read from a single FITS file and output a single binary
// file. If false then task will read all files in specified folder and output
// multiple files sorted by location
std::optional<bool> singleFileProcess;
// Defines how many threads to use when reading from multiple files
std::optional<int> threadsToUse [[codegen::greater(1)]];
// Defines the first row that will be read from the specified FITS file(s). If not
// defined then reading will start at first row
std::optional<int> firstRow;
// Defines the last row that will be read from the specified FITS file(s). If not
// defined (or less than FirstRow) then full file(s) will be read
std::optional<int> lastRow;
// A list of strings with the names of all the additional columns that are to be
// read from the specified FITS file(s). These columns can be used for filtering
// while constructing Octree later
std::optional<std::vector<std::string>> filterColumnNames;
};
#include "readfitstask_codegen.cpp"
} // namespace
namespace openspace {
ReadFitsTask::ReadFitsTask(const ghoul::Dictionary& dictionary) {
openspace::documentation::testSpecificationAndThrow(
documentation(),
dictionary,
"ReadFitsTask"
);
const Parameters p = codegen::bake<Parameters>(dictionary);
_inFileOrFolderPath = absPath(dictionary.value<std::string>(KeyInFileOrFolderPath));
_outFileOrFolderPath = absPath(dictionary.value<std::string>(KeyOutFileOrFolderPath));
_inFileOrFolderPath = absPath(p.inFileOrFolderPath);
_outFileOrFolderPath = absPath(p.outFileOrFolderPath);
_singleFileProcess = p.singleFileProcess.value_or(_singleFileProcess);
_threadsToUse = p.threadsToUse.value_or(_threadsToUse);
_firstRow = p.firstRow.value_or(_firstRow);
_lastRow = p.lastRow.value_or(_lastRow);
if (dictionary.hasKey(KeySingleFileProcess)) {
_singleFileProcess = dictionary.value<bool>(KeySingleFileProcess);
}
if (dictionary.hasKey(KeyThreadsToUse)) {
_threadsToUse = static_cast<size_t>(dictionary.value<double>(KeyThreadsToUse));
if (_threadsToUse < 1) {
LINFO(fmt::format(
"User defined ThreadsToUse was: {}. Will be set to 1", _threadsToUse
));
_threadsToUse = 1;
}
}
if (dictionary.hasKey(KeyFirstRow)) {
_firstRow = static_cast<int>(dictionary.value<double>(KeyFirstRow));
}
if (dictionary.hasKey(KeyLastRow)) {
_lastRow = static_cast<int>(dictionary.value<double>(KeyLastRow));
}
if (dictionary.hasKey(KeyFilterColumnNames)) {
if (p.filterColumnNames.has_value()) {
ghoul::Dictionary d = dictionary.value<ghoul::Dictionary>(KeyFilterColumnNames);
// Ugly fix for ASCII sorting when there are more columns read than 10.
@@ -322,66 +328,9 @@ int ReadFitsTask::writeOctantToFile(const std::vector<float>& octantData, int in
}
documentation::Documentation ReadFitsTask::Documentation() {
using namespace documentation;
return {
"ReadFitsFile",
"gaiamission_fitsfiletorawdata",
{
{
KeyInFileOrFolderPath,
new StringVerifier,
Optional::No,
"If SingleFileProcess is set to true then this specifies the path to a "
"single FITS file that will be read. Otherwise it specifies the path to "
"a folder with multiple FITS files that are to be read.",
},
{
KeyOutFileOrFolderPath,
new StringVerifier,
Optional::No,
"If SingleFileProcess is set to true then this specifies the name "
"(including entire path) to the output file. Otherwise it specifies the "
"path to the output folder which to export binary star data to.",
},
{
KeySingleFileProcess,
new BoolVerifier,
Optional::Yes,
"If true then task will read from a single FITS file and output a single "
"binary file. If false then task will read all files in specified folder "
"and output multiple files sorted by location."
},
{
KeyThreadsToUse,
new IntVerifier,
Optional::Yes,
"Defines how many threads to use when reading from multiple files."
},
{
KeyFirstRow,
new IntVerifier,
Optional::Yes,
"Defines the first row that will be read from the specified FITS "
"file(s). If not defined then reading will start at first row.",
},
{
KeyLastRow,
new IntVerifier,
Optional::Yes,
"Defines the last row that will be read from the specified FITS file(s). "
"If not defined (or less than FirstRow) then full file(s) will be read.",
},
{
KeyFilterColumnNames,
new StringListVerifier,
Optional::Yes,
"A list of strings with the names of all the additional columns that are "
"to be read from the specified FITS file(s). These columns can be used "
"for filtering while constructing Octree later.",
},
}
};
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "gaiamission_fitsfiletorawdata";
return doc;
}
} // namespace openspace

View File

@@ -34,23 +34,30 @@
#include <fstream>
namespace {
constexpr const char* KeyInFilePath = "InFilePath";
constexpr const char* KeyOutFilePath = "OutFilePath";
constexpr const char* _loggerCat = "ReadSpeckTask";
struct [[codegen::Dictionary(ReadSpeckTask)]] Parameters {
// The path to the SPECK file that are to be read
std::string inFilePath;
// The path to the file to export raw VBO data to
std::string outFilePath;
};
#include "readspecktask_codegen.cpp"
} // namespace
namespace openspace {
ReadSpeckTask::ReadSpeckTask(const ghoul::Dictionary& dictionary) {
openspace::documentation::testSpecificationAndThrow(
documentation(),
dictionary,
"ReadSpeckTask"
);
documentation::Documentation ReadSpeckTask::Documentation() {
documentation::Documentation doc = codegen::doc<Parameters>();
doc.id = "gaiamission_speckfiletorawdata";
return doc;
}
_inFilePath = absPath(dictionary.value<std::string>(KeyInFilePath));
_outFilePath = absPath(dictionary.value<std::string>(KeyOutFilePath));
ReadSpeckTask::ReadSpeckTask(const ghoul::Dictionary& dictionary) {
const Parameters p = codegen::bake<Parameters>(dictionary);
_inFilePath = absPath(p.inFilePath);
_outFilePath = absPath(p.outFilePath);
}
std::string ReadSpeckTask::description() {
@@ -92,26 +99,4 @@ void ReadSpeckTask::perform(const Task::ProgressCallback& onProgress) {
onProgress(1.f);
}
documentation::Documentation ReadSpeckTask::Documentation() {
using namespace documentation;
return {
"ReadSpeckTask",
"gaiamission_speckfiletorawdata",
{
{
KeyInFilePath,
new StringVerifier,
Optional::No,
"The path to the SPECK file that are to be read.",
},
{
KeyOutFilePath,
new StringVerifier,
Optional::No,
"The path to the file to export raw VBO data to.",
},
}
};
}
} // namespace openspace

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