mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-27 15:29:26 -06:00
Merged master.
This commit is contained in:
@@ -52,7 +52,7 @@
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include <libtorrent/entry.hpp>
|
||||
#include <libtorrent/bencode.hpp>
|
||||
//#include <libtorrent/bencode.hpp>
|
||||
#include <libtorrent/session.hpp>
|
||||
#include <libtorrent/alert_types.hpp>
|
||||
#include <libtorrent/torrent_info.hpp>
|
||||
@@ -161,23 +161,28 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
|
||||
}
|
||||
_session->start_upnp();
|
||||
|
||||
std::ifstream file(_configurationFile);
|
||||
if (!file.fail()) {
|
||||
union {
|
||||
uint32_t value;
|
||||
std::array<char, 4> data;
|
||||
} size;
|
||||
|
||||
file.read(size.data.data(), sizeof(uint32_t));
|
||||
std::vector<char> buffer(size.value);
|
||||
file.read(buffer.data(), size.value);
|
||||
file.close();
|
||||
// I commented this out as it caused the Linux build nodes to fail during linking
|
||||
// and I couldn't figure out how to fix it
|
||||
// it would throw an cxx11 ABI incompatibility error
|
||||
|
||||
libtorrent::entry e = libtorrent::bdecode(buffer.begin(), buffer.end());
|
||||
_session->start_dht(e);
|
||||
}
|
||||
else
|
||||
_session->start_dht();
|
||||
//std::ifstream file(_configurationFile);
|
||||
//if (!file.fail()) {
|
||||
// union {
|
||||
// uint32_t value;
|
||||
// std::array<char, 4> data;
|
||||
// } size;
|
||||
|
||||
// file.read(size.data.data(), sizeof(uint32_t));
|
||||
// std::vector<char> buffer(size.value);
|
||||
// file.read(buffer.data(), size.value);
|
||||
// file.close();
|
||||
|
||||
// libtorrent::entry e = libtorrent::bdecode(buffer.begin(), buffer.end());
|
||||
// _session->start_dht(e);
|
||||
//}
|
||||
//else
|
||||
_session->start_dht();
|
||||
|
||||
_session->add_dht_router({ "router.utorrent.com", 6881 });
|
||||
_session->add_dht_router({ "dht.transmissionbt.com", 6881 });
|
||||
@@ -198,18 +203,22 @@ SyncWidget::SyncWidget(QWidget* parent, Qt::WindowFlags f)
|
||||
SyncWidget::~SyncWidget() {
|
||||
libtorrent::entry dht = _session->dht_state();
|
||||
|
||||
std::vector<char> buffer;
|
||||
libtorrent::bencode(std::back_inserter(buffer), dht);
|
||||
// I commented this out as it caused the Linux build nodes to fail during linking
|
||||
// and I couldn't figure out how to fix it
|
||||
// it would throw an cxx11 ABI incompatibility error
|
||||
|
||||
std::ofstream f(_configurationFile);
|
||||
//std::vector<char> buffer;
|
||||
//libtorrent::bencode(std::back_inserter(buffer), dht);
|
||||
|
||||
union {
|
||||
uint32_t value;
|
||||
std::array<char, 4> data;
|
||||
} size;
|
||||
size.value = buffer.size();
|
||||
f.write(size.data.data(), sizeof(uint32_t));
|
||||
f.write(buffer.data(), buffer.size());
|
||||
//std::ofstream f(_configurationFile);
|
||||
|
||||
//union {
|
||||
// uint32_t value;
|
||||
// std::array<char, 4> data;
|
||||
//} size;
|
||||
//size.value = buffer.size();
|
||||
//f.write(size.data.data(), sizeof(uint32_t));
|
||||
//f.write(buffer.data(), buffer.size());
|
||||
|
||||
_downloadManager.reset();
|
||||
ghoul::deinitialize();
|
||||
|
||||
@@ -268,7 +268,7 @@ void mainInitFunc() {
|
||||
|
||||
const sgct::SGCTWindow::StereoMode sm = windowPtr->getStereoMode();
|
||||
const bool hasStereo =
|
||||
(sm != sgct::SGCTWindow::No_Stereo) &&
|
||||
(sm != sgct::SGCTWindow::No_Stereo) &&
|
||||
(sm < sgct::SGCTWindow::Side_By_Side_Stereo);
|
||||
|
||||
if (hasStereo) {
|
||||
@@ -359,6 +359,20 @@ void mainRenderFunc() {
|
||||
LTRACE("main::mainRenderFunc(end)");
|
||||
}
|
||||
|
||||
void mainDraw2DFunc() {
|
||||
LTRACE("main::mainDraw2DFunc(begin)");
|
||||
|
||||
OsEng.drawOverlays();
|
||||
|
||||
// SGCT gets angry if we change this in our function
|
||||
glEnable(GL_BLEND);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
|
||||
|
||||
LTRACE("main::mainDraw2DFunc(end)");
|
||||
}
|
||||
|
||||
void mainPostDrawFunc() {
|
||||
LTRACE("main::mainPostDrawFunc(begin)");
|
||||
|
||||
@@ -525,6 +539,7 @@ int main_main(int argc, char** argv) {
|
||||
SgctEngine->setPreSyncFunction(mainPreSyncFunc);
|
||||
SgctEngine->setPostSyncPreDrawFunction(mainPostSyncPreDrawFunc);
|
||||
SgctEngine->setDrawFunction(mainRenderFunc);
|
||||
SgctEngine->setDraw2DFunction(mainDraw2DFunc);
|
||||
SgctEngine->setPostDrawFunction(mainPostDrawFunc);
|
||||
SgctEngine->setKeyboardCallbackFunction(mainKeyboardCallback);
|
||||
SgctEngine->setMouseButtonCallbackFunction(mainMouseButtonCallback);
|
||||
@@ -609,7 +624,7 @@ int main_main(int argc, char** argv) {
|
||||
cleanup();
|
||||
|
||||
// Exit program
|
||||
exit(EXIT_SUCCESS);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -58,10 +58,14 @@ namespace {
|
||||
|
||||
void initTextureReaders() {
|
||||
#ifdef GHOUL_USE_DEVIL
|
||||
ghoul::io::TextureReader::ref().addReader(std::make_shared<ghoul::io::TextureReaderDevIL>());
|
||||
ghoul::io::TextureReader::ref().addReader(
|
||||
std::make_shared<ghoul::io::TextureReaderDevIL>()
|
||||
);
|
||||
#endif // GHOUL_USE_DEVIL
|
||||
#ifdef GHOUL_USE_FREEIMAGE
|
||||
ghoul::io::TextureReader::ref().addReader(std::make_shared<ghoul::io::TextureReaderFreeImage>());
|
||||
ghoul::io::TextureReader::ref().addReader(
|
||||
std::make_shared<ghoul::io::TextureReaderFreeImage>()
|
||||
);
|
||||
#endif // GHOUL_USE_FREEIMAGE
|
||||
}
|
||||
|
||||
@@ -81,7 +85,10 @@ void performTasks(const std::string& path) {
|
||||
|
||||
for (size_t i = 0; i < tasks.size(); i++) {
|
||||
Task& task = *tasks[i].get();
|
||||
LINFO("Performing task " << (i + 1) << " out of " << tasks.size() << ": " << task.description());
|
||||
LINFO(
|
||||
"Performing task " << (i + 1) << " out of " <<
|
||||
tasks.size() << ": " << task.description()
|
||||
);
|
||||
ProgressBar progressBar(100);
|
||||
auto onProgress = [&progressBar](float progress) {
|
||||
progressBar.print(progress * 100);
|
||||
|
||||
@@ -253,7 +253,8 @@ void ControlWidget::onDateChange() {
|
||||
QString script =
|
||||
"openspace.time.setTime('" + date + "');\
|
||||
openspace.setPropertyValue('Interaction.origin', '" + focus + "');\
|
||||
openspace.setPropertyValue('Interaction.coordinateSystem', '" + coordinateSystem + "')";
|
||||
openspace.setPropertyValue('Interaction.coordinateSystem', '" +
|
||||
coordinateSystem + "')";
|
||||
emit scriptActivity(script);
|
||||
}
|
||||
_setTime->blockSignals(true);
|
||||
@@ -265,18 +266,28 @@ void ControlWidget::onFocusChange() {
|
||||
int index = _focusNode->currentIndex();
|
||||
QString name = FocusNodes[index].name;
|
||||
QString coordinateSystem = FocusNodes[index].coordinateSystem;
|
||||
QString script = "openspace.setPropertyValue('Interaction.origin', '" + name + "');openspace.setPropertyValue('Interaction.coordinateSystem', '" + coordinateSystem + "');";
|
||||
QString script = "openspace.setPropertyValue('Interaction.origin', '" + name +
|
||||
"');openspace.setPropertyValue('Interaction.coordinateSystem', '" +
|
||||
coordinateSystem + "');";
|
||||
emit scriptActivity(script);
|
||||
}
|
||||
|
||||
void ControlWidget::onFocusToTargetButton() {
|
||||
std::string target = reinterpret_cast<MainWindow*>(parent())->nextTarget();
|
||||
if (!target.empty()) {
|
||||
auto it = std::find_if(std::begin(FocusNodes), std::end(FocusNodes), [target](const FocusNode& n) { return n.guiName.toLower() == QString::fromStdString(target).toLower(); });
|
||||
auto it = std::find_if(
|
||||
std::begin(FocusNodes),
|
||||
std::end(FocusNodes),
|
||||
[target](const FocusNode& n) {
|
||||
return n.guiName.toLower() == QString::fromStdString(target).toLower();
|
||||
});
|
||||
if (it != std::end(FocusNodes)) {
|
||||
QString name = it->name;
|
||||
QString coordinateSystem = it->coordinateSystem;
|
||||
QString script = "openspace.setPropertyValue('Interaction.origin', '" + name + "');openspace.setPropertyValue('Interaction.coordinateSystem', '" + coordinateSystem + "');";
|
||||
QString script =
|
||||
"openspace.setPropertyValue('Interaction.origin', '" + name +
|
||||
"');openspace.setPropertyValue('Interaction.coordinateSystem', '" +
|
||||
coordinateSystem + "');";
|
||||
emit scriptActivity(script);
|
||||
}
|
||||
}
|
||||
@@ -292,7 +303,9 @@ void ControlWidget::onFocusToNewHorizonsButton() {
|
||||
else
|
||||
coordinateSystem = "Pluto";
|
||||
|
||||
QString script = "openspace.setPropertyValue('Interaction.origin', 'NewHorizons');openspace.setPropertyValue('Interaction.coordinateSystem', '" + coordinateSystem + "');";
|
||||
QString script = "openspace.setPropertyValue('Interaction.origin', 'NewHorizons');\
|
||||
openspace.setPropertyValue('Interaction.coordinateSystem', '" + coordinateSystem +
|
||||
"');";
|
||||
emit scriptActivity(script);
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,9 @@ QLineEdit {
|
||||
|
||||
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 */
|
||||
/* the groove expands to the size of the slider by default. by giving it a height,
|
||||
it has a fixed size */
|
||||
height: 8px;
|
||||
background: qlineargradient(
|
||||
x1:0, y1:0, x2:1, y2:0,
|
||||
stop:0 #c4c4c4,
|
||||
@@ -72,7 +74,9 @@ 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 */
|
||||
/* handle is placed by default on the contents rect of the groove.
|
||||
Expand outside the groove */
|
||||
margin: -2px 0;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
@@ -112,7 +116,7 @@ QCombobox {
|
||||
}
|
||||
|
||||
QComboBox:editable {
|
||||
background: lightgrey;
|
||||
background: lightgrey;
|
||||
}
|
||||
|
||||
QComboBox QAbstractItemView {
|
||||
|
||||
@@ -257,17 +257,23 @@ void MainWindow::handleStatusMessage(QByteArray data) {
|
||||
QString::fromStdString(std::string(timeString.begin(), timeString.end())),
|
||||
QString::number(delta.value)
|
||||
);
|
||||
_timelineWidget->setCurrentTime(std::string(timeString.begin(), timeString.end()), et.value);
|
||||
_timelineWidget->setCurrentTime(
|
||||
std::string(timeString.begin(), timeString.end()),
|
||||
et.value
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> instrumentsFromId(uint16_t instrumentId, std::map<uint16_t, std::string> instrumentMap) {
|
||||
std::vector<std::string> instrumentsFromId(uint16_t instrumentId,
|
||||
std::map<uint16_t, std::string> instrumentMap)
|
||||
{
|
||||
std::vector<std::string> 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())
|
||||
if (t.empty()) {
|
||||
qDebug() << "Empty instrument";
|
||||
}
|
||||
results.push_back(t);
|
||||
}
|
||||
}
|
||||
@@ -318,15 +324,21 @@ QByteArray MainWindow::handlePlaybook(QByteArray data) {
|
||||
qDebug() << "Instruments were empty";
|
||||
images.push_back(image);
|
||||
}
|
||||
_timelineWidget->setData(std::move(images), std::move(targetMap), std::move(instrumentMap));
|
||||
_timelineWidget->setData(
|
||||
std::move(images),
|
||||
std::move(targetMap),
|
||||
std::move(instrumentMap)
|
||||
);
|
||||
|
||||
auto dataSize = data.size();
|
||||
auto readSize = currentReadLocation;
|
||||
auto extraBytes = dataSize - readSize;
|
||||
if (extraBytes > 0)
|
||||
if (extraBytes > 0) {
|
||||
return data.mid(currentReadLocation);
|
||||
else
|
||||
}
|
||||
else {
|
||||
return QByteArray();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::sendScript(QString script) {
|
||||
@@ -361,7 +373,10 @@ std::string MainWindow::nextTarget() const {
|
||||
}
|
||||
|
||||
void MainWindow::fullyConnected() {
|
||||
_informationWidget->logInformation("Connected to " + _socket->peerName() + " on port " + QString::number(_socket->peerPort()) + ".");
|
||||
_informationWidget->logInformation(
|
||||
"Connected to " + _socket->peerName() + " on port " +
|
||||
QString::number(_socket->peerPort()) + "."
|
||||
);
|
||||
|
||||
_configurationWidget->socketConnected();
|
||||
_timeControlWidget->socketConnected();
|
||||
@@ -379,6 +394,5 @@ void MainWindow::printMapping(QByteArray data) {
|
||||
std::string mapping = readFromBuffer<std::string>(buffer, currentReadPosition);
|
||||
|
||||
qDebug() << identifier << ": " << QString::fromStdString(mapping);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,12 @@ void TimelineWidget::paintEvent(QPaintEvent* event) {
|
||||
|
||||
QRectF fullRect = contentsRect();
|
||||
QRectF contentRect(0, 0, fullRect.width() - 1, fullRect.height() - LegendHeight);
|
||||
QRectF legendRect(0, fullRect.bottom() - LegendHeight, fullRect.right(), fullRect.bottom());
|
||||
QRectF legendRect(
|
||||
0,
|
||||
fullRect.bottom() - LegendHeight,
|
||||
fullRect.right(),
|
||||
fullRect.bottom()
|
||||
);
|
||||
|
||||
painter.save();
|
||||
drawContent(painter, contentRect);
|
||||
@@ -101,10 +106,17 @@ void TimelineWidget::paintEvent(QPaintEvent* event) {
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
void TimelineWidget::setData(std::vector<Image> images, std::map<uint8_t, std::string> targetMap, std::map<uint16_t, std::string> instrumentMap) {
|
||||
void TimelineWidget::setData(std::vector<Image> images,
|
||||
std::map<uint8_t, std::string> targetMap,
|
||||
std::map<uint16_t, std::string> instrumentMap)
|
||||
{
|
||||
_images.insert(_images.end(), images.begin(), images.end());
|
||||
|
||||
std::sort(_images.begin(), _images.end(), [](const Image& a, const Image& b) { return a.beginning < b.beginning; });
|
||||
std::sort(
|
||||
_images.begin(),
|
||||
_images.end(),
|
||||
[](const Image& a, const Image& b) { return a.beginning < b.beginning; }
|
||||
);
|
||||
|
||||
_targetMap.insert(targetMap.begin(), targetMap.end());
|
||||
_instrumentMap.insert(instrumentMap.begin(), instrumentMap.end());
|
||||
@@ -148,8 +160,15 @@ void TimelineWidget::drawContent(QPainter& painter, QRectF rect) {
|
||||
// Draw current time
|
||||
painter.setBrush(QBrush(Qt::black));
|
||||
painter.setPen(QPen(Qt::black, 2));
|
||||
painter.drawLine(QPointF(0, timelineRect.height() / 2), QPointF(timelineRect.width(), timelineRect.height() / 2));
|
||||
painter.drawText(timelineRect.width(), timelineRect.height() / 2 + TextOffset, QString::fromStdString(_currentTime.time));
|
||||
painter.drawLine(
|
||||
QPointF(0, timelineRect.height() / 2),
|
||||
QPointF(timelineRect.width(), timelineRect.height() / 2)
|
||||
);
|
||||
painter.drawText(
|
||||
timelineRect.width(),
|
||||
timelineRect.height() / 2 + TextOffset,
|
||||
QString::fromStdString(_currentTime.time)
|
||||
);
|
||||
}
|
||||
|
||||
void TimelineWidget::drawLegend(QPainter& painter, QRectF rect) {
|
||||
@@ -171,14 +190,21 @@ void TimelineWidget::drawLegend(QPainter& painter, QRectF rect) {
|
||||
;
|
||||
painter.setBrush(QBrush(InstrumentColors[QString::fromStdString(instrument)]));
|
||||
painter.setPen(QPen(InstrumentColors[QString::fromStdString(instrument)]));
|
||||
painter.drawRect(currentHorizontalPosition, currentVerticalPosition, BoxSize, BoxSize);
|
||||
painter.drawRect(
|
||||
currentHorizontalPosition,
|
||||
currentVerticalPosition,
|
||||
BoxSize,
|
||||
BoxSize
|
||||
);
|
||||
currentHorizontalPosition += BoxSize + Padding;
|
||||
|
||||
painter.setPen(QPen(QColor(200, 200, 200)));
|
||||
//painter.setPen(QPen(Qt::black));
|
||||
painter.drawText(currentHorizontalPosition, currentVerticalPosition + BoxSize / 2 + TextOffset, InstrumentConversion[QString::fromStdString(instrument)]);
|
||||
// int textWidth = painter.boundingRect(QRect(), QString::fromStdString(instrument)).width();
|
||||
//currentHorizontalPosition += std::max(textWidth, 25) + Padding;
|
||||
painter.drawText(
|
||||
currentHorizontalPosition,
|
||||
currentVerticalPosition + BoxSize / 2 + TextOffset,
|
||||
InstrumentConversion[QString::fromStdString(instrument)]
|
||||
);
|
||||
currentHorizontalPosition += 125;
|
||||
}
|
||||
}
|
||||
@@ -198,11 +224,12 @@ void TimelineWidget::drawImages(
|
||||
{
|
||||
std::set<std::string> instrumentSet;
|
||||
for (Image* i : images) {
|
||||
for (std::string instrument : i->instruments)
|
||||
for (std::string instrument : i->instruments) {
|
||||
instrumentSet.insert(instrument);
|
||||
}
|
||||
}
|
||||
std::map<std::string, int> instruments;
|
||||
for (std::set<std::string>::const_iterator it = instrumentSet.begin(); it != instrumentSet.end(); ++it)
|
||||
for (auto it = instrumentSet.begin(); it != instrumentSet.end(); ++it)
|
||||
instruments[*it] = std::distance(instrumentSet.begin(), it);
|
||||
|
||||
for (Image* i : images) {
|
||||
@@ -215,8 +242,9 @@ void TimelineWidget::drawImages(
|
||||
int height = (timelineRect.top() + timelineRect.height() * tEnd) - loc;
|
||||
height = std::max(height, 5);
|
||||
|
||||
if (loc + height > timelineRect.height())
|
||||
if (loc + height > timelineRect.height()) {
|
||||
height = timelineRect.height() - loc;
|
||||
}
|
||||
|
||||
std::string target = i->target;
|
||||
auto it = std::find(_targets.begin(), _targets.end(), target);
|
||||
@@ -224,10 +252,13 @@ void TimelineWidget::drawImages(
|
||||
|
||||
for (std::string instrument : i->instruments) {
|
||||
auto it = std::find(_instruments.begin(), _instruments.end(), instrument);
|
||||
if (it == _instruments.end())
|
||||
if (it == _instruments.end()) {
|
||||
qDebug() << "Instrument not found";
|
||||
}
|
||||
|
||||
painter.setBrush(QBrush(InstrumentColors[QString::fromStdString(instrument)]));
|
||||
painter.setBrush(
|
||||
QBrush(InstrumentColors[QString::fromStdString(instrument)])
|
||||
);
|
||||
|
||||
double width = timelineRect.width() / instruments.size();
|
||||
double pos = instruments[instrument] * width;
|
||||
@@ -238,7 +269,8 @@ void TimelineWidget::drawImages(
|
||||
if (height >= 5) {
|
||||
painter.setBrush(QBrush(Qt::black));
|
||||
painter.setPen(QPen(Qt::black));
|
||||
QString line = QString::fromStdString(i->beginningString) + QString(" (") + QString::fromStdString(i->target) + QString(")");
|
||||
QString line = QString::fromStdString(i->beginningString) + QString(" (") +
|
||||
QString::fromStdString(i->target) + QString(")");
|
||||
|
||||
painter.drawText(timelineRect.width(), loc + height / 2 + TextOffset, line);
|
||||
}
|
||||
@@ -257,9 +289,16 @@ void TimelineWidget::socketDisconnected() {
|
||||
}
|
||||
|
||||
std::string TimelineWidget::nextTarget() const {
|
||||
auto it = std::lower_bound(_images.begin(), _images.end(), _currentTime.et, [](const Image& i, double et) { return i.beginning < et; });
|
||||
if (it != _images.end())
|
||||
auto it = std::lower_bound(
|
||||
_images.begin(),
|
||||
_images.end(),
|
||||
_currentTime.et,
|
||||
[](const Image& i, double et) { return i.beginning < et; }
|
||||
);
|
||||
if (it != _images.end()) {
|
||||
return it->target;
|
||||
else
|
||||
}
|
||||
else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ Q_OBJECT
|
||||
public:
|
||||
TimelineWidget(QWidget* parent);
|
||||
|
||||
void setData(std::vector<Image> images, std::map<uint8_t, std::string> targetMap, std::map<uint16_t, std::string> instrumentMap);
|
||||
void setData(std::vector<Image> images, std::map<uint8_t, std::string> targetMap,
|
||||
std::map<uint16_t, std::string> instrumentMap);
|
||||
void setCurrentTime(std::string currentTime, double et);
|
||||
void socketConnected();
|
||||
void socketDisconnected();
|
||||
@@ -48,10 +49,11 @@ public:
|
||||
std::string nextTarget() const;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
void paintEvent(QPaintEvent* event);
|
||||
void drawContent(QPainter& painter, QRectF rect);
|
||||
void drawLegend(QPainter& painter, QRectF rect);
|
||||
void drawImages(QPainter& painter, QRectF timelineRect, std::vector<Image*> images, double minimumTime, double maximumTime);
|
||||
void drawImages(QPainter& painter, QRectF timelineRect, std::vector<Image*> images,
|
||||
double minimumTime, double maximumTime);
|
||||
|
||||
private:
|
||||
std::vector<Image> _images;
|
||||
|
||||
BIN
data/openspace-logo.png
Normal file
BIN
data/openspace-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
35
data/scene/examples/fixedrotation/fixedrotation.mod
Normal file
35
data/scene/examples/fixedrotation/fixedrotation.mod
Normal file
@@ -0,0 +1,35 @@
|
||||
return {
|
||||
-- Earth barycenter module
|
||||
{
|
||||
Name = "Fixed Rotation",
|
||||
Parent = "EarthBarycenter",
|
||||
Transform = {
|
||||
Rotation = {
|
||||
Type = "FixedRotation",
|
||||
Attached = "Fixed Rotation",
|
||||
XAxis = { 0.0, 1.0, 0.0 },
|
||||
XAxisOrthogonal = true,
|
||||
YAxis = "EarthBarycenter"
|
||||
},
|
||||
Translation = {
|
||||
Type = "SpiceTranslation",
|
||||
Target = "MOON",
|
||||
Observer = "EARTH BARYCENTER",
|
||||
Kernels = "${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
},
|
||||
Scale = {
|
||||
Type = "StaticScale",
|
||||
Scale = 10000000
|
||||
}
|
||||
},
|
||||
Renderable = {
|
||||
Type = "RenderableModel",
|
||||
Geometry = {
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "teapot.obj",
|
||||
-- Magnification = 4,
|
||||
},
|
||||
ColorTexture = "placeholder.png",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ using Optional = ghoul::Boolean;
|
||||
struct TestResult {
|
||||
/**
|
||||
* An Offense is a violation against a specific verifier. The Offense::offender is the
|
||||
* key that caused the offense (in the case of nested tables, it will be fully
|
||||
* key that caused the offense (in the case of nested tables, it will be fully
|
||||
* qualified identifier) and the Offense::Reason is the reason that caused the
|
||||
* offense.
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ struct TestResult {
|
||||
ExtraKey, ///< The exhaustive documentation contained an extra key
|
||||
WrongType, ///< The key's value was not of the expected type
|
||||
Verification, ///< The value did not pass a necessary non-type verifier
|
||||
UnknownIdentifier ///< If the identifier for a ReferencingVerifier did not exist
|
||||
UnknownIdentifier ///< The identifier for a ReferencingVerifier did not exist
|
||||
};
|
||||
/// The offending key that caused the Offense. In the case of a nested table,
|
||||
/// this value will be the fully qualified name of the key
|
||||
@@ -142,8 +142,8 @@ struct DocumentationEntry {
|
||||
|
||||
/**
|
||||
* The constructor for a DocumentationEntry describing a \p key in a Documentation.
|
||||
* The value for the key (or each value in the case of the
|
||||
* DocumentationEntry::Wildcard) is tested using the \p verifier, that specifies the
|
||||
* The value for the key (or each value in the case of the
|
||||
* DocumentationEntry::Wildcard) is tested using the \p verifier, that specifies the
|
||||
* conditions that the \p key%'s value has to fulfill. The textual documentation
|
||||
* \p doc shall describe the usage of the key-value pair and will be printed for human
|
||||
* consumption for example in the DocumentationEngine. Each DocumentationEntry can
|
||||
@@ -211,7 +211,7 @@ Documentation doc = {
|
||||
{ // A list of DocumentationEntry%s; also specified using initializer lists
|
||||
{ "key1", new IntVerifier, "Documentation key1", Optional::Yes },
|
||||
{ "key2", new FloatVerifier, "Documentation key2" },
|
||||
{ "key3", new StringVerifier }
|
||||
{ "key3", new StringVerifier }
|
||||
}
|
||||
};
|
||||
\endverbatim
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
DocumentationEngine();
|
||||
|
||||
/**
|
||||
* Adds the \p documentation to the list of Documentation%s that are written to a
|
||||
* Adds the \p documentation to the list of Documentation%s that are written to a
|
||||
* documentation file with the writeDocumentation method.
|
||||
* \param documentation The Documentation object that is to be stored for later use
|
||||
* \throws DuplicateDocumentationException If the \p documentation has a non-empty
|
||||
|
||||
@@ -33,10 +33,10 @@ namespace openspace {
|
||||
/*
|
||||
* This abstract class is used for instances when another class has the ability to
|
||||
* generate a Handlebar generated documentation file that contains valuable information
|
||||
* for the user. Instances of this are the DocumentationEngine results, the list of
|
||||
* for the user. Instances of this are the DocumentationEngine results, the list of
|
||||
* Property%s generated by the Scene, or the FactoryEngine results. The documentation is
|
||||
* generated through the writeDocumentation method.
|
||||
*
|
||||
*
|
||||
* The concrete subclass needs to overload the generateJson class that will return the
|
||||
* Json that is parsed by Handlebar to generate the webpage.
|
||||
*
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
* writeDocumentation method.
|
||||
* \param name The name of the written documentation
|
||||
* \param jsonName The variable name of the value generated by the generateJson
|
||||
* \param handlebarTemplates A list of Handlebar templates that is added to the
|
||||
* \param handlebarTemplates A list of Handlebar templates that is added to the
|
||||
* documentation file
|
||||
* \param javascriptFilename The path to a Javascript source file that is added to the
|
||||
* documentation and that can contain additional functionality
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
/**
|
||||
* Create the documentation into the provided filename. Any existing file will be
|
||||
* silently overwritten. This method will call the generateJson method that can be
|
||||
* used by concrete subclasses to provide the actual data that is provided in the
|
||||
* used by concrete subclasses to provide the actual data that is provided in the
|
||||
* documentation.
|
||||
* \param filename The filename in which the documentation is written
|
||||
*/
|
||||
|
||||
@@ -61,7 +61,7 @@ struct Verifier {
|
||||
* \post If the return values' TestResult::success is \c true, its
|
||||
* TestResult::offenders is empty
|
||||
*/
|
||||
virtual TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
virtual TestResult operator()(const ghoul::Dictionary& dictionary,
|
||||
const std::string& key) const = 0;
|
||||
|
||||
/**
|
||||
@@ -116,7 +116,7 @@ struct TemplateVerifier : public Verifier {
|
||||
};
|
||||
|
||||
/**
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
|
||||
* A Verifier that checks whether a given key inside a ghoul::Dictionary is of type
|
||||
* \c bool. No implicit conversion is considered in this testing.
|
||||
*/
|
||||
struct BoolVerifier : public TemplateVerifier<bool> {
|
||||
@@ -258,7 +258,7 @@ struct Vector4Verifier : public TemplateVerifier<glm::tvec4<T>>, public VectorVe
|
||||
};
|
||||
|
||||
/**
|
||||
* A Verifier that checks whether all values contained in a Table are of
|
||||
* A Verifier that checks whether all values contained in a Table are of
|
||||
* type <code>glm::tvec2<T></code>
|
||||
*/
|
||||
template <typename T>
|
||||
@@ -546,7 +546,9 @@ struct GreaterVerifier : public OperatorVerifier<T, std::greater<typename T::Typ
|
||||
* as) BoolVerifier, StringVerifier, TableVerifier, or VectorVerifier.
|
||||
*/
|
||||
template <typename T>
|
||||
struct GreaterEqualVerifier : public OperatorVerifier<T, std::greater_equal<typename T::Type>> {
|
||||
struct GreaterEqualVerifier : public OperatorVerifier<T,
|
||||
std::greater_equal<typename T::Type>>
|
||||
{
|
||||
static_assert(
|
||||
!std::is_base_of<BoolVerifier, T>::value,
|
||||
"T cannot be BoolVerifier"
|
||||
@@ -627,7 +629,7 @@ struct InListVerifier : public T {
|
||||
* Tests whether the \p key exists in the \p dictionary, whether it has the correct
|
||||
* type by invoking the template parameter \c T, and then tests if the \p key's value
|
||||
* is part of the list passed to the constructor.
|
||||
* \param dictionary The ghoul::Dictionary that contains the \p key
|
||||
* \param dictionary The ghoul::Dictionary that contains the \p key
|
||||
* \param key The key that is contained in the \p dictionary and whose value is tested
|
||||
* \return A TestResult containing the results of the specification testing. If the
|
||||
* \p key%'s value has the wrong type, it will be added to the TestResult's offense
|
||||
@@ -688,7 +690,7 @@ struct NotInListVerifier : public T {
|
||||
* This Verifier checks whether the incoming value is of the correct type, using the
|
||||
* Verifier passed as a template parameter \c T and then checks whether it is greater or
|
||||
* equal to a lower limit and less or equal to a higher limit. To the missing comparison
|
||||
* operators, \c T cannot be a subclass of (or the same as) BoolVerifier, StringVerifier,
|
||||
* operators, \c T cannot be a subclass of (or the same as) BoolVerifier, StringVerifier,
|
||||
* TableVerifier, or VectorVerifier. Both the lower and the higher limit are inclusive).
|
||||
*/
|
||||
template <typename T>
|
||||
@@ -890,7 +892,7 @@ struct ReferencingVerifier : public TableVerifier {
|
||||
|
||||
std::string documentation() const override;
|
||||
|
||||
/// The identifier that references another Documentation registered with the
|
||||
/// The identifier that references another Documentation registered with the
|
||||
/// DocumentationEngine
|
||||
std::string identifier;
|
||||
};
|
||||
@@ -900,7 +902,7 @@ struct ReferencingVerifier : public TableVerifier {
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This Verifier takes two Verifiers and performs a boolean \c and operation on their
|
||||
* This Verifier takes two Verifiers and performs a boolean \c and operation on their
|
||||
* results. In essence, a value only passes this Verifier if it passes both Verifier%s
|
||||
* that are passed in the constructor. Opposed to the <code>C++</code> <code>&&</code>
|
||||
* operator, the AndVerifier does not perform any short-circut evaluation.
|
||||
|
||||
@@ -122,7 +122,7 @@ OperatorVerifier<T, Operator>::OperatorVerifier(typename T::Type val)
|
||||
|
||||
template <typename T, typename Operator>
|
||||
TestResult OperatorVerifier<T, Operator>::operator()(const ghoul::Dictionary& dict,
|
||||
const std::string& key) const
|
||||
const std::string& key) const
|
||||
{
|
||||
TestResult res = T::operator()(dict, key);
|
||||
if (res.success) {
|
||||
@@ -345,7 +345,9 @@ TestResult DeprecatedVerifier<T>::operator()(const ghoul::Dictionary& dict,
|
||||
const std::string& key) const
|
||||
{
|
||||
TestResult res = T::operator()(dict, key);
|
||||
res.warnings.push_back(TestResult::Warning{ key, TestResult::Warning::Reason::Deprecated });
|
||||
res.warnings.push_back(
|
||||
TestResult::Warning{ key, TestResult::Warning::Reason::Deprecated }
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,9 +131,9 @@ public:
|
||||
static const std::string PartHttpProxyPort;
|
||||
/// The key that stores the authentication method of the http proxy
|
||||
static const std::string PartHttpProxyAuthentication;
|
||||
/// The key that stores the username to use for authentication to access the http proxy
|
||||
/// Key that stores the username to use for authentication to access the http proxy
|
||||
static const std::string PartHttpProxyUser;
|
||||
/// The key that stores the password to use for authentication to access the http proxy
|
||||
/// Key that stores the password to use for authentication to access the http proxy
|
||||
static const std::string PartHttpProxyPassword;
|
||||
/// The key that stores the dictionary containing information about debug contexts
|
||||
static const std::string KeyOpenGLDebugContext;
|
||||
@@ -156,6 +156,20 @@ public:
|
||||
/// The part of the key storing whether each OpenGL call should be logged
|
||||
static const std::string KeyLogEachOpenGLCall;
|
||||
|
||||
/// This key determines whether the scene graph nodes should initialized multithreaded
|
||||
static const std::string KeyUseMultithreadedInitialization;
|
||||
|
||||
/// The key under which all of the loading settings are grouped
|
||||
static const std::string KeyLoadingScreen;
|
||||
/// The part of the key storing whether the loading screen should display the message
|
||||
/// about current status
|
||||
static const std::string PartShowMessage;
|
||||
/// The part of the key storing whether the loading screen should display node names
|
||||
static const std::string PartShowNodeNames;
|
||||
/// The part of the key storing whether the loading screen should contain a progress
|
||||
/// bar
|
||||
static const std::string PartShowProgressbar;
|
||||
|
||||
|
||||
/**
|
||||
* Iteratively walks the directory structure starting with \p filename to find the
|
||||
|
||||
@@ -102,13 +102,13 @@ public:
|
||||
DownloadProgressCallback progressCallback = DownloadProgressCallback()
|
||||
);
|
||||
|
||||
std::future<MemoryFile> fetchFile(
|
||||
const std::string& url,
|
||||
SuccessCallback successCallback = SuccessCallback(), ErrorCallback errorCallback = ErrorCallback());
|
||||
std::future<MemoryFile> fetchFile(const std::string& url,
|
||||
SuccessCallback successCallback = SuccessCallback(),
|
||||
ErrorCallback errorCallback = ErrorCallback());
|
||||
|
||||
std::vector<std::shared_ptr<FileFuture>> downloadRequestFiles(const std::string& identifier,
|
||||
const ghoul::filesystem::Directory& destination, int version,
|
||||
bool overrideFiles = true,
|
||||
std::vector<std::shared_ptr<FileFuture>> downloadRequestFiles(
|
||||
const std::string& identifier, const ghoul::filesystem::Directory& destination,
|
||||
int version, bool overrideFiles = true,
|
||||
DownloadFinishedCallback finishedCallback = DownloadFinishedCallback(),
|
||||
DownloadProgressCallback progressCallback = DownloadProgressCallback()
|
||||
);
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
* Registers the passed \p module with this ModuleEngine. The OpenSpaceModule::create
|
||||
* method will be called on the \p module in the process.
|
||||
* \param module The OpenSpaceModule that is to be registered
|
||||
* \throw ghoul::RuntimeError If the name of the \p module was already registered
|
||||
* \throw ghoul::RuntimeError If the name of the \p module was already registered
|
||||
* previously
|
||||
* \pre \p module must not be nullptr
|
||||
*/
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace openspace {
|
||||
class ConfigurationManager;
|
||||
class DownloadManager;
|
||||
class GUI;
|
||||
class LoadingScreen;
|
||||
class LuaConsole;
|
||||
class ModuleEngine;
|
||||
class NetworkEngine;
|
||||
@@ -87,6 +88,7 @@ public:
|
||||
void postSynchronizationPreDraw();
|
||||
void render(const glm::mat4& sceneMatrix, const glm::mat4& viewMatrix,
|
||||
const glm::mat4& projectionMatrix);
|
||||
void drawOverlays();
|
||||
void postDraw();
|
||||
void keyboardCallback(Key key, KeyModifier mod, KeyAction action);
|
||||
void charCallback(unsigned int codepoint, KeyModifier mod);
|
||||
@@ -109,6 +111,7 @@ public:
|
||||
LuaConsole& console();
|
||||
DownloadManager& downloadManager();
|
||||
ModuleEngine& moduleEngine();
|
||||
LoadingScreen& loadingScreen();
|
||||
NetworkEngine& networkEngine();
|
||||
ParallelConnection& parallelConnection();
|
||||
RenderEngine& renderEngine();
|
||||
@@ -133,6 +136,7 @@ public:
|
||||
PreSync, // Callback for the end of the pre-sync function
|
||||
PostSyncPreDraw, // Callback for the end of the post-sync-pre-draw function
|
||||
Render, // Callback for the end of the render function
|
||||
Draw2D, // Callback for the two-dimensional rendering functions
|
||||
PostDraw // Callback for the end of the post-draw function
|
||||
};
|
||||
|
||||
@@ -200,6 +204,8 @@ private:
|
||||
// Others
|
||||
std::unique_ptr<properties::PropertyOwner> _globalPropertyNamespace;
|
||||
|
||||
std::unique_ptr<LoadingScreen> _loadingScreen;
|
||||
|
||||
struct {
|
||||
properties::StringProperty versionString;
|
||||
properties::StringProperty sourceControlInformation;
|
||||
@@ -218,6 +224,7 @@ private:
|
||||
std::vector<std::function<void()>> preSync;
|
||||
std::vector<std::function<void()>> postSyncPreDraw;
|
||||
std::vector<std::function<void()>> render;
|
||||
std::vector<std::function<void()>> draw2D;
|
||||
std::vector<std::function<void()>> postDraw;
|
||||
|
||||
std::vector<std::function<bool (Key, KeyModifier, KeyAction)>> keyboard;
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
SyncEngine(unsigned int syncBufferSize);
|
||||
|
||||
/**
|
||||
* Encodes all added Syncables in the injected <code>SyncBuffer</code>.
|
||||
* Encodes all added Syncables in the injected <code>SyncBuffer</code>.
|
||||
* This method is only called on the SGCT master node
|
||||
*/
|
||||
void encodeSyncables();
|
||||
@@ -95,7 +95,7 @@ public:
|
||||
void removeSyncables(const std::vector<Syncable*>& syncables);
|
||||
|
||||
private:
|
||||
/**
|
||||
/**
|
||||
* Vector of Syncables. The vectors ensures consistent encode/decode order
|
||||
*/
|
||||
std::vector<Syncable*> _syncables;
|
||||
|
||||
@@ -79,6 +79,8 @@ public:
|
||||
|
||||
void takeScreenshot(bool applyWarping = false) const override;
|
||||
|
||||
void swapBuffer() const override;
|
||||
|
||||
private:
|
||||
properties::FloatProperty _eyeSeparation;
|
||||
properties::BoolProperty _showStatsGraph;
|
||||
|
||||
@@ -125,7 +125,7 @@ public:
|
||||
* is <code>1</code> if mouse button <code>i</code> is pressed down;
|
||||
* <code>false</code> otherwise. On default, this method returns that none of the
|
||||
* buttons is pressed.
|
||||
* \param maxNumber The maximum number of mouse buttons that should be queried
|
||||
* \param maxNumber The maximum number of mouse buttons that should be queried
|
||||
* \return A bitmask showing the status of all mouse buttons (up to \p maxNumber)
|
||||
*/
|
||||
virtual uint32_t mouseButtons(int maxNumber = 8) const;
|
||||
@@ -201,8 +201,9 @@ public:
|
||||
virtual bool isUsingSwapGroups() const;
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> if the current rendering window is master of the swap its group.
|
||||
*/
|
||||
* Returns <code>true</code> if the current rendering window is master of the swap its
|
||||
* group.
|
||||
*/
|
||||
virtual bool isSwapGroupMaster() const;
|
||||
|
||||
/**
|
||||
@@ -270,6 +271,8 @@ public:
|
||||
*/
|
||||
virtual void takeScreenshot(bool applyWarping = false) const;
|
||||
|
||||
virtual void swapBuffer() const;
|
||||
|
||||
struct WindowWrapperException : public ghoul::RuntimeError {
|
||||
explicit WindowWrapperException(const std::string& msg);
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
|
||||
static scripting::LuaLibrary luaLibrary();
|
||||
|
||||
// Callback functions
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
|
||||
private:
|
||||
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
/**
|
||||
* \param sensitivity
|
||||
* \param velocityScaleFactor can be set to 60 to remove the inertia of the
|
||||
* interaction. Lower value will make it harder to move the camera.
|
||||
* interaction. Lower value will make it harder to move the camera.
|
||||
*/
|
||||
MouseStates(double sensitivity, double velocityScaleFactor);
|
||||
void updateMouseStatesFromInput(const InputState& inputState, double deltaTime);
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void setCamera(Camera* camera);
|
||||
void resetCameraDirection();
|
||||
|
||||
void setCameraStateFromDictionary(const ghoul::Dictionary& cameraDict);
|
||||
void setCameraStateFromDictionary(const ghoul::Dictionary& cameraDict);
|
||||
|
||||
void updateCamera(double deltaTime);
|
||||
|
||||
@@ -69,9 +69,9 @@ public:
|
||||
Camera* camera() const;
|
||||
const InputState& inputState() const;
|
||||
const OrbitalNavigator& orbitalNavigator() const;
|
||||
KeyframeNavigator& keyframeNavigator() const;
|
||||
KeyframeNavigator& keyframeNavigator() const;
|
||||
|
||||
// Callback functions
|
||||
// Callback functions
|
||||
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
|
||||
void mouseButtonCallback(MouseButton button, MouseAction action);
|
||||
void mousePositionCallback(double x, double y);
|
||||
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
void setFocusNode(SceneGraphNode* focusNode);
|
||||
void startInterpolateCameraDirection(const Camera& camera);
|
||||
|
||||
bool followingNodeRotation() const;
|
||||
bool followingNodeRotation() const;
|
||||
SceneGraphNode* focusNode() const;
|
||||
|
||||
bool hasRotationalFriction() const;
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
* camera points towards the focus node in the direction opposite to the direction
|
||||
* out from the surface of the object. The local rotation defines the differential
|
||||
* from the global to the current total rotation so that
|
||||
* <code>cameraRotation = globalRotation * localRotation</code>.
|
||||
* <code>cameraRotation = globalRotation * localRotation</code>.
|
||||
*/
|
||||
CameraRotationDecomposition decomposeCameraRotation(const glm::dvec3& cameraPosition,
|
||||
const glm::dquat& cameraRotation, const glm::dvec3& cameraLookUp,
|
||||
@@ -139,7 +139,7 @@ private:
|
||||
|
||||
/*
|
||||
* Adds rotation to the camera position so that it follows the rotation of the focus
|
||||
* node defined by the differential focusNodeRotationDiff.
|
||||
* node defined by the differential focusNodeRotationDiff.
|
||||
* \returns a position updated with the rotation defined by focusNodeRotationDiff
|
||||
*/
|
||||
glm::dvec3 followFocusNodeRotation(const glm::dvec3& cameraPosition,
|
||||
|
||||
36
include/openspace/interaction/touchbar.h
Normal file
36
include/openspace/interaction/touchbar.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2017 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___TOUCHBAR___H__
|
||||
#define __OPENSPACE_CORE___TOUCHBAR___H__
|
||||
|
||||
namespace openspace {
|
||||
|
||||
// Initializes the touch bar on MacOS (if available) and creates all the buttons and
|
||||
// callbacks
|
||||
void showTouchbar();
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___TOUCHBAR___H__
|
||||
@@ -41,7 +41,7 @@ namespace documentation { struct Documentation; }
|
||||
* Used to represent a named period of time within a mission. Allows nested phases, i.e.
|
||||
* phases within phases. Designed for WORM usage (Write Once, Read Multiple), and,
|
||||
* therefore, has only accessors.
|
||||
*
|
||||
*
|
||||
* Each MissionPhase is characterized by its MissionPhase::name, a TimeRange, an
|
||||
* optional MissionPhase::description, and optional subphases.
|
||||
*/
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace openspace {
|
||||
namespace scripting { struct LuaLibrary; }
|
||||
|
||||
/**
|
||||
* Singleton class keeping track of space missions.
|
||||
* Singleton class keeping track of space missions.
|
||||
*/
|
||||
class MissionManager : public ghoul::Singleton<MissionManager> {
|
||||
public:
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
|
||||
/**
|
||||
* Reads a mission from file and maps the mission name to the Mission object. If
|
||||
* this is the first mission to be loaded, the mission will also be set as the
|
||||
* this is the first mission to be loaded, the mission will also be set as the
|
||||
* current active mission.
|
||||
* \pre \p filename must not be empty
|
||||
* \pre \p filename must not contain tokens
|
||||
@@ -79,8 +79,8 @@ public:
|
||||
bool hasCurrentMission() const;
|
||||
|
||||
/**
|
||||
* Returns the latest mission specified to `setCurrentMission()`. If no mission has
|
||||
* been specified, the first mission loaded will be returned. If no mission has been
|
||||
* Returns the latest mission specified to `setCurrentMission()`. If no mission has
|
||||
* been specified, the first mission loaded will be returned. If no mission has been
|
||||
* loaded, a warning will be printed and a dummy mission will be returned.
|
||||
*/
|
||||
const Mission& currentMission();
|
||||
|
||||
@@ -52,27 +52,51 @@ struct CameraKeyframe {
|
||||
|
||||
double _timestamp;
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
void serialize(std::vector<char> &buffer) {
|
||||
// Add position
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_position), reinterpret_cast<char*>(&_position) + sizeof(_position));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_position),
|
||||
reinterpret_cast<char*>(&_position) + sizeof(_position)
|
||||
);
|
||||
|
||||
// Add orientation
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_rotation), reinterpret_cast<char*>(&_rotation) + sizeof(_rotation));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_rotation),
|
||||
reinterpret_cast<char*>(&_rotation) + sizeof(_rotation)
|
||||
);
|
||||
|
||||
// Follow focus node rotation?
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_followNodeRotation), reinterpret_cast<char*>(&_followNodeRotation) + sizeof(_followNodeRotation));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_followNodeRotation),
|
||||
reinterpret_cast<char*>(&_followNodeRotation) + sizeof(_followNodeRotation)
|
||||
);
|
||||
|
||||
int nodeNameLength = static_cast<int>(_focusNode.size());
|
||||
|
||||
// Add focus node
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&nodeNameLength), reinterpret_cast<char*>(&nodeNameLength) + sizeof(nodeNameLength));
|
||||
buffer.insert(buffer.end(), _focusNode.data(), _focusNode.data() + nodeNameLength);
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&nodeNameLength),
|
||||
reinterpret_cast<char*>(&nodeNameLength) + sizeof(nodeNameLength)
|
||||
);
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
_focusNode.data(),
|
||||
_focusNode.data() + nodeNameLength
|
||||
);
|
||||
|
||||
// Add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timestamp), reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_timestamp),
|
||||
reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp)
|
||||
);
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
void deserialize(const std::vector<char> &buffer) {
|
||||
int offset = 0;
|
||||
int size = 0;
|
||||
|
||||
@@ -94,7 +118,7 @@ struct CameraKeyframe {
|
||||
// Focus node
|
||||
int nodeNameLength;
|
||||
size = sizeof(int);
|
||||
memcpy(&nodeNameLength, buffer.data() + offset, size);
|
||||
memcpy(&nodeNameLength, buffer.data() + offset, size);
|
||||
offset += size;
|
||||
size = nodeNameLength;
|
||||
_focusNode = std::string(buffer.data() + offset, buffer.data() + offset + size);
|
||||
@@ -120,19 +144,39 @@ struct TimeKeyframe {
|
||||
|
||||
void serialize(std::vector<char> &buffer){
|
||||
// Add current time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_time), reinterpret_cast<char*>(&_time) + sizeof(_time));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_time),
|
||||
reinterpret_cast<char*>(&_time) + sizeof(_time)
|
||||
);
|
||||
|
||||
// Add delta time
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_dt), reinterpret_cast<char*>(&_dt) + sizeof(_dt));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_dt),
|
||||
reinterpret_cast<char*>(&_dt) + sizeof(_dt)
|
||||
);
|
||||
|
||||
// Add whether time is paused or not
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_paused), reinterpret_cast<char*>(&_paused) + sizeof(_paused));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_paused),
|
||||
reinterpret_cast<char*>(&_paused) + sizeof(_paused)
|
||||
);
|
||||
|
||||
// Add whether a time jump is necessary (recompute paths etc)
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_requiresTimeJump), reinterpret_cast<char*>(&_requiresTimeJump) + sizeof(_requiresTimeJump));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_requiresTimeJump),
|
||||
reinterpret_cast<char*>(&_requiresTimeJump) + sizeof(_requiresTimeJump)
|
||||
);
|
||||
|
||||
// Add timestamp
|
||||
buffer.insert(buffer.end(), reinterpret_cast<char*>(&_timestamp), reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp));
|
||||
buffer.insert(
|
||||
buffer.end(),
|
||||
reinterpret_cast<char*>(&_timestamp),
|
||||
reinterpret_cast<char*>(&_timestamp) + sizeof(_timestamp)
|
||||
);
|
||||
};
|
||||
|
||||
void deserialize(const std::vector<char> &buffer){
|
||||
|
||||
@@ -48,7 +48,8 @@ public:
|
||||
void sendMessages();
|
||||
|
||||
// Initial Connection Messages
|
||||
void setInitialConnectionMessage(MessageIdentifier identifier, std::vector<char> message);
|
||||
void setInitialConnectionMessage(MessageIdentifier identifier,
|
||||
std::vector<char> message);
|
||||
void sendInitialInformation();
|
||||
|
||||
// Background
|
||||
|
||||
@@ -53,8 +53,10 @@ public:
|
||||
|
||||
bool isMeasuringPerformance() const;
|
||||
|
||||
void storeIndividualPerformanceMeasurement(std::string identifier, long long nanoseconds);
|
||||
void storeScenePerformanceMeasurements(const std::vector<SceneGraphNode*>& sceneNodes);
|
||||
void storeIndividualPerformanceMeasurement(std::string identifier,
|
||||
long long nanoseconds);
|
||||
void storeScenePerformanceMeasurements(
|
||||
const std::vector<SceneGraphNode*>& sceneNodes);
|
||||
|
||||
void outputLogs();
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ class PerformanceManager;
|
||||
|
||||
class PerformanceMeasurement {
|
||||
public:
|
||||
PerformanceMeasurement(std::string identifier, performance::PerformanceManager* manager);
|
||||
PerformanceMeasurement(std::string identifier,
|
||||
performance::PerformanceManager* manager);
|
||||
~PerformanceMeasurement();
|
||||
|
||||
private:
|
||||
|
||||
@@ -34,9 +34,10 @@ class NumericalProperty : public TemplateProperty<T> {
|
||||
public:
|
||||
NumericalProperty(Property::PropertyInfo info);
|
||||
NumericalProperty(Property::PropertyInfo info, T value);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue, T maximumValue);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue, T maximumValue,
|
||||
T steppingValue);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue,
|
||||
T maximumValue);
|
||||
NumericalProperty(Property::PropertyInfo info, T value, T minimumValue,
|
||||
T maximumValue, T steppingValue);
|
||||
|
||||
bool getLuaValue(lua_State* state) const override;
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
|
||||
@@ -141,27 +141,27 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* lua, \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(state, success); \
|
||||
return FROM_LUA_LAMBDA_EXPRESSION(lua, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* state, \
|
||||
bool& success) \
|
||||
TYPE PropertyDelegate<NumericalProperty<TYPE>>::fromLuaValue<TYPE>(lua_State* lua, \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::fromLuaValue<TYPE>( \
|
||||
state, success); \
|
||||
lua, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* state, \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toLuaValue<TYPE>(lua_State* lua, \
|
||||
TYPE value) \
|
||||
{ \
|
||||
return TO_LUA_LAMBDA_EXPRESSION(state, value); \
|
||||
return TO_LUA_LAMBDA_EXPRESSION(lua, value); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
@@ -187,9 +187,9 @@ namespace openspace::properties {
|
||||
template <> \
|
||||
template <> \
|
||||
TYPE PropertyDelegate<TemplateProperty<TYPE>>::fromString(std::string value, \
|
||||
bool& success) \
|
||||
bool& successful) \
|
||||
{ \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, success); \
|
||||
return FROM_STRING_LAMBDA_EXPRESSION(value, successful); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
@@ -205,18 +205,18 @@ namespace openspace::properties {
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& outValue, \
|
||||
TYPE inValue) \
|
||||
bool PropertyDelegate<TemplateProperty<TYPE>>::toString(std::string& out, \
|
||||
TYPE in) \
|
||||
{ \
|
||||
return TO_STRING_LAMBDA_EXPRESSION(outValue, inValue); \
|
||||
return TO_STRING_LAMBDA_EXPRESSION(out, in); \
|
||||
} \
|
||||
\
|
||||
template <> \
|
||||
template <> \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toString(std::string& outValue, \
|
||||
TYPE inValue) \
|
||||
bool PropertyDelegate<NumericalProperty<TYPE>>::toString(std::string& out, \
|
||||
TYPE in) \
|
||||
{ \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toString(outValue, inValue); \
|
||||
return PropertyDelegate<TemplateProperty<TYPE>>::toString(out, in); \
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ const std::string NumericalProperty<T>::SteppingValueKey = "SteppingValue";
|
||||
|
||||
// Delegating constructors are necessary; automatic template deduction cannot
|
||||
// deduce template argument for 'U' if 'default' methods are used as default values in
|
||||
// a single constructor
|
||||
// a single constructor
|
||||
|
||||
template <typename T>
|
||||
NumericalProperty<T>::NumericalProperty(Property::PropertyInfo info)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
namespace openspace::properties {
|
||||
|
||||
/**
|
||||
* The OptionProperty is a property that provides a number of predefined (using the
|
||||
* The OptionProperty is a property that provides a number of predefined (using the
|
||||
* addOption method) options consisting of a <code>description</code> and a
|
||||
* <code>value</code>. The available options can be queried using the options method.
|
||||
* Only values representing valid options can be used to set this property, or an error
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
|
||||
/**
|
||||
* Get the description of the option that matches <code>value</code>
|
||||
* \param value The value of the option
|
||||
* \param value The value of the option
|
||||
*/
|
||||
std::string getDescriptionByValue(int value);
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
Visibility visibility = Visibility::All;
|
||||
};
|
||||
|
||||
/// An OnChangeHandle is returned by the onChange method to uniquely identify an
|
||||
/// An OnChangeHandle is returned by the onChange method to uniquely identify an
|
||||
/// onChange callback
|
||||
using OnChangeHandle = uint32_t;
|
||||
|
||||
@@ -102,7 +102,7 @@ public:
|
||||
* to be accessed by the GUI elements using the <code>guiName</code> key. The default
|
||||
* visibility settings is Visibility::All, whereas the default read-only state is
|
||||
* <code>false</code>.
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* \param info The PropertyInfo structure that contains all the required static
|
||||
* information for initializing this Property.
|
||||
* \pre \p info.identifier must not be empty
|
||||
* \pre \p info.guiName must not be empty
|
||||
@@ -399,7 +399,7 @@ protected:
|
||||
* <code>generateAdditionalDescription()}</code>, which #generateMetaDataDescription
|
||||
* and this method being the override points to customize the behavior.
|
||||
* \return The information specific to each subclass of Property
|
||||
*/
|
||||
*/
|
||||
virtual std::string generateAdditionalDescription() const;
|
||||
|
||||
/**
|
||||
@@ -409,7 +409,7 @@ protected:
|
||||
void notifyListener();
|
||||
|
||||
/// The PropetyOwner this Property belongs to, or <code>nullptr</code>
|
||||
PropertyOwner* _owner;
|
||||
PropertyOwner* _owner;
|
||||
|
||||
/// The identifier for this Property
|
||||
std::string _identifier;
|
||||
|
||||
@@ -39,7 +39,7 @@ class Property;
|
||||
* sub-owners must be unique to this PropertyOwner. A Property cannot have the same name
|
||||
* as a PropertyOwner owned by this PropertyOwner.
|
||||
* Propertys can be added using the Property::addProperty methods and be removed by the
|
||||
* Property::removeProperty method. The same holds true for sub-owners
|
||||
* Property::removeProperty method. The same holds true for sub-owners
|
||||
* (Property::addPropertySubOwner, Property::removePropertySubOwner). These methods will
|
||||
* inform the passed object about the new ownership automatically.
|
||||
* Stored properties can be accessed using the Property::properties method or the
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
void addTag(std::string tag);
|
||||
|
||||
/**
|
||||
* Removes a tag from this PropertyOwner. No error is reported if the tag does not
|
||||
* Removes a tag from this PropertyOwner. No error is reported if the tag does not
|
||||
* exist
|
||||
* @param tag The tag is that is to be removed from this PropertyOwner
|
||||
*/
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file boolproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class BoolProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file charproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class CharProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file doubleproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class DoubleProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file floatproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class FloatProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file intproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class IntProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file longdoubleproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class LongDoubleProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file longlongproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class LongLongProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file longproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class LongProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file shortproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class ShortProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file signedcharproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class SignedCharProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file ucharproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class UCharProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file uintproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class UIntProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file ulonglongproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class ULongLongProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file ulongproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class ULongProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file ushortproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class UShortProperty
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
/**
|
||||
* \file wcharproperty.h
|
||||
*
|
||||
* \addtogroup openspace
|
||||
* \addtogroup openspace
|
||||
* @{
|
||||
* \addtogroup properties
|
||||
* \addtogroup properties
|
||||
* @{
|
||||
|
||||
* \class WCharProperty
|
||||
|
||||
@@ -63,22 +63,26 @@ std::string PropertyDelegate<TemplateProperty<std::vector<int>>>::className();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(lua_State* state, bool& success);
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromLuaValue(
|
||||
lua_State* state, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(lua_State* state, std::vector<int> value);
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toLuaValue(
|
||||
lua_State* state, std::vector<int> value);
|
||||
|
||||
template <>
|
||||
int PropertyDelegate<TemplateProperty<std::vector<int>>>::typeLua();
|
||||
|
||||
template <>
|
||||
template <>
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromString(std::string value, bool& success);
|
||||
std::vector<int> PropertyDelegate<TemplateProperty<std::vector<int>>>::fromString(
|
||||
std::string value, bool& success);
|
||||
|
||||
template <>
|
||||
template <>
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(std::string& outValue, std::vector<int> inValue);
|
||||
bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(
|
||||
std::string& outValue, std::vector<int> inValue);
|
||||
|
||||
} // namespace openspace::properties
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ namespace openspace::properties {
|
||||
// The following macros can be used to quickly generate the necessary PropertyDelegate
|
||||
// specializations required by the TemplateProperty class. Use the
|
||||
// REGISTER_TEMPLATEPROPERTY_HEADER macro in the header file and the
|
||||
// REGISTER_TEMPLATEPROPERTY_SOURCE macro in the source file of your new specialization of
|
||||
// a TemplateProperty
|
||||
// REGISTER_TEMPLATEPROPERTY_SOURCE macro in the source file of your new
|
||||
// specialization of a TemplateProperty
|
||||
|
||||
|
||||
// CLASS_NAME = The string that the Property::className() should return as well as the
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
/**
|
||||
* Accepts only the <code>LUA_TNIL</code> type and will notify all the listeners
|
||||
* that the event has been triggered.
|
||||
* \param state The unused Lua state
|
||||
* \param state The unused Lua state
|
||||
* \return Returns always <code>true</code>
|
||||
*/
|
||||
bool setLuaValue(lua_State* state) override;
|
||||
|
||||
@@ -109,9 +109,11 @@ private:
|
||||
* The _volumes map keeps track of which volumes that can
|
||||
* be rendered using the current resolve program, along with their raycast data
|
||||
* (id, namespace, etc)
|
||||
*/
|
||||
*/
|
||||
std::map<VolumeRaycaster*, RaycastData> _raycastData;
|
||||
std::map<VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>> _boundsPrograms;
|
||||
std::map<
|
||||
VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>
|
||||
> _boundsPrograms;
|
||||
std::vector<std::string> _helperPaths;
|
||||
|
||||
ghoul::Dictionary _resolveDictionary;
|
||||
|
||||
@@ -78,9 +78,15 @@ public:
|
||||
|
||||
private:
|
||||
std::map<VolumeRaycaster*, RaycastData> _raycastData;
|
||||
std::map<VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>> _exitPrograms;
|
||||
std::map<VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>> _raycastPrograms;
|
||||
std::map<VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>> _insideRaycastPrograms;
|
||||
std::map<
|
||||
VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>
|
||||
> _exitPrograms;
|
||||
std::map<
|
||||
VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>
|
||||
> _raycastPrograms;
|
||||
std::map<
|
||||
VolumeRaycaster*, std::unique_ptr<ghoul::opengl::ProgramObject>
|
||||
> _insideRaycastPrograms;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _resolveProgram;
|
||||
|
||||
|
||||
138
include/openspace/rendering/loadingscreen.h
Normal file
138
include/openspace/rendering/loadingscreen.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2017 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __OPENSPACE_CORE___LOADINGSCREEN___H__
|
||||
#define __OPENSPACE_CORE___LOADINGSCREEN___H__
|
||||
|
||||
#include <ghoul/glm.h>
|
||||
#include <ghoul/misc/boolean.h>
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
|
||||
// #define LOADINGSCREEN_DEBUGGING
|
||||
|
||||
namespace ghoul::fontrendering {
|
||||
class Font;
|
||||
} // namespace ghoul::fontrendering
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class LoadingScreen {
|
||||
public:
|
||||
using ShowMessage = ghoul::Boolean;
|
||||
using ShowNodeNames = ghoul::Boolean;
|
||||
using ShowProgressbar = ghoul::Boolean;
|
||||
|
||||
LoadingScreen(ShowMessage showMessage, ShowNodeNames showNodeNames,
|
||||
ShowProgressbar showProgressbar);
|
||||
~LoadingScreen();
|
||||
|
||||
void render();
|
||||
|
||||
void postMessage(std::string message);
|
||||
|
||||
void finalize();
|
||||
|
||||
void setItemNumber(int nItems);
|
||||
void tickItem();
|
||||
|
||||
enum class Phase {
|
||||
Construction,
|
||||
Initialization
|
||||
};
|
||||
void setPhase(Phase phase);
|
||||
|
||||
|
||||
enum class ItemStatus {
|
||||
Started,
|
||||
Initializing,
|
||||
Finished,
|
||||
Failed
|
||||
};
|
||||
|
||||
void updateItem(const std::string& itemName, ItemStatus newStatus);
|
||||
|
||||
private:
|
||||
bool _showMessage;
|
||||
bool _showNodeNames;
|
||||
bool _showProgressbar;
|
||||
|
||||
Phase _phase;
|
||||
int _iProgress;
|
||||
int _nItems;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _program;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _logoTexture;
|
||||
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _loadingFont;
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _messageFont;
|
||||
std::shared_ptr<ghoul::fontrendering::Font> _itemFont;
|
||||
|
||||
struct {
|
||||
GLuint vao;
|
||||
GLuint vbo;
|
||||
} _logo;
|
||||
|
||||
struct {
|
||||
GLuint vaoFill;
|
||||
GLuint vboFill;
|
||||
|
||||
GLuint vaoBox;
|
||||
GLuint vboBox;
|
||||
} _progressbar;
|
||||
|
||||
std::string _message;
|
||||
std::mutex _messageMutex;
|
||||
|
||||
struct Item {
|
||||
std::string name;
|
||||
ItemStatus status;
|
||||
|
||||
bool hasLocation;
|
||||
#ifdef LOADINGSCREEN_DEBUGGING
|
||||
bool exhaustedSearch;
|
||||
#endif // LOADINGSCREEN_DEBUGGING
|
||||
glm::vec2 ll;
|
||||
glm::vec2 ur;
|
||||
|
||||
std::chrono::system_clock::time_point finishedTime;
|
||||
};
|
||||
std::vector<Item> _items;
|
||||
std::mutex _itemsMutex;
|
||||
|
||||
std::random_device _randomDevice;
|
||||
std::default_random_engine _randomEngine;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___LOADINGSCREEN___H__
|
||||
@@ -42,7 +42,7 @@ struct UpdateData;
|
||||
struct RendererTasks;
|
||||
struct SurfacePositionHandle;
|
||||
|
||||
namespace documentation { struct Documentation; }
|
||||
namespace documentation { struct Documentation; }
|
||||
|
||||
// Forward declare to minimize dependencies
|
||||
|
||||
@@ -58,14 +58,17 @@ public:
|
||||
Overlay = 8
|
||||
};
|
||||
|
||||
static std::unique_ptr<Renderable> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static std::unique_ptr<Renderable> createFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
// constructors & destructor
|
||||
Renderable(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Renderable();
|
||||
|
||||
virtual void initialize();
|
||||
virtual void initializeGL();
|
||||
virtual void deinitialize();
|
||||
virtual void deinitializeGL();
|
||||
|
||||
virtual bool isReady() const = 0;
|
||||
bool isEnabled() const;
|
||||
@@ -89,7 +92,8 @@ public:
|
||||
|
||||
void onEnabledChange(std::function<void(bool)> callback);
|
||||
|
||||
static void setPscUniforms(ghoul::opengl::ProgramObject& program, const Camera& camera, const PowerScaledCoordinate& position);
|
||||
static void setPscUniforms(ghoul::opengl::ProgramObject& program,
|
||||
const Camera& camera, const PowerScaledCoordinate& position);
|
||||
|
||||
static documentation::Documentation Documentation();
|
||||
|
||||
|
||||
@@ -127,7 +127,8 @@ public:
|
||||
|
||||
std::string progressToStr(int size, double t);
|
||||
|
||||
void removeRenderProgram(const std::unique_ptr<ghoul::opengl::ProgramObject>& program);
|
||||
void removeRenderProgram(
|
||||
const std::unique_ptr<ghoul::opengl::ProgramObject>& program);
|
||||
|
||||
/**
|
||||
* Set raycasting uniforms on the program object, and setup raycasting.
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
/**
|
||||
* The base class for screen space images and screen space framebuffers.
|
||||
* This base class handles general functionality specific to planes that are rendered in
|
||||
* This base class handles general functionality specific to planes that are rendered in
|
||||
* front of the camera. It implements protected methods and properties for converting
|
||||
* the planes from Spherical to Euclidean coordinates and back. It also specifies the
|
||||
* interface that its children need to implement.
|
||||
@@ -60,7 +60,10 @@ public:
|
||||
virtual void render();
|
||||
|
||||
virtual bool initialize();
|
||||
virtual bool initializeGL();
|
||||
virtual bool deinitialize();
|
||||
virtual bool deinitializeGL();
|
||||
|
||||
virtual void update() = 0;
|
||||
virtual bool isReady() const;
|
||||
bool isEnabled() const;
|
||||
@@ -79,7 +82,7 @@ protected:
|
||||
* Converts Spherical coordinates to Euclidean.
|
||||
* \param spherical The coordinates theta and phi
|
||||
* \param radius The radius position value of the plane
|
||||
* \return The x and y position value of the plane
|
||||
* \return The x and y position value of the plane
|
||||
*/
|
||||
glm::vec2 toEuclidean(const glm::vec2& spherical, float radius);
|
||||
|
||||
|
||||
@@ -38,7 +38,8 @@ class TransferFunction {
|
||||
public:
|
||||
typedef std::function<void (const TransferFunction&)> TfChangedCallback;
|
||||
|
||||
TransferFunction(const std::string& filepath, TfChangedCallback tfChangedCallback = TfChangedCallback());
|
||||
TransferFunction(const std::string& filepath,
|
||||
TfChangedCallback tfChangedCallback = TfChangedCallback());
|
||||
void setPath(const std::string& filepath);
|
||||
ghoul::opengl::Texture& getTexture();
|
||||
void bind();
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
Volume() {};
|
||||
Volume() {};
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
@@ -50,16 +50,19 @@ public:
|
||||
/**
|
||||
* Render the volume's entry points (front face of the bounding geometry)
|
||||
*/
|
||||
//virtual void renderEntryPoints(const RenderData& data, ghoul::opengl::ProgramObject* program) = 0;
|
||||
//virtual void renderEntryPoints(const RenderData& data,
|
||||
// ghoul::opengl::ProgramObject* program) = 0;
|
||||
|
||||
/**
|
||||
* Render the volume's exit points (back face of the bounding geometry)
|
||||
*/
|
||||
//virtual void renderExitPoints(const RenderData& data, ghoul::opengl::ProgramObject* program) = 0;
|
||||
//virtual void renderExitPoints(const RenderData& data,
|
||||
// ghoul::opengl::ProgramObject* program) = 0;
|
||||
|
||||
/**
|
||||
* Prepare the volume for the ABuffer's resolve step.
|
||||
* Make sure textures are up to date, bind them to texture units, set program uniforms etc.
|
||||
* Make sure textures are up to date, bind them to texture units, set program uniforms
|
||||
* etc.
|
||||
*/
|
||||
//virtual void preRayCast(ghoul::opengl::ProgramObject* program) {};
|
||||
|
||||
@@ -76,22 +79,22 @@ public:
|
||||
*
|
||||
* The shader preprocessor will have acceess to
|
||||
* A #{namespace} variable (unique per helper file)
|
||||
*
|
||||
*
|
||||
* Should define the function:
|
||||
* vec4 getVertex()
|
||||
*/
|
||||
//virtual std::string getBoundsVsPath() = 0;
|
||||
|
||||
/*
|
||||
* Return a path to a file with the functions, uniforms and fragment shader in variables
|
||||
* required to generate the fragment color and depth.
|
||||
* Return a path to a file with the functions, uniforms and fragment shader in
|
||||
* variables required to generate the fragment color and depth.
|
||||
*
|
||||
* Should define the function:
|
||||
* Fragment getFragment()
|
||||
*
|
||||
*
|
||||
* The shader preprocessor will have acceess to
|
||||
* A #{namespace} variable (unique per helper file)
|
||||
*/
|
||||
*/
|
||||
//virtual std::string getBoundsFsPath() = 0;
|
||||
|
||||
/**
|
||||
@@ -99,7 +102,8 @@ public:
|
||||
* required to perform ray casting through this volume.
|
||||
*
|
||||
* The header should define the following two functions:
|
||||
* vec4 sampler#{id}(vec3 samplePos, vec3 dir, float occludingAlpha, inout float maxStepSize)
|
||||
* vec4 sampler#{id}(vec3 samplePos, vec3 dir, float occludingAlpha,
|
||||
* inout float maxStepSize)
|
||||
* (return color of sample)
|
||||
* float stepSize#{id}(vec3 samplePos, vec3 dir)
|
||||
* (return the preferred step size at this sample position)
|
||||
@@ -116,9 +120,9 @@ public:
|
||||
* This file will be included once per shader program generated,
|
||||
* regardless of how many volumes say they require the file.
|
||||
* Ideal to avoid redefinitions of helper functions.
|
||||
*
|
||||
* The shader preprocessor will have access to the #{namespace} variable (unique per helper file)
|
||||
* which should be a prefix to all symbols defined by the helper
|
||||
*
|
||||
* The shader preprocessor will have access to the #{namespace} variable (unique per
|
||||
* helper file) which should be a prefix to all symbols defined by the helper
|
||||
*/
|
||||
//virtual std::string getHelperPath() = 0;
|
||||
|
||||
|
||||
@@ -49,30 +49,37 @@ public:
|
||||
/**
|
||||
* Render the volume's entry points (front face of the bounding geometry)
|
||||
*/
|
||||
virtual void renderEntryPoints(const RenderData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) = 0;
|
||||
virtual void renderEntryPoints(const RenderData& /*data*/,
|
||||
ghoul::opengl::ProgramObject& /*program*/) = 0;
|
||||
|
||||
/**
|
||||
* Render the volume's exit points (back face of the bounding geometry)
|
||||
*/
|
||||
virtual void renderExitPoints(const RenderData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) = 0;
|
||||
virtual void renderExitPoints(const RenderData& /*data*/,
|
||||
ghoul::opengl::ProgramObject& /*program*/) = 0;
|
||||
|
||||
/**
|
||||
* Prepare the volume for the ABuffer's resolve step.
|
||||
* Make sure textures are up to date, bind them to texture units, set program uniforms etc.
|
||||
* Make sure textures are up to date, bind them to texture units, set program uniforms
|
||||
* etc.
|
||||
*/
|
||||
virtual void preRaycast(const RaycastData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) {};
|
||||
virtual void preRaycast(const RaycastData& /*data*/,
|
||||
ghoul::opengl::ProgramObject& /*program*/) {};
|
||||
|
||||
/**
|
||||
* Clean up for the volume after the ABuffer's resolve step.
|
||||
* Make sure texture units are deinitialized, etc.
|
||||
*/
|
||||
virtual void postRaycast(const RaycastData& /*data*/, ghoul::opengl::ProgramObject& /*program*/) {};
|
||||
virtual void postRaycast(const RaycastData& /*data*/,
|
||||
ghoul::opengl::ProgramObject& /*program*/) {};
|
||||
|
||||
/**
|
||||
* Return true if the camera is inside the volume.
|
||||
* Also set localPosition to the camera position in the volume's local coordainte system.
|
||||
* Also set localPosition to the camera position in the volume's local coordinate
|
||||
* system.
|
||||
*/
|
||||
virtual bool cameraIsInside(const RenderData& /*data*/, glm::vec3& /*localPosition*/) { return false; };
|
||||
virtual bool cameraIsInside(const RenderData& /*data*/,
|
||||
glm::vec3& /*localPosition*/) { return false; };
|
||||
|
||||
/**
|
||||
* Return a path the file to use as vertex shader
|
||||
@@ -83,15 +90,15 @@ public:
|
||||
virtual std::string getBoundsVsPath() const = 0;
|
||||
|
||||
/*
|
||||
* Return a path to a file with the functions, uniforms and fragment shader in variables
|
||||
* required to generate the fragment color and depth.
|
||||
* Return a path to a file with the functions, uniforms and fragment shader in
|
||||
* variables required to generate the fragment color and depth.
|
||||
*
|
||||
* Should define the function:
|
||||
* Fragment getFragment()
|
||||
*
|
||||
*
|
||||
* The shader preprocessor will have acceess to
|
||||
* A #{namespace} variable (unique per helper file)
|
||||
*/
|
||||
*/
|
||||
virtual std::string getBoundsFsPath() const = 0 ;
|
||||
|
||||
/**
|
||||
@@ -99,7 +106,8 @@ public:
|
||||
* required to perform ray casting through this volume.
|
||||
*
|
||||
* The header should define the following two functions:
|
||||
* vec4 sample#{id}(vec3 samplePos, vec3 dir, float occludingAlpha, inout float maxStepSize)
|
||||
* vec4 sample#{id}(vec3 samplePos, vec3 dir, float occludingAlpha,
|
||||
* inout float maxStepSize)
|
||||
* (return color of sample)
|
||||
* float stepSize#{id}(vec3 samplePos, vec3 dir)
|
||||
* (return the preferred step size at this sample position)
|
||||
@@ -116,13 +124,13 @@ public:
|
||||
* This file will be included once per shader program generated,
|
||||
* regardless of how many volumes say they require the file.
|
||||
* Ideal to avoid redefinitions of helper functions.
|
||||
*
|
||||
* The shader preprocessor will have access to the #{namespace} variable (unique per helper file)
|
||||
* which should be a prefix to all symbols defined by the helper
|
||||
*
|
||||
* The shader preprocessor will have access to the #{namespace} variable (unique per
|
||||
* helper file) which should be a prefix to all symbols defined by the helper
|
||||
*/
|
||||
virtual std::string getHelperPath() const = 0;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_CORE___VOLUMERAYCASTER___H__
|
||||
#endif // __OPENSPACE_CORE___VOLUMERAYCASTER___H__
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
class Rotation : public properties::PropertyOwner {
|
||||
public:
|
||||
static std::unique_ptr<Rotation> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static std::unique_ptr<Rotation> createFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
Rotation(const ghoul::Dictionary& dictionary);
|
||||
virtual ~Rotation() = default;
|
||||
|
||||
@@ -41,7 +41,8 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
class Scale : public properties::PropertyOwner {
|
||||
public:
|
||||
static std::unique_ptr<Scale> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static std::unique_ptr<Scale> createFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
Scale();
|
||||
virtual ~Scale() = default;
|
||||
|
||||
@@ -61,7 +61,8 @@ public:
|
||||
* \param component The optional compoment that caused this exception to be thrown
|
||||
* \pre message may not be empty
|
||||
*/
|
||||
explicit InvalidSceneError(const std::string& message, const std::string& component = "");
|
||||
explicit InvalidSceneError(const std::string& message,
|
||||
const std::string& component = "");
|
||||
};
|
||||
|
||||
// constructors & destructor
|
||||
@@ -72,6 +73,12 @@ public:
|
||||
* Initalizes the SceneGraph
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
* Initializes the OpenGL part of the SceneGraph
|
||||
*/
|
||||
void initializeGL();
|
||||
|
||||
|
||||
/**
|
||||
* Clear the scene graph,
|
||||
@@ -118,12 +125,14 @@ public:
|
||||
/**
|
||||
* Add a node and all its children to the scene.
|
||||
*/
|
||||
void addNode(SceneGraphNode* node, UpdateDependencies updateDeps = UpdateDependencies::Yes);
|
||||
void addNode(SceneGraphNode* node,
|
||||
UpdateDependencies updateDeps = UpdateDependencies::Yes);
|
||||
|
||||
/**
|
||||
* Remove a node and all its children from the scene.
|
||||
*/
|
||||
void removeNode(SceneGraphNode* node, UpdateDependencies updateDeps = UpdateDependencies::Yes);
|
||||
void removeNode(SceneGraphNode* node,
|
||||
UpdateDependencies updateDeps = UpdateDependencies::Yes);
|
||||
|
||||
void addSceneLicense(SceneLicense license);
|
||||
|
||||
|
||||
@@ -73,10 +73,13 @@ public:
|
||||
SceneGraphNode();
|
||||
~SceneGraphNode();
|
||||
|
||||
static std::unique_ptr<SceneGraphNode> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static std::unique_ptr<SceneGraphNode> createFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
void initialize();
|
||||
void initializeGL();
|
||||
void deinitialize();
|
||||
void deinitializeGL();
|
||||
|
||||
void traversePreOrder(std::function<void(SceneGraphNode*)> fn);
|
||||
void traversePostOrder(std::function<void(SceneGraphNode*)> fn);
|
||||
@@ -84,16 +87,21 @@ public:
|
||||
void render(const RenderData& data, RendererTasks& tasks);
|
||||
void updateCamera(Camera* camera) const;
|
||||
|
||||
void attachChild(std::unique_ptr<SceneGraphNode> child, UpdateScene updateScene = UpdateScene::Yes);
|
||||
std::unique_ptr<SceneGraphNode> detachChild(SceneGraphNode& child, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void attachChild(std::unique_ptr<SceneGraphNode> child,
|
||||
UpdateScene updateScene = UpdateScene::Yes);
|
||||
std::unique_ptr<SceneGraphNode> detachChild(SceneGraphNode& child,
|
||||
UpdateScene updateScene = UpdateScene::Yes);
|
||||
void setParent(SceneGraphNode& parent, UpdateScene updateScene = UpdateScene::Yes);
|
||||
|
||||
void addDependency(SceneGraphNode& dependency, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void removeDependency(SceneGraphNode& dependency, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void addDependency(SceneGraphNode& dependency,
|
||||
UpdateScene updateScene = UpdateScene::Yes);
|
||||
void removeDependency(SceneGraphNode& dependency,
|
||||
UpdateScene updateScene = UpdateScene::Yes);
|
||||
void clearDependencies(UpdateScene updateScene = UpdateScene::Yes);
|
||||
void setDependencies(const std::vector<SceneGraphNode*>& dependencies, UpdateScene updateScene = UpdateScene::Yes);
|
||||
void setDependencies(const std::vector<SceneGraphNode*>& dependencies,
|
||||
UpdateScene updateScene = UpdateScene::Yes);
|
||||
SurfacePositionHandle calculateSurfacePositionHandle(
|
||||
const glm::dvec3& targetModelSpace);
|
||||
const glm::dvec3& targetModelSpace);
|
||||
|
||||
const std::vector<SceneGraphNode*>& dependencies() const;
|
||||
const std::vector<SceneGraphNode*>& dependentNodes() const;
|
||||
|
||||
@@ -59,7 +59,8 @@ public:
|
||||
/**
|
||||
* Import a scene graph node from a dictionary into an existing scene.
|
||||
*/
|
||||
SceneGraphNode* importNodeDictionary(Scene& scene, const ghoul::Dictionary& dictionary);
|
||||
SceneGraphNode* importNodeDictionary(Scene& scene,
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
private:
|
||||
struct LoadedNode {
|
||||
@@ -99,7 +100,8 @@ private:
|
||||
/**
|
||||
* Load a mod file.
|
||||
*/
|
||||
std::vector<SceneLoader::LoadedNode> loadModule(const std::string& path, lua_State* luaState);
|
||||
std::vector<SceneLoader::LoadedNode> loadModule(const std::string& path,
|
||||
lua_State* luaState);
|
||||
|
||||
/**
|
||||
* Loads an existing license file
|
||||
@@ -120,7 +122,8 @@ private:
|
||||
/**
|
||||
* Add loaded nodes to an existing scene
|
||||
*/
|
||||
std::vector<SceneGraphNode*> addLoadedNodes(Scene& scene, std::vector<SceneLoader::LoadedNode>&& nodes);
|
||||
std::vector<SceneGraphNode*> addLoadedNodes(Scene& scene,
|
||||
std::vector<SceneLoader::LoadedNode>&& nodes);
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -42,7 +42,8 @@ namespace documentation { struct Documentation; }
|
||||
|
||||
class Translation : public properties::PropertyOwner {
|
||||
public:
|
||||
static std::unique_ptr<Translation> createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
static std::unique_ptr<Translation> createFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
|
||||
Translation();
|
||||
virtual ~Translation() = default;
|
||||
|
||||
@@ -91,11 +91,6 @@ public:
|
||||
|
||||
std::vector<std::string> allLuaFunctions() const;
|
||||
|
||||
//parallel functions
|
||||
//bool parseLibraryAndFunctionNames(std::string &library, std::string &function, const std::string &script);
|
||||
//bool shouldScriptBeSent(const std::string &library, const std::string &function);
|
||||
//void cacheScript(const std::string &library, const std::string &function, const std::string &script);
|
||||
|
||||
static std::string OpenSpaceLibraryName;
|
||||
|
||||
private:
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace openspace::documentation { struct Documentation; }
|
||||
namespace openspace::scripting {
|
||||
|
||||
/**
|
||||
* Maintains an ordered list of <code>ScheduledScript</code>s and provides a simple
|
||||
* Maintains an ordered list of <code>ScheduledScript</code>s and provides a simple
|
||||
* interface for retrieveing scheduled scripts
|
||||
*/
|
||||
class ScriptScheduler {
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
void clearSchedule();
|
||||
|
||||
/**
|
||||
* Progresses the script schedulers time and returns all scripts that has been
|
||||
* scheduled to run between \param newTime and the time provided in the last invocation
|
||||
* Progresses the script schedulers time and returns all scripts that has been
|
||||
* scheduled to run between \param newTime and the time provided in the last invocation
|
||||
* of this method.
|
||||
*
|
||||
* \param newTime A j2000 time value specifying the new time stamp that
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
> progressTo(double newTime);
|
||||
|
||||
/**
|
||||
* Returns the the j2000 time value that the script scheduler is currently at
|
||||
* Returns the the j2000 time value that the script scheduler is currently at
|
||||
*/
|
||||
double currentTime() const;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ struct Job {
|
||||
virtual std::shared_ptr<P> product() = 0;
|
||||
};
|
||||
|
||||
/*
|
||||
/*
|
||||
* Templated Concurrent Job Manager
|
||||
* This class is used execute specific jobs on one (1) parallell thread
|
||||
*/
|
||||
|
||||
@@ -41,7 +41,7 @@ class UniformLocation {
|
||||
public:
|
||||
|
||||
/**
|
||||
* Updates the uniform location of the uniform variable named <name>
|
||||
* Updates the uniform location of the uniform variable named <name>
|
||||
* in the provided shader program.
|
||||
*/
|
||||
void bind(ghoul::opengl::ProgramObject* program, const std::string& name);
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
|
||||
/**
|
||||
* Manages a GPU representation of the templated data type T.
|
||||
* This class provides a simple interface setting the value of
|
||||
* This class provides a simple interface setting the value of
|
||||
* the binded GLSL variable.
|
||||
*/
|
||||
template<typename T>
|
||||
@@ -71,13 +71,13 @@ public:
|
||||
|
||||
/**
|
||||
* Manages a Texture on the GPU.
|
||||
* This class provides a simple interface binding texture to the
|
||||
* This class provides a simple interface binding texture to the
|
||||
* named uniform.
|
||||
*/
|
||||
class GPUTexture : public UniformLocation{
|
||||
public:
|
||||
/**
|
||||
* Sets and assignes a texture unit within the provided shader
|
||||
* Sets and assignes a texture unit within the provided shader
|
||||
* program.
|
||||
* OBS! Users must ensure bind has been called before using this method.
|
||||
*/
|
||||
|
||||
@@ -49,10 +49,10 @@ public:
|
||||
* Enter value into the histogram. The add method takes the given
|
||||
* value, works out which bin this corresponds to, and increments
|
||||
* this bin by 'repeat'.
|
||||
*
|
||||
*
|
||||
* @param value The Value to insert into the histogram
|
||||
* @param repeat How many times you want to insert it
|
||||
*
|
||||
*
|
||||
* @return Returns true if succesful insertion, otherwise return false
|
||||
*/
|
||||
bool add(float value, float repeat = 1.0f);
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace documentation { struct Documentation; }
|
||||
class OpenSpaceModule : public properties::PropertyOwner {
|
||||
public:
|
||||
/**
|
||||
* Constructs the OpenSpaceModule with a specific \p name. The uniqueness of the
|
||||
* Constructs the OpenSpaceModule with a specific \p name. The uniqueness of the
|
||||
* \p name will be checked at a later stage.
|
||||
* \param name The name of this OpenSpace module
|
||||
* \pre \p name must not be empty
|
||||
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
LightTime, ///< One-way light time (<code>LT</code>)
|
||||
LightTimeStellar, ///< One-way light time and stellar (<code>LT+S</code>)
|
||||
ConvergedNewtonian, ///< Converged newtonian light time (<code>CN</code>)
|
||||
ConvergedNewtonianStellar ///< Converged newtonian + stellar (<code>CN+S</code>)
|
||||
ConvergedNewtonianStellar ///< Converged newtonian+stellar (<code>CN+S</code>)
|
||||
};
|
||||
/// The direction of the aberration correct
|
||||
enum class Direction {
|
||||
@@ -630,7 +630,7 @@ public:
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the state vector (position and velocity) of a \p target body relative to an
|
||||
* Returns the state vector (position and velocity) of a \p target body relative to an
|
||||
* \p observer in a specific \p referenceFrame, optionally corrected for aberration
|
||||
* (\p aberrationCorrection).
|
||||
* \param target The target body name or the target body's NAIF ID
|
||||
@@ -660,7 +660,7 @@ public:
|
||||
const std::string& observer, const std::string& referenceFrame,
|
||||
AberrationCorrection aberrationCorrection, double ephemerisTime) const;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Returns the state transformation matrix used to convert from the \p sourceFrame to
|
||||
* the \p destinationFrame at a specific \p ephemerisTime.
|
||||
* \param sourceFrame The name of the source reference frame
|
||||
@@ -824,7 +824,7 @@ public:
|
||||
bool addFrame(std::string body, std::string frame);
|
||||
|
||||
/**
|
||||
* This function returns the frame of a body if defined, otherwise it returns
|
||||
* This function returns the frame of a body if defined, otherwise it returns
|
||||
* IAU_ + body (most frames are known by the International Astronomical Union)
|
||||
* \param body - the name of the body
|
||||
* \return the frame of the body
|
||||
@@ -833,7 +833,7 @@ public:
|
||||
std::string frameFromBody(const std::string& body) const;
|
||||
|
||||
/**
|
||||
* Sets the SpiceManager's exception handling. If UseException::No is passed to this
|
||||
* Sets the SpiceManager's exception handling. If UseException::No is passed to this
|
||||
* function, all subsequent calls will not throw an error, but fail silently instead.
|
||||
* If set to UseException::Yes, a SpiceException is thrown whenever an error occurs.
|
||||
* \param useException The new exeception handling method that the SpiceManager should
|
||||
@@ -896,7 +896,8 @@ private:
|
||||
* position will be retrieved. If the coverage has ended, the last position will be
|
||||
* retrieved. If \p time is in a coverage gap, the position will be interpolated.
|
||||
* \param target The body which is missing SPK data for this time
|
||||
* \param observer The observer. The position will be retrieved in relation to this body
|
||||
* \param observer The observer. The position will be retrieved in relation to this
|
||||
* body
|
||||
* \param referenceFrame The reference frame of the output position vector
|
||||
* \param aberrationCorrection The aberration correction used for the position
|
||||
* calculation
|
||||
|
||||
@@ -52,7 +52,11 @@ public:
|
||||
ghoul_assert(_encodeOffset + size < _n, "");
|
||||
|
||||
int32_t length = static_cast<int32_t>(s.length());
|
||||
memcpy(_dataStream.data() + _encodeOffset, reinterpret_cast<const char*>(&length), sizeof(int32_t));
|
||||
memcpy(
|
||||
_dataStream.data() + _encodeOffset,
|
||||
reinterpret_cast<const char*>(&length),
|
||||
sizeof(int32_t)
|
||||
);
|
||||
_encodeOffset += sizeof(int32_t);
|
||||
memcpy(_dataStream.data() + _encodeOffset, s.c_str(), length);
|
||||
_encodeOffset += length;
|
||||
@@ -69,7 +73,11 @@ public:
|
||||
|
||||
std::string decode() {
|
||||
int32_t length;
|
||||
memcpy(reinterpret_cast<char*>(&length), _dataStream.data() + _decodeOffset, sizeof(int32_t));
|
||||
memcpy(
|
||||
reinterpret_cast<char*>(&length),
|
||||
_dataStream.data() + _decodeOffset,
|
||||
sizeof(int32_t)
|
||||
);
|
||||
char* tmp = new char[length + 1];
|
||||
_decodeOffset += sizeof(int32_t);
|
||||
memcpy(tmp, _dataStream.data() + _decodeOffset, length);
|
||||
|
||||
@@ -53,13 +53,13 @@ protected:
|
||||
};
|
||||
|
||||
/**
|
||||
* A double buffered implementation of the Syncable interface.
|
||||
* Users are encouraged to used this class as a default way to synchronize different
|
||||
* A double buffered implementation of the Syncable interface.
|
||||
* Users are encouraged to used this class as a default way to synchronize different
|
||||
* C++ data types using the <code>SyncEngine</code>
|
||||
*
|
||||
* This class aims to handle the synchronization parts and yet act like a regular
|
||||
* instance of T. Implicit casts are supported, however, when accessing member functions or
|
||||
* or variables, user may have to do explicit casts.
|
||||
* This class aims to handle the synchronization parts and yet act like a regular
|
||||
* instance of T. Implicit casts are supported, however, when accessing member functions
|
||||
* or variables, user may have to do explicit casts.
|
||||
*
|
||||
* ((T&) t).method();
|
||||
*
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
SyncData() {};
|
||||
SyncData(const T& val) : data(val) {};
|
||||
SyncData(const SyncData<T>& o) : data(o.data) {
|
||||
// Should not have to be copied!
|
||||
// Should not have to be copied!
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace openspace {
|
||||
|
||||
class TaskLoader {
|
||||
public:
|
||||
std::vector<std::unique_ptr<Task>> tasksFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
std::vector<std::unique_ptr<Task>> tasksFromDictionary(
|
||||
const ghoul::Dictionary& dictionary);
|
||||
std::vector<std::unique_ptr<Task>> tasksFromFile(const std::string& path);
|
||||
};
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace openspace {
|
||||
class ThreadPool;
|
||||
|
||||
class Worker {
|
||||
public:
|
||||
public:
|
||||
Worker(ThreadPool& pool);
|
||||
void operator()();
|
||||
private:
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace openspace {
|
||||
/**
|
||||
* This singleton class represents the current simulation time in OpenSpace. It
|
||||
* internally stores the time and provides methods to set the time directly
|
||||
* (setTime(double), setTime(std::string)) using a <code>double</code> value using the
|
||||
* (setTime(double), setTime(std::string)) using a <code>double</code> value using the
|
||||
* number of seconds passed since the J2000 epoch or a <code>string</code> that denotes
|
||||
* a valid date string in accordance to the Spice library
|
||||
* (http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/str2et_c.html). The time can
|
||||
@@ -47,12 +47,12 @@ namespace openspace {
|
||||
* the number of seconds that pass for each real-time second. This value is set with
|
||||
* setDeltaTime(double), retrieved with deltaTime() and solely used in the
|
||||
* advanceTime(double), which takes a <code>tickTime</code> parameter. The value of the
|
||||
* parameter is dependent on the usage of the class and must be equal to the real-world
|
||||
* parameter is dependent on the usage of the class and must be equal to the real-world
|
||||
* time that has passed since the last call to the method. For example, if the
|
||||
* advanceTime(double) method is called each frame, the <code>tickTime</code> has to be
|
||||
* equal to the frame time.
|
||||
*
|
||||
* The synchronization of the simulation time requires
|
||||
* The synchronization of the simulation time requires
|
||||
*/
|
||||
class Time {
|
||||
public:
|
||||
@@ -144,7 +144,7 @@ public:
|
||||
double deltaTime() const;
|
||||
|
||||
/**
|
||||
* Sets the pause function, i.e. setting the deltaTime to 0 (<code>pause</code> =
|
||||
* Sets the pause function, i.e. setting the deltaTime to 0 (<code>pause</code> =
|
||||
* <code>true</code>) and restoring it when the function is called with a parameter of
|
||||
* <code>false</code>.
|
||||
* \param pause If <code>true</code>, the simulation time stops;
|
||||
|
||||
@@ -64,7 +64,8 @@ public:
|
||||
void removeKeyframe(size_t id);
|
||||
void removeKeyframesBefore(double timestamp, bool inclusive = false);
|
||||
void removeKeyframesAfter(double timestamp, bool inclusive = false);
|
||||
void removeKeyframesBetween(double begin, double end, bool inclusiveBegin = false, bool inclusiveEnd = false);
|
||||
void removeKeyframesBetween(double begin, double end, bool inclusiveBegin = false,
|
||||
bool inclusiveEnd = false);
|
||||
size_t nKeyframes() const;
|
||||
const Keyframe<T>* firstKeyframeAfter(double timestamp, bool inclusive = false) const;
|
||||
const Keyframe<T>* lastKeyframeBefore(double timestamp, bool inclusive = false) const;
|
||||
|
||||
@@ -35,15 +35,30 @@ Timeline<T>::~Timeline() {}
|
||||
template <typename T>
|
||||
void Timeline<T>::addKeyframe(double timestamp, T data) {
|
||||
Keyframe<T> keyframe(++_nextKeyframeId, timestamp, data);
|
||||
auto iter = std::upper_bound(_keyframes.begin(), _keyframes.end(), keyframe, &compareKeyframeTimes);
|
||||
auto iter = std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
keyframe,
|
||||
&compareKeyframeTimes
|
||||
);
|
||||
_keyframes.insert(iter, keyframe);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframesAfter(double timestamp, bool inclusive) {
|
||||
auto iter = inclusive
|
||||
? std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime)
|
||||
: std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime);
|
||||
? std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
)
|
||||
: std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
|
||||
_keyframes.erase(iter, _keyframes.end());
|
||||
}
|
||||
@@ -51,21 +66,53 @@ void Timeline<T>::removeKeyframesAfter(double timestamp, bool inclusive) {
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframesBefore(double timestamp, bool inclusive) {
|
||||
auto iter = inclusive
|
||||
? std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime)
|
||||
: std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime);
|
||||
? std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
)
|
||||
: std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime)
|
||||
;
|
||||
|
||||
_keyframes.erase(_keyframes.begin(), iter);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframesBetween(double begin, double end, bool inclusiveBegin, bool inclusiveEnd) {
|
||||
void Timeline<T>::removeKeyframesBetween(double begin, double end, bool inclusiveBegin,
|
||||
bool inclusiveEnd)
|
||||
{
|
||||
auto beginIter = inclusiveBegin
|
||||
? std::lower_bound(_keyframes.begin(), _keyframes.end(), begin, &compareKeyframeTimeWithTime)
|
||||
: std::upper_bound(_keyframes.begin(), _keyframes.end(), begin, &compareTimeWithKeyframeTime);
|
||||
? std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
begin,
|
||||
&compareKeyframeTimeWithTime
|
||||
)
|
||||
: std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
begin,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
|
||||
auto endIter = inclusiveEnd
|
||||
? std::upper_bound(beginIter, _keyframes.end(), end, &compareTimeWithKeyframeTime)
|
||||
: std::lower_bound(beginIter, _keyframes.end(), end, &compareKeyframeTimeWithTime);
|
||||
? std::upper_bound(
|
||||
beginIter,
|
||||
_keyframes.end(),
|
||||
end,
|
||||
&compareTimeWithKeyframeTime
|
||||
)
|
||||
: std::lower_bound(
|
||||
beginIter,
|
||||
_keyframes.end(),
|
||||
end,
|
||||
&compareKeyframeTimeWithTime
|
||||
);
|
||||
|
||||
_keyframes.erase(beginIter, endIter);
|
||||
}
|
||||
@@ -77,9 +124,14 @@ void Timeline<T>::clearKeyframes() {
|
||||
|
||||
template <typename T>
|
||||
void Timeline<T>::removeKeyframe(size_t id) {
|
||||
_keyframes.erase(std::remove_if(_keyframes.begin(), _keyframes.end(), [id] (Keyframe<T> keyframe) {
|
||||
return keyframe.id == id;
|
||||
}), _keyframes.end());
|
||||
_keyframes.erase(
|
||||
std::remove_if(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
[id] (Keyframe<T> keyframe) { return keyframe.id == id; }
|
||||
),
|
||||
_keyframes.end()
|
||||
);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -88,10 +140,23 @@ size_t Timeline<T>::nKeyframes() const {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclusive) const {
|
||||
const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp,
|
||||
bool inclusive) const
|
||||
{
|
||||
auto it = inclusive
|
||||
? std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime)
|
||||
: std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime);
|
||||
? std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
)
|
||||
: std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
);
|
||||
|
||||
if (it == _keyframes.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -99,10 +164,23 @@ const Keyframe<T>* Timeline<T>::firstKeyframeAfter(double timestamp, bool inclus
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const Keyframe<T>* Timeline<T>::lastKeyframeBefore(double timestamp, bool inclusive) const {
|
||||
const Keyframe<T>* Timeline<T>::lastKeyframeBefore(double timestamp,
|
||||
bool inclusive) const
|
||||
{
|
||||
auto it = inclusive
|
||||
? std::upper_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareTimeWithKeyframeTime)
|
||||
: std::lower_bound(_keyframes.begin(), _keyframes.end(), timestamp, &compareKeyframeTimeWithTime);
|
||||
? std::upper_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareTimeWithKeyframeTime
|
||||
)
|
||||
: std::lower_bound(
|
||||
_keyframes.begin(),
|
||||
_keyframes.end(),
|
||||
timestamp,
|
||||
&compareKeyframeTimeWithTime
|
||||
);
|
||||
|
||||
if (it == _keyframes.begin()) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -116,6 +194,4 @@ const std::deque<Keyframe<T>>& Timeline<T>::keyframes() const {
|
||||
return _keyframes;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -38,7 +38,7 @@ struct TimeRange {
|
||||
TimeRange();
|
||||
|
||||
/**
|
||||
* Initializes a TimeRange with both start and end time. Initializing empty timeranges
|
||||
* Initializes a TimeRange with both start and end time. Initializing empty timeranges
|
||||
* is OK.
|
||||
*/
|
||||
TimeRange(double startTime, double endTime);
|
||||
@@ -49,9 +49,11 @@ struct TimeRange {
|
||||
TimeRange(const ghoul::Dictionary& dict);
|
||||
|
||||
/**
|
||||
* \returns true if timeRange could be initialized from the dictionary, false otherwise.
|
||||
* \returns true if timeRange could be initialized from the dictionary,
|
||||
* false otherwise.
|
||||
*/
|
||||
static bool initializeFromDictionary(const ghoul::Dictionary& dict, TimeRange& timeRange);
|
||||
static bool initializeFromDictionary(const ghoul::Dictionary& dict,
|
||||
TimeRange& timeRange);
|
||||
|
||||
void include(double val);
|
||||
|
||||
|
||||
@@ -59,10 +59,12 @@ public:
|
||||
TransformationManager();
|
||||
~TransformationManager();
|
||||
|
||||
glm::dmat3 frameTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const;
|
||||
glm::dmat3 frameTransformationMatrix(const std::string& from, const std::string& to,
|
||||
double ephemerisTime) const;
|
||||
|
||||
private:
|
||||
glm::dmat3 kameleonTransformationMatrix(const std::string& from, const std::string& to, double ephemerisTime) const;
|
||||
glm::dmat3 kameleonTransformationMatrix(const std::string& from,
|
||||
const std::string& to, double ephemerisTime) const;
|
||||
|
||||
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
|
||||
std::shared_ptr<ccmc::Kameleon> _kameleon;
|
||||
|
||||
@@ -39,6 +39,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.h
|
||||
@@ -61,6 +62,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimageonline.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translation/luatranslation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/translation/statictranslation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rotation/fixedrotation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rotation/luarotation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rotation/staticrotation.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/scale/luascale.cpp
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <modules/base/translation/luatranslation.h>
|
||||
#include <modules/base/translation/statictranslation.h>
|
||||
|
||||
#include <modules/base/rotation/fixedrotation.h>
|
||||
#include <modules/base/rotation/luarotation.h>
|
||||
#include <modules/base/rotation/staticrotation.h>
|
||||
|
||||
@@ -94,6 +95,7 @@ void BaseModule::internalInitialize() {
|
||||
auto fRotation = FactoryManager::ref().factory<Rotation>();
|
||||
ghoul_assert(fRotation, "Rotation factory was not created");
|
||||
|
||||
fRotation->registerClass<FixedRotation>("FixedRotation");
|
||||
fRotation->registerClass<LuaRotation>("LuaRotation");
|
||||
fRotation->registerClass<StaticRotation>("StaticRotation");
|
||||
|
||||
@@ -118,6 +120,7 @@ std::vector<documentation::Documentation> BaseModule::documentations() const {
|
||||
ScreenSpaceFramebuffer::Documentation(),
|
||||
ScreenSpaceImageLocal::Documentation(),
|
||||
ScreenSpaceImageOnline::Documentation(),
|
||||
FixedRotation::Documentation(),
|
||||
LuaRotation::Documentation(),
|
||||
StaticRotation::Documentation(),
|
||||
LuaScale::Documentation(),
|
||||
|
||||
@@ -52,7 +52,7 @@ bool MultiModelGeometry::loadModel(const std::string& filename) {
|
||||
_vertices.push_back(vv);
|
||||
}
|
||||
|
||||
_indices.resize(indices.size());
|
||||
_indices.resize(indices.size());
|
||||
std::copy(indices.begin(), indices.end(), _indices.begin());
|
||||
|
||||
return true;
|
||||
|
||||
@@ -39,7 +39,7 @@ public:
|
||||
MultiModelGeometry(const ghoul::Dictionary& dictionary);
|
||||
|
||||
private:
|
||||
bool loadModel(const std::string& filename);
|
||||
virtual bool loadModel(const std::string& filename) override;
|
||||
};
|
||||
|
||||
} // namespace openspace::modelgeometry
|
||||
|
||||
@@ -156,7 +156,7 @@ bool RenderableModel::isReady() const {
|
||||
return _programObject && _texture;
|
||||
}
|
||||
|
||||
void RenderableModel::initialize() {
|
||||
void RenderableModel::initializeGL() {
|
||||
_programObject = OsEng.renderEngine().buildRenderProgram(
|
||||
"ModelProgram",
|
||||
"${MODULE_BASE}/shaders/model_vs.glsl",
|
||||
@@ -165,10 +165,10 @@ void RenderableModel::initialize() {
|
||||
|
||||
loadTexture();
|
||||
|
||||
_geometry->initialize(this);
|
||||
_geometry->initialize(this);
|
||||
}
|
||||
|
||||
void RenderableModel::deinitialize() {
|
||||
void RenderableModel::deinitializeGL() {
|
||||
if (_geometry) {
|
||||
_geometry->deinitialize();
|
||||
_geometry = nullptr;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include <memory>
|
||||
|
||||
namespace ghoul::opengl {
|
||||
class ProgramObject;
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
} // namespace ghoul::opengl
|
||||
|
||||
@@ -51,8 +51,8 @@ class RenderableModel : public Renderable {
|
||||
public:
|
||||
RenderableModel(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ bool RenderablePlane::isReady() const {
|
||||
return _shader && _texture;
|
||||
}
|
||||
|
||||
void RenderablePlane::initialize() {
|
||||
void RenderablePlane::initializeGL() {
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
createPlane();
|
||||
@@ -191,7 +191,7 @@ void RenderablePlane::initialize() {
|
||||
loadTexture();
|
||||
}
|
||||
|
||||
void RenderablePlane::deinitialize() {
|
||||
void RenderablePlane::deinitializeGL() {
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
@@ -210,7 +210,7 @@ void RenderablePlane::deinitialize() {
|
||||
void RenderablePlane::render(const RenderData& data, RendererTasks&) {
|
||||
_shader->activate();
|
||||
//if (_projectionListener){
|
||||
// //get parent node-texture and set with correct dimensions
|
||||
// //get parent node-texture and set with correct dimensions
|
||||
// SceneGraphNode* textureNode = OsEng.renderEngine().scene()->sceneGraphNode(
|
||||
// _nodeName
|
||||
// )->parent();
|
||||
@@ -342,7 +342,7 @@ void RenderablePlane::createPlane() {
|
||||
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
GL_FLOAT,
|
||||
GL_FALSE,
|
||||
|
||||
@@ -54,8 +54,8 @@ class RenderablePlane : public Renderable {
|
||||
public:
|
||||
RenderablePlane(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
|
||||
@@ -220,7 +220,7 @@ bool RenderableSphere::isReady() const {
|
||||
return _shader && _texture;
|
||||
}
|
||||
|
||||
void RenderableSphere::initialize() {
|
||||
void RenderableSphere::initializeGL() {
|
||||
_sphere = std::make_unique<PowerScaledSphere>(
|
||||
PowerScaledScalar::CreatePSS(_size), _segments
|
||||
);
|
||||
@@ -234,7 +234,7 @@ void RenderableSphere::initialize() {
|
||||
loadTexture();
|
||||
}
|
||||
|
||||
void RenderableSphere::deinitialize() {
|
||||
void RenderableSphere::deinitializeGL() {
|
||||
_texture = nullptr;
|
||||
|
||||
if (_shader) {
|
||||
|
||||
@@ -49,8 +49,8 @@ class RenderableSphere : public Renderable {
|
||||
public:
|
||||
RenderableSphere(const ghoul::Dictionary& dictionary);
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
|
||||
@@ -177,18 +177,7 @@ bool RenderableSphericalGrid::isReady() const {
|
||||
return ready;
|
||||
}
|
||||
|
||||
void RenderableSphericalGrid::deinitialize() {
|
||||
glDeleteVertexArrays(1,&_vaoID);
|
||||
_vaoID = 0;
|
||||
|
||||
glDeleteBuffers(1,&_vBufferID);
|
||||
_vBufferID = 0;
|
||||
|
||||
glDeleteBuffers(1,&_iBufferID);
|
||||
_iBufferID = 0;
|
||||
}
|
||||
|
||||
void RenderableSphericalGrid::initialize() {
|
||||
void RenderableSphericalGrid::initializeGL() {
|
||||
_gridProgram = OsEng.renderEngine().buildRenderProgram(
|
||||
"GridProgram",
|
||||
"${MODULE_BASE}/shaders/grid_vs.glsl",
|
||||
@@ -206,6 +195,17 @@ void RenderableSphericalGrid::initialize() {
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
void RenderableSphericalGrid::deinitializeGL() {
|
||||
glDeleteVertexArrays(1, &_vaoID);
|
||||
_vaoID = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vBufferID);
|
||||
_vBufferID = 0;
|
||||
|
||||
glDeleteBuffers(1, &_iBufferID);
|
||||
_iBufferID = 0;
|
||||
}
|
||||
|
||||
void RenderableSphericalGrid::render(const RenderData& data, RendererTasks&){
|
||||
_gridProgram->activate();
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
RenderableSphericalGrid(const ghoul::Dictionary& dictionary);
|
||||
~RenderableSphericalGrid();
|
||||
|
||||
void initialize() override;
|
||||
void deinitialize() override;
|
||||
void initializeGL() override;
|
||||
void deinitializeGL() override;
|
||||
|
||||
bool isReady() const override;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user