Commit 97f1e67e authored by Luis Penaranda's avatar Luis Penaranda

now the controls for the ZB transformation work

parent a8d3155a
......@@ -18,288 +18,344 @@
<normaloff/>
</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="23" column="1" colspan="2">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
<item row="16" column="1">
<widget class="QCheckBox" name="shrinkAll">
<property name="text">
<string>Shrink all</string>
</property>
</widget>
</item>
<item row="20" column="1" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefovmax">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>359</number>
</property>
<property name="sliderPosition">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="20" column="2" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefov">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>359</number>
</property>
<property name="value">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string>Shrink computation</string>
</property>
</widget>
</item>
<item row="18" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_6">
<property name="text">
<string>FOV</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Visualization</string>
</property>
</widget>
</item>
<item row="18" column="1">
<widget class="QLabel" name="label_5">
<property name="text">
<string>FOV max</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QComboBox" name="comboBox">
<property name="editable">
<bool>false</bool>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<item>
<property name="text">
<string>Simple</string>
</property>
</item>
<item>
<property name="text">
<string>Square Root</string>
</property>
</item>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Square Power</string>
</property>
</item>
<item>
<property name="text">
<string>Cubic Power</string>
</property>
</item>
<item>
<property name="text">
<string>Logarithm</string>
</property>
</item>
</widget>
</item>
<item row="19" column="2" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="numDigits">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
<item row="19" column="1" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovmaxled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="numDigits">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
<item row="22" column="1" colspan="2">
<widget class="QPushButton" name="chooseFile">
<property name="text">
<string>Input Image</string>
</property>
</widget>
</item>
<item row="17" column="1" colspan="2">
<widget class="QCheckBox" name="automax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Auto FOV max</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBox_2">
<item>
<property name="text">
<string>Moebius</string>
</property>
</item>
<item>
<property name="text">
<string>3D Sphere</string>
</property>
</item>
<item>
<property name="text">
<string>Equi-Rectangular</string>
</property>
</item>
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
<item>
<property name="text">
<string>Stereographic</string>
</property>
</item>
<item>
<property name="text">
<string>Orthographic</string>
</property>
</item>
<item>
<property name="text">
<string>Mercator</string>
</property>
</item>
<item>
<property name="text">
<string>Zorin-Barr</string>
</property>
</item>
</widget>
</item>
<item row="9" column="1" colspan="2">
<widget class="QSlider" name="changezblambda">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="pageStep">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="24">
<widget class="OpenGLCanvas" name="GLCanvas" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="21" column="1" colspan="2">
<widget class="QPushButton" name="reCenter">
<property name="text">
<string>Re-center</string>
</property>
</widget>
</item>
<item row="10" column="1" colspan="2">
<widget class="QSlider" name="changezbR">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="pageStep">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
<widget class="OpenGLCanvas" name="GLCanvas" native="true">
<property name="geometry">
<rect>
<x>9</x>
<y>9</y>
<width>1110</width>
<height>673</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>1120</x>
<y>9</y>
<width>150</width>
<height>671</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Visualization</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_2">
<item>
<property name="text">
<string>Moebius</string>
</property>
</item>
<item>
<property name="text">
<string>3D Sphere</string>
</property>
</item>
<item>
<property name="text">
<string>Equi-Rectangular</string>
</property>
</item>
<item>
<property name="text">
<string>Perspective</string>
</property>
</item>
<item>
<property name="text">
<string>Stereographic</string>
</property>
</item>
<item>
<property name="text">
<string>Orthographic</string>
</property>
</item>
<item>
<property name="text">
<string>Mercator</string>
</property>
</item>
<item>
<property name="text">
<string>Zorin-Barr</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Shrink computation</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="editable">
<bool>false</bool>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<item>
<property name="text">
<string>Simple</string>
</property>
</item>
<item>
<property name="text">
<string>Square Root</string>
</property>
</item>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Square Power</string>
</property>
</item>
<item>
<property name="text">
<string>Cubic Power</string>
</property>
</item>
<item>
<property name="text">
<string>Logarithm</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QSlider" name="changezblambda">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="pageStep">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>lambda</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QSlider" name="changezbR">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="pageStep">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="label_4">
<property name="text">
<string>R</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="shrinkAll">
<property name="text">
<string>Shrink all</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="automax">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Ignored" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Auto FOV max</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="label_6">
<property name="text">
<string>FOV</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLCDNumber" name="fovmaxled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="numDigits">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
<item row="2" column="1" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefov">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>359</number>
</property>
<property name="value">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLCDNumber" name="fovled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="numDigits">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
<item row="2" column="0" alignment="Qt::AlignHCenter">
<widget class="QSlider" name="changefovmax">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>359</number>
</property>
<property name="sliderPosition">
<number>60</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>10</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>FOV max</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QPushButton" name="reCenter">
<property name="text">
<string>Re-center</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="chooseFile">
<property name="text">
<string>Input Image</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>Close</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
......
......@@ -28,6 +28,15 @@
//#define CONST_PI_F (0x1.921fb6p+1f)
//#define CONST_PI_2_F (0x1.921fb6p+0f)
// These definitions specify which attributes should be used to store some
// parameters passed to the vertex shader. Nvidia hardware
// only leaves attributes 1 and 7 unreserved; attributes 8 to 15 are
// reserved for textures.
// TODO: we use attributes 14 and 15, which work for Nvidia; we need to
// test with other hardware.
#define ZBL_ATTR 14
#define ZBR_ATTR 15
OpenGLCanvas::OpenGLCanvas(QWidget *parent) :
QGLWidget(parent)
{
......@@ -99,12 +108,14 @@ void OpenGLCanvas::change_fov_max(int new_fov_max){
void OpenGLCanvas::change_zb_lambda(int new_zb_lambda){
zblambda=(float)new_zb_lambda/1000;
fprintf(stderr,"zb_lambda=%f\n",zblambda);
glVertexAttrib1f(ZBL_ATTR,zblambda);
updateGL();
}
void OpenGLCanvas::change_zb_R(int new_zb_R){
zbR=(float)new_zb_R/1000;
zbR=(float)new_zb_R/100;
fprintf(stderr,"zb_R=%f\n",zbR);
glVertexAttrib1f(ZBR_ATTR,zbR);
updateGL();
}
......@@ -728,13 +739,7 @@ void OpenGLCanvas::setShaders() {
GLuint p = glCreateProgram();
// Bind attributes zblambda and zbR to the vertex shader. Nvidia hardware
// only leaves attributes 1 and 7 unreserved; attributes 8 to 15 are
// reserved for textures.
// TODO: we use attributes 14 and 15, which work for Nvidia; we need to
// test with other hardware.
#define ZBL_ATTR 14
#define ZBR_ATTR 15
// Bind attributes zblambda and zbR to the vertex shader.
glVertexAttrib1f(ZBL_ATTR,zblambda);
glBindAttribLocation(p,ZBL_ATTR,"zblambda");
glVertexAttrib1f(ZBR_ATTR,zbR);
......
......@@ -18,244 +18,336 @@
<normaloff/>
</iconset>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="15" column="2" alignment="Qt::AlignHCenter">
<widget class="QLabel" name="label_6">
<property name="text">
<string>FOV</string>
</property>
</widget>
</item>
<item row="16" column="1" alignment="Qt::AlignHCenter">
<widget class="QLCDNumber" name="fovmaxled">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="numDigits">
<number>3</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
</widget>
</item>
<item row="18" column="1" colspan="2">
<widget class="QPushButton" name="reCenter">
<property name="text">
<string>Re-center</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Visualization</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QComboBox" name="comboBox">
<property name="editable">
<bool>false</bool>
</property>
<property name="modelColumn">
<number>0</number>
</property>
<item>
<property name="text">
<string>Simple</string>
</property>
</item>
<item>
<property name="text">
<string>Square Root</string>
</property>
</item>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Square Power</string>
</property>
</item>
<item>
<property name="text">
<string>Cubic Power</string>
</property>
</item>
<item>
<property name="text">
<string>Logarithm</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="comboBox_2">
<item>
<property name="text">
<string>Moebius</string>
</property>