Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Luis Penaranda
panoramic
Commits
a5318a15
Commit
a5318a15
authored
Aug 12, 2013
by
Leonardo Koller Sacht
Browse files
Added Stereographic and Mercator to the interface
parent
cdb7b3c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
openglcanvas.cpp
View file @
a5318a15
...
...
@@ -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
);
...
...
panowindow1.ui
View file @
a5318a15
...
...
@@ -179,7 +179,7 @@
<widget
class=
"QComboBox"
name=
"comboBox_2"
>
<item>
<property
name=
"text"
>
<string>
Perspective
</string>
<string>
Moebius
</string>
</property>
</item>
<item>
...
...
@@ -192,6 +192,16 @@
<string>
Equi-Rectangular
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Stereographic
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
Mercator
</string>
</property>
</item>
</widget>
</item>
<item
row=
"12"
column=
"1"
>
...
...
shaders/test_vertex_shader.vert
View file @
a5318a15
...
...
@@ -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);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment