mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 19:50:03 -06:00
Some clean up and small fixes
This commit is contained in:
@@ -20,7 +20,7 @@ return {
|
||||
"milkyway",
|
||||
-- "milkyway-eso",
|
||||
--"constellationbounds",
|
||||
-- "fieldlines",
|
||||
--"fieldlines",
|
||||
--"io",
|
||||
--"europa",
|
||||
--"ganymede",
|
||||
|
||||
Binary file not shown.
@@ -1,63 +0,0 @@
|
||||
KPL/FK
|
||||
|
||||
Inspired by William Thompson of NASA GSFC.
|
||||
|
||||
The coordinate frames in this file all have ID values based on the pattern
|
||||
18ccple, where
|
||||
|
||||
18 = Prefix to put in the allowed 1400000 to 2000000 range
|
||||
cc = 03 for geocentric, 10 for heliocentric
|
||||
p = Pole basis: 1=geographic, 2=geomagnetic, 3=ecliptic, 4=solar
|
||||
l = Longitude basis: 1=Earth-Sun, 2=ecliptic
|
||||
e = Ecliptic basis: 0=J2000, 1=mean, 2=true
|
||||
|
||||
Earth geomagnetic North pole vector from IGRF-11 at
|
||||
http://www.ngdc.noaa.gov/IAGA/vmod/igrf.html
|
||||
|
||||
\begindata
|
||||
FRAME_MAG = 1803222
|
||||
FRAME_1803222_NAME = 'MAG'
|
||||
FRAME_1803222_CLASS = 3
|
||||
FRAME_1803222_CLASS_ID = 1803222
|
||||
FRAME_1803222_CENTER = 399
|
||||
|
||||
CK_1803222_SCLK = -39900001
|
||||
CK_1803222_SPK = 399
|
||||
|
||||
\begintext
|
||||
|
||||
Geocentric Solar Magnetospheric frame (GSM):
|
||||
* Origin at the Earth centre
|
||||
* X along the origin-to-Sun vector
|
||||
* Z points in the direction of Earth geomagnetic North pole vector
|
||||
* Y is Z x X, completing the right-handed reference frame
|
||||
|
||||
\begindata
|
||||
|
||||
FRAME_GSM = 1803212
|
||||
FRAME_1803212_NAME = 'GSM'
|
||||
FRAME_1803212_CLASS = 5
|
||||
FRAME_1803212_CLASS_ID = 1803212
|
||||
FRAME_1803212_CENTER = 399
|
||||
|
||||
FRAME_1803212_RELATIVE = 'J2000'
|
||||
FRAME_1803212_DEF_STYLE = 'PARAMETERIZED'
|
||||
FRAME_1803212_FAMILY = 'TWO-VECTOR'
|
||||
|
||||
FRAME_1803212_PRI_AXIS = 'X'
|
||||
FRAME_1803212_PRI_VECTOR_DEF = 'OBSERVER_TARGET_POSITION'
|
||||
FRAME_1803212_PRI_OBSERVER = 399
|
||||
FRAME_1803212_PRI_TARGET = 10
|
||||
FRAME_1803212_PRI_ABCORR = 'NONE'
|
||||
|
||||
FRAME_1803212_SEC_AXIS = 'Z'
|
||||
FRAME_1803212_SEC_VECTOR_DEF = 'CONSTANT'
|
||||
FRAME_1803212_SEC_FRAME = 'MAG'
|
||||
FRAME_1803212_SEC_SPEC = 'RECTANGULAR'
|
||||
FRAME_1803212_SEC_VECTOR = ( 0, 0, 1 )
|
||||
|
||||
FRAME_1803212_ROTATION_STATE = 'ROTATING'
|
||||
|
||||
\begintext
|
||||
|
||||
$Id: geomagnetic.tf 4746 2013-04-05 19:49:10Z bogdan $
|
||||
@@ -1,25 +0,0 @@
|
||||
KPL/SCLK
|
||||
|
||||
This kernel introduces an artificial spacecraft clock that is in an identity
|
||||
relation with TDT. This is useful for spacecrafts whose ancillary attitude
|
||||
data is referenced on a terrestrial time scale.
|
||||
|
||||
\begindata
|
||||
|
||||
SCLK_KERNEL_ID = ( @2013-04-08T12:00:00 )
|
||||
|
||||
SCLK_DATA_TYPE_39900000 = ( 1 )
|
||||
SCLK01_TIME_SYSTEM_39900000 = ( 2 )
|
||||
SCLK01_N_FIELDS_39900000 = ( 1 )
|
||||
SCLK01_MODULI_39900000 = ( 2147483648 )
|
||||
SCLK01_OFFSETS_39900000 = ( 0 )
|
||||
SCLK01_OUTPUT_DELIM_39900000 = ( 1 )
|
||||
|
||||
SCLK_PARTITION_START_39900000 = ( 0 )
|
||||
SCLK_PARTITION_END_39900000 = ( 2147483647 )
|
||||
|
||||
SCLK01_COEFFICIENTS_39900000 = ( 0, 0, 1 )
|
||||
|
||||
\begintext
|
||||
|
||||
$Id: tdt.tsc 4747 2013-04-08 18:36:22Z bogdan $
|
||||
@@ -1,30 +0,0 @@
|
||||
KPL/SCLK
|
||||
|
||||
This kernel introduces an artificial clock which is TDT with a shifted
|
||||
origin, in order to represent time before J2000.0 as positive s/c clock
|
||||
ticks as required by the SPICE SCLK sub-system.
|
||||
|
||||
This kernel is valid between 1965-12-23 and 2034-01-10.
|
||||
|
||||
The time accuracy loss due to use of this kernel is in the order of
|
||||
0.24 microseconds.
|
||||
|
||||
\begindata
|
||||
|
||||
SCLK_KERNEL_ID = ( @2013-04-05T12:00:00 )
|
||||
|
||||
SCLK_DATA_TYPE_39900001 = ( 1 )
|
||||
SCLK01_TIME_SYSTEM_39900001 = ( 2 )
|
||||
SCLK01_N_FIELDS_39900001 = ( 1 )
|
||||
SCLK01_MODULI_39900001 = ( 2147483648 )
|
||||
SCLK01_OFFSETS_39900001 = ( 1073741824 )
|
||||
SCLK01_OUTPUT_DELIM_39900001 = ( 1 )
|
||||
|
||||
SCLK_PARTITION_START_39900001 = ( -1073741824 )
|
||||
SCLK_PARTITION_END_39900001 = ( 1073741823 )
|
||||
|
||||
SCLK01_COEFFICIENTS_39900001 = ( 0, -1073741824, 1 )
|
||||
|
||||
\begintext
|
||||
|
||||
$Id: tdt_shifted.tsc 4746 2013-04-05 19:49:10Z bogdan $
|
||||
@@ -29,7 +29,7 @@ CygnetPlane::CygnetPlane(const ghoul::Dictionary& dictionary)
|
||||
,_quad(0)
|
||||
,_vertexPositionBuffer(0)
|
||||
,_futureObject(nullptr)
|
||||
,_backgroundValue(0.0f)
|
||||
// ,_backgroundValue(0.0f)
|
||||
{}
|
||||
|
||||
CygnetPlane::~CygnetPlane(){}
|
||||
@@ -38,8 +38,6 @@ bool CygnetPlane::isReady() const{
|
||||
bool ready = true;
|
||||
if (!_shader)
|
||||
ready &= false;
|
||||
// if(!_texture)
|
||||
// ready &= false;
|
||||
return ready;
|
||||
}
|
||||
|
||||
@@ -93,12 +91,6 @@ void CygnetPlane::render(const RenderData& data){
|
||||
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", transform);
|
||||
// _shader->setUniform("background", _backgroundValue);
|
||||
|
||||
// _shader->setUniform("top", _topColor.value());
|
||||
// _shader->setUniform("mid", _midColor.value());
|
||||
// _shader->setUniform("bot", _botColor.value());
|
||||
// _shader->setUniform("tfValues", _tfValues.value());
|
||||
|
||||
setPscUniforms(*_shader.get(), data.camera, position);
|
||||
|
||||
@@ -114,32 +106,16 @@ void CygnetPlane::render(const RenderData& data){
|
||||
_texture->bind();
|
||||
_shader->setUniform("texture1", unit);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
glBindVertexArray(_quad);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glEnable(GL_CULL_FACE);
|
||||
_shader->deactivate();
|
||||
|
||||
// position += transform*(glm::vec4(0.5f*_data->scale.x+100.0f ,-0.5f*_data->scale.y, 0.0f, _data->scale.w));
|
||||
// // RenderData data = { *_camera, psc(), doPerformanceMeasurements };
|
||||
// ColorBarData cbdata = { data.camera,
|
||||
// position,
|
||||
// transform,
|
||||
// _topColor.value(),
|
||||
// _midColor.value(),
|
||||
// _botColor.value(),
|
||||
// _tfValues.value()
|
||||
// // transform
|
||||
// };
|
||||
// _colorbar->render(cbdata);
|
||||
}
|
||||
|
||||
void CygnetPlane::update(const UpdateData& data){
|
||||
_openSpaceTime = Time::ref().currentTime();
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());;
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", _data->frame, _openSpaceTime);
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ public:
|
||||
virtual void render(const RenderData& data) override;
|
||||
virtual void update(const UpdateData& data) override;
|
||||
|
||||
|
||||
protected:
|
||||
virtual bool loadTexture() = 0;
|
||||
virtual bool updateTexture() = 0;
|
||||
@@ -53,7 +52,7 @@ protected:
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> _futureObject;
|
||||
float _backgroundValue;
|
||||
// float _backgroundValue;
|
||||
};
|
||||
} //namespace openspace
|
||||
|
||||
|
||||
@@ -46,9 +46,7 @@ DataPlane::DataPlane(const ghoul::Dictionary& dictionary)
|
||||
,_useHistogram("_useHistogram", "Use Histogram", true)
|
||||
,_useRGB("useRGB","Use RGB Channels", false)
|
||||
// ,_colorbar(nullptr)
|
||||
{
|
||||
_id = id();
|
||||
|
||||
{
|
||||
std::string name;
|
||||
dictionary.getValue("Name", name);
|
||||
setName(name);
|
||||
@@ -106,9 +104,9 @@ bool DataPlane::initialize(){
|
||||
|
||||
updateTexture();
|
||||
|
||||
|
||||
std::string tfPath = "${OPENSPACE_DATA}/colormap_parula.jpg";
|
||||
_transferFunction = std::make_shared<TransferFunction>(tfPath);
|
||||
|
||||
// std::cout << "Creating Colorbar" << std::endl;
|
||||
// _colorbar = std::make_shared<ColorBar>();
|
||||
// if(_colorbar){
|
||||
@@ -132,9 +130,6 @@ bool DataPlane::deinitialize(){
|
||||
return true;
|
||||
}
|
||||
|
||||
// void DataPlane::render(const RenderData& data){} //moved to CygnetPlane
|
||||
// void DataPLane::update(const UpdateData& data){} //moved to CygnetPlane
|
||||
|
||||
bool DataPlane::loadTexture() {
|
||||
float* values = readData();
|
||||
if(!values)
|
||||
@@ -268,11 +263,6 @@ float* DataPlane::readData(){
|
||||
|
||||
sum[i] += v;
|
||||
logmean[i] += (v != 0) ? ceil(log10(fabs(v))) : 0.0f;
|
||||
if((_backgroundValue == 0.0f) && (fabs(value[0]) < 2.5f) &&
|
||||
(fabs(value[1]) < 2.5f) && (fabs(value[2]) < 2.5f) ){
|
||||
_backgroundValue = v;
|
||||
std::cout << _backgroundValue << std::endl;
|
||||
}
|
||||
}
|
||||
numValues++;
|
||||
}
|
||||
@@ -354,7 +344,6 @@ void DataPlane::processData(float* outputData, int inputChannel, std::vector<flo
|
||||
}
|
||||
}
|
||||
//======================
|
||||
>>>>>>> cleanup of read data function
|
||||
|
||||
for(int i=0; i< numValues; i++){
|
||||
|
||||
@@ -404,9 +393,4 @@ float DataPlane::normalizeWithLogarithm(float value, int logMean){
|
||||
float logNormalized = ((value/pow(10,logMean)+logMin))/(logMin+logMax);
|
||||
return glm::clamp(logNormalized,0.0f, 1.0f);
|
||||
}
|
||||
|
||||
int DataPlane::id(){
|
||||
static int id = 0;
|
||||
return id++;
|
||||
}
|
||||
}// namespace openspace
|
||||
@@ -62,8 +62,6 @@ class DataPlane : public CygnetPlane {
|
||||
float normalizeWithStandardScore(float value, float mean, float sd);
|
||||
float normalizeWithLogarithm(float value, int logMean);
|
||||
|
||||
static int id();
|
||||
|
||||
properties::SelectionProperty _dataOptions;
|
||||
properties::Vec2Property _normValues;
|
||||
properties::BoolProperty _useLog;
|
||||
|
||||
@@ -43,7 +43,6 @@ ISWAContainer::ISWAContainer(const ghoul::Dictionary& dictionary)
|
||||
:Renderable(dictionary)
|
||||
{
|
||||
ISWAManager::initialize();
|
||||
ISWAManager::ref().setContainer(this);
|
||||
std::string textureCygnets;
|
||||
std::string dataCygnets;
|
||||
dictionary.getValue("TextureCygnets", textureCygnets);
|
||||
@@ -67,109 +66,11 @@ ISWAContainer::ISWAContainer(const ghoul::Dictionary& dictionary)
|
||||
}
|
||||
|
||||
ISWAContainer::~ISWAContainer(){}
|
||||
|
||||
bool ISWAContainer::initialize(){
|
||||
// ISWAManager::ref().addISWACygnet(0, "BATSRUS.cdf");
|
||||
// ISWAManager::ref().addISWACygnet(5, "Screen");
|
||||
// ISWAManager::ref().addISWACygnet(7, "Sun");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISWAContainer::deinitialize(){
|
||||
for(auto iSWACygnet : _iSWACygnets)
|
||||
iSWACygnet->deinitialize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ISWAContainer::initialize(){return true;}
|
||||
bool ISWAContainer::deinitialize(){return true;}
|
||||
bool ISWAContainer::isReady() const { return true; }
|
||||
void ISWAContainer::render(const RenderData& data){}
|
||||
|
||||
void ISWAContainer::render(const RenderData& data){
|
||||
// for(auto iSWACygnet : _iSWACygnets){
|
||||
// if(iSWACygnet->isEnabled() && iSWACygnet->isReady()){
|
||||
// iSWACygnet->render(data);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
void ISWAContainer::update(const UpdateData& data){}
|
||||
|
||||
void ISWAContainer::update(const UpdateData& data){
|
||||
|
||||
// // Create iSWAcygnets if a ExtensionFuture in _extFutures is finished loading.
|
||||
// // Then remove it from the _extFutures vector.
|
||||
// for (auto it = _extFutures.begin(); it != _extFutures.end(); )
|
||||
// {
|
||||
// if ((*it)->isFinished) {
|
||||
// std::string path = "${OPENSPACE_DATA}/scene/iswa/" + std::to_string((*it)->id) + (*it)->extension;
|
||||
|
||||
// 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);
|
||||
// }
|
||||
// it = _extFutures.erase( it );
|
||||
// }
|
||||
// else {
|
||||
// ++it;
|
||||
// }
|
||||
// }
|
||||
|
||||
// if(!_deletedCygnets.empty())
|
||||
// _deletedCygnets.clear();
|
||||
|
||||
// for(auto& iSWACygnet : _iSWACygnets)
|
||||
// iSWACygnet->update(data);
|
||||
}
|
||||
|
||||
void ISWAContainer::addISWACygnet(std::string 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, std::string data){
|
||||
// std::shared_ptr<ExtensionFuture> extFuture = ISWAManager::ref().fileExtension(id);
|
||||
// extFuture->parent = data;
|
||||
// _extFutures.push_back(extFuture);
|
||||
}
|
||||
|
||||
void ISWAContainer::addISWACygnet(std::shared_ptr<ISWACygnet> cygnet){
|
||||
// if(cygnet){
|
||||
// _iSWACygnets.push_back(cygnet);
|
||||
// }
|
||||
}
|
||||
|
||||
void ISWAContainer::deleteISWACygnet(std::string name){
|
||||
// std::shared_ptr<ISWACygnet> c = iSWACygnet(name);
|
||||
|
||||
// auto it = std::find(
|
||||
// _iSWACygnets.begin(),
|
||||
// _iSWACygnets.end(),
|
||||
// c
|
||||
// );
|
||||
|
||||
// if (it != _iSWACygnets.end()) {
|
||||
// c->deinitialize();
|
||||
// _deletedCygnets.push_back(c);
|
||||
// _iSWACygnets.erase(it);
|
||||
// }
|
||||
}
|
||||
|
||||
std::shared_ptr<ISWACygnet> ISWAContainer::iSWACygnet(std::string name){
|
||||
/* for(auto cygnet : _iSWACygnets){
|
||||
if(cygnet->name() == name){
|
||||
return cygnet;
|
||||
}
|
||||
}*/
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@@ -44,18 +44,7 @@ public:
|
||||
virtual void render(const RenderData& data) override;
|
||||
virtual void update(const UpdateData& data) override;
|
||||
|
||||
void addISWACygnet(std::string path);
|
||||
void addISWACygnet(int id, std::string data);
|
||||
void addISWACygnet(std::shared_ptr<ISWACygnet> cygnet);
|
||||
|
||||
void deleteISWACygnet(std::string name);
|
||||
|
||||
std::shared_ptr<ISWACygnet> iSWACygnet(std::string name);
|
||||
|
||||
private:
|
||||
std::vector<std::shared_ptr<ISWACygnet>> _iSWACygnets;
|
||||
std::vector<std::shared_ptr<ExtensionFuture>> _extFutures;
|
||||
std::vector<std::shared_ptr<ISWACygnet>> _deletedCygnets;
|
||||
};
|
||||
|
||||
}//namespace openspace
|
||||
|
||||
@@ -50,16 +50,16 @@ ISWACygnet::ISWACygnet(const ghoul::Dictionary& dictionary)
|
||||
dictionary.getValue("Id", renderableId);
|
||||
dictionary.getValue("UpdateTime", updateTime);
|
||||
dictionary.getValue("SpatialScale", spatialScale);
|
||||
dictionary.getValue("Min", min);
|
||||
dictionary.getValue("Max", max);
|
||||
dictionary.getValue("GridMin", min);
|
||||
dictionary.getValue("GridMax", max);
|
||||
dictionary.getValue("Frame",_data->frame);
|
||||
dictionary.getValue("CoordinateType", _data->coordinateType);
|
||||
|
||||
_data->id = (int) renderableId;
|
||||
_data->updateTime = (int) updateTime;
|
||||
_data->spatialScale = spatialScale;
|
||||
_data->min = min;
|
||||
_data->max = max;
|
||||
_data->gridMin = min;
|
||||
_data->gridMax = max;
|
||||
|
||||
|
||||
glm::vec3 scale;
|
||||
@@ -79,10 +79,7 @@ ISWACygnet::ISWACygnet(const ghoul::Dictionary& dictionary)
|
||||
|
||||
_data->scale = scale;
|
||||
_data->offset = offset;
|
||||
// dictionary.getValue("Path",_data->path);
|
||||
// dictionary.getValue("Parent",_data->parent);
|
||||
|
||||
// addProperty(_enabled);
|
||||
addProperty(_delete);
|
||||
|
||||
// std::cout << _data->id << std::endl;
|
||||
|
||||
@@ -55,8 +55,8 @@ struct Metadata {
|
||||
std::string path;
|
||||
std::string parent;
|
||||
std::string frame;
|
||||
glm::vec3 min;
|
||||
glm::vec3 max;
|
||||
glm::vec3 gridMin;
|
||||
glm::vec3 gridMax;
|
||||
glm::vec3 offset;
|
||||
glm::vec3 scale;
|
||||
glm::vec4 spatialScale;
|
||||
@@ -68,28 +68,17 @@ struct Metadata {
|
||||
|
||||
class ISWACygnet : public Renderable{
|
||||
public:
|
||||
// ISWACygnet(std::shared_ptr<Metadata> data);
|
||||
ISWACygnet(const ghoul::Dictionary& dictionary);
|
||||
~ISWACygnet();
|
||||
|
||||
virtual bool initialize() = 0;
|
||||
virtual bool deinitialize() = 0;
|
||||
|
||||
// virtual void render(const RenderData& data) = 0;
|
||||
// virtual void update(const UpdateData& data) = 0;
|
||||
// virtual bool isReady() = 0;
|
||||
|
||||
// bool enabled(){return _enabled.value();}
|
||||
|
||||
protected:
|
||||
// void setPscUniforms(ghoul::opengl::ProgramObject* program, const Camera* camera, const PowerScaledCoordinate& position);
|
||||
void registerProperties();
|
||||
void unregisterProperties();
|
||||
void initializeTime();
|
||||
void updateCygnet();
|
||||
// void setParent();
|
||||
|
||||
// properties::BoolProperty _enabled;
|
||||
|
||||
properties::TriggerProperty _delete;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
@@ -108,8 +97,6 @@ protected:
|
||||
int _minRealTimeUpdateInterval;
|
||||
|
||||
std::shared_ptr<TransferFunction> _transferFunction;
|
||||
|
||||
int _id;
|
||||
};
|
||||
|
||||
}//namespace openspace
|
||||
|
||||
@@ -43,9 +43,7 @@ namespace openspace {
|
||||
|
||||
KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
|
||||
:CygnetPlane(dictionary)
|
||||
{
|
||||
_id = id();
|
||||
|
||||
{
|
||||
std::string name;
|
||||
dictionary.getValue("Name", name);
|
||||
setName(name);
|
||||
@@ -65,8 +63,6 @@ KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
|
||||
}else{
|
||||
_data->scale.z = 0;
|
||||
}
|
||||
|
||||
std::cout << "Creating kameleonplane" << std::endl;
|
||||
}
|
||||
|
||||
KameleonPlane::~KameleonPlane(){}
|
||||
@@ -144,8 +140,4 @@ bool KameleonPlane::updateTexture(){
|
||||
return true;
|
||||
}
|
||||
|
||||
int KameleonPlane::id(){
|
||||
static int id = 0;
|
||||
return id++;
|
||||
}
|
||||
}// namespace openspace
|
||||
@@ -36,13 +36,10 @@ namespace openspace {
|
||||
|
||||
ScreenSpaceCygnet::ScreenSpaceCygnet(int cygnetId)
|
||||
: ScreenSpaceRenderable()
|
||||
, _updateInterval("updateInterval", "Update Interval", 0.35, 0.1 , 1.0)
|
||||
, _updateInterval("updateInterval", "Update Interval", 1.0, 0.0 , 10.0)
|
||||
, _cygnetId(cygnetId)
|
||||
// , _path(path)
|
||||
{
|
||||
std::cout << "screenspacecygnet constructor 1" << std::endl;
|
||||
_id = id();
|
||||
setName("ScreenSpaceCygnet" + std::to_string(_id));
|
||||
setName("iSWACygnet" + std::to_string(_cygnetId));
|
||||
addProperty(_updateInterval);
|
||||
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_enabled);
|
||||
@@ -69,6 +66,9 @@ bool ScreenSpaceCygnet::initialize(){
|
||||
useEuclideanCoordinates(_useFlatScreen.value());
|
||||
});
|
||||
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
_lastUpdateRealTime = _realTime;
|
||||
|
||||
return isReady();
|
||||
}
|
||||
|
||||
@@ -89,8 +89,6 @@ bool ScreenSpaceCygnet::deinitialize(){
|
||||
_shader = nullptr;
|
||||
}
|
||||
|
||||
// std::remove(absPath(_path).c_str());
|
||||
// _path = "";
|
||||
_memorybuffer = "";
|
||||
return true;
|
||||
}
|
||||
@@ -109,20 +107,18 @@ void ScreenSpaceCygnet::render(){
|
||||
}
|
||||
|
||||
void ScreenSpaceCygnet::update(){
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
int updateInterval = (int) (_updateInterval.value()*1000);
|
||||
bool timeToUpdate = ((_realTime.count()-_lastUpdateRealTime.count()) > updateInterval) &&
|
||||
(Time::ref().deltaTime() != 0);
|
||||
|
||||
_time = Time::ref().currentTime();
|
||||
|
||||
float openSpaceUpdateInterval = abs(Time::ref().deltaTime()*_updateInterval);
|
||||
if(openSpaceUpdateInterval){
|
||||
if(abs(_time-_lastUpdateTime) >= openSpaceUpdateInterval){
|
||||
updateTexture();
|
||||
_lastUpdateTime = _time;
|
||||
}
|
||||
if(updateInterval != 0 && (Time::ref().timeJumped() || timeToUpdate )){
|
||||
updateTexture();
|
||||
_lastUpdateRealTime = _realTime;
|
||||
}
|
||||
|
||||
if(_futureTexture && _futureTexture->isFinished){
|
||||
loadTexture();
|
||||
|
||||
_futureTexture = nullptr;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +135,6 @@ bool ScreenSpaceCygnet::isReady() const{
|
||||
void ScreenSpaceCygnet::updateTexture(){
|
||||
_memorybuffer = "";
|
||||
|
||||
// std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImage(_cygnetId, absPath(_path));
|
||||
std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImageToMemory(_cygnetId, _memorybuffer);
|
||||
if(future){
|
||||
_futureTexture = future;
|
||||
@@ -172,10 +167,4 @@ void ScreenSpaceCygnet::loadTexture() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int ScreenSpaceCygnet::id(){
|
||||
static int id = 0;
|
||||
return id++;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
#ifndef __SCREENSPACECYGNET_H__
|
||||
#define __SCREENSPACECYGNET_H__
|
||||
|
||||
#include <chrono>
|
||||
#include <openspace/rendering/screenspacerenderable.h>
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
@@ -43,21 +44,17 @@ public:
|
||||
bool isReady() const override;
|
||||
|
||||
private:
|
||||
static int id();
|
||||
void updateTexture();
|
||||
void loadTexture();
|
||||
|
||||
properties::FloatProperty _updateInterval;
|
||||
|
||||
std::string _path;
|
||||
const int _cygnetId;
|
||||
float _time;
|
||||
float _lastUpdateTime = 0.0f;
|
||||
|
||||
properties::FloatProperty _updateInterval;
|
||||
std::chrono::milliseconds _realTime;
|
||||
std::chrono::milliseconds _lastUpdateRealTime;
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> _futureTexture;
|
||||
std::string _memorybuffer;
|
||||
|
||||
int _id;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace openspace {
|
||||
TexturePlane::TexturePlane(const ghoul::Dictionary& dictionary)
|
||||
:CygnetPlane(dictionary)
|
||||
{
|
||||
_id = id();
|
||||
std::string name;
|
||||
dictionary.getValue("Name", name);
|
||||
setName(name);
|
||||
@@ -71,9 +70,6 @@ bool TexturePlane::deinitialize(){
|
||||
return true;
|
||||
}
|
||||
|
||||
// void TexturePlane::render(const RenderData& data){} //moved to CygnetPlane
|
||||
// void TexturePlane::update(const UpdateData& data){} //moved to CygnetPlane
|
||||
|
||||
bool TexturePlane::loadTexture() {
|
||||
if(_memorybuffer != ""){
|
||||
|
||||
@@ -119,9 +115,4 @@ bool TexturePlane::updateTexture(){
|
||||
return false;
|
||||
}
|
||||
|
||||
int TexturePlane::id(){
|
||||
static int id = 0;
|
||||
return id++;
|
||||
}
|
||||
|
||||
}// namespace openspace
|
||||
@@ -38,9 +38,6 @@
|
||||
|
||||
virtual bool initialize() override;
|
||||
virtual bool deinitialize() override;
|
||||
|
||||
// virtual void render(const RenderData& data) override; //moved to cygnetPlane
|
||||
// virtual void update(const UpdateData& data) override; //moved to cygnetPlane
|
||||
|
||||
private:
|
||||
virtual bool loadTexture() override;
|
||||
|
||||
@@ -40,7 +40,6 @@ namespace {
|
||||
|
||||
namespace openspace{
|
||||
ISWAManager::ISWAManager()
|
||||
:_container(nullptr)
|
||||
{
|
||||
_month["JAN"] = "01";
|
||||
_month["FEB"] = "02";
|
||||
@@ -81,10 +80,10 @@ namespace openspace{
|
||||
createScreenSpace(id);
|
||||
}else if(id < 0){
|
||||
//download metadata to texture plane
|
||||
std::shared_ptr<MetadataFuture> metaFuture = downloadMetadata(id);
|
||||
metaFuture->type = info;
|
||||
metaFuture->id = id;
|
||||
_metaFutures.push_back(metaFuture);
|
||||
std::shared_ptr<MetadataFuture> metadataFuture = downloadMetadata(id);
|
||||
metadataFuture->type = info;
|
||||
metadataFuture->id = id;
|
||||
_metadataFutures.push_back(metadataFuture);
|
||||
}else{
|
||||
//create kameleonplane
|
||||
createKameleonPlane(info);
|
||||
@@ -95,16 +94,16 @@ namespace openspace{
|
||||
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + name + "')");
|
||||
}
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> ISWAManager::downloadImage(int id, std::string path){
|
||||
return DlManager.downloadFile(
|
||||
iSWAurl(id),
|
||||
path,
|
||||
true,
|
||||
[path](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download finished: " << path);
|
||||
}
|
||||
);
|
||||
}
|
||||
// std::shared_ptr<DownloadManager::FileFuture> ISWAManager::downloadImage(int id, std::string path){
|
||||
// return DlManager.downloadFile(
|
||||
// iSWAurl(id),
|
||||
// path,
|
||||
// true,
|
||||
// [path](const DownloadManager::FileFuture& f){
|
||||
// LDEBUG("Download finished: " << path);
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> ISWAManager::downloadImageToMemory(int id, std::string& buffer){
|
||||
return DlManager.downloadToMemory(
|
||||
@@ -126,53 +125,21 @@ namespace openspace{
|
||||
);
|
||||
}
|
||||
|
||||
std::shared_ptr<MetadataFuture> ISWAManager::downloadMetadata(int id){
|
||||
std::shared_ptr<MetadataFuture> metaFuture = std::make_shared<MetadataFuture>();
|
||||
|
||||
metaFuture->id = id;
|
||||
DlManager.downloadToMemory(
|
||||
"http://128.183.168.116:3000/" + std::to_string(-id),
|
||||
// "http://10.0.0.76:3000/" + std::to_string(-id),
|
||||
metaFuture->json,
|
||||
[metaFuture](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download to memory finished");
|
||||
metaFuture->isFinished = true;
|
||||
}
|
||||
);
|
||||
return metaFuture;
|
||||
}
|
||||
|
||||
std::shared_ptr<ExtensionFuture> ISWAManager::fileExtension(int id){
|
||||
std::shared_ptr<ExtensionFuture> extFuture = std::make_shared<ExtensionFuture>();
|
||||
extFuture->isFinished = false;
|
||||
extFuture->id = id;
|
||||
DlManager.getFileExtension(
|
||||
iSWAurl(id),
|
||||
[extFuture](std::string extension){
|
||||
std::stringstream ss(extension);
|
||||
std::string token;
|
||||
std::getline(ss, token, '/');
|
||||
std::getline(ss, token);
|
||||
|
||||
|
||||
std::string ext = "."+token;
|
||||
extFuture->extension = ext;
|
||||
extFuture->isFinished = true;
|
||||
void ISWAManager::update(){
|
||||
for (auto it = _metadataFutures.begin(); it != _metadataFutures.end(); ){
|
||||
if((*it)->isFinished) {
|
||||
if((*it)->type == "TEXTURE"){
|
||||
createPlane((*it)->id,(*it)->json,std::string("TexturePlane"));
|
||||
}else if ((*it)->type == "DATA"){
|
||||
createPlane((*it)->id,(*it)->json,std::string("DataPlane"));
|
||||
} else {
|
||||
LERROR("\""+ (*it)->type + "\" is not a valid type");
|
||||
}
|
||||
);
|
||||
|
||||
return extFuture;
|
||||
}
|
||||
|
||||
void ISWAManager::setContainer(ISWAContainer* container){
|
||||
_container = container;
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<ISWACygnet> ISWAManager::iSWACygnet(std::string name){
|
||||
if(_container)
|
||||
return _container->iSWACygnet(name);
|
||||
return nullptr;
|
||||
it = _metadataFutures.erase( it );
|
||||
}else{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string ISWAManager::iSWAurl(int id, std::string type){
|
||||
@@ -200,23 +167,23 @@ namespace openspace{
|
||||
return url;
|
||||
}
|
||||
|
||||
void ISWAManager::update(){
|
||||
for (auto it = _metaFutures.begin(); it != _metaFutures.end(); ){
|
||||
if((*it)->isFinished) {
|
||||
if((*it)->type == "TEXTURE"){
|
||||
createPlane((*it)->id,(*it)->json,std::string("TexturePlane"));
|
||||
}else if ((*it)->type == "DATA"){
|
||||
createPlane((*it)->id,(*it)->json,std::string("DataPlane"));
|
||||
} else {
|
||||
LERROR("\""+ (*it)->type + "\" is not a valid type");
|
||||
}
|
||||
it = _metaFutures.erase( it );
|
||||
}else{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
std::shared_ptr<MetadataFuture> ISWAManager::downloadMetadata(int id){
|
||||
std::shared_ptr<MetadataFuture> metaFuture = std::make_shared<MetadataFuture>();
|
||||
|
||||
metaFuture->id = id;
|
||||
DlManager.downloadToMemory(
|
||||
"http://128.183.168.116:3000/" + std::to_string(-id),
|
||||
// "http://10.0.0.76:3000/" + std::to_string(-id),
|
||||
metaFuture->json,
|
||||
[metaFuture](const DownloadManager::FileFuture& f){
|
||||
LDEBUG("Download to memory finished");
|
||||
metaFuture->isFinished = true;
|
||||
}
|
||||
);
|
||||
return metaFuture;
|
||||
}
|
||||
|
||||
|
||||
std::string ISWAManager::parseJSONToLuaTable(int id, std::string jsonString, std::string type){
|
||||
if(jsonString != ""){
|
||||
json j = json::parse(jsonString);
|
||||
@@ -254,16 +221,14 @@ namespace openspace{
|
||||
"Type = '" + type + "', "
|
||||
"Id = " + std::to_string(id) + ", "
|
||||
"Frame = '" + frame + "' , "
|
||||
"Min = " + std::to_string(min) + ", "
|
||||
"Max = " + std::to_string(max) + ", "
|
||||
"GridMin = " + std::to_string(min) + ", "
|
||||
"GridMax = " + std::to_string(max) + ", "
|
||||
"SpatialScale = " + std::to_string(spatialScale) + ", "
|
||||
"UpdateTime = " + std::to_string(updateTime) + ", "
|
||||
"CoordinateType = '" + coordinateType + "', "
|
||||
"}"
|
||||
"}"
|
||||
;
|
||||
|
||||
// std::cout << table << std::endl;
|
||||
"}";
|
||||
|
||||
return table;
|
||||
}
|
||||
return "";
|
||||
@@ -305,8 +270,8 @@ namespace openspace{
|
||||
"Type = 'KameleonPlane', "
|
||||
"Id = 0 ,"
|
||||
"Frame = '" + frame + "' , "
|
||||
"Min = " + std::to_string(min) + ", "
|
||||
"Max = " + std::to_string(max) + ", "
|
||||
"GridMin = " + std::to_string(min) + ", "
|
||||
"GridMax = " + std::to_string(max) + ", "
|
||||
"SpatialScale = " + std::to_string(spatialScale) + ", "
|
||||
"UpdateTime = 0, "
|
||||
"kwPath = '" + kwPath + "' ,"
|
||||
|
||||
@@ -35,14 +35,6 @@
|
||||
|
||||
namespace openspace {
|
||||
class ISWACygnet;
|
||||
class ISWAContainer;
|
||||
|
||||
struct ExtensionFuture {
|
||||
std::string extension;
|
||||
bool isFinished;
|
||||
int id;
|
||||
std::string parent;
|
||||
};
|
||||
|
||||
struct MetadataFuture {
|
||||
int id;
|
||||
@@ -60,18 +52,13 @@ public:
|
||||
ISWAManager();
|
||||
~ISWAManager();
|
||||
|
||||
// std::shared_ptr<ISWACygnet> createISWACygnet(std::shared_ptr<Metadata> metadata);
|
||||
void addISWACygnet(std::string info);
|
||||
void addISWACygnet(int id, std::string info = "TEXTURE");
|
||||
void deleteISWACygnet(std::string);
|
||||
|
||||
std::shared_ptr<DownloadManager::FileFuture> downloadImage(int, std::string);
|
||||
// std::shared_ptr<DownloadManager::FileFuture> downloadImage(int, std::string);
|
||||
std::shared_ptr<DownloadManager::FileFuture> downloadImageToMemory(int id, std::string& buffer);
|
||||
std::shared_ptr<DownloadManager::FileFuture> downloadDataToMemory(int id, std::string& buffer);
|
||||
std::shared_ptr<ExtensionFuture> fileExtension(int);
|
||||
|
||||
void setContainer(ISWAContainer*);
|
||||
std::shared_ptr<ISWACygnet> iSWACygnet(std::string);
|
||||
|
||||
void update();
|
||||
|
||||
@@ -79,20 +66,15 @@ public:
|
||||
private:
|
||||
std::string iSWAurl(int id, std::string type = "image");
|
||||
std::shared_ptr<MetadataFuture> downloadMetadata(int id);
|
||||
std::string getDictionaryTable(int id, std::string path);
|
||||
std::string parseJSONToLuaTable(int id, std::string json, std::string type);
|
||||
std::string parseKWToLuaTable(std::string kwPath);
|
||||
|
||||
// void createDataPlane(std::string kwPath);
|
||||
// void createTexturePlane(int id, std::string json);
|
||||
void createPlane(int id, std::string json, std::string type);
|
||||
void createScreenSpace(int id);
|
||||
void createKameleonPlane(std::string kwPath);
|
||||
|
||||
std::map<std::string, std::string> _month;
|
||||
ISWAContainer* _container;
|
||||
std::vector<std::shared_ptr<ExtensionFuture>> _extFutures;
|
||||
std::vector<std::shared_ptr<MetadataFuture>> _metaFutures;
|
||||
std::vector<std::shared_ptr<MetadataFuture>> _metadataFutures;
|
||||
};
|
||||
|
||||
} //namespace openspace
|
||||
|
||||
@@ -84,16 +84,7 @@ properties::Property* property(const std::string& uri) {
|
||||
return property;
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
if(ISWAManager::isInitialized()){
|
||||
std::shared_ptr<ISWACygnet> cygnet = ISWAManager::ref().iSWACygnet(nameUri);
|
||||
if(cygnet){
|
||||
return cygnet->property(remainingUri);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
LERROR("Node, iSWACygnet or ScreenSpaceRenderable' " << nameUri << "' did not exist");
|
||||
LERROR("Node or ScreenSpaceRenderable' " << nameUri << "' did not exist");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,16 +26,16 @@
|
||||
|
||||
namespace openspace {
|
||||
ScreenSpaceRenderable::ScreenSpaceRenderable()
|
||||
: _enabled("enabled", "Is Enabled", true)
|
||||
, _useFlatScreen("flatScreen", "Flat Screen", false)
|
||||
, _euclideanPosition("euclideanPosition", "Euclidean coordinates", glm::vec2(0),glm::vec2(-4),glm::vec2(4))
|
||||
, _sphericalPosition("sphericalPosition", "Spherical coordinates", glm::vec2(0),glm::vec2(-M_PI),glm::vec2(M_PI))
|
||||
, _depth("depth", "Depth", 0, 0, 1)
|
||||
, _scale("scale", "Scale" , 0.5, 0, 2)
|
||||
, _alpha("alpha", "Alpha" , 1, 0, 1)
|
||||
:_enabled("enabled", "Is Enabled", true)
|
||||
,_useFlatScreen("flatScreen", "Flat Screen", true)
|
||||
,_euclideanPosition("euclideanPosition", "Euclidean coordinates", glm::vec2(0),glm::vec2(-4),glm::vec2(4))
|
||||
,_sphericalPosition("sphericalPosition", "Spherical coordinates", glm::vec2(0, M_PI_2),glm::vec2(-M_PI),glm::vec2(M_PI))
|
||||
,_depth("depth", "Depth", 0, 0, 1)
|
||||
,_scale("scale", "Scale" , 0.25, 0, 2)
|
||||
,_alpha("alpha", "Alpha" , 1, 0, 1)
|
||||
,_delete("delete", "Delete")
|
||||
, _quad(0)
|
||||
, _vertexPositionBuffer(0)
|
||||
,_quad(0)
|
||||
,_vertexPositionBuffer(0)
|
||||
,_rendererPath("${SHADERS}/framebuffer/renderframebuffer.frag")
|
||||
,_vertexPath("${MODULE_BASE}/shaders/screnspace_vs.glsl")
|
||||
,_fragmentPath("${MODULE_BASE}/shaders/screnspace_fs.glsl")
|
||||
|
||||
Reference in New Issue
Block a user