mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-28 14:59:31 -05:00
Texture plane updates with cygnet update time
This commit is contained in:
@@ -42,10 +42,12 @@ ISWACygnet::ISWACygnet(const ghoul::Dictionary& dictionary)
|
||||
|
||||
// dict.getValue can only set strings in _data directly
|
||||
float renderableId;
|
||||
float updateTime;
|
||||
glm::vec3 min, max;
|
||||
glm::vec2 spatialScale;
|
||||
|
||||
dictionary.getValue("Id", renderableId);
|
||||
dictionary.getValue("UpdateTime", updateTime);
|
||||
dictionary.getValue("SpatialScale", spatialScale);
|
||||
dictionary.getValue("Min", min);
|
||||
dictionary.getValue("Max", max);
|
||||
@@ -53,6 +55,7 @@ ISWACygnet::ISWACygnet(const ghoul::Dictionary& dictionary)
|
||||
|
||||
|
||||
_data->id = (int) renderableId;
|
||||
_data->updateTime = (int) updateTime;
|
||||
_data->spatialScale = spatialScale;
|
||||
_data->min = min;
|
||||
_data->max = max;
|
||||
|
||||
@@ -46,6 +46,24 @@
|
||||
|
||||
|
||||
namespace openspace{
|
||||
|
||||
struct Metadata {
|
||||
int id;
|
||||
int updateTime;
|
||||
std::string path;
|
||||
std::string parent;
|
||||
std::string frame;
|
||||
glm::vec3 min;
|
||||
glm::vec3 max;
|
||||
glm::vec3 offset;
|
||||
glm::vec3 scale;
|
||||
glm::vec2 spatialScale;
|
||||
std::string scaleVariable;
|
||||
std::shared_ptr<KameleonWrapper> kw;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ISWACygnet : public Renderable{
|
||||
public:
|
||||
// ISWACygnet(std::shared_ptr<Metadata> data);
|
||||
|
||||
@@ -56,27 +56,27 @@ ScreenSpaceCygnet::ScreenSpaceCygnet(int cygnetId)
|
||||
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);
|
||||
// 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);
|
||||
|
||||
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);
|
||||
// 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(){}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace openspace{
|
||||
class ScreenSpaceCygnet : public ScreenSpaceRenderable {
|
||||
public:
|
||||
ScreenSpaceCygnet(int cygnetId);
|
||||
ScreenSpaceCygnet(std::shared_ptr<Metadata> data);
|
||||
// ScreenSpaceCygnet(std::shared_ptr<Metadata> data);
|
||||
~ScreenSpaceCygnet();
|
||||
|
||||
void render() override;
|
||||
|
||||
@@ -142,13 +142,13 @@ void TexturePlane::update(const UpdateData& data){
|
||||
_time = Time::ref().currentTime();
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix("GALACTIC", _data->frame, _time);
|
||||
|
||||
float openSpaceUpdateInterval = fabs(Time::ref().deltaTime()*_updateInterval);
|
||||
if(openSpaceUpdateInterval){
|
||||
if(fabs(_time-_lastUpdateTime) >= openSpaceUpdateInterval){
|
||||
// float openSpaceUpdateInterval = fabs(Time::ref().deltaTime()*_updateInterval);
|
||||
// if(openSpaceUpdateInterval){
|
||||
if(fabs(_time-_lastUpdateTime) >= _data->updateTime){
|
||||
updateTexture();
|
||||
_lastUpdateTime = _time;
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
if(_futureTexture && _futureTexture->isFinished){
|
||||
loadTexture();
|
||||
|
||||
@@ -219,6 +219,9 @@ namespace openspace{
|
||||
|
||||
std::string parent = j["Central Body"];
|
||||
std::string frame = j["Coordinates"];
|
||||
int updateTime = j["ISWA_UPDATE_SECONDS"];
|
||||
|
||||
std::cout << updateTime << std::endl;
|
||||
|
||||
glm::vec3 max(
|
||||
j["Plot XMAX"],
|
||||
@@ -249,6 +252,7 @@ namespace openspace{
|
||||
"Min = " + std::to_string(min) + ", "
|
||||
"Max = " + std::to_string(max) + ", "
|
||||
"SpatialScale = " + std::to_string(spatialScale) + ", "
|
||||
"UpdateTime = " + std::to_string(updateTime) + ", "
|
||||
"}"
|
||||
"}"
|
||||
;
|
||||
|
||||
@@ -44,20 +44,6 @@ struct ExtensionFuture {
|
||||
std::string parent;
|
||||
};
|
||||
|
||||
struct Metadata {
|
||||
int id;
|
||||
std::string path;
|
||||
std::string parent;
|
||||
std::string frame;
|
||||
glm::vec3 min;
|
||||
glm::vec3 max;
|
||||
glm::vec3 offset;
|
||||
glm::vec3 scale;
|
||||
glm::vec2 spatialScale;
|
||||
std::string scaleVariable;
|
||||
std::shared_ptr<KameleonWrapper> kw;
|
||||
};
|
||||
|
||||
struct MetadataFuture {
|
||||
int id;
|
||||
std::string type;
|
||||
|
||||
@@ -22,7 +22,8 @@ openspace.bindKey("5", "openspace.time.setDeltaTime(40)")
|
||||
openspace.bindKey("6", "openspace.time.setDeltaTime(60)")
|
||||
openspace.bindKey("7", "openspace.time.setDeltaTime(120)")
|
||||
openspace.bindKey("8", "openspace.time.setDeltaTime(360)")
|
||||
openspace.bindKey("9", "openspace.time.setDeltaTime(540)")
|
||||
openspace.bindKey("9", "openspace.time.setDeltaTime(540)")
|
||||
openspace.bindKey("0", "openspace.time.setDeltaTime(1200)")
|
||||
|
||||
--[[openspace.bindKey("2", "openspace.time.setDeltaTime(30)")
|
||||
openspace.bindKey("3", "openspace.time.setDeltaTime(180)") -- 3m
|
||||
|
||||
Reference in New Issue
Block a user