mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 04:00:37 -06:00
Merge branch 'feature/iSWA' of github.com:OpenSpace/OpenSpace-Development into feature/iSWA
This commit is contained in:
@@ -43,6 +43,8 @@ DataSphere::DataSphere(const ghoul::Dictionary& dictionary)
|
||||
_programName = "DataSphereProgram";
|
||||
_vsPath = "${MODULE_ISWA}/shaders/datasphere_vs.glsl";
|
||||
_fsPath = "${MODULE_ISWA}/shaders/datasphere_fs.glsl";
|
||||
|
||||
|
||||
}
|
||||
|
||||
DataSphere::~DataSphere(){}
|
||||
@@ -50,6 +52,9 @@ DataSphere::~DataSphere(){}
|
||||
bool DataSphere::initialize(){
|
||||
IswaCygnet::initialize();
|
||||
|
||||
//rotate 90 degrees because of the texture coordinates in PowerScaledSphere
|
||||
_rotation = glm::rotate(_rotation, (float)M_PI_2, glm::vec3(1.0, 0.0, 0.0));
|
||||
|
||||
if(_group){
|
||||
_dataProcessor = _group->dataProcessor();
|
||||
subscribeToGroup();
|
||||
|
||||
@@ -42,6 +42,7 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
|
||||
, _shader(nullptr)
|
||||
, _group(nullptr)
|
||||
, _textureDirty(false)
|
||||
, _rotation(glm::mat4(1.0f))
|
||||
{
|
||||
std::string name;
|
||||
dictionary.getValue("Name", name);
|
||||
@@ -146,12 +147,12 @@ void IswaCygnet::render(const RenderData& data){
|
||||
psc position = data.position;
|
||||
glm::mat4 transform = glm::mat4(1.0);
|
||||
|
||||
glm::mat4 rot = glm::mat4(1.0);
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
transform[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
transform = transform*_rotation;
|
||||
|
||||
position += transform*glm::vec4(_data->spatialScale.x*_data->offset, _data->spatialScale.w);
|
||||
|
||||
|
||||
@@ -142,6 +142,7 @@ protected:
|
||||
std::string _fsPath;
|
||||
std::string _programName;
|
||||
|
||||
glm::mat4 _rotation; //to rotate objects with fliped texture coordniates
|
||||
private:
|
||||
bool destroyShader();
|
||||
glm::dmat3 _stateMatrix;
|
||||
@@ -152,6 +153,7 @@ private:
|
||||
std::chrono::milliseconds _realTime;
|
||||
std::chrono::milliseconds _lastUpdateRealTime;
|
||||
int _minRealTimeUpdateInterval;
|
||||
|
||||
};
|
||||
|
||||
}//namespace openspace
|
||||
|
||||
@@ -37,8 +37,8 @@ TexturePlane::TexturePlane(const ghoul::Dictionary& dictionary)
|
||||
,_vertexPositionBuffer(0)
|
||||
{
|
||||
_programName = "PlaneProgram";
|
||||
_vsPath = "${MODULE_ISWA}/shaders/cygnetplane_vs.glsl";
|
||||
_fsPath = "${MODULE_ISWA}/shaders/cygnetplane_fs.glsl";
|
||||
_vsPath = "${MODULE_ISWA}/shaders/textureplane_vs.glsl";
|
||||
_fsPath = "${MODULE_ISWA}/shaders/textureplane_fs.glsl";
|
||||
}
|
||||
|
||||
TexturePlane::~TexturePlane(){}
|
||||
|
||||
@@ -55,7 +55,7 @@ Fragment getFragment() {
|
||||
|
||||
if((numTransferFunctions == 1) || (numTextures > numTransferFunctions)){
|
||||
for(int i=0; i<numTextures; i++){
|
||||
v += texture(textures[i], vec2(vs_st.s, 1-vs_st.t)).r;
|
||||
v += texture(textures[i], vs_st).r;
|
||||
}
|
||||
v /= numTextures;
|
||||
|
||||
@@ -67,7 +67,7 @@ Fragment getFragment() {
|
||||
diffuse = color;
|
||||
}else{
|
||||
for(int i=0; i<numTextures; i++){
|
||||
v = texture(textures[i], vec2(vs_st.s, 1-vs_st.t)).r;
|
||||
v = texture(textures[i], vs_st).r;
|
||||
vec4 color = texture(transferFunctions[i], vec2(v,0));
|
||||
if((v<(x+y)) && v>(x-y))
|
||||
color = transparent;
|
||||
|
||||
@@ -36,19 +36,7 @@ Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse;
|
||||
diffuse = texture(texture1, vec2(vs_st.s, 1-vs_st.t));
|
||||
|
||||
//vec4 diffuse = vec4(1,vs_st,1);
|
||||
//vec4 diffuse = vec4(1,0,0,1);
|
||||
// if(position.w > 9.0) {
|
||||
// diffuse = vec4(1,0,0,1);
|
||||
// }
|
||||
|
||||
//diffuse.a = diffuse.r;
|
||||
float tot = diffuse.r + diffuse.g + diffuse.b;
|
||||
tot /= 3.0;
|
||||
if (tot >= 0.5 || tot <= 0.05)
|
||||
discard;
|
||||
diffuse = texture(texture1, vs_st);
|
||||
|
||||
diffuse.a *= transparency;
|
||||
|
||||
@@ -39,11 +39,9 @@
|
||||
#else
|
||||
LWARNING("Kameleon module needed for transformations with dynamic frames");
|
||||
#endif
|
||||
|
||||
_kameleonFrames = { "J2000", "GEI", "GEO", "MAG", "GSE", "GSM", "SM", "RTN", "GSEQ", //geocentric
|
||||
"HEE", "HAE", "HEEQ" //heliocentric
|
||||
};
|
||||
// _dipoleFrames = {"GSM", "MAG"};
|
||||
}
|
||||
|
||||
TransformationManager::~TransformationManager(){
|
||||
@@ -68,15 +66,11 @@
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in1, &out1);
|
||||
_kameleon->_cxform(from.c_str(), to.c_str(), ephemerisTime, &in2, &out2);
|
||||
|
||||
glm::dmat3 out = glm::dmat3(
|
||||
return glm::dmat3(
|
||||
out0.c0 , out0.c1 , out0.c2,
|
||||
out1.c0 , out1.c1 , out1.c2,
|
||||
out2.c0 , out2.c1 , out2.c2
|
||||
);
|
||||
|
||||
// Need to rotate 90 degrees around x-axis becuase kameleon is flipped
|
||||
out = glm::dmat3(glm::rotate(glm::mat4(out), (float)M_PI_2, glm::vec3(1.0f, 0.0f, 0.0f)));
|
||||
return out;
|
||||
);;
|
||||
}
|
||||
|
||||
glm::dmat3 TransformationManager::frameTransformationMatrix(std::string from,
|
||||
@@ -84,32 +78,11 @@
|
||||
double ephemerisTime) const
|
||||
{
|
||||
#ifdef OPENSPACE_MODULE_KAMELEON_ENABLED
|
||||
auto fromit = _dipoleFrames.find(from);
|
||||
auto toit = _dipoleFrames.find(to);
|
||||
|
||||
// //diopole frame to J200 makes the frame rotate.
|
||||
// if(fromit != _dipoleFrames.end()) from = "GSE";
|
||||
// if(toit != _dipoleFrames.end()) to = "GSE";
|
||||
|
||||
fromit = _kameleonFrames.find(from);
|
||||
toit = _kameleonFrames.find(to);
|
||||
auto fromit = _kameleonFrames.find(from);
|
||||
auto toit = _kameleonFrames.find(to);
|
||||
|
||||
bool fromKameleon = (fromit != _kameleonFrames.end());
|
||||
bool toKameleon = (toit != _kameleonFrames.end());
|
||||
|
||||
ccmc::Position in0 = {1.f, 0.f, 0.f};
|
||||
ccmc::Position in1 = {0.f, 1.f, 0.f};
|
||||
ccmc::Position in2 = {0.f, 0.f, 1.f};
|
||||
|
||||
glm::dmat3 in(
|
||||
in0.c0, in0.c1, in0.c2,
|
||||
in1.c0, in1.c1, in1.c2,
|
||||
in2.c0, in2.c1, in2.c2
|
||||
);
|
||||
|
||||
ccmc::Position out0;
|
||||
ccmc::Position out1;
|
||||
ccmc::Position out2;
|
||||
|
||||
if(!fromKameleon && !toKameleon){
|
||||
return SpiceManager::ref().frameTransformationMatrix(from, to, ephemerisTime);
|
||||
|
||||
Reference in New Issue
Block a user