Commit 163a2e9e authored by Maire Nicolas's avatar Maire Nicolas
Browse files

Rajout d'une interface Qt pour pouvoir interagir avec toutes les options d'affichage des plans

parent 5159fad1
......@@ -171,6 +171,44 @@ void StageShader::slot_doubleSpinBox_ColorAttenuationFactor(double c)
updateGL();
}
void StageShader::slot_doubleSpinBox_GridDisplaySize(double c)
{
m_shader->setPlaneDisplaySize((float)c);
updateGL();
}
void StageShader::slot_spinBox_GridResolutionX(int i)
{
m_shader->setPlaneDisplayXRes((size_t)i);
updateGL();
}
void StageShader::slot_spinBox_GridResolutionY(int i)
{
m_shader->setPlaneDisplayYRes((size_t)i);
updateGL();
}
void StageShader::slot_doubleSpinBox_GridColor(double c)
{
float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorR->value();
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorG->value();
float b = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorB->value();
m_shader->setPlaneDisplayColor(Geom::Vec3f(r, g, b));
updateGL();
}
void StageShader::slot_horizontalSlider_GridType(int i)
{
if (i == 0)
m_shader->setPlaneDisplayType(Utils::ClippingShader::STRAIGHT_GRID);
else if (i == 1)
m_shader->setPlaneDisplayType(Utils::ClippingShader::RADIAL_GRID);
updateGL();
}
void StageShader::button_compile()
{
QString st1 = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->vertexEdit->toPlainText();
......@@ -236,12 +274,31 @@ void StageShader::initGUI()
setCallBack(dock.doubleSpinBox_PlaneOriginz, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double)));
setCallBack(dock.doubleSpinBox_ColorAttenuationFactor, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_ColorAttenuationFactor(double)));
setCallBack(dock.doubleSpinBox_GridDisplaySize, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridDisplaySize(double)));
setCallBack(dock.spinBox_GridResolutionX, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolutionX(int)));
setCallBack(dock.spinBox_GridResolutionY, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_GridResolutionY(int)));
setCallBack(dock.doubleSpinBox_GridColorR, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double)));
setCallBack(dock.doubleSpinBox_GridColorG, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double)));
setCallBack(dock.doubleSpinBox_GridColorB, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_GridColor(double)));
setCallBack(dock.horizontalSlider_GridType, SIGNAL(valueChanged(int)), SLOT(slot_horizontalSlider_GridType(int)));
setCallBack(dock.compileButton, SIGNAL(clicked()), SLOT(button_compile()) );
dock.vertexEdit->setPlainText(QString(m_shader->getVertexShaderSrc()));
dock.fragmentEdit->setPlainText(QString(m_shader->getFragmentShaderSrc()));
dock.doubleSpinBox_ColorAttenuationFactor->setValue(m_shader->getClippingColorAttenuationFactor());
dock.doubleSpinBox_GridDisplaySize->setValue(m_shader->getPlaneDisplaySize());
dock.spinBox_GridResolutionX->setValue(m_shader->getPlaneDisplayXRes());
dock.spinBox_GridResolutionY->setValue(m_shader->getPlaneDisplayYRes());
Geom::Vec3f col = m_shader->getPlaneDisplayColor();
dock.doubleSpinBox_GridColorR->setValue(col[0]);
dock.doubleSpinBox_GridColorG->setValue(col[1]);
dock.doubleSpinBox_GridColorB->setValue(col[2]);
if (m_shader->getPlaneDisplayType() == Utils::ClippingShader::STRAIGHT_GRID)
dock.horizontalSlider_GridType->setValue(0);
else if (m_shader->getPlaneDisplayType() == Utils::ClippingShader::RADIAL_GRID)
dock.horizontalSlider_GridType->setValue(1);
}
void StageShader::cb_Open()
......@@ -330,7 +387,6 @@ void StageShader::cb_initGL()
m_shader->setPlaneDisplayColor(Geom::Vec3f (1.0, 0.0, 0.0));
m_shader->setPlaneDisplayXRes(10);
m_shader->setPlaneDisplayYRes(5);
m_shader->setPlaneDisplayType(Utils::ClippingShader::STRAIGHT_GRID);
}
void StageShader::updateVBOprimitives(int upType)
......
......@@ -134,6 +134,11 @@ public slots:
void slot_doubleSpinBox_PlaneOrigin(double c);
void slot_doubleSpinBox_ColorAttenuationFactor(double c);
void slot_doubleSpinBox_GridDisplaySize(double c);
void slot_spinBox_GridResolutionX(int i);
void slot_spinBox_GridResolutionY(int i);
void slot_doubleSpinBox_GridColor(double c);
void slot_horizontalSlider_GridType(int i);
void button_compile();
};
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>324</width>
<height>628</height>
<width>417</width>
<height>534</height>
</rect>
</property>
<property name="allowedAreas">
......@@ -18,7 +18,7 @@
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="0" column="1">
<widget class="QTabWidget" name="tabWidget">
<property name="tabPosition">
<enum>QTabWidget::East</enum>
......@@ -32,6 +32,16 @@
</attribute>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QTabWidget" name="tabWidget_3">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab_Object">
<attribute name="title">
<string>Object</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_vertices">
......@@ -171,75 +181,180 @@
</item>
</layout>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox_clipping">
</layout>
</widget>
<widget class="QWidget" name="tab_Clipping">
<attribute name="title">
<string>Clipping</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="3,1,2">
<item>
<widget class="QGroupBox" name="groupBox_DisplayParams">
<property name="enabled">
<bool>true</bool>
</property>
<property name="title">
<string>Clipping</string>
<string>Display Parameters</string>
</property>
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1x">
<property name="geometry">
<rect>
<x>0</x>
<y>90</y>
<width>63</width>
<height>28</height>
</rect>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_12">
<item row="3" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridColorG">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="minimum">
<double>-99.989999999999995</double>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_GridResolution">
<property name="text">
<string>Res.</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_ColorAttenuationFactor">
<property name="text">
<string>Color Att.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="spinBox_GridResolutionX">
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_ColorAttenuationFactor">
<property name="singleStep">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_GridColor">
<property name="text">
<string>Color</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridDisplaySize"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_GridSize">
<property name="text">
<string>Size</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridColorB">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</widget>
</item>
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_GridColorR">
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
</widget>
<widget class="QLabel" name="label_Plane">
<property name="geometry">
<rect>
<x>0</x>
<y>40</y>
<width>69</width>
<height>18</height>
</rect>
</item>
<item row="2" column="2">
<widget class="QSpinBox" name="spinBox_GridResolutionY">
<property name="maximum">
<number>200</number>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_GridType">
<property name="text">
<string>Plane :</string>
<string>Type</string>
</property>
</widget>
<widget class="QLabel" name="label_ColorAttenuationFactor">
</item>
<item row="4" column="1">
<widget class="QSlider" name="horizontalSlider_GridType">
<property name="maximum">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_PlanesSelection">
<property name="title">
<string>Planes Selection</string>
</property>
<widget class="QPushButton" name="pushButton_deletePlane">
<property name="geometry">
<rect>
<x>0</x>
<y>200</y>
<width>201</width>
<height>18</height>
<x>170</x>
<y>30</y>
<width>31</width>
<height>28</height>
</rect>
</property>
<property name="text">
<string>Color Attenuation Factor :</string>
<string>-</string>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_ColorAttenuationFactor">
<widget class="QPushButton" name="pushButton_addPlane">
<property name="geometry">
<rect>
<x>0</x>
<y>230</y>
<width>63</width>
<x>140</x>
<y>30</y>
<width>31</width>
<height>28</height>
</rect>
</property>
<property name="singleStep">
<double>1.000000000000000</double>
<property name="text">
<string>+</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_PlaneIndex">
......@@ -248,7 +363,7 @@
</property>
<property name="geometry">
<rect>
<x>60</x>
<x>10</x>
<y>30</y>
<width>99</width>
<height>28</height>
......@@ -264,41 +379,31 @@
<number>-1</number>
</property>
</widget>
<widget class="QPushButton" name="pushButton_addPlane">
<property name="geometry">
<rect>
<x>190</x>
<y>30</y>
<width>31</width>
<height>28</height>
</rect>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_PlaneVectors">
<property name="title">
<string>Plane Vectors</string>
</property>
<property name="text">
<string>+</string>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_11">
<item row="0" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1x">
<property name="minimum">
<double>-99.989999999999995</double>
</property>
</widget>
<widget class="QPushButton" name="pushButton_deletePlane">
<property name="geometry">
<rect>
<x>220</x>
<y>30</y>
<width>31</width>
<height>28</height>
</rect>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="text">
<string>-</string>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1y">
<property name="geometry">
<rect>
<x>70</x>
<y>90</y>
<width>63</width>
<height>28</height>
</rect>
</property>
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -309,15 +414,9 @@
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1z">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>63</width>
<height>28</height>
</rect>
</property>
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -328,15 +427,9 @@
<double>0.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2z">
<property name="geometry">
<rect>
<x>140</x>
<y>120</y>
<width>63</width>
<height>28</height>
</rect>
</property>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2x">
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -347,15 +440,9 @@
<double>0.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2x">
<property name="geometry">
<rect>
<x>0</x>
<y>120</y>
<width>63</width>
<height>28</height>
</rect>
</property>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginy">
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -366,15 +453,9 @@
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2y">
<property name="geometry">
<rect>
<x>70</x>
<y>120</y>
<width>63</width>
<height>28</height>
</rect>
</property>
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -385,15 +466,9 @@
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginz">
<property name="geometry">
<rect>
<x>140</x>
<y>150</y>
<width>63</width>
<height>28</height>
</rect>
</property>
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -404,15 +479,9 @@
<double>0.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginy">
<property name="geometry">
<rect>
<x>70</x>
<y>150</y>
<width>63</width>
<height>28</height>
</rect>
</property>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginx">
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -423,15 +492,9 @@
<double>0.000000000000000</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginx">
<property name="geometry">
<rect>
<x>0</x>
<y>150</y>
<width>63</width>
<height>28</height>
</rect>
</property>
</item>
<item row="1" column="3">
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2z">
<property name="minimum">
<double>-99.989999999999995</double>
</property>
......@@ -442,6 +505,37 @@
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_Vec1">
<property name="text">
<string>Vec 1</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_Vec2">
<property name="text">
<string>Vec 2</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_Origin">
<property name="text">
<string>Origin</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
......
......@@ -154,7 +154,7 @@ public:
* set the planes display color
* @param color the new color
*/
void setPlaneDisplayColor(Geom::Vec3f color) { m_clipPlanesDisplayColor = color; }
void setPlaneDisplayColor(Geom::Vec3f color) { m_clipPlanesDisplayColor = color; updateAllClippingPlanesVBOs(); }
/**
* get the planes display color
......@@ -165,7 +165,7 @@ public:
* set the planes display grids type
* @param gridType the new grid type
*/
void setPlaneDisplayType(clipPlaneDisplayGridType gridType) { m_clipPlanesDisplayType = gridType; }
void setPlaneDisplayType(clipPlaneDisplayGridType gridType) { m_clipPlanesDisplayType = gridType; updateAllClippingPlanesVBOs(); }
/**
* get the planes display grids type
......@@ -176,7 +176,7 @@ public:
* set the planes display grid x resolution
* @param res the new resolution
*/
void setPlaneDisplayXRes(size_t res) { m_clipPlanesDisplayXRes = res; }
void setPlaneDisplayXRes(size_t res) { m_clipPlanesDisplayXRes = res; updateAllClippingPlanesVBOs(); }
/**
* get the planes display grid x resolution
......@@ -187,7 +187,7 @@ public:
* set the planes display grid y resolution
* @param res the new resolution
*/
void setPlaneDisplayYRes(size_t res) { m_clipPlanesDisplayYRes = res; }
void setPlaneDisplayYRes(size_t res) { m_clipPlanesDisplayYRes = res; updateAllClippingPlanesVBOs(); }
/**
* get the planes display grid y resolution
......@@ -198,7 +198,7 @@ public:
* set the planes display size
* @param size the new size
*/
void setPlaneDisplaySize(float size) { m_clipPlanesDisplaySize = size; }
void setPlaneDisplaySize(float size) { m_clipPlanesDisplaySize = size; updateAllClippingPlanesVBOs(); }
<