Commit dade31c1 by Luis Penaranda

added orthographic projection

1 parent 44ec9b4f
......@@ -522,6 +522,15 @@ void OpenGLCanvas::vertex_transformation(float *positions, int m, int n, float c
positions[3*(j+i*n)+1] = v/extent;
positions[3*(j+i*n)+2] = z;
}
if (visualization=="Orthographic"){
u = x;
v = y;
positions[3*(j+i*n)] = u/extent;
positions[3*(j+i*n)+1] = v/extent;
positions[3*(j+i*n)+2] = z;
}
}
}
......@@ -598,6 +607,14 @@ float OpenGLCanvas::calculate_extent(float fov_rads){
u = x/(-z);
v = y/(-z);
}
if (visualization=="Orthographic"){
if(z<0.){
u=x;
v=y;
}else{
u=v=1.f;
}
}
return u;
}
......@@ -789,6 +806,7 @@ void OpenGLCanvas::paintGL(){
else if (visualization=="Stereographic") vis_mode=4.0;
else if (visualization=="Mercator") vis_mode=5.0;
else if (visualization=="Zorin-Barr") vis_mode=6.0;
else if (visualization=="Orthographic") vis_mode=7.0;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 2.0/extent, 0.0, 2.0/scale, 0.0, -2.0/vis_mode);
......
......@@ -207,6 +207,11 @@
<string>Zorin-Barr</string>
</property>
</item>
<item>
<property name="text">
<string>Orthographic</string>
</property>
</item>
</widget>
</item>
<item row="12" column="1">
......
......@@ -92,6 +92,11 @@ void main(void){
v=zbrho*sin(zbalpha);
gl_Position = vec4(u/extent,v/extent,z,1.0);
}
else if (vis_mode==7.0){ // Orthographic
u=x;
v=y;
gl_Position = vec4(u/extent,v/extent,z,1.0);
}
// gl_Position = vec4(u/2.0,v/2.0,z,1.0);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!