Correct coordinate transformation

This commit is contained in:
Sebastian Piwell
2016-06-14 13:33:55 -04:00
parent 448492c655
commit d368ad9054
4 changed files with 13 additions and 32 deletions
+5
View File
@@ -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();
+2 -1
View File
@@ -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);
+2
View File
@@ -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