diff --git a/.gitmodules b/.gitmodules
index e78869f917..60281862f8 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,8 +1,8 @@
[submodule "ext/ghoul"]
path = ext/ghoul
url = https://github.com/OpenSpace/Ghoul.git
-[submodule "openspace-data"]
- path = openspace-data
+[submodule "data"]
+ path = data
url = git@openspace.itn.liu.se:/openspace-data
[submodule "modules/kameleon/ext/kameleon"]
path = modules/kameleon/ext/kameleon
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8144a87665..f6735892f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,12 +22,13 @@
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
#########################################################################################
-cmake_minimum_required (VERSION 3.0)
+cmake_minimum_required (VERSION 3.0 FATAL_ERROR)
project (OpenSpace)
message(STATUS "Generating OpenSpace project")
set(OPENSPACE_BASE_DIR "${PROJECT_SOURCE_DIR}")
+set(OPENSPACE_APPS_DIR "${OPENSPACE_BASE_DIR}/apps")
set(OPENSPACE_EXT_DIR "${OPENSPACE_BASE_DIR}/ext")
set(OPENSPACE_MODULE_DIR "${OPENSPACE_BASE_DIR}/modules")
set(OPENSPACE_CMAKE_EXT_DIR "${OPENSPACE_BASE_DIR}/support/cmake")
@@ -48,9 +49,9 @@ option(OPENSPACE_BUILD_GUI_APPLICATIONS "Build GUI Applications" OFF)
include(src/CMakeLists.txt)
-create_openspace_targets()
-set_compile_settings()
+create_openspace_target()
add_external_dependencies()
+handle_applications()
if (MSVC)
option(OPENSPACE_ENABLE_VLD "Enable the Visual Leak Detector" OFF)
diff --git a/apps/Launcher/CMakeLists.txt b/apps/Launcher/CMakeLists.txt
new file mode 100644
index 0000000000..2cf98ae128
--- /dev/null
+++ b/apps/Launcher/CMakeLists.txt
@@ -0,0 +1,64 @@
+#########################################################################################
+# #
+# OpenSpace #
+# #
+# Copyright (c) 2014-2015 #
+# #
+# 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. #
+#########################################################################################
+
+set(APPLICATION_NAME Launcher)
+set(APPLICATION_LINK_TO_OPENSPACE ON)
+
+set(SOURCE_FILES
+ ${OPENSPACE_APPS_DIR}/Launcher/main.cpp
+ ${OPENSPACE_APPS_DIR}/Launcher/mainwindow.cpp
+ ${OPENSPACE_APPS_DIR}/Launcher/shortcutwidget.cpp
+ ${OPENSPACE_APPS_DIR}/Launcher/syncwidget.cpp
+)
+
+set(HEADER_FILES
+ ${OPENSPACE_APPS_DIR}/Launcher/mainwindow.h
+ ${OPENSPACE_APPS_DIR}/Launcher/shortcutwidget.h
+ ${OPENSPACE_APPS_DIR}/Launcher/syncwidget.h
+)
+
+find_package(Qt5Widgets)
+find_package(Qt5Network)
+
+qt5_wrap_cpp(MOC_FILES ${HEADER_FILES})
+qt5_add_resources(RESOURCE_FILES ${OPENSPACE_APPS_DIR}/Launcher/files.qrc)
+
+add_executable(${APPLICATION_NAME} MACOSX_BUNDLE
+ ${SOURCE_FILES}
+ ${HEADER_FILES}
+ ${MOC_FILES}
+ ${RESOURCE_FILES}
+)
+
+target_link_libraries(${APPLICATION_NAME}
+ Qt5::Widgets
+ Qt5::Network
+)
+
+if (APPLE)
+INSTALL(CODE "
+ include(BundleUtilities)
+ fixup_bundle(\"/Users/alex/Development/OpenSpace/bin/openspace/Debug/Launcher.app/Contents/MacOS/Launcher\" \"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/plugins/platforms/libqcocoa.dylib\" \"\")
+ " COMPONENT Runtime)
+endif ()
diff --git a/apps/Launcher/files.qrc b/apps/Launcher/files.qrc
new file mode 100644
index 0000000000..5661c6a39f
--- /dev/null
+++ b/apps/Launcher/files.qrc
@@ -0,0 +1,5 @@
+
+
+ images/header.png
+
+
diff --git a/apps/Launcher/images/header.png b/apps/Launcher/images/header.png
new file mode 100644
index 0000000000..21ced755c8
Binary files /dev/null and b/apps/Launcher/images/header.png differ
diff --git a/apps/Launcher/main.cpp b/apps/Launcher/main.cpp
new file mode 100644
index 0000000000..b4c17f6d04
--- /dev/null
+++ b/apps/Launcher/main.cpp
@@ -0,0 +1,155 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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
+
+#include "mainwindow.h"
+
+//static const QString style = R"style(
+//QWidget {
+// background-color: rgb(80, 80, 80);
+// font-family: Helvetica;
+//}
+//
+//QGroupBox {
+// background-color: qlineargradient(
+// x1: 0, y1: 0, x2: 0, y2: 1,
+// stop: 0 #858585,
+// stop: 1 #959595);
+// border: 2px solid gray;
+// border-radius: 5px;
+// margin-top: 4ex;
+// font-size: bold 12px;
+//}
+//
+//QGroupBox::title {
+// background-color: #E0E0E0;
+// border: 2px solid gray;
+// border-radius: 5px;
+// subcontrol-origin: margin;
+// subcontrol-position: top center;
+// padding: 0 10px;
+//}
+//
+//QLineEdit {
+// color: lightgray;
+//}
+//
+//QSlider::groove:horizontal {
+// border: 1px solid #999999;
+// height: 8px; /* the groove expands to the size of the slider by default. by giving it a height, it has a fixed size */
+// background: qlineargradient(
+// x1:0, y1:0, x2:1, y2:0,
+// stop:0 #c4c4c4,
+// stop:0.5 #555555,
+// stop:1 #c4c4c4
+// );
+// margin: 2px 0;
+//}
+//
+//QSlider::handle:horizontal {
+// background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop:0 #b4b4b4, stop:1 #8f8f8f);
+// border: 1px solid #5c5c5c;
+// width: 18px;
+// margin: -2px 0; /* handle is placed by default on the contents rect of the groove. Expand outside the groove */
+// border-radius: 3px;
+//}
+//
+//QPushButton {
+// background-color: lightgray;
+// border-style: outset;
+// border-width: 0.5px;
+// border-radius: 5px;
+// border-color: black;
+// font: bold 12px;
+// min-width: 10em;
+//}
+//
+//QPushButton#connection {
+// background-color: lightgreen;
+//}
+//
+//QPushButton#connection:pressed {
+// background-color: green;
+//}
+//
+//
+//QPushButton#pause, QPushButton#play {
+// padding: 5px;
+//}
+//
+//QPushButton#pause:pressed, QPushButton#play:pressed, QPushButton:pressed {
+// background-color: darkgray;
+// border-style: inset;
+//}
+//
+//QCombobox {
+// border: 1px solid gray;
+// border-radius: 3px;
+// padding: 1px 18px 1px 3px;
+// min-width: 6em;
+//}
+//
+//QComboBox:editable {
+// background: lightgrey;
+//}
+//
+//QComboBox QAbstractItemView {
+// border: 2px solid darkgray;
+// border-radius: 5px;
+// background-color: #a8a8a8;
+// selection-background-color: #a8a8a8;
+//}
+//
+//QLabel#label {
+// font-size: 13px;
+// background-color: transparent;
+// font-variant: small-caps;
+//}
+//
+//QLabel#value {
+// font-family: monospace;
+// font-weight: bold;
+// font-size: 14px;
+// background-color: transparent;
+//}
+//
+//QWidget#background {
+// background-color: transparent;
+//}
+//
+//QTextEdit {
+// font-family: monospace;
+//}
+//)style";
+
+int main(int argc, char** argv) {
+ QApplication app(argc, argv);
+
+// app.setStyleSheet(style);
+ MainWindow window;
+ window.show();
+
+ return app.exec();
+}
diff --git a/apps/Launcher/mainwindow.cpp b/apps/Launcher/mainwindow.cpp
new file mode 100644
index 0000000000..138a083a13
--- /dev/null
+++ b/apps/Launcher/mainwindow.cpp
@@ -0,0 +1,457 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 "mainwindow.h"
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace {
+ const QSize WindowSize = QSize(640, 480);
+
+ const QString NewsURL = "http://openspace.itn.liu.se/news.txt";
+
+ const QString ModulesDirectory = "../data/scene"; // temporary ---abock
+
+#ifdef WIN32
+ const QString OpenSpaceExecutable = "OpenSpace.exe";
+#else
+ const QString OpenSpaceExecutable = "OpenSpace";
+#endif
+}
+
+MainWindow::MainWindow()
+ : QWidget(nullptr)
+ , _newsReply(nullptr)
+ , _informationWidget(nullptr)
+ , _scenes(nullptr)
+ , _shortcutWidget(nullptr)
+ , _syncWidget(nullptr)
+{
+ setFixedSize(WindowSize);
+
+ QGridLayout* layout = new QGridLayout;
+
+ QLabel* image = new QLabel;
+ QPixmap p = QPixmap(":/images/header.png");
+ image->setPixmap(p.scaledToWidth(WindowSize.width()));
+ layout->addWidget(image, 0, 0, 1, 2);
+
+ _informationWidget = new QTextEdit(this);
+ _informationWidget->setReadOnly(true);
+ layout->addWidget(_informationWidget, 1, 0, 2, 1);
+
+ QWidget* container = new QWidget;
+ {
+ QGridLayout* layout = new QGridLayout;
+
+ QLabel* shortcutLabel = new QLabel("Keyboard Shortcuts:");
+ layout->addWidget(shortcutLabel, 0, 0);
+ QPushButton* shortcutButton = new QPushButton("Open...");
+ QObject::connect(shortcutButton, SIGNAL(clicked(bool)),
+ this, SLOT(shortcutButtonPressed())
+ );
+ layout->addWidget(shortcutButton, 0, 1);
+
+ QLabel* sceneSelectionLabel = new QLabel("Scenes:");
+ layout->addWidget(sceneSelectionLabel, 1, 0);
+ _scenes = new QComboBox;
+ layout->addWidget(_scenes);
+
+ container->setLayout(layout);
+ }
+ layout->addWidget(container, 1, 1);
+
+ container = new QWidget;
+ {
+ QBoxLayout* layout = new QHBoxLayout;
+
+ QPushButton* cancelButton = new QPushButton("Cancel");
+ QObject::connect(
+ cancelButton, SIGNAL(clicked(bool)),
+ QApplication::instance(), SLOT(quit())
+ );
+ layout->addWidget(cancelButton);
+
+ QPushButton* syncButton = new QPushButton("Sync");
+ QObject::connect(
+ syncButton, SIGNAL(clicked(bool)),
+ this, SLOT(syncButtonPressed())
+ );
+ layout->addWidget(syncButton);
+
+ QPushButton* startButton = new QPushButton("Start");
+ QObject::connect(
+ startButton, SIGNAL(clicked(bool)),
+ this, SLOT(startButtonPressed())
+ );
+ layout->addWidget(startButton);
+
+ container->setLayout(layout);
+ }
+ layout->addWidget(container, 2, 1);
+
+ setLayout(layout);
+
+ initialize();
+}
+
+MainWindow::~MainWindow() {
+ delete _informationWidget;
+}
+
+void MainWindow::initialize() {
+ // Get the news information
+ QNetworkRequest request;
+ request.setUrl(QUrl(NewsURL));
+
+ _newsReply = _networkManager.get(request);
+ QObject::connect(_newsReply, SIGNAL(finished()),
+ this, SLOT(newsReadyRead())
+ );
+ QObject::connect(_newsReply, SIGNAL(error(QNetworkReply::NetworkError)),
+ this, SLOT(newsNetworkError())
+ );
+
+ _shortcutWidget.hide();
+ _syncWidget.hide();
+
+ QDir d(ModulesDirectory);
+ d.setFilter(QDir::Files);
+
+ QFileInfoList list = d.entryInfoList();
+ for (const QFileInfo& i : list) {
+ _sceneFiles.insert(i.fileName(), i.absoluteFilePath());
+ _scenes->addItem(i.fileName());
+ }
+}
+
+void MainWindow::shortcutButtonPressed() {
+ _shortcutWidget.show();
+}
+
+void MainWindow::syncButtonPressed() {
+ QString currentScene = _scenes->currentText();
+ _syncWidget.setSceneFile(_sceneFiles[currentScene]);
+ _syncWidget.show();
+}
+
+void MainWindow::startButtonPressed() {
+ QProcess* p = new QProcess(this);
+ p->start(OpenSpaceExecutable);
+}
+
+void MainWindow::newsNetworkError() {
+ QString error = _newsReply->errorString();
+ _informationWidget->setText(error);
+ _newsReply->deleteLater();
+}
+
+void MainWindow::newsReadyRead() {
+ QByteArray data = _newsReply->readAll();
+ QString news = QString::fromLatin1(data);
+ _informationWidget->setText(news);
+ _newsReply->deleteLater();
+}
+
+//MainWindow::MainWindow()
+// : QWidget(nullptr)
+// , _configurationWidget(nullptr)
+// , _timeControlWidget(nullptr)
+// , _informationWidget(nullptr)
+// , _timelineWidget(nullptr)
+// , _socket(nullptr)
+//{
+// setWindowTitle("OpenSpace Timeline");
+//
+// _configurationWidget = new ConfigurationWidget(this);
+// _configurationWidget->setMinimumWidth(350);
+// _timeControlWidget = new ControlWidget(this);
+// _timeControlWidget->setMinimumWidth(350);
+// _informationWidget = new InformationWidget(this);
+// _informationWidget->setMinimumWidth(350);
+// _timelineWidget = new TimelineWidget(this);
+//
+// QGridLayout* layout = new QGridLayout;
+// layout->addWidget(_configurationWidget, 0, 0);
+// layout->addWidget(_timeControlWidget, 1, 0);
+// layout->addWidget(_informationWidget, 2, 0);
+// layout->addWidget(_timelineWidget, 0, 1, 3, 1);
+//
+// layout->setColumnStretch(1, 5);
+//
+//
+// QObject::connect(
+// _configurationWidget, SIGNAL(connect(QString, QString)),
+// this, SLOT(onConnect(QString, QString))
+// );
+// QObject::connect(
+// _configurationWidget, SIGNAL(disconnect()),
+// this, SLOT(onDisconnect())
+// );
+//
+// QObject::connect(
+// _timeControlWidget, SIGNAL(scriptActivity(QString)),
+// this, SLOT(sendScript(QString))
+// );
+//
+// setLayout(layout);
+//
+// _configurationWidget->socketDisconnected();
+// _timeControlWidget->socketDisconnected();
+// _informationWidget->socketDisconnected();
+// _timelineWidget->socketDisconnected();
+//}
+//
+//MainWindow::~MainWindow() {
+// delete _socket;
+//}
+//
+//void MainWindow::onConnect(QString host, QString port) {
+// delete _socket;
+//
+// _socket = new QTcpSocket(this);
+// QObject::connect(_socket, SIGNAL(readyRead()), SLOT(readTcpData()));
+// QObject::connect(_socket, SIGNAL(connected()), SLOT(onSocketConnected()));
+// QObject::connect(_socket, SIGNAL(disconnected()), SLOT(onSocketDisconnected()));
+//
+// _socket->connectToHost(host, port.toUInt());
+//}
+//
+//void MainWindow::onDisconnect() {
+// delete _socket;
+// _socket = nullptr;
+//}
+//
+//void MainWindow::readTcpData() {
+// static const uint16_t MessageTypeStatus = 0;
+// static const uint16_t MessageTypePlayBookHongKang = 2;
+// static const uint16_t MessageTypePlayBookLabel = 3;
+//
+// QByteArray data = _socket->readAll();
+//
+// if (QString(data) == "Connected to SGCT!\r\n")
+// return;
+// if (QString(data) == "OK\r\n")
+// return;
+//
+// QByteArray messageTypeData = data.left(2);
+// union {
+// uint16_t value;
+// std::array data;
+// } messageType;
+// std::memcpy(messageType.data.data(), messageTypeData.data(), sizeof(uint16_t));
+//
+// switch (messageType.value) {
+// case MessageTypeStatus:
+// break;
+// case MessageTypePlayBookHongKang:
+// qDebug() << "Hong Kang Playbook received";
+// break;
+// case MessageTypePlayBookLabel:
+// qDebug() << "Label Playbook received";
+// break;
+// default:
+// qDebug() << "Unknown message of type '" << messageType.value << "'";
+// }
+//
+// switch (messageType.value) {
+// case MessageTypeStatus:
+// {
+// if (_hasHongKangTimeline && _hasLabelTimeline)
+// handleStatusMessage(data.mid(2));
+// break;
+// }
+// case MessageTypePlayBookHongKang:
+// case MessageTypePlayBookLabel:
+// {
+// const char* payloadDebug = data.mid(2).data();
+//
+// size_t beginning = 0;
+// uint32_t size = readFromBuffer(data.mid(2).data(), beginning);
+//
+// //qDebug() << "Begin reading data";
+// while (_socket->waitForReadyRead() && data.size() < int(size)) {
+// //qDebug() << ".";
+// data = data.append(_socket->readAll());
+// //data = data.append(_socket->read(int(size) - data.size()));
+// QThread::msleep(50);
+// }
+// //qDebug() << "Finished reading data. Handling playbook";
+//
+// handlePlaybook(data.mid(2));
+//
+// //qDebug() << "Finished handling playbook";
+//
+// if (messageType.value == MessageTypePlayBookHongKang)
+// _hasHongKangTimeline = true;
+// if (messageType.value == MessageTypePlayBookLabel)
+// _hasLabelTimeline = true;
+//
+// if (_hasHongKangTimeline && _hasLabelTimeline) {
+// fullyConnected();
+// }
+//
+// break;
+// }
+// default:
+// qDebug() << QString(data);
+// }
+//
+//}
+//
+//void MainWindow::handleStatusMessage(QByteArray data) {
+// const char* buffer = data.data();
+//
+// union {
+// double value;
+// std::array buffer;
+// } et;
+// std::memmove(et.buffer.data(), buffer, sizeof(double));
+//
+// std::vector timeString(24);
+// std::memmove(timeString.data(), buffer + sizeof(double), 24);
+//
+// union {
+// double value;
+// std::array buffer;
+// } delta;
+// std::memmove(delta.buffer.data(), buffer + sizeof(double) + 24, sizeof(double));
+//
+// _timeControlWidget->update(
+// QString::fromStdString(std::string(timeString.begin(), timeString.end())),
+// QString::number(delta.value)
+// );
+// _timelineWidget->setCurrentTime(std::string(timeString.begin(), timeString.end()), et.value);
+//}
+//
+//std::vector instrumentsFromId(uint16_t instrumentId, std::map instrumentMap) {
+// std::vector results;
+// for (int i = 0; i < 16; ++i) {
+// uint16_t testValue = 1 << i;
+// if ((testValue & instrumentId) != 0) {
+// std::string t = instrumentMap.at(testValue);
+// if (t.empty())
+// qDebug() << "Empty instrument";
+// results.push_back(t);
+// }
+// }
+// return results;
+//}
+//
+//void MainWindow::handlePlaybook(QByteArray data) {
+// char* buffer = data.data();
+// size_t currentReadLocation = 0;
+//
+// uint32_t totalData = readFromBuffer(buffer, currentReadLocation);
+//
+// uint8_t nTargets = readFromBuffer(buffer, currentReadLocation);
+// qDebug() << "Targets: " << nTargets;
+// std::map targetMap;
+// for (uint8_t i = 0; i < nTargets; ++i) {
+// uint8_t id = readFromBuffer(buffer, currentReadLocation);
+// std::string value = readFromBuffer(buffer, currentReadLocation);
+// qDebug() << QString::fromStdString(value);
+// targetMap[id] = value;
+// }
+//
+// uint8_t nInstruments = readFromBuffer(buffer, currentReadLocation);
+// qDebug() << "Instruments: " << nInstruments;
+// std::map instrumentMap;
+// for (uint8_t i = 0; i < nInstruments; ++i) {
+// uint16_t id = readFromBuffer(buffer, currentReadLocation);
+// std::string value = readFromBuffer(buffer, currentReadLocation);
+// qDebug() << QString::fromStdString(value);
+// instrumentMap[id] = value;
+// }
+//
+// uint32_t nImages = readFromBuffer(buffer, currentReadLocation);
+// std::vector images;
+// for (uint32_t i = 0; i < nImages; ++i) {
+// Image image;
+// image.beginning = readFromBuffer(buffer, currentReadLocation);
+// image.ending = readFromBuffer(buffer, currentReadLocation);
+//
+// image.beginningString = readFromBuffer(buffer, currentReadLocation);
+// image.endingString = readFromBuffer(buffer, currentReadLocation);
+//
+// uint8_t targetId = readFromBuffer(buffer, currentReadLocation);
+// uint16_t instrumentId = readFromBuffer(buffer, currentReadLocation);
+// image.target = targetMap[targetId];
+// image.instruments = instrumentsFromId(instrumentId, instrumentMap);
+// if (image.instruments.empty())
+// qDebug() << "Instruments were empty";
+// images.push_back(image);
+// }
+//
+// _timelineWidget->setData(std::move(images), std::move(targetMap), std::move(instrumentMap));
+//
+//}
+//
+//void MainWindow::sendScript(QString script) {
+// if (_socket) {
+// _socket->write(("0" + script + "\r\n").toLatin1());
+// //QByteArray data = (QString("0") + script).toLocal8Bit();
+// //qDebug() << data;
+// //_socket->write(data);
+// //QThread::msleep(25);
+// }
+// //_socket->write(("0" + script + "\r\n").toLatin1());
+// //_socket->write(("0" + script + "\0").toLatin1());
+//}
+//
+//void MainWindow::onSocketConnected() {
+// _socket->write(QString("1\r\n").toLatin1());
+// //_socket->write(QString("1").toLatin1());
+//
+//}
+//
+//void MainWindow::onSocketDisconnected() {
+// _configurationWidget->socketDisconnected();
+// _timeControlWidget->socketDisconnected();
+// _informationWidget->socketDisconnected();
+// _timelineWidget->socketDisconnected();
+//
+// _informationWidget->logInformation("Disconnected.");
+//}
+//
+//std::string MainWindow::nextTarget() const {
+// return _timelineWidget->nextTarget();
+//}
+//
+//void MainWindow::fullyConnected() {
+// _informationWidget->logInformation("Connected to " + _socket->peerName() + " on port " + QString::number(_socket->peerPort()) + ".");
+//
+// _configurationWidget->socketConnected();
+// _timeControlWidget->socketConnected();
+// _informationWidget->socketConnected();
+// _timelineWidget->socketConnected();
+//}
diff --git a/apps/Launcher/mainwindow.h b/apps/Launcher/mainwindow.h
new file mode 100644
index 0000000000..109bc4b0b4
--- /dev/null
+++ b/apps/Launcher/mainwindow.h
@@ -0,0 +1,108 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 __MAINWINDOW_H__
+#define __MAINWINDOW_H__
+
+#include
+
+#include "shortcutwidget.h"
+#include "syncwidget.h"
+
+#include
+#include
+#include
+#include
+
+class QComboBox;
+class QNetworkAccessManager;
+
+class MainWindow : public QWidget {
+Q_OBJECT
+public:
+ MainWindow();
+ ~MainWindow();
+
+private slots:
+ void shortcutButtonPressed();
+ void syncButtonPressed();
+ void startButtonPressed();
+
+ void newsNetworkError();
+ void newsReadyRead();
+
+private:
+ void initialize();
+
+ QNetworkReply* _newsReply;
+
+ QTextEdit* _informationWidget;
+
+ QComboBox* _scenes;
+ QMap _sceneFiles;
+
+ ShortcutWidget _shortcutWidget;
+ SyncWidget _syncWidget;
+
+
+ QNetworkAccessManager _networkManager;
+};
+
+//class MainWindow : public QWidget {
+//Q_OBJECT
+//public:
+// MainWindow();
+// ~MainWindow();
+//
+// std::string nextTarget() const;
+//
+//public slots:
+// void sendScript(QString script);
+//
+//private slots:
+// void onConnect(QString host, QString port);
+// void onDisconnect();
+//
+// void onSocketConnected();
+// void onSocketDisconnected();
+//
+// void readTcpData();
+// void handleStatusMessage(QByteArray data);
+// void handlePlaybook(QByteArray data);
+//
+// void fullyConnected();
+//
+//private:
+// ConfigurationWidget* _configurationWidget;
+// ControlWidget* _timeControlWidget;
+// InformationWidget* _informationWidget;
+// TimelineWidget* _timelineWidget;
+//
+// QTcpSocket* _socket;
+//
+// bool _hasHongKangTimeline = false;
+// bool _hasLabelTimeline = false;
+//};
+
+#endif // __MAINWINDOW_H__
diff --git a/apps/Launcher/shortcutwidget.cpp b/apps/Launcher/shortcutwidget.cpp
new file mode 100644
index 0000000000..899b60c82e
--- /dev/null
+++ b/apps/Launcher/shortcutwidget.cpp
@@ -0,0 +1,29 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 "shortcutwidget.h"
+
+ShortcutWidget::ShortcutWidget(QWidget* parent)
+ : QWidget(parent)
+{}
diff --git a/apps/Launcher/shortcutwidget.h b/apps/Launcher/shortcutwidget.h
new file mode 100644
index 0000000000..5a06a0d388
--- /dev/null
+++ b/apps/Launcher/shortcutwidget.h
@@ -0,0 +1,36 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 __SHORTCUTWIDGET_H__
+#define __SHORTCUTWIDGET_H__
+
+#include
+
+class ShortcutWidget : public QWidget {
+Q_OBJECT
+public:
+ ShortcutWidget(QWidget* parent);
+};
+
+#endif // __SHORTCUTWIDGET_H__
diff --git a/apps/Launcher/syncwidget.cpp b/apps/Launcher/syncwidget.cpp
new file mode 100644
index 0000000000..30babbe899
--- /dev/null
+++ b/apps/Launcher/syncwidget.cpp
@@ -0,0 +1,120 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 "syncwidget.h"
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+namespace {
+}
+
+SyncWidget::SyncWidget(QWidget* parent)
+ : QWidget(parent)
+{
+ setFixedSize(500, 500);
+
+ ghoul::initialize();
+
+}
+
+void SyncWidget::setSceneFile(QString scene) {
+ clear();
+
+ qDebug() << scene;
+
+ ghoul::Dictionary sceneDictionary;
+ ghoul::lua::loadDictionaryFromFile(
+ scene.toStdString(),
+ sceneDictionary
+ );
+
+ ghoul::Dictionary modules;
+ bool success = sceneDictionary.getValue("Modules", modules);
+ qDebug() << success;
+
+ QStringList modulesList;
+ for (int i = 1; i < modules.size(); ++i) {
+ std::string module = modules.value(std::to_string(i));
+ modulesList.append(QString::fromStdString(module));
+ }
+ qDebug() << modulesList;
+
+ QDir sceneDir(scene);
+ sceneDir.cdUp();
+ for (QString module : modulesList) {
+ QString moduleFile = sceneDir.absoluteFilePath(module + "/" + module + ".mod");
+ QString dataFile = sceneDir.absoluteFilePath(module + "/" + module + ".data");
+
+ qDebug() << module;
+ qDebug() << moduleFile << QFileInfo(moduleFile).exists();
+ qDebug() << dataFile << QFileInfo(dataFile).exists();
+
+ if (QFileInfo(dataFile).exists()) {
+ ghoul::Dictionary dataDictionary;
+ ghoul::lua::loadDictionaryFromFile(dataFile.toStdString(), dataDictionary);
+
+ ghoul::Dictionary directFiles;
+ ghoul::Dictionary torrentFiles;
+
+ bool found = dataDictionary.getValue("Files", directFiles);
+ if (found) {
+ QStringList files;
+ for (int i = 1; i < directFiles.size(); ++i) {
+ std::string f = directFiles.value(std::to_string(i));
+ files.append(QString::fromStdString(f));
+ }
+ handleDirectFiles(module, files);
+ }
+
+ found = dataDictionary.getValue("Torrents", torrentFiles);
+ if (found) {
+ QStringList torrents;
+ for (int i = 1; i < torrentFiles.size(); ++i) {
+ std::string f = torrentFiles.value(std::to_string(i));
+ torrents.append(QString::fromStdString(f));
+ }
+ handleTorrentFiles(module, torrents);
+ }
+ }
+ }
+}
+
+void SyncWidget::clear() {
+
+
+}
+
+void SyncWidget::handleDirectFiles(QString module, QStringList files) {
+ qDebug() << files;
+}
+
+void SyncWidget::handleTorrentFiles(QString module, QStringList torrents) {
+ qDebug() << torrents;
+}
diff --git a/apps/Launcher/syncwidget.h b/apps/Launcher/syncwidget.h
new file mode 100644
index 0000000000..ef206914f4
--- /dev/null
+++ b/apps/Launcher/syncwidget.h
@@ -0,0 +1,42 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 __SYNCWIDGET_H__
+#define __SYNCWIDGET_H__
+
+#include
+
+class SyncWidget : public QWidget {
+public:
+ SyncWidget(QWidget* parent);
+
+ void setSceneFile(QString scene);
+
+private:
+ void clear();
+ void handleDirectFiles(QString module, QStringList files);
+ void handleTorrentFiles(QString module, QStringList torrents);
+};
+
+#endif // __SYNCWIDGET_H__
diff --git a/apps/OpenSpace/CMakeLists.txt b/apps/OpenSpace/CMakeLists.txt
new file mode 100644
index 0000000000..a49ee281e8
--- /dev/null
+++ b/apps/OpenSpace/CMakeLists.txt
@@ -0,0 +1,36 @@
+#########################################################################################
+# #
+# OpenSpace #
+# #
+# Copyright (c) 2014-2015 #
+# #
+# 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. #
+#########################################################################################
+
+set(APPLICATION_NAME OpenSpace)
+set(APPLICATION_LINK_TO_OPENSPACE ON)
+
+add_executable(${APPLICATION_NAME} ${OPENSPACE_APPS_DIR}/OpenSpace/main.cpp)
+target_include_directories(${APPLICATION_NAME} PUBLIC ${OPENSPACE_BASE_DIR}/include)
+target_link_libraries(${APPLICATION_NAME} libOpenSpace)
+
+if (MSVC)
+ set_target_properties(${APPLICATION_NAME} PROPERTIES LINK_FLAGS
+ "/NODEFAULTLIB:LIBCMTD.lib /NODEFAULTLIB:LIBCMT.lib"
+ )
+endif ()
diff --git a/src/main.cpp b/apps/OpenSpace/main.cpp
similarity index 81%
rename from src/main.cpp
rename to apps/OpenSpace/main.cpp
index e2340f90e9..0edbe2edc9 100644
--- a/src/main.cpp
+++ b/apps/OpenSpace/main.cpp
@@ -47,6 +47,32 @@ void mainDecodeFun();
void mainExternalControlCallback(const char * receivedChars, int size);
void mainLogCallback(const char* msg);
+std::pair supportedOpenGLVersion () {
+ glfwInit();
+
+ //On OS X we need to explicitly set the version and specify that we are using CORE profile
+ //to be able to use glGetIntegerv(GL_MAJOR_VERSION, &major) and glGetIntegerv(GL_MINOR_VERSION, &minor)
+ //explicitly setting to OGL 3.3 CORE works since all Mac's now support at least 3.3
+#if __APPLE__
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
+ glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
+ glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
+ glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
+#endif
+
+ glfwWindowHint(GLFW_VISIBLE, GL_FALSE);
+ GLFWwindow* offscreen = glfwCreateWindow(128, 128, "", nullptr, nullptr);
+ glfwMakeContextCurrent(offscreen);
+
+ int major, minor;
+ glGetIntegerv(GL_MAJOR_VERSION, &major);
+ glGetIntegerv(GL_MINOR_VERSION, &minor);
+
+ glfwDestroyWindow(offscreen);
+ glfwWindowHint(GLFW_VISIBLE, GL_TRUE);
+ return { major, minor };
+}
+
//temporary post-FX functions, TODO make a more permanent solution to this @JK
void postFXPass();
void setupPostFX();
@@ -60,16 +86,18 @@ namespace {
}
int main(int argc, char** argv) {
+ auto glVersion = supportedOpenGLVersion();
+
// create the OpenSpace engine and get arguments for the sgct engine
std::vector sgctArguments;
- std::string openGlVersion = "";
const bool success = openspace::OpenSpaceEngine::create(
argc, argv,
- sgctArguments,
- openGlVersion
+ sgctArguments
);
if (!success)
return EXIT_FAILURE;
+
+ LINFO("Detected OpenGL version: " << glVersion.first << "." << glVersion.second);
// create sgct engine c arguments
int newArgc = static_cast(sgctArguments.size());
@@ -106,6 +134,8 @@ int main(int argc, char** argv) {
_sgctEngine->setExternalControlCallback(mainExternalControlCallback);
_sgctEngine->setCharCallbackFunction(mainCharCallback);
+ _sgctEngine->setFisheyeClearColor(0.f, 0.f, 0.f);
+
// set encode and decode functions
// NOTE: starts synchronizing before init functions
sgct::SharedData::instance()->setEncodeFunction(mainEncodeFun);
@@ -113,21 +143,20 @@ int main(int argc, char** argv) {
// try to open a window
LDEBUG("Initialize SGCT Engine");
-#ifdef __APPLE__
- sgct::Engine::RunMode rm = sgct::Engine::RunMode::OpenGL_4_1_Core_Profile;
-#else
- std::map versionMapping = {
- { "4.2", sgct::Engine::RunMode::OpenGL_4_2_Core_Profile },
- { "4.3", sgct::Engine::RunMode::OpenGL_4_3_Core_Profile },
- { "4.4", sgct::Engine::RunMode::OpenGL_4_4_Core_Profile },
- { "4.5", sgct::Engine::RunMode::OpenGL_4_5_Core_Profile }
+ std::map, sgct::Engine::RunMode> versionMapping = {
+ { { 3, 3 }, sgct::Engine::RunMode::OpenGL_3_3_Core_Profile },
+ { { 4, 0 }, sgct::Engine::RunMode::OpenGL_4_0_Core_Profile },
+ { { 4, 1 }, sgct::Engine::RunMode::OpenGL_4_1_Core_Profile },
+ { { 4, 2 }, sgct::Engine::RunMode::OpenGL_4_2_Core_Profile },
+ { { 4, 3 }, sgct::Engine::RunMode::OpenGL_4_3_Core_Profile },
+ { { 4, 4 }, sgct::Engine::RunMode::OpenGL_4_4_Core_Profile },
+ { { 4, 5 }, sgct::Engine::RunMode::OpenGL_4_5_Core_Profile }
};
- if (versionMapping.find(openGlVersion) == versionMapping.end()) {
- LFATAL("Requested OpenGL version " << openGlVersion << " not supported");
+ if (versionMapping.find(glVersion) == versionMapping.end()) {
+ LFATAL("Requested OpenGL version " << glVersion.first << "." << glVersion.second << " not supported");
return EXIT_FAILURE;
}
- sgct::Engine::RunMode rm = versionMapping[openGlVersion];
-#endif
+ sgct::Engine::RunMode rm = versionMapping[glVersion];
const bool initSuccess = _sgctEngine->init(rm);
if (!initSuccess) {
LFATAL("Initializing failed");
diff --git a/apps/TimelineView/CMakeLists.txt b/apps/TimelineView/CMakeLists.txt
new file mode 100644
index 0000000000..284192421e
--- /dev/null
+++ b/apps/TimelineView/CMakeLists.txt
@@ -0,0 +1,62 @@
+#########################################################################################
+# #
+# OpenSpace #
+# #
+# Copyright (c) 2014-2015 #
+# #
+# 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. #
+#########################################################################################
+
+set(APPLICATION_NAME TimelineView)
+set(APPLICATION_LINK_TO_OPENSPACE OFF)
+
+set(SOURCE_FILES
+ ${OPENSPACE_APPS_DIR}/TimelineView/main.cpp
+ ${OPENSPACE_APPS_DIR}/TimelineView/mainwindow.cpp
+ ${OPENSPACE_APPS_DIR}/TimelineView/configurationwidget.cpp
+ ${OPENSPACE_APPS_DIR}/TimelineView/informationwidget.cpp
+ ${OPENSPACE_APPS_DIR}/TimelineView/controlwidget.cpp
+ ${OPENSPACE_APPS_DIR}/TimelineView/timelinewidget.cpp
+)
+
+set(HEADER_FILES
+ ${OPENSPACE_APPS_DIR}/TimelineView/mainwindow.h
+ ${OPENSPACE_APPS_DIR}/TimelineView/configurationwidget.h
+ ${OPENSPACE_APPS_DIR}/TimelineView/informationwidget.h
+ ${OPENSPACE_APPS_DIR}/TimelineView/controlwidget.h
+ ${OPENSPACE_APPS_DIR}/TimelineView/timelinewidget.h
+)
+
+find_package(Qt5Widgets)
+find_package(Qt5Network)
+
+qt5_wrap_cpp(MOC_FILES ${HEADER_FILES})
+
+add_executable(${APPLICATION_NAME} MACOSX_BUNDLE ${SOURCE_FILES} ${HEADER_FILES} ${MOC_FILES})
+
+target_link_libraries(${APPLICATION_NAME}
+ Qt5::Widgets
+ Qt5::Network
+)
+
+if (APPLE)
+INSTALL(CODE "
+ include(BundleUtilities)
+ fixup_bundle(\"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/MacOS/TimelineView\" \"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/plugins/platforms/libqcocoa.dylib\" \"\")
+ " COMPONENT Runtime)
+endif ()
diff --git a/gui/timelineview/common.h b/apps/TimelineView/common.h
similarity index 100%
rename from gui/timelineview/common.h
rename to apps/TimelineView/common.h
diff --git a/gui/timelineview/configurationwidget.cpp b/apps/TimelineView/configurationwidget.cpp
similarity index 100%
rename from gui/timelineview/configurationwidget.cpp
rename to apps/TimelineView/configurationwidget.cpp
diff --git a/gui/timelineview/configurationwidget.h b/apps/TimelineView/configurationwidget.h
similarity index 100%
rename from gui/timelineview/configurationwidget.h
rename to apps/TimelineView/configurationwidget.h
diff --git a/gui/timelineview/controlwidget.cpp b/apps/TimelineView/controlwidget.cpp
similarity index 100%
rename from gui/timelineview/controlwidget.cpp
rename to apps/TimelineView/controlwidget.cpp
diff --git a/gui/timelineview/controlwidget.h b/apps/TimelineView/controlwidget.h
similarity index 100%
rename from gui/timelineview/controlwidget.h
rename to apps/TimelineView/controlwidget.h
diff --git a/gui/timelineview/informationwidget.cpp b/apps/TimelineView/informationwidget.cpp
similarity index 100%
rename from gui/timelineview/informationwidget.cpp
rename to apps/TimelineView/informationwidget.cpp
diff --git a/gui/timelineview/informationwidget.h b/apps/TimelineView/informationwidget.h
similarity index 100%
rename from gui/timelineview/informationwidget.h
rename to apps/TimelineView/informationwidget.h
diff --git a/gui/timelineview/main.cpp b/apps/TimelineView/main.cpp
similarity index 97%
rename from gui/timelineview/main.cpp
rename to apps/TimelineView/main.cpp
index f864703957..463578f67e 100644
--- a/gui/timelineview/main.cpp
+++ b/apps/TimelineView/main.cpp
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 *
+ * Copyright (c) 2014-2015 *
* *
* 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 *
@@ -149,8 +149,6 @@ int main(int argc, char** argv) {
app.setStyleSheet(style);
- std::string s = style.toStdString();
-
MainWindow window;
window.show();
diff --git a/gui/timelineview/mainwindow.cpp b/apps/TimelineView/mainwindow.cpp
similarity index 99%
rename from gui/timelineview/mainwindow.cpp
rename to apps/TimelineView/mainwindow.cpp
index 242f916a53..87c030c662 100644
--- a/gui/timelineview/mainwindow.cpp
+++ b/apps/TimelineView/mainwindow.cpp
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 *
+ * Copyright (c) 2014-2015 *
* *
* 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 *
diff --git a/gui/timelineview/mainwindow.h b/apps/TimelineView/mainwindow.h
similarity index 97%
rename from gui/timelineview/mainwindow.h
rename to apps/TimelineView/mainwindow.h
index 23d85fec0b..c998082e39 100644
--- a/gui/timelineview/mainwindow.h
+++ b/apps/TimelineView/mainwindow.h
@@ -2,7 +2,7 @@
* *
* OpenSpace *
* *
- * Copyright (c) 2014 *
+ * Copyright (c) 2014-2015 *
* *
* 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 *
diff --git a/gui/timelineview/timelinewidget.cpp b/apps/TimelineView/timelinewidget.cpp
similarity index 100%
rename from gui/timelineview/timelinewidget.cpp
rename to apps/TimelineView/timelinewidget.cpp
diff --git a/gui/timelineview/timelinewidget.h b/apps/TimelineView/timelinewidget.h
similarity index 100%
rename from gui/timelineview/timelinewidget.h
rename to apps/TimelineView/timelinewidget.h
diff --git a/data b/data
new file mode 160000
index 0000000000..f3928948f2
--- /dev/null
+++ b/data
@@ -0,0 +1 @@
+Subproject commit f3928948f25ac520240a4c7a6ac280b278ddf3b7
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt
deleted file mode 100644
index bcaf2ef502..0000000000
--- a/gui/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-cmake_minimum_required(VERSION 2.8.11)
-
-add_subdirectory(timelineview)
\ No newline at end of file
diff --git a/gui/timelineview/CMakeLists.txt b/gui/timelineview/CMakeLists.txt
deleted file mode 100644
index 241d78d868..0000000000
--- a/gui/timelineview/CMakeLists.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-cmake_minimum_required(VERSION 2.8.11)
-
-project(TimelineView)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-find_package(Qt5Widgets)
-find_package(Qt5Network)
-if (APPLE)
-add_executable(TimelineView MACOSX_BUNDLE main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp)
-else (APPLE)
-add_executable(TimelineView main.cpp mainwindow.cpp configurationwidget.cpp informationwidget.cpp controlwidget.cpp timelinewidget.cpp)
-endif ()
-
-target_link_libraries(TimelineView Qt5::Widgets Qt5::Network)
-
-if (APPLE)
-INSTALL(CODE "
- include(BundleUtilities)
- fixup_bundle(\"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/MacOS/TimelineView\" \"/Users/alex/Development/OpenSpace/bin/openspace/Debug/TimelineView.app/Contents/plugins/platforms/libqcocoa.dylib\" \"\")
- " COMPONENT Runtime)
-endif ()
diff --git a/include/openspace/abuffer/abuffer.h b/include/openspace/abuffer/abuffer.h
index 82d50e37dd..f8e1550a29 100644
--- a/include/openspace/abuffer/abuffer.h
+++ b/include/openspace/abuffer/abuffer.h
@@ -45,7 +45,6 @@ namespace openspace {
class ABuffer {
public:
-
struct fragmentData {
GLfloat _position[3];
GLfloat _color[4];
diff --git a/include/openspace/engine/openspaceengine.h b/include/openspace/engine/openspaceengine.h
index 11f1eee190..08a25948d9 100644
--- a/include/openspace/engine/openspaceengine.h
+++ b/include/openspace/engine/openspaceengine.h
@@ -59,7 +59,7 @@ namespace scripting {
class OpenSpaceEngine {
public:
- static bool create(int argc, char** argv, std::vector& sgctArguments, std::string& openGlVersion);
+ static bool create(int argc, char** argv, std::vector& sgctArguments);
static void destroy();
static OpenSpaceEngine& ref();
diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h
index 8466028514..4056dc2e56 100644
--- a/include/openspace/rendering/renderengine.h
+++ b/include/openspace/rendering/renderengine.h
@@ -51,7 +51,7 @@ public:
RenderEngine();
~RenderEngine();
- bool initialize(const std::string& renderingMethod);
+ bool initialize();
void setSceneGraph(Scene* sceneGraph);
Scene* scene();
diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h
index f1f2e79754..e8aa0e0c52 100644
--- a/include/openspace/scripting/scriptengine.h
+++ b/include/openspace/scripting/scriptengine.h
@@ -92,7 +92,7 @@ private:
lua_State* _state;
std::set _registeredLibraries;
-
+
//sync variables
std::mutex _mutex;
std::vector _queuedScripts;
diff --git a/include/openspace/util/spicemanager.h b/include/openspace/util/spicemanager.h
index c03113dc79..a0d2a1001c 100644
--- a/include/openspace/util/spicemanager.h
+++ b/include/openspace/util/spicemanager.h
@@ -630,6 +630,42 @@ public:
*/
bool getFieldOfView(int instrument, std::string& fovShape, std::string& frameName,
glm::dvec3& boresightVector, std::vector& bounds) const;
+
+ /**
+ This routine computes a set of points on the umbral or penumbral terminator of
+ a specified target body, where SPICE models the target shape as an ellipsoid.
+ \param numberOfPoints - number of points along terminator returned by this method
+ \param terminatorType - is a string indicating the type of terminator to compute:
+ umbral or penumbral. The umbral terminator is the boundary of the portion of the
+ ellipsoid surface in total shadow. The penumbral terminator is the boundary of
+ the portion of the surface that is completely illuminated. Note that in astronomy
+ references, the unqualified word "terminator" refers to the umbral terminator.
+ Here, the unqualified word refers to either type of terminator.
+ \param lightSource - name of body acting as light source
+ \param observer - name of bodserving body
+ \param target - name of target body
+ \param frame - name of the reference frame relative to which the output terminator
+ points are expressed.
+ \param aberrationCorrection - correction for light time and/or stellar aberration
+ \param ephemerisTime - the epoch of participation of the observer
+ \param targetEpoch - is the "target epoch.", time it takes for
+ \param observerPosition - is the vector from the target body at targetEpoch
+ \param terminatorPoints - an array of points on the umbral or penumbral terminator
+ of the ellipsoid, as specified by the input argument `numberOfPoints'
+ For further, more specific details please refer to
+ http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/edterm_c.html
+ */
+ bool getTerminatorEllipse(const int numberOfPoints,
+ const std::string terminatorType,
+ const std::string lightSource,
+ const std::string observer,
+ const std::string target,
+ const std::string frame,
+ const std::string aberrationCorrection,
+ double ephemerisTime,
+ double& targetEpoch,
+ glm::dvec3& observerPosition,
+ std::vector& terminatorPoints);
/**
* This function adds a frame to a body
diff --git a/modules/base/rendering/modelgeometry.cpp b/modules/base/rendering/modelgeometry.cpp
index a390bae9a2..7630c78c30 100644
--- a/modules/base/rendering/modelgeometry.cpp
+++ b/modules/base/rendering/modelgeometry.cpp
@@ -155,7 +155,7 @@ bool ModelGeometry::loadObj(const std::string& filename){
// file for the next run
}
else {
- LINFO("Cache for Model'" << filename << "' not found");
+ LINFO("Cache for Model '" << filename << "' not found");
}
LINFO("Loading Model file '" << filename << "'");
bool success = loadModel(filename);
diff --git a/modules/base/rendering/renderablepath.cpp b/modules/base/rendering/renderablepath.cpp
index 4321bcccf5..9ccdf8622b 100644
--- a/modules/base/rendering/renderablepath.cpp
+++ b/modules/base/rendering/renderablepath.cpp
@@ -212,7 +212,7 @@ void RenderablePath::calculatePath(std::string observer) {
return;
double lightTime;
- bool correctPosition = true;
+// bool correctPosition = true;
psc pscPos;
double currentTime = _start;
@@ -222,7 +222,7 @@ void RenderablePath::calculatePath(std::string observer) {
//float g = _lineColor[1];
//float b = _lineColor[2];
for (int i = 0; i < segments; i++) {
- correctPosition = SpiceManager::ref().getTargetPosition(_target, observer, _frame, "NONE", currentTime, pscPos, lightTime);
+ SpiceManager::ref().getTargetPosition(_target, observer, _frame, "NONE", currentTime, pscPos, lightTime);
pscPos[3] += 3;
//if (!correctPosition) {
diff --git a/modules/base/rendering/renderableplane.cpp b/modules/base/rendering/renderableplane.cpp
index 4bb27bf458..ef7108646b 100644
--- a/modules/base/rendering/renderableplane.cpp
+++ b/modules/base/rendering/renderableplane.cpp
@@ -28,6 +28,10 @@
#include
#include
+#include
+#include
+#include
+
#include
#include
#include
@@ -51,6 +55,7 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
: Renderable(dictionary)
, _texturePath("texture", "Texture")
, _billboard("billboard", "Billboard", false)
+ , _projectionListener("projectionListener", "DisplayProjections", false)
, _size("size", "Size", glm::vec2(1,1), glm::vec2(0.f), glm::vec2(1.f, 25.f))
, _origin(Origin::Center)
, _shader(nullptr)
@@ -63,6 +68,10 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
dictionary.getValue("Size", size);
_size = size;
+ if (dictionary.hasKey("Name")){
+ dictionary.getValue("Name", _nodeName);
+ }
+
std::string origin;
if (dictionary.getValue("Origin", origin)) {
if (origin == "LowerLeft") {
@@ -87,6 +96,13 @@ RenderablePlane::RenderablePlane(const ghoul::Dictionary& dictionary)
if (dictionary.getValue("Billboard", billboard)) {
_billboard = billboard;
}
+ if (dictionary.hasKey("ProjectionListener")){
+ bool projectionListener = false;
+ if (dictionary.getValue("ProjectionListener", projectionListener)) {
+ _projectionListener = projectionListener;
+ }
+ }
+
std::string texturePath = "";
bool success = dictionary.getValue("Texture", texturePath);
@@ -147,8 +163,12 @@ bool RenderablePlane::deinitialize() {
glDeleteBuffers(1, &_vertexPositionBuffer);
_vertexPositionBuffer = 0;
- delete _texture;
- _texture = nullptr;
+ if (!_projectionListener){
+ // its parents job to kill texture
+ // iff projectionlistener
+ delete _texture;
+ _texture = nullptr;
+ }
delete _textureFile;
_textureFile = nullptr;
@@ -166,6 +186,18 @@ void RenderablePlane::render(const RenderData& data) {
// Activate shader
_shader->activate();
+ if (_projectionListener){
+ //get parent node-texture and set with correct dimensions
+ SceneGraphNode* textureNode = OsEng.renderEngine()->scene()->sceneGraphNode(_nodeName)->parent();
+ if (textureNode != nullptr){
+ RenderablePlanetProjection *t = static_cast(textureNode->renderable());
+ _texture = t->baseTexture();
+ float h = _texture->height();
+ float w = _texture->width();
+ float scale = h / w;
+ transform = glm::scale(transform, glm::vec3(1.f, scale, 1.f));
+ }
+ }
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
_shader->setUniform("ModelTransform", transform);
diff --git a/modules/base/rendering/renderableplane.h b/modules/base/rendering/renderableplane.h
index 60effc4c5e..e4301cd7f0 100644
--- a/modules/base/rendering/renderableplane.h
+++ b/modules/base/rendering/renderableplane.h
@@ -68,9 +68,11 @@ private:
properties::StringProperty _texturePath;
properties::BoolProperty _billboard;
+ properties::BoolProperty _projectionListener;
properties::Vec2Property _size;
Origin _origin;
+ std::string _nodeName;
bool _planeIsDirty;
diff --git a/modules/newhorizons/CMakeLists.txt b/modules/newhorizons/CMakeLists.txt
index d25a88fd44..fa6a7a06b4 100644
--- a/modules/newhorizons/CMakeLists.txt
+++ b/modules/newhorizons/CMakeLists.txt
@@ -30,6 +30,7 @@ set(HEADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefov.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneprojection.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanetprojection.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableshadowcylinder.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometryprojection.h
${CMAKE_CURRENT_SOURCE_DIR}/rendering/writeToTexture.h
${CMAKE_CURRENT_SOURCE_DIR}/util/decoder.h
@@ -50,6 +51,7 @@ set(SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablefov.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplaneprojection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableplanetprojection.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableshadowcylinder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometryprojection.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/decoder.cpp
${CMAKE_CURRENT_SOURCE_DIR}/util/hongkangparser.cpp
@@ -70,6 +72,8 @@ set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/fov_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/projectiveTexture_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/projectiveTexture_vs.glsl
+ ${CMAKE_CURRENT_SOURCE_DIR}/shaders/terminatorshadow_fs.glsl
+ ${CMAKE_CURRENT_SOURCE_DIR}/shaders/terminatorshadow_vs.glsl
)
source_group("Shader Files" FILES ${SHADER_FILES})
diff --git a/modules/newhorizons/newhorizonsmodule.cpp b/modules/newhorizons/newhorizonsmodule.cpp
index 4ec0ff04d6..8a1570fcf2 100644
--- a/modules/newhorizons/newhorizonsmodule.cpp
+++ b/modules/newhorizons/newhorizonsmodule.cpp
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
#include
#include
@@ -63,6 +64,7 @@ bool NewHorizonsModule::initialize() {
auto fRenderable = FactoryManager::ref().factory();
ghoul_assert(fRenderable, "No renderable factory existed");
+ fRenderable->registerClass("RenderableShadowCylinder");
fRenderable->registerClass("RenderableCrawlingLine");
fRenderable->registerClass("RenderableFov");
fRenderable->registerClass("RenderablePlaneProjection");
diff --git a/modules/newhorizons/rendering/renderablefov.cpp b/modules/newhorizons/rendering/renderablefov.cpp
index 43e8a941a4..bc5f378de9 100644
--- a/modules/newhorizons/rendering/renderablefov.cpp
+++ b/modules/newhorizons/rendering/renderablefov.cpp
@@ -531,12 +531,12 @@ void RenderableFov::render(const RenderData& data) {
psc position;
double lt;
SpiceManager::ref().getTargetPosition(_fovTarget,
- _spacecraft,
- _frame,
- _aberrationCorrection,
- _time,
- position,
- lt);
+ _spacecraft,
+ _frame,
+ _aberrationCorrection,
+ _time,
+ position,
+ lt);
//if aimed 80 deg away from target, dont draw white square
if (glm::dot(glm::normalize(aim), glm::normalize(position.vec3())) < 0.2){
diff --git a/modules/newhorizons/rendering/renderableplanetprojection.h b/modules/newhorizons/rendering/renderableplanetprojection.h
index 01c8971fb3..de9a15d541 100644
--- a/modules/newhorizons/rendering/renderableplanetprojection.h
+++ b/modules/newhorizons/rendering/renderableplanetprojection.h
@@ -67,6 +67,7 @@ public:
void render(const RenderData& data) override;
void update(const UpdateData& data) override;
+ ghoul::opengl::Texture* baseTexture() { return _texture; };
protected:
@@ -91,7 +92,6 @@ private:
properties::BoolProperty _performProjection;
properties::BoolProperty _clearAllProjections;
-
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::ProgramObject* _fboProgramObject;
diff --git a/modules/newhorizons/rendering/renderableshadowcylinder.cpp b/modules/newhorizons/rendering/renderableshadowcylinder.cpp
new file mode 100644
index 0000000000..e0cda86132
--- /dev/null
+++ b/modules/newhorizons/rendering/renderableshadowcylinder.cpp
@@ -0,0 +1,202 @@
+/*****************************************************************************************
+* *
+* OpenSpace *
+* *
+* Copyright (c) 2014-2015 *
+* *
+* 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
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+
+
+namespace {
+ const std::string _loggerCat = "RenderablePlane";
+ const std::string _keyType = "TerminatorType";
+ const std::string _keyLightSource = "LightSource";
+ const std::string _keyObserver = "Observer";
+ const std::string _keyBody = "Body";
+ const std::string _keyBodyFrame = "BodyFrame";
+ const std::string _keyMainFrame = "MainFrame";
+ const std::string _keyAberration = "Aberration";
+}
+
+namespace openspace {
+ RenderableShadowCylinder::RenderableShadowCylinder(const ghoul::Dictionary& dictionary)
+ : Renderable(dictionary)
+ , _numberOfPoints("amountOfPoints", "Points", 190, 1, 300)
+ , _shadowLength("shadowLength", "Shadow Length", 0.1, 0.0, 0.5)
+ , _shader(nullptr)
+ , _vao(0)
+ , _vbo(0)
+{
+ addProperty(_numberOfPoints);
+ addProperty(_shadowLength);
+
+ bool success = dictionary.getValue(_keyType, _terminatorType);
+ ghoul_assert(success, "");
+ success = dictionary.getValue(_keyLightSource, _lightSource);
+ ghoul_assert(success, "");
+ success = dictionary.getValue(_keyObserver, _observer);
+ ghoul_assert(success, "");
+ success = dictionary.getValue(_keyBody, _body);
+ ghoul_assert(success, "");
+ success = dictionary.getValue(_keyBodyFrame, _bodyFrame);
+ ghoul_assert(success, "");
+ success = dictionary.getValue(_keyMainFrame, _mainFrame);
+ ghoul_assert(success, "");
+ success = dictionary.getValue(_keyAberration, _aberration);
+ ghoul_assert(success, "");
+}
+
+RenderableShadowCylinder::~RenderableShadowCylinder() {
+}
+
+bool RenderableShadowCylinder::isReady() const {
+ bool ready = true;
+ if (!_shader)
+ ready &= false;
+ return ready;
+}
+
+bool RenderableShadowCylinder::initialize() {
+ glGenVertexArrays(1, &_vao); // generate array
+ glGenBuffers(1, &_vbo); // generate buffer
+ createCylinder();
+
+ bool completeSuccess = true;
+ _shader = ghoul::opengl::ProgramObject::Build("ShadowProgram",
+ "${MODULE_NEWHORIZONS}/shaders/terminatorshadow_vs.glsl",
+ "${MODULE_NEWHORIZONS}/shaders/terminatorshadow_fs.glsl");
+ if (!_shader)
+ return false;
+ return completeSuccess;
+}
+
+bool RenderableShadowCylinder::deinitialize() {
+ glDeleteVertexArrays(1, &_vao);
+ _vao = 0;
+ glDeleteBuffers(1, &_vbo);
+ _vbo = 0;
+ delete _shader;
+ _shader = nullptr;
+ return true;
+}
+
+void RenderableShadowCylinder::render(const RenderData& data){
+ glm::mat4 _transform = glm::mat4(1.0);
+ for (int i = 0; i < 3; i++){
+ for (int j = 0; j < 3; j++){
+ _transform[i][j] = static_cast(_stateMatrix[i][j]);
+ }
+ }
+ // Activate shader
+ _shader->activate();
+
+ _shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
+ _shader->setUniform("ModelTransform", _transform);
+ setPscUniforms(_shader, &data.camera, data.position);
+
+ glBindVertexArray(_vao);
+ glDrawArrays(GL_TRIANGLE_STRIP, 0, static_cast(_vertices.size()));
+ glBindVertexArray(0);
+
+ _shader->deactivate();
+}
+
+void RenderableShadowCylinder::update(const UpdateData& data) {
+ openspace::SpiceManager::ref().getPositionTransformMatrix(_bodyFrame, _mainFrame, data.time, _stateMatrix);
+ _time = data.time;
+ if (_shader->isDirty())
+ _shader->rebuildFromFile();
+ createCylinder();
+}
+
+glm::vec4 psc_addition(glm::vec4 v1, glm::vec4 v2) {
+ float k = 10.f;
+ float ds = v2.w - v1.w;
+ if (ds >= 0) {
+ float p = pow(k, -ds);
+ return glm::vec4(v1.x*p + v2.x, v1.y*p + v2.y, v1.z*p + v2.z, v2.w);
+ }
+ else {
+ float p = pow(k, ds);
+ return glm::vec4(v1.x + v2.x*p, v1.y + v2.y*p, v1.z + v2.z*p, v1.w);
+ }
+}
+
+void RenderableShadowCylinder::createCylinder() {
+ double targetEpoch;
+ glm::dvec3 observerPosition;
+ std::vector terminatorPoints;
+ SpiceManager::ref().getTerminatorEllipse(_numberOfPoints,
+ _terminatorType,
+ _lightSource,
+ _observer,
+ _body,
+ _bodyFrame,
+ _aberration,
+ _time,
+ targetEpoch,
+ observerPosition,
+ terminatorPoints);
+
+ glm::dvec3 vecLightSource;
+ double lt;
+ bool performs = SpiceManager::ref().getTargetPosition(_body, _lightSource, _mainFrame, _aberration, _time, vecLightSource, lt);
+
+ glm::dmat3 _stateMatrix;
+ openspace::SpiceManager::ref().getPositionTransformMatrix(_bodyFrame, _mainFrame, _time, _stateMatrix);
+
+ _stateMatrix = glm::inverse(_stateMatrix);
+ vecLightSource = _stateMatrix * vecLightSource;
+
+ vecLightSource *= _shadowLength;
+ _vertices.clear();
+
+ psc endpoint = psc::CreatePowerScaledCoordinate(vecLightSource.x, vecLightSource.y, vecLightSource.z);
+ for (auto v : terminatorPoints){
+ _vertices.push_back(CylinderVBOLayout(v[0], v[1], v[2], v[3]));
+ glm::vec4 f = psc_addition(v.vec4(), endpoint.vec4());
+ _vertices.push_back(CylinderVBOLayout(f[0], f[1], f[2], f[3]));
+ }
+ _vertices.push_back(_vertices[0]);
+ _vertices.push_back(_vertices[1]);
+
+ glBindVertexArray(_vao); // bind array
+ glBindBuffer(GL_ARRAY_BUFFER, _vbo); // bind buffer
+ glBufferData(GL_ARRAY_BUFFER, _vertices.size() * sizeof(CylinderVBOLayout), NULL, GL_DYNAMIC_DRAW); // orphaning the buffer, sending NULL data.
+ glBufferSubData(GL_ARRAY_BUFFER, 0, _vertices.size() * sizeof(CylinderVBOLayout), &_vertices[0]);
+
+ glEnableVertexAttribArray(0);
+ glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
+ glBindVertexArray(0);
+}
+
+} // namespace openspace
diff --git a/modules/newhorizons/rendering/renderableshadowcylinder.h b/modules/newhorizons/rendering/renderableshadowcylinder.h
new file mode 100644
index 0000000000..b5caac7f9f
--- /dev/null
+++ b/modules/newhorizons/rendering/renderableshadowcylinder.h
@@ -0,0 +1,97 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014-2015 *
+ * *
+ * 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 RENDERABLESHADOWCYLINDER_H_
+#define RENDERABLESHADOWCYLINDER_H_
+
+#include
+
+#include
+#include
+#include
+
+namespace ghoul {
+ namespace filesystem {
+ class File;
+ }
+ namespace opengl {
+ class ProgramObject;
+ class Texture;
+ }
+}
+
+namespace openspace {
+ struct LinePoint;
+ class RenderableShadowCylinder : public Renderable {
+
+ public:
+ RenderableShadowCylinder(const ghoul::Dictionary& dictionary);
+ ~RenderableShadowCylinder();
+
+ bool initialize() override;
+ bool deinitialize() override;
+
+ bool isReady() const override;
+
+ void render(const RenderData& data) override;
+ void update(const UpdateData& data) override;
+
+ private:
+ struct CylinderVBOLayout {
+ CylinderVBOLayout(double a1, double a2, double a3, double a4){
+ x = a1;
+ y = a2;
+ z = a3;
+ e = a4;
+ }
+ float x, y, z, e;
+ };
+
+ void createCylinder();
+ properties::IntProperty _numberOfPoints;
+ properties::FloatProperty _shadowLength;
+
+ ghoul::opengl::ProgramObject* _shader;
+
+ glm::dmat3 _stateMatrix;
+
+ GLuint _vao;
+ GLuint _vbo;
+
+ std::vector _vertices;
+
+ std::string _terminatorType;
+ std::string _lightSource;
+ std::string _observer;
+ std::string _body;
+ std::string _bodyFrame;
+ std::string _mainFrame;
+ std::string _aberration;
+
+ double _time;
+ };
+
+} // namespace openspace
+#endif // RENDERABLESHADOWCYLINDER_H_
+
diff --git a/modules/newhorizons/shaders/terminatorshadow_fs.glsl b/modules/newhorizons/shaders/terminatorshadow_fs.glsl
new file mode 100644
index 0000000000..6fcfc4d90c
--- /dev/null
+++ b/modules/newhorizons/shaders/terminatorshadow_fs.glsl
@@ -0,0 +1,47 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014 *
+ * *
+ * 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. *
+ ****************************************************************************************/
+
+#version __CONTEXT__
+
+in vec4 vs_point_position;
+in vec4 vs_point_velocity;
+//in float fade;
+//uniform float forceFade;
+
+uniform vec3 color;
+
+in vec4 vs_color;
+
+#include "ABuffer/abufferStruct.hglsl"
+#include "ABuffer/abufferAddToBuffer.hglsl"
+#include "PowerScaling/powerScaling_fs.hglsl"
+
+void main() {
+ vec4 position = vs_point_position;
+ float depth = pscDepth(position);
+
+ vec4 c = vs_color;
+ ABufferStruct_t frag = createGeometryFragment(c, position, depth);
+ addToBuffer(frag);
+}
\ No newline at end of file
diff --git a/modules/newhorizons/shaders/terminatorshadow_vs.glsl b/modules/newhorizons/shaders/terminatorshadow_vs.glsl
new file mode 100644
index 0000000000..7f5398e74f
--- /dev/null
+++ b/modules/newhorizons/shaders/terminatorshadow_vs.glsl
@@ -0,0 +1,60 @@
+/*****************************************************************************************
+ * *
+ * OpenSpace *
+ * *
+ * Copyright (c) 2014 *
+ * *
+ * 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. *
+ ****************************************************************************************/
+
+#version __CONTEXT__
+
+uniform mat4 ViewProjection;
+uniform mat4 ModelTransform;
+uniform vec4 objectVelocity;
+
+
+
+layout(location = 0) in vec4 in_point_position;
+
+out vec4 vs_point_position;
+out vec4 vs_color;
+//out float fade;
+
+uniform uint nVertices;
+//uniform float lineFade;
+
+#include "PowerScaling/powerScaling_vs.hglsl"
+
+void main() {
+ //float id = float(gl_VertexID) / float(nVertices * lineFade);
+ //fade = 1.0 - id;
+
+ if(mod(gl_VertexID,2) == 0.f){
+ vs_color = vec4(1,1,1,0.5);
+ }else{
+ vs_color = vec4(0);
+ }
+
+ vec4 tmp = in_point_position;
+ //tmp = psc_to_meter(tmp, vec2(1,0.f));
+ vec4 position = pscTransform(tmp, ModelTransform);
+ vs_point_position = tmp;
+ position = ViewProjection * position;
+ gl_Position = z_normalization(position);
+}
\ No newline at end of file
diff --git a/openspace-data b/openspace-data
deleted file mode 160000
index 54af421ff5..0000000000
--- a/openspace-data
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 54af421ff583392c559748983251da6521c73c8a
diff --git a/openspace.cfg b/openspace.cfg
index d9325aa65b..bd72416a0c 100644
--- a/openspace.cfg
+++ b/openspace.cfg
@@ -14,7 +14,7 @@ return {
SCRIPTS = "${BASE_PATH}/scripts",
SHADERS = "${BASE_PATH}/shaders",
SHADERS_GENERATED = "${SHADERS}/generated",
- OPENSPACE_DATA = "${BASE_PATH}/openspace-data",
+ OPENSPACE_DATA = "${BASE_PATH}/data",
MODULES = "${BASE_PATH}/modules",
TESTDIR = "${BASE_PATH}/tests",
CONFIG = "${BASE_PATH}/config",
@@ -54,6 +54,4 @@ return {
File = "${BASE_PATH}/Properties.txt"
},
DownloadRequestURL = "http://openspace.itn.liu.se/request.cgi",
- RenderingMethod = "ABufferSingleLinked" -- On Windows and Unix
- -- RenderingMethod = "ABufferFrameBuffer" -- On Mac due to OpenGL 4.1 restrictions
}
\ No newline at end of file
diff --git a/scripts/bind_keys.lua b/scripts/bind_keys.lua
index 2c7e85b413..63a4b18286 100644
--- a/scripts/bind_keys.lua
+++ b/scripts/bind_keys.lua
@@ -53,6 +53,8 @@ openspace.bindKey("6", "openspace.time.setTime('2015-07-14T12:04:35.00'); opensp
openspace.bindKey("7", "openspace.time.setTime('2015-07-14T15:02:46.00'); openspace.time.setDeltaTime(100)")
]]--
+openspace.bindKey("i", "local b = openspace.getPropertyValue('PlutoTexture.renderable.enabled'); openspace.setPropertyValue('PlutoTexture.renderable.enabled', not b)")
+
openspace.bindKey("q", "local b = openspace.getPropertyValue('SunMarker.renderable.enabled'); openspace.setPropertyValue('SunMarker.renderable.enabled', not b)")
openspace.bindKey("e", "local b = openspace.getPropertyValue('EarthMarker.renderable.enabled'); openspace.setPropertyValue('EarthMarker.renderable.enabled', not b)")
diff --git a/scripts/default_settings.lua b/scripts/default_settings.lua
index 38a6dcc523..0f3f2ffcb1 100644
--- a/scripts/default_settings.lua
+++ b/scripts/default_settings.lua
@@ -8,6 +8,7 @@ openspace.setPropertyValue("SunMarker.renderable.enabled", true)
openspace.setPropertyValue("EarthMarker.renderable.enabled", true)
openspace.setPropertyValue("Constellation Bounds.renderable.enabled", false)
openspace.setPropertyValue("PlutoTrail.renderable.enabled", false)
+openspace.setPropertyValue("PlutoTexture.renderable.enabled", false)
openspace.setPropertyValue("MilkyWay.renderable.transparency", 0.75)
openspace.setPropertyValue("MilkyWay.renderable.segments", 50)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e63c0e4361..20f9e3b0b8 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -84,10 +84,6 @@ set(OPENSPACE_SOURCE
${OPENSPACE_BASE_DIR}/src/util/time_lua.inl
)
-set(OPENSPACE_MAIN
- ${OPENSPACE_BASE_DIR}/src/main.cpp
-)
-
set(OPENSPACE_HEADER
${OPENSPACE_BASE_DIR}/include/openspace/abuffer/abuffer.h
${OPENSPACE_BASE_DIR}/include/openspace/abuffer/abufferdynamic.h
diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp
index 14f7c8d481..37abd2ac32 100644
--- a/src/engine/openspaceengine.cpp
+++ b/src/engine/openspaceengine.cpp
@@ -86,18 +86,11 @@ namespace {
const std::string _sgctConfigArgumentCommand = "-config";
- const std::string KeyRenderingMethod = "RenderingMethod";
- const std::string DefaultRenderingMethod = "ABufferSingleLinked";
- const std::string KeyDownloadRequestURL = "DownloadRequestURL";
-
- const std::string DefaultOpenGlVersion = "4.3";
-
const int CacheVersion = 1;
struct {
std::string configurationName;
std::string sgctConfigurationName;
- std::string openGlVersion;
} commandlineArgumentPlaceholders;
}
@@ -149,8 +142,7 @@ OpenSpaceEngine& OpenSpaceEngine::ref() {
bool OpenSpaceEngine::create(
int argc, char** argv,
- std::vector& sgctArguments,
- std::string& openGlVersion)
+ std::vector& sgctArguments)
{
ghoul::initialize();
@@ -165,7 +157,6 @@ bool OpenSpaceEngine::create(
LogMgr.addLog(new ConsoleLog);
LDEBUG("Initialize FileSystem");
- ghoul::filesystem::FileSystem::initialize();
#ifdef __APPLE__
ghoul::filesystem::File app(argv[0]);
@@ -261,10 +252,6 @@ bool OpenSpaceEngine::create(
sgctConfigurationPath = commandlineArgumentPlaceholders.sgctConfigurationName;
}
- openGlVersion = commandlineArgumentPlaceholders.openGlVersion;
- if (openGlVersion != DefaultOpenGlVersion)
- LINFO("Using OpenGL version " << openGlVersion);
-
// Prepend the outgoing sgctArguments with the program name
// as well as the configuration file that sgct is supposed to use
sgctArguments.insert(sgctArguments.begin(), argv[0]);
@@ -301,7 +288,7 @@ bool OpenSpaceEngine::initialize() {
SysCap.addComponent(new ghoul::systemcapabilities::OpenGLCapabilitiesComponent);
SysCap.detectCapabilities();
SysCap.logCapabilities();
-
+
std::string requestURL = "";
bool success = configurationManager()->getValue(KeyDownloadRequestURL, requestURL);
if (success)
@@ -348,10 +335,11 @@ bool OpenSpaceEngine::initialize() {
_renderEngine->setSceneGraph(sceneGraph);
// initialize the RenderEngine
- if (_configurationManager->hasKeyAndValue(KeyRenderingMethod))
- _renderEngine->initialize(_configurationManager->value(KeyRenderingMethod));
- else
- _renderEngine->initialize(DefaultRenderingMethod);
+ _renderEngine->initialize();
+ // if (_configurationManager->hasKeyAndValue(KeyRenderingMethod))
+ // _renderEngine->initialize(_configurationManager->value(KeyRenderingMethod));
+ // else
+ // _renderEngine->initialize(DefaultRenderingMethod);
sceneGraph->initialize();
@@ -410,13 +398,6 @@ bool OpenSpaceEngine::gatherCommandlineArguments() {
"the OpenSpace configuration file");
_commandlineParser->addCommand(sgctConfigFileCommand);
- commandlineArgumentPlaceholders.openGlVersion = DefaultOpenGlVersion;
- CommandlineCommand* openGlVersionCommand = new SingleCommand(
- &commandlineArgumentPlaceholders.openGlVersion,
- "-ogl", "-o",
- "Sets the OpenGL version that is to be used; valid values are '4.2' and '4.3'");
- _commandlineParser->addCommand(openGlVersionCommand);
-
return true;
}
@@ -510,7 +491,6 @@ void OpenSpaceEngine::runSettingsScripts() {
runScripts(scripts);
}
-
void OpenSpaceEngine::loadFonts() {
sgct_text::FontManager::FontPath local = sgct_text::FontManager::FontPath::FontPath_Local;
diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp
index 60bcc157c4..d915d3d1bb 100644
--- a/src/rendering/renderengine.cpp
+++ b/src/rendering/renderengine.cpp
@@ -47,6 +47,9 @@
#include
#include
#include
+#include
+#include
+#include
#include
#ifdef GHOUL_USE_DEVIL
@@ -76,6 +79,9 @@
namespace {
const std::string _loggerCat = "RenderEngine";
+ const std::string KeyRenderingMethod = "RenderingMethod";
+ const std::string DefaultRenderingMethod = "ABufferSingleLinked";
+
const std::map RenderingMethods = {
{ "ABufferFrameBuffer", ABUFFER_FRAMEBUFFER},
{ "ABufferSingleLinked", ABUFFER_SINGLE_LINKED },
@@ -130,7 +136,23 @@ RenderEngine::~RenderEngine() {
ghoul::SharedMemory::remove(PerformanceMeasurementSharedData);
}
-bool RenderEngine::initialize(const std::string& renderingMethod) {
+bool RenderEngine::initialize() {
+ std::string renderingMethod = DefaultRenderingMethod;
+
+ // If the user specified a rendering method that he would like to use, use that
+ if (OsEng.configurationManager()->hasKeyAndValue(KeyRenderingMethod))
+ renderingMethod = OsEng.configurationManager()->value(KeyRenderingMethod);
+ else {
+ using Version = ghoul::systemcapabilities::OpenGLCapabilitiesComponent::Version;
+
+ // The default rendering method has a requirement of OpenGL 4.3, so if we are
+ // below that, we will fall back to frame buffer operation
+ if (OpenGLCap.openGLVersion() < Version(4,3)) {
+ LINFO("Falling back to framebuffer implementation due to OpenGL limitations");
+ renderingMethod = "ABufferFrameBuffer";
+ }
+ }
+
auto it = RenderingMethods.find(renderingMethod);
if (it == RenderingMethods.end()) {
LFATAL("Rendering method '" << renderingMethod << "' not among the available "
@@ -308,7 +330,8 @@ void RenderEngine::postSynchronizationPreDraw() {
}
// converts the quaternion used to rotation matrices
- _mainCamera->compileViewRotationMatrix();
+ if (_mainCamera)
+ _mainCamera->compileViewRotationMatrix();
// update and evaluate the scene starting from the root node
_sceneGraph->update({
diff --git a/src/util/spicemanager.cpp b/src/util/spicemanager.cpp
index 1e5219021c..896b249610 100644
--- a/src/util/spicemanager.cpp
+++ b/src/util/spicemanager.cpp
@@ -316,9 +316,9 @@ bool SpiceManager::getNaifId(const std::string& body, int& id) const {
}
else {
SpiceBoolean success;
- SpiceInt sid = id;
- bods2c_c(body.c_str(), &sid, &success);
- id = sid;
+// SpiceInt sid = id;
+ bods2c_c(body.c_str(), &id, &success);
+// id = sid;
if (success == SPICEFALSE)
LERROR("Could not find NAIF ID of body '" + body + "'");
return (success == SPICETRUE);
@@ -331,9 +331,7 @@ bool SpiceManager::getFrameId(const std::string& frame, int& id) const {
return false;
}
else {
- SpiceInt sid = id;
- namfrm_c(frame.c_str(), &sid);
- id = sid;
+ namfrm_c(frame.c_str(), &id);
bool hasError = SpiceManager::checkForError("Error getting id for frame '" + frame + "'");
return !hasError;
}
@@ -403,7 +401,7 @@ bool SpiceManager::getValue(const std::string& body, const std::string& value,
}
bool SpiceManager::spacecraftClockToET(const std::string& craftIdCode, double& craftTicks, double& et){
- int craftID;
+ int craftID = -1;
getNaifId(craftIdCode, craftID);
sct2e_c(craftID, craftTicks, &et);
bool hasError = checkForError("Error transforming spacecraft clock of '" + craftIdCode + "' at time " + std::to_string(craftTicks));
@@ -957,6 +955,45 @@ bool SpiceManager::getFieldOfView(int instrument,
return true;
}
+bool SpiceManager::getTerminatorEllipse(const int numberOfPoints,
+ const std::string terminatorType,
+ const std::string lightSource,
+ const std::string observer,
+ const std::string target,
+ const std::string frame,
+ const std::string aberrationCorrection,
+ double ephemerisTime,
+ double& targetEpoch,
+ glm::dvec3& observerPosition,
+ std::vector& terminatorPoints){
+
+ double(*tpoints)[3] = new double[numberOfPoints][3];
+
+ edterm_c(terminatorType.c_str(),
+ lightSource.c_str(),
+ target.c_str(),
+ ephemerisTime,
+ frame.c_str(),
+ aberrationCorrection.c_str(),
+ observer.c_str(),
+ numberOfPoints,
+ &targetEpoch,
+ glm::value_ptr(observerPosition),
+ (double(*)[3])tpoints );
+
+ bool hasError = checkForError("Error getting " + terminatorType +
+ "terminator for'" + target + "'");
+ if (hasError)
+ return false;
+
+ for (int i = 0; i < numberOfPoints; i++){
+ psc point = psc::CreatePowerScaledCoordinate(tpoints[i][0], tpoints[i][1], tpoints[i][2]);
+ point[3] += 3;
+ terminatorPoints.push_back(point);
+ }
+
+ return true;
+}
std::string SpiceManager::frameFromBody(const std::string body) const {
@@ -1010,8 +1047,8 @@ bool SpiceManager::checkForError(std::string errorMessage) {
bool SpiceManager::getPlanetEllipsoid(std::string planetName, float &a, float &b, float &c) {
SpiceDouble radii[3];
- SpiceInt n;
- int id;
+ SpiceInt n = -1;
+ int id = -1;
getNaifId(planetName, id);
if (bodfnd_c(id, "RADII")) {
diff --git a/support/cmake/module_definition.cmake b/support/cmake/module_definition.cmake
index 59b381864f..ee16a9e8dd 100644
--- a/support/cmake/module_definition.cmake
+++ b/support/cmake/module_definition.cmake
@@ -189,8 +189,11 @@ endfunction ()
function (write_module_name module_name)
string(TOLOWER ${module_name} module_name_lower)
+ set(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${module_name_lower}module.h)
+ string(REPLACE "${OPENSPACE_BASE_DIR}/" "" MODULE_PATH ${MODULE_PATH})
+
file(WRITE ${CMAKE_BINARY_DIR}/modules/${module_name_lower}/modulename.cmake
"set(MODULE_NAME ${module_name}Module)\n"
- "set(MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${module_name_lower}module.h)"
+ "set(MODULE_PATH ${MODULE_PATH})"
)
endfunction ()
diff --git a/support/cmake/module_registration.template b/support/cmake/module_registration.template
index 58d73f69a7..5349553d0b 100644
--- a/support/cmake/module_registration.template
+++ b/support/cmake/module_registration.template
@@ -6,12 +6,10 @@
#define __MODULE_REGISTRATION_H__
@MODULE_HEADERS@
-
namespace openspace {
std::vector AllModules = {
-@MODULE_CLASSES@
-};
+@MODULE_CLASSES@};
} // namespace openspace
diff --git a/support/cmake/support_macros.cmake b/support/cmake/support_macros.cmake
index e1f986226f..3813976a8b 100644
--- a/support/cmake/support_macros.cmake
+++ b/support/cmake/support_macros.cmake
@@ -64,59 +64,51 @@ endfunction ()
-function (create_openspace_targets)
+function (create_openspace_target)
add_library(libOpenSpace STATIC ${OPENSPACE_HEADER} ${OPENSPACE_SOURCE})
target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_BASE_DIR}/include)
target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_BASE_DIR})
target_include_directories(libOpenSpace PUBLIC ${CMAKE_BINARY_DIR}/_generated/include)
- add_executable(OpenSpace ${OPENSPACE_MAIN})
- target_include_directories(OpenSpace PUBLIC ${OPENSPACE_BASE_DIR}/include)
- target_link_libraries(OpenSpace libOpenSpace)
+ set_compile_settings(libOpenSpace)
endfunction ()
-function (set_compile_settings)
+function (set_compile_settings project)
if (MSVC)
- target_compile_options(libOpenSpace PUBLIC "/MP" "/wd4201" "/wd4127")
+ target_compile_options(${project} PUBLIC "/MP" "/wd4201" "/wd4127")
if (OPENSPACE_WARNINGS_AS_ERRORS)
- target_compile_options(libOpenSpace PUBLIC "/WX")
- target_compile_options(OpenSpace PUBLIC "/WX")
+ target_compile_options(${project} PUBLIC "/WX")
endif ()
-
- set_target_properties(OpenSpace PROPERTIES LINK_FLAGS
- "/NODEFAULTLIB:LIBCMTD.lib /NODEFAULTLIB:LIBCMT.lib"
- )
elseif (APPLE)
- target_compile_definitions(libOpenSpace PUBLIC "__APPLE__")
+ target_compile_definitions(${project} PUBLIC "__APPLE__")
include (CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
mark_as_advanced(COMPILER_SUPPORTS_CXX11, COMPILER_SUPPORTS_CXX0X)
if (COMPILER_SUPPORTS_CXX11)
- target_compile_options(libOpenSpace PUBLIC "-std=c++11")
+ target_compile_options(${project} PUBLIC "-std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
- target_compile_options(libOpenSpace PUBLIC "-std=c++0x")
+ target_compile_options(${project} PUBLIC "-std=c++0x")
else ()
message(FATAL_ERROR "Compiler does not have C++11 support")
endif ()
if (OPENSPACE_WARNINGS_AS_ERRORS)
- target_compile_options(libOpenSpace PUBLIC "-Werror")
- target_compile_options(OpenSpace PUBLIC "-Werror")
+ target_compile_options(${project} PUBLIC "-Werror")
endif ()
- target_compile_options(libOpenSpace PUBLIC "-stdlib=libc++")
+ target_compile_options(${project} PUBLIC "-stdlib=libc++")
- target_include_directories(libOpenSpace PUBLIC "/Developer/Headers/FlatCarbon")
+ target_include_directories(${project} PUBLIC "/Developer/Headers/FlatCarbon")
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(CARBON_LIBRARY Carbon)
find_library(COCOA_LIBRARY Carbon)
find_library(APP_SERVICES_LIBRARY ApplicationServices)
mark_as_advanced(CARBON_LIBRARY COCOA_LIBRARY APP_SERVICES_LIBRARY)
- target_link_libraries(libOpenSpace
+ target_link_libraries(${project}
${CARBON_LIBRARY}
${COREFOUNDATION_LIBRARY}
${COCOA_LIBRARY}
@@ -128,20 +120,18 @@ function (set_compile_settings)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)
mark_as_advanced(COMPILER_SUPPORTS_CXX11, COMPILER_SUPPORTS_CXX0X)
if (COMPILER_SUPPORTS_CXX11)
- target_compile_options(libOpenSpace PUBLIC "-std=c++11")
+ target_compile_options(${project} PUBLIC "-std=c++11")
elseif (COMPILER_SUPPORTS_CXX0X)
- target_compile_options(libOpenSpace PUBLIC "-std=c++0x")
+ target_compile_options(${project} PUBLIC "-std=c++0x")
else ()
message(FATAL_ERROR "Compiler does not have C++11 support")
endif ()
if (OPENSPACE_WARNINGS_AS_ERRORS)
- target_compile_options(libOpenSpace PUBLIC "-Werror")
- target_compile_options(OpenSpace PUBLIC "-Werror")
+ target_compile_options(${project} PUBLIC "-Werror")
endif ()
- target_compile_options(libOpenSpace PUBLIC "-ggdb" "-Wall" "-Wno-long-long" "-pedantic" "-Wextra")
- target_compile_options(OpenSpace PUBLIC "-ggdb" "-Wall" "-Wno-long-long" "-pedantic" "-Wextra")
+ target_compile_options(${project} PUBLIC "-ggdb" "-Wall" "-Wno-long-long" "-pedantic" "-Wextra")
endif ()
endfunction ()
@@ -188,21 +178,96 @@ function (add_external_dependencies)
target_compile_definitions(libOpenSpace PUBLIC "OPENSPACE_CURL_ENABLED")
endif ()
endif()
-
- # add_subdirectory(${OPENSPACE_EXT_DIR}/curl)
- # target_link_libraries(libOpenSpace
-
endfunction ()
+function (handle_applications)
+ set(applications "")
+ set(applications_link_to_openspace "")
+
+ file(GLOB appDirs RELATIVE ${OPENSPACE_APPS_DIR} ${OPENSPACE_APPS_DIR}/*)
+ list(REMOVE_ITEM appDirs ".DS_Store") # Removing the .DS_Store present on Mac
+
+ set(DEFAULT_APPLICATIONS
+ "OpenSpace"
+ )
+ mark_as_advanced(DEFAULT_APPLICATIONS)
+
+ foreach (app ${appDirs})
+ string(TOUPPER ${app} upper_app)
+ list (FIND DEFAULT_APPLICATIONS "${app}" _index)
+ if (${_index} GREATER -1)
+ # App is a default application
+ option(OPENSPACE_APPLICATION_${upper_app} "${app} Application" ON)
+ else ()
+ option(OPENSPACE_APPLICATION_${upper_app} "${app} Application" OFF)
+ endif()
+ if (OPENSPACE_APPLICATION_${upper_app})
+ unset(APPLICATION_NAME)
+ unset(APPLICATION_LINK_TO_OPENSPACE)
+ include(${OPENSPACE_APPS_DIR}/${app}/CMakeLists.txt)
+ set_compile_settings(${APPLICATION_NAME})
+
+ if (APPLICATION_LINK_TO_OPENSPACE)
+ get_property(
+ OPENSPACE_INCLUDE_DIR
+ TARGET libOpenSpace
+ PROPERTY INTERFACE_INCLUDE_DIRECTORIES
+ )
+ target_include_directories(${APPLICATION_NAME} PUBLIC
+ "${OPENSPACE_BASE_DIR}"
+ ${OPENSPACE_INCLUDE_DIR}
+ )
+
+ get_property(
+ OPENSPACE_DEFINES
+ TARGET libOpenSpace
+ PROPERTY INTERFACE_COMPILE_DEFINITIONS
+ )
+ target_compile_definitions(${APPLICATION_NAME} PUBLIC ${OPENSPACE_DEFINES})
+
+ target_link_libraries(${APPLICATION_NAME} Ghoul)
+ target_link_libraries(${APPLICATION_NAME} libOpenSpace)
+ endif ()
+
+ list(APPEND applications ${APPLICATION_NAME})
+ list(APPEND applications_link_to_openspace ${APPLICATION_LINK_TO_OPENSPACE})
+ unset(APPLICATION_NAME)
+ unset(APPLICATION_LINK_TO_OPENSPACE)
+ endif ()
+ endforeach ()
+
+
+ # option(OPENSPACE_APPLICATION_OPENSPACE "Main OpenSpace Application" ON)
+ # if (OPENSPACE_APPLICATION_OPENSPACE)
+ # include(${OPENSPACE_APPS_DIR}/OpenSpace/CMakeLists.txt)
+ # list(APPEND applications "OpenSpace")
+ # endif ()
+ set(OPENSPACE_APPLICATIONS ${applications} PARENT_SCOPE)
+ set(OPENSPACE_APPLICATIONS_LINK_REQUEST ${applications_link_to_openspace} PARENT_SCOPE)
+
+ message(STATUS "Applications:")
+ list(LENGTH applications len1)
+ math(EXPR len2 "${len1} - 1")
+
+ foreach(val RANGE ${len2})
+ list(GET applications ${val} val1)
+ list(GET applications_link_to_openspace ${val} val2)
+ message(STATUS "\t${val1} (Link: ${val2})")
+ endforeach()
+endfunction()
+
+
function (handle_option_vld)
if (OPENSPACE_ENABLE_VLD)
target_compile_definitions(libOpenSpace PUBLIC "OPENSPACE_ENABLE_VLD")
target_link_libraries(libOpenSpace ${OPENSPACE_EXT_DIR}/vld/lib/vld.lib)
target_include_directories(libOpenSpace PUBLIC ${OPENSPACE_EXT_DIR}/vld)
- copy_files(OpenSpace "${OPENSPACE_EXT_DIR}/vld/bin/vld_x64.dll")
+ foreach (app ${OPENSPACE_APPLCATIONS})
+ copy_files(${app} "${OPENSPACE_EXT_DIR}/vld/bin/vld_x64.dll")
+ endforeach ()
endif ()
endfunction ()
@@ -317,7 +382,10 @@ function (handle_internal_modules)
set(MODULE_HEADERS "")
set(MODULE_CLASSES "")
- message(STATUS ${sortedModules})
+ message(STATUS "Included modules:")
+ foreach (module ${sortedModules})
+ message(STATUS "\t${module}")
+ endforeach ()
# Add subdirectories in the correct order
foreach (module ${sortedModules})
@@ -325,7 +393,18 @@ function (handle_internal_modules)
if (${optionName})
create_library_name(${module} libraryName)
add_subdirectory(${OPENSPACE_MODULE_DIR}/${module})
- target_link_libraries(OpenSpace ${libraryName})
+
+ list(LENGTH OPENSPACE_APPLICATIONS len1)
+ math(EXPR len2 "${len1} - 1")
+
+ foreach(val RANGE ${len2})
+ list(GET OPENSPACE_APPLICATIONS ${val} val1)
+ list(GET OPENSPACE_APPLICATIONS_LINK_REQUEST ${val} val2)
+ if (${val2})
+ target_link_libraries(${app} ${libraryName})
+ endif ()
+ endforeach()
+
target_link_libraries(libOpenSpace ${libraryName})
create_define_name(${module} defineName)
target_compile_definitions(libOpenSpace PUBLIC "${defineName}")
@@ -343,10 +422,7 @@ function (handle_internal_modules)
#"#endif\n\n"
)
- list(APPEND MODULE_CLASSES
- "new ${MODULE_NAME},\n"
- )
-
+ list(APPEND MODULE_CLASSES " new ${MODULE_NAME},\n")
endif ()
endforeach ()
diff --git a/tests/main.cpp b/tests/main.cpp
index ede4213fc6..40252d4f44 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -53,28 +53,8 @@ namespace {
int main(int argc, char** argv) {
std::vector args;
- std::string glVersion;
- openspace::OpenSpaceEngine::create(argc, argv, args, glVersion);
+ openspace::OpenSpaceEngine::create(argc, argv, args);
-
- //LogManager::initialize(LogManager::LogLevel::Debug);
- //LogMgr.addLog(new ConsoleLog);
-
- //FileSystem::initialize();
- //std::string configurationFilePath = "";
- //LDEBUG("Finding configuration");
- //if (!openspace::OpenSpaceEngine::findConfiguration(configurationFilePath)) {
- // LFATAL("Could not find OpenSpace configuration file!");
- // assert(false);
- //}
- ////LINFO("Configuration file found: " << FileSys.absolutePath(configurationFilePath));
-
- //openspace::ConfigurationManager manager;
- //manager.loadFromFile(configurationFilePath);
-
-
- //openspace::FactoryManager::initialize();
-
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}