mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 04:00:37 -06:00
Update texture based on OpenSpace time
This commit is contained in:
@@ -46,16 +46,13 @@ DataPlane::DataPlane(std::shared_ptr<KameleonWrapper> kw, std::string path)
|
||||
, _texture(nullptr)
|
||||
, _quad(0)
|
||||
, _vertexPositionBuffer(0)
|
||||
{
|
||||
addProperty(_enabled);
|
||||
addProperty(_cygnetId);
|
||||
addProperty(_path);
|
||||
|
||||
{
|
||||
_id = id();
|
||||
setName("DataPlane" + std::to_string(_id));
|
||||
OsEng.gui()._property.registerProperty(&_enabled);
|
||||
OsEng.gui()._property.registerProperty(&_cygnetId);
|
||||
OsEng.gui()._property.registerProperty(&_path);
|
||||
OsEng.gui()._property.registerProperty(&_updateInterval);
|
||||
|
||||
KameleonWrapper::Model model = _kw->model();
|
||||
if( model == KameleonWrapper::Model::BATSRUS){
|
||||
|
||||
@@ -35,9 +35,13 @@ DataSurface::DataSurface(std::string path)
|
||||
:_enabled("enabled", "Is Enabled", true)
|
||||
,_cygnetId("cygnetId", "CygnetID",7, 0, 10)
|
||||
,_path("path", "Path", path)
|
||||
,_updateInterval("updateInterval", "Update Interval", 3, 1, 10)
|
||||
,_shader(nullptr)
|
||||
{
|
||||
setName("DataSurface");
|
||||
addProperty(_enabled);
|
||||
addProperty(_cygnetId);
|
||||
addProperty(_path);
|
||||
addProperty(_updateInterval);
|
||||
}
|
||||
|
||||
DataSurface::~DataSurface(){}
|
||||
|
||||
@@ -54,11 +54,13 @@ protected:
|
||||
properties::BoolProperty _enabled;
|
||||
properties::IntProperty _cygnetId;
|
||||
properties::StringProperty _path;
|
||||
properties::FloatProperty _updateInterval;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
|
||||
SceneGraphNode* _parent;
|
||||
double _time;
|
||||
double _lastUpdateTime = 0;
|
||||
std::map<std::string, std::string> _month;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,15 +47,12 @@ TexturePlane::TexturePlane(std::string path)
|
||||
, _vertexPositionBuffer(0)
|
||||
, _futureTexture(nullptr)
|
||||
{
|
||||
addProperty(_enabled);
|
||||
addProperty(_cygnetId);
|
||||
addProperty(_path);
|
||||
|
||||
_id = id();
|
||||
setName("TexturePlane" + std::to_string(_id));
|
||||
OsEng.gui()._property.registerProperty(&_enabled);
|
||||
OsEng.gui()._property.registerProperty(&_cygnetId);
|
||||
OsEng.gui()._property.registerProperty(&_path);
|
||||
OsEng.gui()._property.registerProperty(&_updateInterval);
|
||||
|
||||
_path.setValue("${OPENSPACE_DATA}/"+ name() + ".jpg");
|
||||
_cygnetId.onChange([this](){ updateTexture(); });
|
||||
@@ -165,15 +162,20 @@ void TexturePlane::render(){
|
||||
}
|
||||
|
||||
void TexturePlane::update(){
|
||||
_time = Time::ref().currentTime();
|
||||
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", "GSM", Time::ref().currentTime());
|
||||
if(_futureTexture && _futureTexture->isFinished){
|
||||
|
||||
_path.set(absPath("${OPENSPACE_DATA}/"+_futureTexture->filePath));
|
||||
loadTexture();
|
||||
|
||||
delete _futureTexture;
|
||||
_futureTexture = nullptr;
|
||||
}
|
||||
|
||||
if((_time-_lastUpdateTime) >= _updateInterval){
|
||||
updateTexture();
|
||||
}
|
||||
}
|
||||
|
||||
void TexturePlane::setParent(){
|
||||
@@ -199,7 +201,8 @@ void TexturePlane::updateTexture(){
|
||||
_futureTexture = future;
|
||||
imageSize-=1;
|
||||
}
|
||||
// }
|
||||
// }
|
||||
_lastUpdateTime = _time;
|
||||
}
|
||||
|
||||
void TexturePlane::loadTexture() {
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
glm::dmat3 _stateMatrix;
|
||||
// bool _planeIsDirty;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user