mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-13 17:09:05 -05:00
Preparation for ENLIL model
This commit is contained in:
@@ -39,54 +39,68 @@ ISWACygnet::ISWACygnet(const ghoul::Dictionary& dictionary)
|
||||
{
|
||||
_data = std::make_shared<Metadata>();
|
||||
|
||||
// dict.getValue can only set strings in _data directly
|
||||
float renderableId;
|
||||
float updateTime;
|
||||
glm::vec3 min, max;
|
||||
glm::vec4 spatialScale;
|
||||
// dict.getValue can only set strings in _data directly
|
||||
float renderableId;
|
||||
float updateTime;
|
||||
glm::vec3 min, max;
|
||||
glm::vec4 spatialScale;
|
||||
|
||||
dictionary.getValue("Id", renderableId);
|
||||
dictionary.getValue("UpdateTime", updateTime);
|
||||
dictionary.getValue("SpatialScale", spatialScale);
|
||||
dictionary.getValue("Min", min);
|
||||
dictionary.getValue("Max", max);
|
||||
dictionary.getValue("Frame",_data->frame);
|
||||
|
||||
|
||||
_data->id = (int) renderableId;
|
||||
_data->updateTime = (int) updateTime;
|
||||
_data->spatialScale = spatialScale;
|
||||
_data->min = min;
|
||||
_data->max = max;
|
||||
|
||||
_data->scale = glm::vec3(
|
||||
(max.x - min.x),
|
||||
(max.y - min.y),
|
||||
(max.z - min.z)
|
||||
);
|
||||
|
||||
_data->offset = glm::vec3(
|
||||
(min.x + (std::abs(min.x)+std::abs(max.x))/2.0f),
|
||||
(min.y + (std::abs(min.y)+std::abs(max.y))/2.0f),
|
||||
(min.z + (std::abs(min.z)+std::abs(max.z))/2.0f)
|
||||
);
|
||||
dictionary.getValue("Id", renderableId);
|
||||
dictionary.getValue("UpdateTime", updateTime);
|
||||
dictionary.getValue("SpatialScale", spatialScale);
|
||||
dictionary.getValue("Min", min);
|
||||
dictionary.getValue("Max", 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;
|
||||
|
||||
|
||||
// dictionary.getValue("Path",_data->path);
|
||||
// dictionary.getValue("Parent",_data->parent);
|
||||
glm::vec3 scale;
|
||||
glm::vec3 offset;
|
||||
|
||||
std::cout << _data->coordinateType << std::endl;
|
||||
if(_data->coordinateType == "Cartesian"){
|
||||
scale = glm::vec3(
|
||||
(max.x - min.x),
|
||||
(max.y - min.y),
|
||||
(max.z - min.z)
|
||||
);
|
||||
|
||||
offset = glm::vec3(
|
||||
(min.x + (std::abs(min.x)+std::abs(max.x))/2.0f),
|
||||
(min.y + (std::abs(min.y)+std::abs(max.y))/2.0f),
|
||||
(min.z + (std::abs(min.z)+std::abs(max.z))/2.0f)
|
||||
);
|
||||
} else if(_data->coordinateType == "Polar"){
|
||||
scale = glm::vec3(
|
||||
(max.x - min.x),
|
||||
0.0f,
|
||||
(max.x - min.x)
|
||||
);
|
||||
|
||||
offset = glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
_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;
|
||||
// std::cout << std::to_string(_data->offset) << std::endl;
|
||||
// std::cout << std::to_string(_data->scale) << std::endl;
|
||||
// std::cout << std::to_string(_data->max) << std::endl;
|
||||
// std::cout << _data->id << std::endl;
|
||||
std::cout << _data->frame << std::endl;
|
||||
std::cout << std::to_string(_data->offset) << std::endl;
|
||||
std::cout << std::to_string(_data->scale) << std::endl;
|
||||
// std::cout << std::to_string(_data->max) << std::endl;
|
||||
// std::cout << std::to_string(_data->min) << std::endl;
|
||||
// std::cout << std::to_string(_data->spatialScale) << std::endl;
|
||||
// std::cout << _data->path << std::endl;
|
||||
// std::cout << _data->parent << std::endl;
|
||||
// std::cout << _data->frame << std::endl;
|
||||
std::cout << std::to_string(_data->spatialScale) << std::endl;
|
||||
|
||||
_delete.onChange([this](){ISWAManager::ref().deleteISWACygnet(name());});
|
||||
}
|
||||
@@ -103,13 +117,13 @@ void ISWACygnet::unregisterProperties(){
|
||||
}
|
||||
|
||||
void ISWACygnet::initializeTime(){
|
||||
_openSpaceTime = Time::ref().currentTime();
|
||||
_lastUpdateOpenSpaceTime = _openSpaceTime;
|
||||
_openSpaceTime = Time::ref().currentTime();
|
||||
_lastUpdateOpenSpaceTime = _openSpaceTime;
|
||||
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
_lastUpdateRealTime = _realTime;
|
||||
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
|
||||
_lastUpdateRealTime = _realTime;
|
||||
|
||||
_minRealTimeUpdateInterval = 100;
|
||||
_minRealTimeUpdateInterval = 100;
|
||||
}
|
||||
|
||||
}//namespace openspac
|
||||
@@ -60,6 +60,7 @@ struct Metadata {
|
||||
glm::vec3 scale;
|
||||
glm::vec4 spatialScale;
|
||||
std::string scaleVariable;
|
||||
std::string coordinateType;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,8 @@ Fragment getFragment() {
|
||||
vec4 diffuse;
|
||||
// diffuse = top;
|
||||
diffuse = texture(texture1, vec2(vs_st.s, 1-vs_st.t));
|
||||
//float v = texture(texture1, vs_st).r;
|
||||
// diffuse = vec4(1,0,0,1);
|
||||
// float v = texture(texture1, vs_st).r;
|
||||
//float x = tfValues.x;
|
||||
//float y = tfValues.y;
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ namespace openspace{
|
||||
|
||||
std::string parent = j["Central Body"];
|
||||
std::string frame = j["Coordinates"];
|
||||
std::string coordinateType = j["Coordinate Type"];
|
||||
int updateTime = j["ISWA_UPDATE_SECONDS"];
|
||||
|
||||
glm::vec3 max(
|
||||
@@ -257,6 +258,7 @@ namespace openspace{
|
||||
"Max = " + std::to_string(max) + ", "
|
||||
"SpatialScale = " + std::to_string(spatialScale) + ", "
|
||||
"UpdateTime = " + std::to_string(updateTime) + ", "
|
||||
"CoordinateType = '" + coordinateType + "', "
|
||||
"}"
|
||||
"}"
|
||||
;
|
||||
@@ -279,19 +281,26 @@ namespace openspace{
|
||||
glm::vec3 max = kw.getGridMax();
|
||||
|
||||
glm::vec4 spatialScale;
|
||||
std::string coordinateType;
|
||||
|
||||
std::tuple < std::string, std::string, std::string > gridUnits = kw.getGridUnits();
|
||||
if (std::get<0>(gridUnits) == "R" && std::get<1>(gridUnits) == "R" && std::get<2>(gridUnits) == "R") {
|
||||
spatialScale.x = 6.371f;
|
||||
spatialScale.y = 6.371f;
|
||||
spatialScale.z = 6.371f;
|
||||
spatialScale.w = 6;
|
||||
|
||||
coordinateType = "Cartesian";
|
||||
}else{
|
||||
spatialScale = glm::vec4(1.0);
|
||||
spatialScale.w = -log10(1.0f/max.x);
|
||||
spatialScale.w = 1; //-log10(1.0f/max.x);
|
||||
|
||||
coordinateType = "Polar";
|
||||
}
|
||||
std::string table = "{"
|
||||
"Name = 'KameleonPlane0',"
|
||||
"Parent = '" + parent + "', "
|
||||
// "Parent = 'Earth', "
|
||||
"Parent = '" + parent + "', "
|
||||
"Renderable = {"
|
||||
"Type = 'KameleonPlane', "
|
||||
"Id = 0 ,"
|
||||
@@ -301,7 +310,8 @@ namespace openspace{
|
||||
"SpatialScale = " + std::to_string(spatialScale) + ", "
|
||||
"UpdateTime = 0, "
|
||||
"kwPath = '" + kwPath + "' ,"
|
||||
"axisCut = 'y'"
|
||||
"axisCut = 'y' ,"
|
||||
"CoordinateType = '" + coordinateType + "', "
|
||||
"}"
|
||||
"}"
|
||||
;
|
||||
@@ -340,6 +350,7 @@ namespace openspace{
|
||||
if(FileSys.fileExists(absPath(kwPath)) && extension == "cdf"){
|
||||
std::string luaTable = parseKWToLuaTable(kwPath);
|
||||
if(!luaTable.empty()){
|
||||
std::cout << luaTable << std::endl;
|
||||
std::string script = "openspace.addSceneGraphNode(" + luaTable + ");";
|
||||
OsEng.scriptEngine().queueScript(script);
|
||||
}
|
||||
|
||||
@@ -1005,7 +1005,7 @@ std::string KameleonWrapper::getParent(){
|
||||
_type == KameleonWrapper::Model::Adapt3D ||
|
||||
_type == KameleonWrapper::Model::SWMF)
|
||||
{
|
||||
return "SolarSystem";
|
||||
return "Sun";
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user