mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-04 18:51:17 -06:00
Merge branch 'feature/iSWA' of github.com:OpenSpace/OpenSpace-Development into feature/iSWA
This commit is contained in:
@@ -75,7 +75,7 @@ InfoWidget::InfoWidget(QString name, int totalBytes)
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
void InfoWidget::update(openspace::DownloadManager::FileFuture* f) {
|
||||
void InfoWidget::update(std::shared_ptr<openspace::DownloadManager::FileFuture> f) {
|
||||
_bytes->setText(
|
||||
QString("%1 / %2")
|
||||
.arg(f->currentSize)
|
||||
|
||||
@@ -40,7 +40,7 @@ Q_OBJECT
|
||||
public:
|
||||
InfoWidget(QString name, int totalBytes = -1);
|
||||
|
||||
void update(openspace::DownloadManager::FileFuture* f);
|
||||
void update(std::shared_ptr<openspace::DownloadManager::FileFuture> f);
|
||||
void update(libtorrent::torrent_status s);
|
||||
|
||||
void error(QString message);
|
||||
|
||||
@@ -230,7 +230,7 @@ void SyncWidget::setSceneFiles(QMap<QString, QString> sceneFiles) {
|
||||
}
|
||||
|
||||
void SyncWidget::clear() {
|
||||
for (openspace::DownloadManager::FileFuture* f : _futures)
|
||||
for (std::shared_ptr<openspace::DownloadManager::FileFuture> f : _futures)
|
||||
f->abortDownload = true;
|
||||
|
||||
using libtorrent::torrent_handle;
|
||||
@@ -254,7 +254,7 @@ void SyncWidget::handleDirectFiles() {
|
||||
for (const DirectFile& f : _directFiles) {
|
||||
LDEBUG(f.url.toStdString() << " -> " << f.destination.toStdString());
|
||||
|
||||
openspace::DownloadManager::FileFuture* future = DlManager.downloadFile(
|
||||
std::shared_ptr<openspace::DownloadManager::FileFuture> future = DlManager.downloadFile(
|
||||
f.url.toStdString(),
|
||||
absPath("${SCENE}/" + f.module.toStdString() + "/" + f.destination.toStdString()),
|
||||
OverwriteFiles
|
||||
@@ -571,8 +571,8 @@ void SyncWidget::handleTimer() {
|
||||
using namespace libtorrent;
|
||||
using FileFuture = openspace::DownloadManager::FileFuture;
|
||||
|
||||
std::vector<FileFuture*> toRemove;
|
||||
for (FileFuture* f : _futures) {
|
||||
std::vector<std::shared_ptr<FileFuture>> toRemove;
|
||||
for (std::shared_ptr<FileFuture> f : _futures) {
|
||||
InfoWidget* w = _futureInfoWidgetMap[f];
|
||||
|
||||
if (CleanInfoWidgets && (f->isFinished || f->isAborted)) {
|
||||
@@ -585,13 +585,12 @@ void SyncWidget::handleTimer() {
|
||||
w->update(f);
|
||||
}
|
||||
|
||||
for (FileFuture* f : toRemove) {
|
||||
for (std::shared_ptr<FileFuture> f : toRemove) {
|
||||
_futures.erase(std::remove(_futures.begin(), _futures.end(), f), _futures.end());
|
||||
delete f;
|
||||
}
|
||||
|
||||
while (_mutex.test_and_set()) {}
|
||||
for (openspace::DownloadManager::FileFuture* f : _futuresToAdd) {
|
||||
for (std::shared_ptr<FileFuture> f : _futuresToAdd) {
|
||||
InfoWidget* w = new InfoWidget(QString::fromStdString(f->filePath), -1);
|
||||
_downloadLayout->insertWidget(_downloadLayout->count() - 1, w);
|
||||
|
||||
@@ -679,7 +678,7 @@ void SyncWidget::handleTimer() {
|
||||
}
|
||||
|
||||
void SyncWidget::handleFileFutureAddition(
|
||||
const std::vector<openspace::DownloadManager::FileFuture*>& futures)
|
||||
const std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>>& futures)
|
||||
{
|
||||
while (_mutex.test_and_set()) {}
|
||||
_futuresToAdd.insert(_futuresToAdd.end(), futures.begin(), futures.end());
|
||||
|
||||
@@ -83,7 +83,7 @@ private:
|
||||
void clear();
|
||||
QStringList selectedScenes() const;
|
||||
|
||||
void handleFileFutureAddition(const std::vector<openspace::DownloadManager::FileFuture*>& futures);
|
||||
void handleFileFutureAddition(const std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>>& futures);
|
||||
|
||||
void handleDirectFiles();
|
||||
void handleFileRequest();
|
||||
@@ -101,10 +101,10 @@ private:
|
||||
QList<FileRequest> _fileRequests;
|
||||
QList<TorrentFile> _torrentFiles;
|
||||
|
||||
std::vector<openspace::DownloadManager::FileFuture*> _futures;
|
||||
std::map<openspace::DownloadManager::FileFuture*, InfoWidget*> _futureInfoWidgetMap;
|
||||
std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>> _futures;
|
||||
std::map<std::shared_ptr<openspace::DownloadManager::FileFuture>, InfoWidget*> _futureInfoWidgetMap;
|
||||
|
||||
std::vector<openspace::DownloadManager::FileFuture*> _futuresToAdd;
|
||||
std::vector<std::shared_ptr<openspace::DownloadManager::FileFuture>> _futuresToAdd;
|
||||
std::atomic_flag _mutex;
|
||||
};
|
||||
|
||||
|
||||
Submodule ext/ghoul updated: f31ddda5d7...901a96beda
@@ -64,20 +64,20 @@ public:
|
||||
using DownloadFinishedCallback = std::function<void(const FileFuture&)>;
|
||||
using RequestFinishedCallback = std::function<void(std::string)>;
|
||||
using AsyncDownloadFinishedCallback =
|
||||
std::function<void(const std::vector<FileFuture*>&)>;
|
||||
std::function<void(const std::vector<std::shared_ptr<FileFuture>>&)>;
|
||||
|
||||
DownloadManager(std::string requestURL, int applicationVersion,
|
||||
bool useMultithreadedDownload = true);
|
||||
|
||||
// callers responsibility to delete
|
||||
// callbacks happen on a different thread
|
||||
FileFuture* downloadFile(const std::string& url, const ghoul::filesystem::File& file,
|
||||
std::shared_ptr<FileFuture> downloadFile(const std::string& url, const ghoul::filesystem::File& file,
|
||||
bool overrideFile = true,
|
||||
DownloadFinishedCallback finishedCallback = DownloadFinishedCallback(),
|
||||
DownloadProgressCallback progressCallback = DownloadProgressCallback()
|
||||
);
|
||||
|
||||
std::vector<FileFuture*> downloadRequestFiles(const std::string& identifier,
|
||||
std::vector<std::shared_ptr<FileFuture>> downloadRequestFiles(const std::string& identifier,
|
||||
const ghoul::filesystem::Directory& destination, int version,
|
||||
bool overrideFiles = true,
|
||||
DownloadFinishedCallback finishedCallback = DownloadFinishedCallback(),
|
||||
|
||||
@@ -71,6 +71,7 @@ public:
|
||||
|
||||
//void addNode(SceneGraphNode* child);
|
||||
|
||||
void addChild(SceneGraphNode* child);
|
||||
void setParent(SceneGraphNode* parent);
|
||||
//bool abandonChild(SceneGraphNode* child);
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ void RenderableFieldlines::render(const RenderData& data) {
|
||||
_program->setUniform("modelViewProjection", data.camera.viewProjectionMatrix());
|
||||
_program->setUniform("modelTransform", glm::mat4(1.0));
|
||||
_program->setUniform("cameraViewDir", data.camera.viewDirection());
|
||||
setPscUniforms(_program.get(), &data.camera, data.position);
|
||||
setPscUniforms(*(_program.get()), data.camera, data.position);
|
||||
|
||||
_program->setUniform("classification", _classification);
|
||||
if (!_classification)
|
||||
|
||||
@@ -19,89 +19,51 @@
|
||||
#include <modules/iswa/rendering/cygnetplane.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
namespace openspace{
|
||||
|
||||
CygnetPlane::CygnetPlane(int cygnetId, std::string path)
|
||||
:ISWACygnet(cygnetId, path)
|
||||
,_quad(0)
|
||||
,_vertexPositionBuffer(0)
|
||||
// CygnetPlane::CygnetPlane(int cygnetId, std::string path)
|
||||
// :ISWACygnet(cygnetId, path)
|
||||
// ,_quad(0)
|
||||
// ,_vertexPositionBuffer(0)
|
||||
// ,_planeIsDirty(true)
|
||||
// {}
|
||||
|
||||
CygnetPlane::CygnetPlane(std::shared_ptr<Metadata> data)
|
||||
:ISWACygnet(data)
|
||||
,_quad(0)
|
||||
,_vertexPositionBuffer(0)
|
||||
,_planeIsDirty(true)
|
||||
{}
|
||||
|
||||
CygnetPlane::~CygnetPlane(){}
|
||||
|
||||
bool CygnetPlane::initialize(){
|
||||
ISWACygnet::initialize();
|
||||
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
createPlane();
|
||||
|
||||
if (_shader == nullptr) {
|
||||
// Plane Program
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("PlaneProgram",
|
||||
"${MODULE_ISWA}/shaders/cygnetplane_vs.glsl",
|
||||
"${MODULE_ISWA}/shaders/cygnetplane_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool CygnetPlane::deinitialize(){
|
||||
ISWACygnet::deinitialize();
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vertexPositionBuffer);
|
||||
_vertexPositionBuffer = 0;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CygnetPlane::isReady(){
|
||||
bool ready = true;
|
||||
if (!_shader)
|
||||
ready &= false;
|
||||
if(!_texture)
|
||||
ready &= false;
|
||||
return ready;
|
||||
}
|
||||
|
||||
void CygnetPlane::render(){}
|
||||
|
||||
void CygnetPlane::update(){
|
||||
ISWACygnet::update();
|
||||
|
||||
_time = Time::ref().currentTime();
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", _frame, _time);
|
||||
_openSpaceUpdateInterval = Time::ref().deltaTime()*_updateInterval;
|
||||
|
||||
if(_openSpaceUpdateInterval){
|
||||
if((_time-_lastUpdateTime) >= _openSpaceUpdateInterval){
|
||||
updateTexture();
|
||||
_lastUpdateTime = _time;
|
||||
}
|
||||
}
|
||||
bool ready = true;
|
||||
if (!_shader)
|
||||
ready &= false;
|
||||
if(!_texture)
|
||||
ready &= false;
|
||||
return ready;
|
||||
}
|
||||
|
||||
void CygnetPlane::createPlane(){
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
// ============================
|
||||
// GEOMETRY (quad)
|
||||
// ============================
|
||||
const GLfloat x = _modelScale.x/2.0;
|
||||
const GLfloat y = _modelScale.z/2.0;
|
||||
const GLfloat w = _modelScale.w;
|
||||
// GLfloat x, y, w;
|
||||
// if(!_data){
|
||||
// x = _modelScale.x/2.0;
|
||||
// y = _modelScale.z/2.0;
|
||||
// w = _modelScale.w;
|
||||
// }else{
|
||||
const GLfloat x = _data->scale.x/2.0;
|
||||
const GLfloat y = _data->scale.z/2.0;
|
||||
const GLfloat w = _data->scale.w;
|
||||
// }
|
||||
const GLfloat vertex_data[] = { // square of two triangles (sigh)
|
||||
// x y z w s t
|
||||
-x, -y, 0, w, 0, 1,
|
||||
@@ -123,4 +85,33 @@ void CygnetPlane::createPlane(){
|
||||
_planeIsDirty = false;
|
||||
}
|
||||
|
||||
void CygnetPlane::destroyPlane(){
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vertexPositionBuffer);
|
||||
_vertexPositionBuffer = 0;
|
||||
}
|
||||
|
||||
bool CygnetPlane::createShader(){
|
||||
if (_shader == nullptr) {
|
||||
// Plane Program
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("PlaneProgram",
|
||||
"${MODULE_ISWA}/shaders/cygnetplane_vs.glsl",
|
||||
"${MODULE_ISWA}/shaders/cygnetplane_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void CygnetPlane::destroyShader(){
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
} //namespace openspace
|
||||
@@ -32,23 +32,24 @@
|
||||
namespace openspace{
|
||||
class CygnetPlane : public ISWACygnet {
|
||||
public:
|
||||
CygnetPlane(int cygnetId, std::string path);
|
||||
// CygnetPlane(int cygnetId, std::string path);
|
||||
CygnetPlane(std::shared_ptr<Metadata> data);
|
||||
~CygnetPlane();
|
||||
|
||||
virtual bool initialize();
|
||||
virtual bool deinitialize();
|
||||
|
||||
bool isReady() override;
|
||||
|
||||
virtual void render();
|
||||
virtual void update();
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
virtual bool isReady();
|
||||
virtual void render() = 0;
|
||||
virtual void update() = 0;
|
||||
|
||||
protected:
|
||||
virtual void setParent() = 0;
|
||||
virtual void loadTexture() = 0;
|
||||
virtual void updateTexture() = 0;
|
||||
|
||||
void createPlane();
|
||||
void destroyPlane();
|
||||
bool createShader();
|
||||
void destroyShader();
|
||||
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "DataPlane";
|
||||
@@ -41,8 +41,25 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path)
|
||||
:CygnetPlane(1, path)
|
||||
// DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path)
|
||||
// :CygnetPlane(1, path)
|
||||
// , _kw(kw)
|
||||
// {
|
||||
// _id = id();
|
||||
// setName("DataPlane" + std::to_string(_id));
|
||||
// registerProperties();
|
||||
|
||||
// KameleonWrapper::Model model = _kw->model();
|
||||
// if( model == KameleonWrapper::Model::BATSRUS){
|
||||
// _var = "p";
|
||||
// }else{
|
||||
// _var = "rho";
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw, std::shared_ptr<Metadata> data)
|
||||
:CygnetPlane(data)
|
||||
, _kw(kw)
|
||||
{
|
||||
_id = id();
|
||||
@@ -56,19 +73,20 @@ DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path)
|
||||
_var = "rho";
|
||||
}
|
||||
|
||||
if(!_data){
|
||||
std::cout << "No data" << std::endl;
|
||||
}else{
|
||||
std::cout << _data->parent << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
DataPlane::~DataPlane(){}
|
||||
|
||||
|
||||
bool DataPlane::initialize(){
|
||||
_modelScale = _kw->getModelScaleScaled();
|
||||
_pscOffset = _kw->getModelBarycenterOffsetScaled();
|
||||
|
||||
CygnetPlane::initialize();
|
||||
// std::cout << _modelScale.x << ", " << _modelScale.y << ", " << _modelScale.z << ", " << _modelScale.w << std::endl;
|
||||
// std::cout << _pscOffset.x << ", " << _pscOffset.y << ", " << _pscOffset.z << ", " << _pscOffset.w << std::endl;
|
||||
setParent();
|
||||
createPlane();
|
||||
createShader();
|
||||
|
||||
_dimensions = glm::size3_t(500,500,1);
|
||||
float zSlice = 0.5f;
|
||||
@@ -80,7 +98,10 @@ bool DataPlane::initialize(){
|
||||
}
|
||||
|
||||
bool DataPlane::deinitialize(){
|
||||
CygnetPlane::deinitialize();
|
||||
_parent = nullptr;
|
||||
unregisterProperties();
|
||||
destroyPlane();
|
||||
destroyShader();
|
||||
_kw = nullptr;
|
||||
|
||||
return true;
|
||||
@@ -124,7 +145,11 @@ void DataPlane::render(){
|
||||
|
||||
glm::mat4 rotation = glm::rotate(glm::mat4(1.0f), angle, ref);
|
||||
transform = rotation * transform;
|
||||
position += transform*glm::vec4(_pscOffset.x, _pscOffset.z, _pscOffset.y, _pscOffset.w);
|
||||
|
||||
// if(!_data)
|
||||
// position += transform*glm::vec4(_pscOffset.x, _pscOffset.z, _pscOffset.y, _pscOffset.w);
|
||||
// else
|
||||
position += transform*glm::vec4(_data->offset.x, _data->offset.z, _data->offset.y, _data->offset.w);
|
||||
|
||||
// Activate shader
|
||||
_shader->activate();
|
||||
@@ -152,33 +177,23 @@ void DataPlane::update(){
|
||||
if(_planeIsDirty)
|
||||
createPlane();
|
||||
|
||||
CygnetPlane::update();
|
||||
_time = Time::ref().currentTime();
|
||||
|
||||
// if(!_data)
|
||||
// _stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", _frame, _time);
|
||||
// else
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", _data->frame, _time);
|
||||
_openSpaceUpdateInterval = Time::ref().deltaTime()*_updateInterval;
|
||||
|
||||
if(_openSpaceUpdateInterval){
|
||||
if((_time-_lastUpdateTime) >= _openSpaceUpdateInterval){
|
||||
updateTexture();
|
||||
_lastUpdateTime = _time;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DataPlane::setParent(){
|
||||
KameleonWrapper::Model model = _kw->model();
|
||||
if( model == KameleonWrapper::Model::BATSRUS ||
|
||||
model == KameleonWrapper::Model::OpenGGCM ||
|
||||
model == KameleonWrapper::Model::LFM)
|
||||
{
|
||||
_parent = OsEng.renderEngine().scene()->sceneGraphNode("Earth");
|
||||
_frame = "GSM";
|
||||
}else if(
|
||||
model == KameleonWrapper::Model::ENLIL ||
|
||||
model == KameleonWrapper::Model::MAS ||
|
||||
model == KameleonWrapper::Model::Adapt3D ||
|
||||
model == KameleonWrapper::Model::SWMF)
|
||||
{
|
||||
_parent = OsEng.renderEngine().scene()->sceneGraphNode("SolarSystem");
|
||||
_frame = "GALACTIC";
|
||||
}else{
|
||||
//Warning!
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DataPlane::loadTexture() {
|
||||
//std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath));
|
||||
ghoul::opengl::Texture::FilterMode filtermode = ghoul::opengl::Texture::FilterMode::Linear;
|
||||
|
||||
@@ -32,17 +32,16 @@
|
||||
|
||||
class DataPlane : public CygnetPlane {
|
||||
public:
|
||||
DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path);
|
||||
// DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path);
|
||||
DataPlane(std::shared_ptr<KameleonWrapper> kw, std::shared_ptr<Metadata> data);
|
||||
~DataPlane();
|
||||
|
||||
virtual bool initialize();
|
||||
virtual bool deinitialize();
|
||||
|
||||
virtual void render();
|
||||
virtual void update();
|
||||
virtual bool initialize() override;
|
||||
virtual bool deinitialize() override;
|
||||
virtual void render() override;
|
||||
virtual void update() override;
|
||||
|
||||
private:
|
||||
virtual void setParent() override;
|
||||
virtual void loadTexture() override;
|
||||
virtual void updateTexture() override;
|
||||
|
||||
@@ -51,6 +50,7 @@
|
||||
std::shared_ptr<KameleonWrapper> _kw;
|
||||
glm::size3_t _dimensions;
|
||||
float* _dataSlice;
|
||||
std::string _var;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -44,11 +44,11 @@ bool ISWAContainer::initialize(){
|
||||
ISWAManager::initialize();
|
||||
ISWAManager::ref().setContainer(this);
|
||||
|
||||
addISWACygnet("${OPENSPACE_DATA}/BATSRUS.cdf");
|
||||
// addISWACygnet("${OPENSPACE_DATA}/BATSRUS.cdf");
|
||||
// addISWACygnet("${OPENSPACE_DATA}/ENLIL.cdf");
|
||||
//addISWACygnet("${OPENSPACE_DATA}/test.png");
|
||||
addISWACygnet(5);
|
||||
addISWACygnet(7);
|
||||
addISWACygnet(5, "Screen");
|
||||
// addISWACygnet(7, "Sun");
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -72,12 +72,17 @@ void ISWAContainer::render(const RenderData& data){
|
||||
}
|
||||
|
||||
void ISWAContainer::update(const UpdateData& data){
|
||||
|
||||
for (auto it = _extFutures.begin(); it != _extFutures.end(); )
|
||||
{
|
||||
if ((*it)->isFinished) {
|
||||
if ((*it)->isFinished) {
|
||||
std::string path = "${OPENSPACE_DATA}/scene/iswa/" + std::to_string((*it)->id) + (*it)->extension;
|
||||
std::shared_ptr<ISWACygnet> cygnet = ISWAManager::ref().createISWACygnet((*it)->id, std::move(path));
|
||||
|
||||
std::shared_ptr<Metadata> data = std::make_shared<Metadata>();
|
||||
data->id = (*it)->id;
|
||||
data->path = path;
|
||||
data->parent = (*it)->parent;
|
||||
|
||||
std::shared_ptr<ISWACygnet> cygnet = ISWAManager::ref().createISWACygnet(data);
|
||||
if(cygnet){
|
||||
_iSWACygnets.push_back(cygnet);
|
||||
}
|
||||
@@ -96,16 +101,20 @@ void ISWAContainer::update(const UpdateData& data){
|
||||
}
|
||||
|
||||
void ISWAContainer::addISWACygnet(std::string path){
|
||||
std::shared_ptr<ISWACygnet> cygnet = ISWAManager::ref().createISWACygnet(1, path);
|
||||
std::shared_ptr<Metadata> data = std::make_shared<Metadata>();
|
||||
data->id = 0;
|
||||
data->path = path;
|
||||
|
||||
std::shared_ptr<ISWACygnet> cygnet = ISWAManager::ref().createISWACygnet(data);
|
||||
if(cygnet){
|
||||
_iSWACygnets.push_back(cygnet);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ISWAContainer::addISWACygnet(int id){
|
||||
|
||||
void ISWAContainer::addISWACygnet(int id, std::string data){
|
||||
std::shared_ptr<ExtensionFuture> extFuture = ISWAManager::ref().fileExtension(id);
|
||||
extFuture->parent = data;
|
||||
_extFutures.push_back(extFuture);
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
virtual void update(const UpdateData& data) override;
|
||||
|
||||
void addISWACygnet(std::string path);
|
||||
void addISWACygnet(int id);
|
||||
void addISWACygnet(int id, std::string data);
|
||||
void addISWACygnet(std::shared_ptr<ISWACygnet> cygnet);
|
||||
|
||||
void deleteCygnet(ISWACygnet* cygnet);
|
||||
|
||||
@@ -28,19 +28,36 @@
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
|
||||
namespace openspace{
|
||||
|
||||
ISWACygnet::ISWACygnet(int cygnetId, std::string path)
|
||||
// ISWACygnet::ISWACygnet(int cygnetId, std::string path)
|
||||
// : _enabled("enabled", "Is Enabled", true)
|
||||
// , _updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
// , _delete("delete", "Delete")
|
||||
// , _cygnetId(cygnetId)
|
||||
// , _shader(nullptr)
|
||||
// , _texture(nullptr)
|
||||
// , _frame("GALACTIC")
|
||||
// , _path(path)
|
||||
// , _data(nullptr)
|
||||
// {
|
||||
// addProperty(_enabled);
|
||||
// addProperty(_updateInterval);
|
||||
// addProperty(_delete);
|
||||
|
||||
// _delete.onChange([this](){ISWAManager::ref().deleteCygnet(name());});
|
||||
// }
|
||||
|
||||
ISWACygnet::ISWACygnet(std::shared_ptr<Metadata> data)
|
||||
: _enabled("enabled", "Is Enabled", true)
|
||||
, _updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
,_delete("delete", "Delete")
|
||||
, _cygnetId(cygnetId)
|
||||
, _delete("delete", "Delete")
|
||||
// , _cygnetId(data->id)
|
||||
, _shader(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _frame("GALACTIC")
|
||||
, _path(path)
|
||||
,_toDelete(false)
|
||||
// , _frame(data->frame)
|
||||
// , _path(data->path)
|
||||
, _data(data)
|
||||
{
|
||||
addProperty(_enabled);
|
||||
addProperty(_updateInterval);
|
||||
@@ -51,23 +68,6 @@ ISWACygnet::ISWACygnet(int cygnetId, std::string path)
|
||||
|
||||
ISWACygnet::~ISWACygnet(){}
|
||||
|
||||
bool ISWACygnet::initialize(){
|
||||
|
||||
setParent();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISWACygnet::deinitialize(){
|
||||
OsEng.gui()._iSWAproperty.unregisterProperties(name());
|
||||
_parent = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ISWACygnet::render(){
|
||||
|
||||
}
|
||||
|
||||
void ISWACygnet::update(){}
|
||||
|
||||
void ISWACygnet::setPscUniforms(
|
||||
ghoul::opengl::ProgramObject* program,
|
||||
@@ -81,11 +81,17 @@ void ISWACygnet::setPscUniforms(
|
||||
}
|
||||
|
||||
void ISWACygnet::registerProperties(){
|
||||
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_enabled);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_updateInterval);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_delete);
|
||||
}
|
||||
|
||||
void ISWACygnet::unregisterProperties(){
|
||||
OsEng.gui()._iSWAproperty.unregisterProperties(name());
|
||||
}
|
||||
|
||||
void ISWACygnet::setParent(){
|
||||
_parent = OsEng.renderEngine().scene()->sceneGraphNode(_data->parent);
|
||||
}
|
||||
|
||||
}//namespace openspac
|
||||
@@ -40,26 +40,31 @@
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
|
||||
|
||||
namespace openspace{
|
||||
class ISWACygnet : public properties::PropertyOwner{
|
||||
public:
|
||||
ISWACygnet(int cygnetId, std::string path);
|
||||
// ISWACygnet(int cygnetId, std::string path);
|
||||
ISWACygnet(std::shared_ptr<Metadata> data);
|
||||
~ISWACygnet();
|
||||
|
||||
virtual bool initialize();
|
||||
virtual bool deinitialize();
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
|
||||
virtual void render();
|
||||
virtual void update();
|
||||
virtual void render() = 0;
|
||||
virtual void update() = 0;
|
||||
virtual bool isReady() = 0;
|
||||
|
||||
bool enabled(){return _enabled.value();}
|
||||
virtual bool isReady() = 0;
|
||||
|
||||
|
||||
protected:
|
||||
void setPscUniforms(ghoul::opengl::ProgramObject* program, const Camera* camera, const PowerScaledCoordinate& position);
|
||||
virtual void setParent() = 0;
|
||||
void registerProperties();
|
||||
void unregisterProperties();
|
||||
|
||||
void setParent();
|
||||
|
||||
properties::BoolProperty _enabled;
|
||||
properties::FloatProperty _updateInterval;
|
||||
@@ -68,26 +73,15 @@ protected:
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
|
||||
SceneGraphNode* _parent;
|
||||
glm::vec4 _pscOffset;
|
||||
glm::vec4 _modelScale;
|
||||
std::shared_ptr<Metadata> _data;
|
||||
|
||||
const int _cygnetId;
|
||||
SceneGraphNode* _parent;
|
||||
glm::dmat3 _stateMatrix;
|
||||
std::string _frame;
|
||||
std::string _var;
|
||||
|
||||
double _time;
|
||||
double _lastUpdateTime = 0;
|
||||
std::map<std::string, std::string> _month;
|
||||
|
||||
std::string _fileExtension;
|
||||
std::string _path;
|
||||
|
||||
float _openSpaceUpdateInterval;
|
||||
|
||||
bool _toDelete;
|
||||
|
||||
int _id;
|
||||
};
|
||||
|
||||
|
||||
@@ -35,16 +35,38 @@ namespace {
|
||||
namespace openspace {
|
||||
|
||||
ScreenSpaceCygnet::ScreenSpaceCygnet(int cygnetId, std::string path)
|
||||
: ScreenSpaceRenderable()
|
||||
, _updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
, _cygnetId(cygnetId)
|
||||
, _path(path)
|
||||
: ScreenSpaceRenderable()
|
||||
, _updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
, _cygnetId(cygnetId)
|
||||
, _path(path)
|
||||
{
|
||||
std::cout << "screenspacecygnet constructor 1" << std::endl;
|
||||
_id = id();
|
||||
setName("ScreenSpaceCygnet" + std::to_string(_id));
|
||||
addProperty(_updateInterval);
|
||||
|
||||
// registerProperties();
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_enabled);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_useFlatScreen);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_euclideanPosition);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_sphericalPosition);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_depth);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_scale);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_alpha);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_updateInterval);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_delete);
|
||||
}
|
||||
|
||||
ScreenSpaceCygnet::ScreenSpaceCygnet(std::shared_ptr<Metadata> data)
|
||||
: ScreenSpaceRenderable()
|
||||
, _updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
, _cygnetId(data->id)
|
||||
, _path(data->path)
|
||||
{
|
||||
_id = id();
|
||||
setName("ScreenSpaceCygnet" + std::to_string(_id));
|
||||
addProperty(_updateInterval);
|
||||
|
||||
// registerProperties();
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_enabled);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_useFlatScreen);
|
||||
@@ -125,14 +147,13 @@ void ScreenSpaceCygnet::update(){
|
||||
|
||||
loadTexture();
|
||||
|
||||
delete _futureTexture;
|
||||
_futureTexture = nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ScreenSpaceCygnet::updateTexture(){
|
||||
DownloadManager::FileFuture* future = ISWAManager::ref().downloadImage(_cygnetId, absPath(_path));
|
||||
std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImage(_cygnetId, absPath(_path));
|
||||
if(future){
|
||||
_futureTexture = future;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,14 @@
|
||||
|
||||
#include <openspace/rendering/screenspacerenderable.h>
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
|
||||
namespace openspace{
|
||||
|
||||
class ScreenSpaceCygnet : public ScreenSpaceRenderable {
|
||||
public:
|
||||
ScreenSpaceCygnet(int cygnetId, std::string path);
|
||||
ScreenSpaceCygnet(std::shared_ptr<Metadata> data);
|
||||
~ScreenSpaceCygnet();
|
||||
|
||||
void render() override;
|
||||
@@ -50,13 +52,15 @@ private:
|
||||
|
||||
std::string _path;
|
||||
const int _cygnetId;
|
||||
int _id;
|
||||
float _time;
|
||||
float _lastUpdateTime = 0.0f;
|
||||
DownloadManager::FileFuture* _futureTexture;
|
||||
std::string _fileExtension;
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> _futureTexture;
|
||||
float _openSpaceUpdateInterval;
|
||||
|
||||
std::string _fileExtension;
|
||||
|
||||
int _id;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "TexutePlane";
|
||||
@@ -41,8 +42,17 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
TexturePlane::TexturePlane(int cygnetId, std::string path)
|
||||
:CygnetPlane(cygnetId, path)
|
||||
// TexturePlane::TexturePlane(int cygnetId, std::string path)
|
||||
// :CygnetPlane(cygnetId, path)
|
||||
// ,_futureTexture(nullptr)
|
||||
// {
|
||||
// _id = id();
|
||||
// setName("TexturePlane" + std::to_string(_id));
|
||||
// registerProperties();
|
||||
// }
|
||||
|
||||
TexturePlane::TexturePlane(std::shared_ptr<Metadata> data)
|
||||
:CygnetPlane(data)
|
||||
,_futureTexture(nullptr)
|
||||
{
|
||||
_id = id();
|
||||
@@ -51,35 +61,25 @@ TexturePlane::TexturePlane(int cygnetId, std::string path)
|
||||
}
|
||||
|
||||
|
||||
TexturePlane::~TexturePlane(){
|
||||
|
||||
}
|
||||
TexturePlane::~TexturePlane(){}
|
||||
|
||||
|
||||
bool TexturePlane::initialize(){
|
||||
_modelScale = glm::vec4(3, 3, 3, 10);
|
||||
_pscOffset = glm::vec4(0, 0, 0, 1);
|
||||
CygnetPlane::initialize();
|
||||
setParent();
|
||||
createPlane();
|
||||
createShader();
|
||||
|
||||
updateTexture();
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool TexturePlane::deinitialize(){
|
||||
CygnetPlane::deinitialize();
|
||||
_parent = nullptr;
|
||||
unregisterProperties();
|
||||
destroyPlane();
|
||||
destroyShader();
|
||||
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vertexPositionBuffer);
|
||||
_vertexPositionBuffer = 0;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
|
||||
std::remove(absPath(_path).c_str());
|
||||
std::remove(absPath(_data->path).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -133,21 +133,28 @@ void TexturePlane::update(){
|
||||
if(_planeIsDirty)
|
||||
createPlane();
|
||||
|
||||
CygnetPlane::update();
|
||||
_time = Time::ref().currentTime();
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", _data->frame, _time);
|
||||
|
||||
_openSpaceUpdateInterval = Time::ref().deltaTime()*_updateInterval;
|
||||
|
||||
if(_openSpaceUpdateInterval){
|
||||
if((_time-_lastUpdateTime) >= _openSpaceUpdateInterval){
|
||||
updateTexture();
|
||||
_lastUpdateTime = _time;
|
||||
}
|
||||
}
|
||||
|
||||
if(_futureTexture && _futureTexture->isFinished){
|
||||
loadTexture();
|
||||
|
||||
delete _futureTexture;
|
||||
_futureTexture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void TexturePlane::setParent(){
|
||||
_parent = OsEng.renderEngine().scene()->sceneGraphNode("Sun");
|
||||
}
|
||||
|
||||
void TexturePlane::updateTexture(){
|
||||
DownloadManager::FileFuture* future = ISWAManager::ref().downloadImage(_cygnetId, absPath(_path));
|
||||
std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImage(_data->id, absPath(_data->path));
|
||||
if(future){
|
||||
_futureTexture = future;
|
||||
}
|
||||
@@ -155,10 +162,10 @@ void TexturePlane::updateTexture(){
|
||||
|
||||
void TexturePlane::loadTexture() {
|
||||
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_path));
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_data->path));
|
||||
|
||||
if (texture) {
|
||||
LDEBUG("Loaded texture from '" << absPath(_path) << "'");
|
||||
LDEBUG("Loaded texture from '" << absPath(_data->path) << "'");
|
||||
|
||||
texture->uploadTexture();
|
||||
// Textures of planets looks much smoother with AnisotropicMipMap rather than linear
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
|
||||
class TexturePlane : public CygnetPlane{
|
||||
public:
|
||||
TexturePlane(int cygnetId, std::string path);
|
||||
// TexturePlane(int cygnetId, std::string path);
|
||||
TexturePlane(std::shared_ptr<Metadata> data);
|
||||
~TexturePlane();
|
||||
|
||||
virtual bool initialize();
|
||||
@@ -44,13 +45,12 @@
|
||||
virtual void update();
|
||||
|
||||
private:
|
||||
virtual void setParent() override;
|
||||
virtual void loadTexture() override;
|
||||
virtual void updateTexture() override;
|
||||
|
||||
static int id();
|
||||
|
||||
DownloadManager::FileFuture* _futureTexture;
|
||||
std::shared_ptr<DownloadManager::FileFuture> _futureTexture;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -56,47 +56,43 @@ namespace openspace{
|
||||
std::stringstream ss(info);
|
||||
getline(ss,token,',');
|
||||
int cygnetId = std::stoi(token);
|
||||
/* // std::cout << token << std::endl;
|
||||
|
||||
getline(ss,token,',');
|
||||
std::string parent = token;*/
|
||||
std::string data = token;
|
||||
|
||||
//if(parent == "Earth" || parent == "Sun"){
|
||||
/*std::shared_ptr<TexturePlane> cygnet;
|
||||
cygnet = std::make_shared<TexturePlane>();
|
||||
cygnet->initialize();*/
|
||||
// cygnet->cygnetId(cygnetId);
|
||||
// cygnet->parent(parent);
|
||||
//_container->addISWACygnet(cygnet);
|
||||
_container->addISWACygnet(cygnetId);
|
||||
|
||||
//}else{
|
||||
// OsEng.renderEngine().registerScreenSpaceRenderable(std::make_shared<ScreenSpaceCygnet>(cygnetId));
|
||||
|
||||
//}
|
||||
// std::cout << token << std::endl;
|
||||
// if(token = ""){
|
||||
// std::cout << "empty" << std::endl;
|
||||
// }
|
||||
|
||||
// std::shared_ptr<ISWACygnet> cygnet;
|
||||
// _container->addCygnet(cygnet);
|
||||
if(cygnetId != 0)
|
||||
_container->addISWACygnet(cygnetId, data);
|
||||
else
|
||||
_container->addISWACygnet("${OPENSPACE_DATA}/"+data);
|
||||
}
|
||||
|
||||
std::shared_ptr<ISWACygnet> ISWAManager::createISWACygnet(int id, std::string path){
|
||||
std::cout << "createISWACygnet " << id << std::endl;
|
||||
if(path != ""){
|
||||
const std::string& extension = ghoul::filesystem::File(absPath(path)).fileExtension();
|
||||
std::shared_ptr<ISWACygnet> ISWAManager::createISWACygnet(std::shared_ptr<Metadata> metadata){
|
||||
std::cout << "createISWACygnet " << metadata->id << std::endl;
|
||||
if(metadata->path != ""){
|
||||
const std::string& extension = ghoul::filesystem::File(absPath(metadata->path)).fileExtension();
|
||||
std::shared_ptr<ISWACygnet> cygnet;
|
||||
|
||||
if(extension == "cdf"){
|
||||
std::shared_ptr<KameleonWrapper> kw = std::make_shared<KameleonWrapper>(absPath(path));
|
||||
cygnet = std::make_shared<DataPlane>(kw, path);
|
||||
} else if(id == 5) {
|
||||
//check some other condition that id==5 (based on metadata maybe?)
|
||||
OsEng.renderEngine().registerScreenSpaceRenderable(std::make_shared<ScreenSpaceCygnet>(id, path));
|
||||
return nullptr;
|
||||
} else {
|
||||
cygnet = std::make_shared<TexturePlane>(id, path);
|
||||
std::shared_ptr<KameleonWrapper> kw = std::make_shared<KameleonWrapper>(absPath(metadata->path));
|
||||
|
||||
metadata->scale = kw->getModelScaleScaled();
|
||||
metadata->offset = kw->getModelBarycenterOffsetScaled();
|
||||
metadata->parent = kw->getParent();
|
||||
metadata->frame = kw->getFrame();
|
||||
|
||||
cygnet = std::make_shared<DataPlane>(kw, metadata);
|
||||
}else {
|
||||
auto node = OsEng.renderEngine().scene()->sceneGraphNode(metadata->parent);
|
||||
if(node){
|
||||
metadata->scale = glm::vec4(3, 3, 3, 10);
|
||||
metadata->offset = glm::vec4(0, 0, 0, 1);
|
||||
metadata->frame = "GALACTIC";
|
||||
|
||||
cygnet = std::make_shared<TexturePlane>(metadata);
|
||||
}else{
|
||||
OsEng.renderEngine().registerScreenSpaceRenderable(std::make_shared<ScreenSpaceCygnet>(metadata));
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
cygnet->initialize();
|
||||
@@ -106,7 +102,7 @@ namespace openspace{
|
||||
}
|
||||
}
|
||||
|
||||
DownloadManager::FileFuture* ISWAManager::downloadImage(int id, std::string path){
|
||||
std::shared_ptr<DownloadManager::FileFuture> ISWAManager::downloadImage(int id, std::string path){
|
||||
|
||||
return DlManager.downloadFile(
|
||||
iSWAurl(id),
|
||||
@@ -126,7 +122,6 @@ namespace openspace{
|
||||
std::shared_ptr<ExtensionFuture> extFuture = std::make_shared<ExtensionFuture>();
|
||||
extFuture->isFinished = false;
|
||||
extFuture->id = id;
|
||||
std::cout << "extension id: "<< id << std::endl;
|
||||
DlManager.getFileExtension(
|
||||
iSWAurl(id),
|
||||
[extFuture](std::string extension){
|
||||
|
||||
@@ -28,16 +28,27 @@
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <ghoul/glm.h>
|
||||
|
||||
namespace openspace {
|
||||
class ISWACygnet;
|
||||
class ISWAContainer;
|
||||
|
||||
struct ExtensionFuture {
|
||||
|
||||
std::string extension;
|
||||
bool isFinished;
|
||||
int id;
|
||||
std::string parent;
|
||||
};
|
||||
|
||||
struct Metadata {
|
||||
int id;
|
||||
std::string path;
|
||||
std::string parent;
|
||||
std::string frame;
|
||||
glm::vec4 offset;
|
||||
glm::vec4 scale;
|
||||
std::string scaleVariable;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,9 +61,10 @@ public:
|
||||
~ISWAManager();
|
||||
|
||||
std::shared_ptr<ISWACygnet> createISWACygnet(int, std::string);
|
||||
std::shared_ptr<ISWACygnet> createISWACygnet(std::shared_ptr<Metadata> metadata);
|
||||
void addCygnet(std::string info);
|
||||
|
||||
DownloadManager::FileFuture* downloadImage(int, std::string);
|
||||
std::shared_ptr<DownloadManager::FileFuture> downloadImage(int, std::string);
|
||||
void downloadData();
|
||||
|
||||
std::shared_ptr<ExtensionFuture> fileExtension(int);
|
||||
|
||||
@@ -136,6 +136,8 @@ public:
|
||||
|
||||
Model model();
|
||||
GridType gridType();
|
||||
std::string getParent();
|
||||
std::string getFrame();
|
||||
|
||||
private:
|
||||
typedef std::vector<glm::vec3> TraceLine;
|
||||
|
||||
@@ -998,4 +998,40 @@ glm::vec4 KameleonWrapper::classifyFieldline(FieldlineEnd fEnd, FieldlineEnd bEn
|
||||
return color;
|
||||
}
|
||||
|
||||
std::string KameleonWrapper::getParent(){
|
||||
if( _type == KameleonWrapper::Model::BATSRUS ||
|
||||
_type == KameleonWrapper::Model::OpenGGCM ||
|
||||
_type == KameleonWrapper::Model::LFM)
|
||||
{
|
||||
return "Earth";
|
||||
}else if(
|
||||
_type == KameleonWrapper::Model::ENLIL ||
|
||||
_type == KameleonWrapper::Model::MAS ||
|
||||
_type == KameleonWrapper::Model::Adapt3D ||
|
||||
_type == KameleonWrapper::Model::SWMF)
|
||||
{
|
||||
return "SolarSystem";
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
std::string KameleonWrapper::getFrame(){
|
||||
if( _type == KameleonWrapper::Model::BATSRUS ||
|
||||
_type == KameleonWrapper::Model::OpenGGCM ||
|
||||
_type == KameleonWrapper::Model::LFM)
|
||||
{
|
||||
return "GSM";
|
||||
}else if(
|
||||
_type == KameleonWrapper::Model::ENLIL ||
|
||||
_type == KameleonWrapper::Model::MAS ||
|
||||
_type == KameleonWrapper::Model::Adapt3D ||
|
||||
_type == KameleonWrapper::Model::SWMF)
|
||||
{
|
||||
return "GALACTIC";
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace {
|
||||
const std::string RequestApplicationVersion = "application_version";
|
||||
|
||||
struct ProgressInformation {
|
||||
openspace::DownloadManager::FileFuture* future;
|
||||
std::shared_ptr<openspace::DownloadManager::FileFuture> future;
|
||||
std::chrono::system_clock::time_point startTime;
|
||||
const openspace::DownloadManager::DownloadProgressCallback* callback;
|
||||
};
|
||||
@@ -139,14 +139,14 @@ DownloadManager::DownloadManager(std::string requestURL, int applicationVersion,
|
||||
// TODO: Allow for multiple requestURLs
|
||||
}
|
||||
|
||||
DownloadManager::FileFuture* DownloadManager::downloadFile(
|
||||
std::shared_ptr<DownloadManager::FileFuture> DownloadManager::downloadFile(
|
||||
const std::string& url, const ghoul::filesystem::File& file, bool overrideFile,
|
||||
DownloadFinishedCallback finishedCallback, DownloadProgressCallback progressCallback)
|
||||
{
|
||||
if (!overrideFile && FileSys.fileExists(file))
|
||||
return nullptr;
|
||||
|
||||
FileFuture* future = new FileFuture(file.filename());
|
||||
std::shared_ptr<FileFuture> future = std::make_shared<FileFuture>(file.filename());
|
||||
FILE* fp = fopen(file.path().c_str(), "wb");
|
||||
|
||||
LDEBUG("Start downloading file: '" << url << "' into file '" << file.path() << "'");
|
||||
@@ -202,13 +202,12 @@ DownloadManager::FileFuture* DownloadManager::downloadFile(
|
||||
return future;
|
||||
}
|
||||
|
||||
|
||||
std::vector<DownloadManager::FileFuture*> DownloadManager::downloadRequestFiles(
|
||||
std::vector<std::shared_ptr<DownloadManager::FileFuture>> DownloadManager::downloadRequestFiles(
|
||||
const std::string& identifier, const ghoul::filesystem::Directory& destination,
|
||||
int version, bool overrideFiles, DownloadFinishedCallback finishedCallback,
|
||||
DownloadProgressCallback progressCallback)
|
||||
{
|
||||
std::vector<FileFuture*> futures;
|
||||
std::vector<std::shared_ptr<FileFuture>> futures;
|
||||
FileSys.createDirectory(destination, ghoul::filesystem::FileSystem::Recursive::Yes);
|
||||
// TODO: Check s ---abock
|
||||
// TODO: Escaping is necessary ---abock
|
||||
@@ -239,7 +238,7 @@ std::vector<DownloadManager::FileFuture*> DownloadManager::downloadRequestFiles(
|
||||
|
||||
LDEBUG("\tLine: " << line << " ; Dest: " << destination.path() + "/" + file);
|
||||
|
||||
FileFuture* future = DlManager.downloadFile(
|
||||
std::shared_ptr<FileFuture> future = DlManager.downloadFile(
|
||||
line,
|
||||
destination.path() + "/" + file,
|
||||
overrideFiles,
|
||||
@@ -251,7 +250,7 @@ std::vector<DownloadManager::FileFuture*> DownloadManager::downloadRequestFiles(
|
||||
isFinished = true;
|
||||
};
|
||||
|
||||
FileFuture* f = downloadFile(
|
||||
std::shared_ptr<FileFuture> f = downloadFile(
|
||||
fullRequest,
|
||||
requestFile,
|
||||
true,
|
||||
@@ -268,7 +267,7 @@ void DownloadManager::downloadRequestFilesAsync(const std::string& identifier,
|
||||
AsyncDownloadFinishedCallback callback)
|
||||
{
|
||||
auto downloadFunction = [this, identifier, destination, version, overrideFiles, callback](){
|
||||
std::vector<FileFuture*> f = downloadRequestFiles(
|
||||
std::vector<std::shared_ptr<FileFuture>> f = downloadRequestFiles(
|
||||
identifier,
|
||||
destination,
|
||||
version,
|
||||
|
||||
@@ -99,6 +99,9 @@ void ABufferRenderer::initialize() {
|
||||
glGenTextures(1, &_fragmentTexture);
|
||||
|
||||
_nAaSamples = OsEng.windowWrapper().currentNumberOfAaSamples();
|
||||
if (_nAaSamples == 0) {
|
||||
_nAaSamples = 1;
|
||||
}
|
||||
if (_nAaSamples > 8) {
|
||||
LERROR("ABuffer renderer does not support more than 8 MSAA samples.");
|
||||
_nAaSamples = 8;
|
||||
|
||||
@@ -123,6 +123,9 @@ void FramebufferRenderer::initialize() {
|
||||
OsEng.renderEngine().raycasterManager().addListener(*this);
|
||||
|
||||
_nAaSamples = OsEng.windowWrapper().currentNumberOfAaSamples();
|
||||
if (_nAaSamples == 0) {
|
||||
_nAaSamples = 1;
|
||||
}
|
||||
if (_nAaSamples > 8) {
|
||||
LERROR("Framebuffer renderer does not support more than 8 MSAA samples.");
|
||||
_nAaSamples = 8;
|
||||
|
||||
@@ -78,12 +78,6 @@ ScreenSpaceRenderable::ScreenSpaceRenderable()
|
||||
|
||||
ScreenSpaceRenderable::~ScreenSpaceRenderable(){}
|
||||
|
||||
|
||||
//deinitialzie(){
|
||||
// unregisterProperies
|
||||
// }
|
||||
|
||||
|
||||
bool ScreenSpaceRenderable::isEnabled() const {
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
@@ -261,6 +261,8 @@ bool SceneGraph::loadFromFile(const std::string& sceneDescription) {
|
||||
}
|
||||
|
||||
node->node->setParent(parentNode);
|
||||
parentNode->addChild(node->node);
|
||||
|
||||
}
|
||||
|
||||
// Setup dependencies
|
||||
|
||||
@@ -155,10 +155,10 @@ bool SceneGraphNode::deinitialize() {
|
||||
delete _ephemeris;
|
||||
_ephemeris = nullptr;
|
||||
|
||||
for (SceneGraphNode* child : _children) {
|
||||
child->deinitialize();
|
||||
delete child;
|
||||
}
|
||||
// for (SceneGraphNode* child : _children) {
|
||||
// child->deinitialize();
|
||||
// delete child;
|
||||
//}
|
||||
_children.clear();
|
||||
|
||||
// reset variables
|
||||
@@ -283,6 +283,11 @@ void SceneGraphNode::setParent(SceneGraphNode* parent)
|
||||
_parent = parent;
|
||||
}
|
||||
|
||||
void SceneGraphNode::addChild(SceneGraphNode* child) {
|
||||
_children.push_back(child);
|
||||
}
|
||||
|
||||
|
||||
//not used anymore @AA
|
||||
//bool SceneGraphNode::abandonChild(SceneGraphNode* child) {
|
||||
// std::vector < SceneGraphNode* >::iterator it = std::find(_children.begin(), _children.end(), child);
|
||||
|
||||
Reference in New Issue
Block a user