diff --git a/openglcanvas.cpp b/openglcanvas.cpp
index 8dd0a965a36c96397b924576b29d3ef23e6682b7..af7298eba66988292feb68e5a8c377b171ca11f4 100644
--- a/openglcanvas.cpp
+++ b/openglcanvas.cpp
@@ -38,7 +38,7 @@ OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
center_lambda = 0.f;
center_phi = 0.f;
fov_scale_relation = "Naive";
- visualization = "Perspective";
+ visualization = "Moebius";
auto_fov_max=false;
time_frames = 0;
@@ -439,10 +439,9 @@ void OpenGLCanvas::vertex_transformation(float *positions, int m, int n, float c
lambda = atan2(x,-z)/CONST_PI_F;
phi = asin(y)/CONST_PI_2_F;
- u = x/(-z);
- v = y/(-z);
-
- if (visualization=="Perspective"){
+ if (visualization=="Moebius"){
+ u = x/(-z);
+ v = y/(-z);
positions[3*(j+i*n)] = u/extent;
positions[3*(j+i*n)+1] = v/extent;
positions[3*(j+i*n)+2] = z;
@@ -460,6 +459,22 @@ void OpenGLCanvas::vertex_transformation(float *positions, int m, int n, float c
positions[3*(j+i*n)+2] = z;
}
+ if (visualization=="Stereographic"){
+ u = 2*x/(-z+1);
+ v = 2*y/(-z+1);
+ positions[3*(j+i*n)] = u/extent;
+ positions[3*(j+i*n)+1] = v/extent;
+ positions[3*(j+i*n)+2] = z;
+ }
+
+ if (visualization=="Mercator"){
+ u = lambda;
+ v = log((1.0/cos(phi)) + tan(phi));
+ positions[3*(j+i*n)] = u/extent;
+ positions[3*(j+i*n)+1] = v/extent;
+ positions[3*(j+i*n)+2] = z;
+ }
+
}
}
@@ -517,8 +532,20 @@ float OpenGLCanvas::calculate_extent(float fov_rads){
x = (4.*u)/(u*u+v*v+4.);
y = (4.*v)/(u*u+v*v+4.);
z = (u*u+v*v-4.)/(u*u+v*v+4.);
- u = x/(-z);
- v = y/(-z);
+ if (visualization=="Moebius"){
+ u = x/(-z);
+ v = y/(-z);
+ }
+ else if (visualization=="Stereographic"){
+ u = 2*x/(-z+1);
+ v = 2*y/(-z+1);
+ }
+ else if (visualization=="Mercator"){
+ u = fov_rads;
+ // Warning: this extent calculation is wrong.
+ // Write now it's olny showing the entire panorama intead of
+ // the corresponging FOV.
+ }
return u;
}
@@ -692,9 +719,11 @@ void OpenGLCanvas::paintGL(){
// defining transformation parameters (that will be passed to the vertex shader)
float extent = calculate_extent(fov_rads);
float vis_mode=.0;
- if (visualization=="Perspective") vis_mode=1.0;
+ if (visualization=="Moebius") vis_mode=1.0;
else if (visualization=="3D Sphere") vis_mode=2.0;
else if (visualization=="Equi-Rectangular") vis_mode=3.0;
+ else if (visualization=="Stereographic") vis_mode=4.0;
+ else if (visualization=="Mercator") vis_mode=5.0;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 2.0/extent, 0.0, 2.0/scale, 0.0, -2.0/vis_mode);
diff --git a/panowindow1.ui b/panowindow1.ui
index 051fa5c5f1150e1dd5a5ee345e50379edd1016c6..f6880c370006d6ffac897a1355f5b70f0652cf78 100644
--- a/panowindow1.ui
+++ b/panowindow1.ui
@@ -179,7 +179,7 @@
-
- Perspective
+ Moebius
-
@@ -192,6 +192,16 @@
Equi-Rectangular
+ -
+
+ Stereographic
+
+
+ -
+
+ Mercator
+
+
-
diff --git a/shaders/test_vertex_shader.vert b/shaders/test_vertex_shader.vert
index ff4bd585a044d2bac3041092c9b243f8d250c52e..7107ae727b048c2d0bd695451ed4fc55bcbc33dc 100644
--- a/shaders/test_vertex_shader.vert
+++ b/shaders/test_vertex_shader.vert
@@ -57,14 +57,24 @@ void main(void){
lambda = atan(x,-z)/3.1415;
phi = asin(y)/1.5708;
- // perspective projection
- u = x/(-z);
- v = y/(-z);
-
// Visualize using specified visualization (remove for timings in the paper! Use only "Perspective" in the paper!)
- if (vis_mode==1.0) gl_Position = vec4(u/extent,v/extent,z,1.0);
+ if (vis_mode==1.0) {
+ u = x/(-z);
+ v = y/(-z);
+ gl_Position = vec4(u/extent,v/extent,z,1.0);
+ }
else if (vis_mode==2.0) gl_Position = vec4(0.9*x,0.9*y,z,1.0);
else if (vis_mode==3.0) gl_Position = vec4(lambda,phi,z,1.0);
+ else if (vis_mode==4.0) {
+ u = 2.f*x/(-z+1);
+ v = 2.f*y/(-z+1);
+ gl_Position = vec4(u/extent,v/extent,z,1.0);
+ }
+ else if (vis_mode==5.0) {
+ u = lambda;
+ v = log((1.0/cos(phi)) + tan(phi));
+ gl_Position = vec4(u,v,z,1.0);
+ }
// gl_Position = vec4(u/2.0,v/2.0,z,1.0);