Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit 775f81c2 authored by Maire Nicolas's avatar Maire Nicolas
Browse files

Implémentation de l'affichage des plans de clipping.

parent 10afca5c
...@@ -77,8 +77,9 @@ void StageShader::slot_explodTopoPhi3(double c) ...@@ -77,8 +77,9 @@ void StageShader::slot_explodTopoPhi3(double c)
void StageShader::slot_pushButton_addPlane() void StageShader::slot_pushButton_addPlane()
{ {
m_shader->setClippingPlanesCount(dock.comboBox_PlaneIndex->count() + 1);
m_shader->setPlaneClipping(dock.comboBox_PlaneIndex->count() + 1); m_shader->setClippingPlaneOrigin(m_bb.center(), dock.comboBox_PlaneIndex->count() + 1 - 1);
std::string indexStr; std::string indexStr;
std::stringstream ss; std::stringstream ss;
...@@ -97,7 +98,7 @@ void StageShader::slot_pushButton_addPlane() ...@@ -97,7 +98,7 @@ void StageShader::slot_pushButton_addPlane()
void StageShader::slot_pushButton_deletePlane() void StageShader::slot_pushButton_deletePlane()
{ {
m_shader->setPlaneClipping(dock.comboBox_PlaneIndex->count() - 1); m_shader->setClippingPlanesCount(dock.comboBox_PlaneIndex->count() - 1);
dock.comboBox_PlaneIndex->removeItem(dock.comboBox_PlaneIndex->count() - 1); dock.comboBox_PlaneIndex->removeItem(dock.comboBox_PlaneIndex->count() - 1);
...@@ -111,23 +112,55 @@ void StageShader::slot_comboBox_PlaneIndexChanged(int newIndex) ...@@ -111,23 +112,55 @@ void StageShader::slot_comboBox_PlaneIndexChanged(int newIndex)
{ {
if (newIndex >= 0) if (newIndex >= 0)
{ {
Geom::Vec4f currPlaneEquation = m_shader->getClippingPlaneEquation(newIndex); Geom::Vec3f currPlaneVec1 = m_shader->getClippingPlaneFirstVec(newIndex);
dock.doubleSpinBox_aPlane->setValue(currPlaneEquation[0]); dock.doubleSpinBox_PlaneVec1x->setValue(currPlaneVec1[0]);
dock.doubleSpinBox_bPlane->setValue(currPlaneEquation[1]); dock.doubleSpinBox_PlaneVec1y->setValue(currPlaneVec1[1]);
dock.doubleSpinBox_cPlane->setValue(currPlaneEquation[2]); dock.doubleSpinBox_PlaneVec1z->setValue(currPlaneVec1[2]);
dock.doubleSpinBox_dPlane->setValue(currPlaneEquation[3]);
Geom::Vec3f currPlaneVec2 = m_shader->getClippingPlaneSecondVec(newIndex);
dock.doubleSpinBox_PlaneVec2x->setValue(currPlaneVec2[0]);
dock.doubleSpinBox_PlaneVec2y->setValue(currPlaneVec2[1]);
dock.doubleSpinBox_PlaneVec2z->setValue(currPlaneVec2[2]);
Geom::Vec3f currPlaneOrigin = m_shader->getClippingPlaneOrigin(newIndex);
dock.doubleSpinBox_PlaneOriginx->setValue(currPlaneOrigin[0]);
dock.doubleSpinBox_PlaneOriginy->setValue(currPlaneOrigin[1]);
dock.doubleSpinBox_PlaneOriginz->setValue(currPlaneOrigin[2]);
} }
} }
void StageShader::slot_doubleSpinBox_Plane(double c) void StageShader::slot_doubleSpinBox_PlaneVec1(double c)
{ {
if (dock.comboBox_PlaneIndex->currentIndex() >= 0) if (dock.comboBox_PlaneIndex->currentIndex() >= 0)
{ {
float aPlane = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_aPlane->value(); float x = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneVec1x->value();
float bPlane = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_bPlane->value(); float y = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneVec1y->value();
float cPlane = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_cPlane->value(); float z = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneVec1z->value();
float dPlane = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_dPlane->value(); m_shader->setClippingPlaneFirstVec(Geom::Vec3f(x, y, z), dock.comboBox_PlaneIndex->currentIndex());
m_shader->setClippingPlaneEquation(Geom::Vec4f(aPlane, bPlane, cPlane, dPlane), dock.comboBox_PlaneIndex->currentIndex()); updateGL();
}
}
void StageShader::slot_doubleSpinBox_PlaneVec2(double c)
{
if (dock.comboBox_PlaneIndex->currentIndex() >= 0)
{
float x = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneVec2x->value();
float y = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneVec2y->value();
float z = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneVec2z->value();
m_shader->setClippingPlaneSecondVec(Geom::Vec3f(x, y, z), dock.comboBox_PlaneIndex->currentIndex());
updateGL();
}
}
void StageShader::slot_doubleSpinBox_PlaneOrigin(double c)
{
if (dock.comboBox_PlaneIndex->currentIndex() >= 0)
{
float x = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneOriginx->value();
float y = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneOriginy->value();
float z = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_PlaneOriginz->value();
m_shader->setClippingPlaneOrigin(Geom::Vec3f(x, y, z), dock.comboBox_PlaneIndex->currentIndex());
updateGL(); updateGL();
} }
} }
...@@ -190,10 +223,17 @@ void StageShader::initGUI() ...@@ -190,10 +223,17 @@ void StageShader::initGUI()
setCallBack(dock.comboBox_PlaneIndex, SIGNAL(currentIndexChanged(int)), SLOT(slot_comboBox_PlaneIndexChanged(int))); setCallBack(dock.comboBox_PlaneIndex, SIGNAL(currentIndexChanged(int)), SLOT(slot_comboBox_PlaneIndexChanged(int)));
setCallBack(dock.doubleSpinBox_aPlane, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_Plane(double))); setCallBack(dock.doubleSpinBox_PlaneVec1x, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneVec1(double)));
setCallBack(dock.doubleSpinBox_bPlane, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_Plane(double))); setCallBack(dock.doubleSpinBox_PlaneVec1y, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneVec1(double)));
setCallBack(dock.doubleSpinBox_cPlane, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_Plane(double))); setCallBack(dock.doubleSpinBox_PlaneVec1z, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneVec1(double)));
setCallBack(dock.doubleSpinBox_dPlane, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_Plane(double)));
setCallBack(dock.doubleSpinBox_PlaneVec2x, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneVec2(double)));
setCallBack(dock.doubleSpinBox_PlaneVec2y, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneVec2(double)));
setCallBack(dock.doubleSpinBox_PlaneVec2z, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneVec2(double)));
setCallBack(dock.doubleSpinBox_PlaneOriginx, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double)));
setCallBack(dock.doubleSpinBox_PlaneOriginy, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_PlaneOrigin(double)));
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_ColorAttenuationFactor, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_ColorAttenuationFactor(double)));
...@@ -248,11 +288,11 @@ void StageShader::importMesh(std::string& filename) ...@@ -248,11 +288,11 @@ void StageShader::importMesh(std::string& filename)
m_render_topo->updateData<PFP>(myMap, allDarts, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]); m_render_topo->updateData<PFP>(myMap, allDarts, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ; m_bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
gPosObj = bb.center() ; gPosObj = m_bb.center() ;
float tailleX = bb.size(0) ; float tailleX = m_bb.size(0) ;
float tailleY = bb.size(1) ; float tailleY = m_bb.size(1) ;
float tailleZ = bb.size(2) ; float tailleZ = m_bb.size(2) ;
gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ) ; gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ) ;
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
...@@ -260,6 +300,8 @@ void StageShader::importMesh(std::string& filename) ...@@ -260,6 +300,8 @@ void StageShader::importMesh(std::string& filename)
setParamObject(gWidthObj, gPosObj.data()) ; setParamObject(gWidthObj, gPosObj.data()) ;
updateGLMatrices() ; updateGLMatrices() ;
m_shader->setPlaneDisplaySize((m_bb.maxSize())*1.2f);
} }
/******************************************************************************* /*******************************************************************************
...@@ -333,6 +375,8 @@ void StageShader::cb_redraw() ...@@ -333,6 +375,8 @@ void StageShader::cb_redraw()
if (m_drawTopo) if (m_drawTopo)
m_render_topo->drawTopo(); m_render_topo->drawTopo();
m_shader->displayClippingPlanes();
} }
void StageShader::cb_keyPress(int code) void StageShader::cb_keyPress(int code)
......
...@@ -87,6 +87,8 @@ public: ...@@ -87,6 +87,8 @@ public:
Algo::Render::GL2::MapRender* m_render; Algo::Render::GL2::MapRender* m_render;
Algo::Render::GL2::Topo3RenderMapD* m_render_topo; Algo::Render::GL2::Topo3RenderMapD* m_render_topo;
Geom::BoundingBox<PFP::VEC3> m_bb;
Utils::VBO* m_positionVBO; Utils::VBO* m_positionVBO;
Utils::ShaderSimpleColor* m_shader; Utils::ShaderSimpleColor* m_shader;
...@@ -127,7 +129,9 @@ public slots: ...@@ -127,7 +129,9 @@ public slots:
void slot_comboBox_PlaneIndexChanged(int newIndex); void slot_comboBox_PlaneIndexChanged(int newIndex);
void slot_doubleSpinBox_Plane(double c); void slot_doubleSpinBox_PlaneVec1(double c);
void slot_doubleSpinBox_PlaneVec2(double c);
void slot_doubleSpinBox_PlaneOrigin(double c);
void slot_doubleSpinBox_ColorAttenuationFactor(double c); void slot_doubleSpinBox_ColorAttenuationFactor(double c);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>324</width> <width>324</width>
<height>569</height> <height>628</height>
</rect> </rect>
</property> </property>
<property name="allowedAreas"> <property name="allowedAreas">
...@@ -184,7 +184,7 @@ ...@@ -184,7 +184,7 @@
<property name="title"> <property name="title">
<string>Clipping</string> <string>Clipping</string>
</property> </property>
<widget class="QDoubleSpinBox" name="doubleSpinBox_aPlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1x">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
...@@ -203,194 +203,243 @@ ...@@ -203,194 +203,243 @@
<double>0.000000000000000</double> <double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_bPlane"> <widget class="QLabel" name="label_Plane">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>60</x> <x>0</x>
<y>90</y> <y>40</y>
<width>63</width> <width>69</width>
<height>28</height> <height>18</height>
</rect> </rect>
</property> </property>
<property name="minimum"> <property name="text">
<double>-99.989999999999995</double> <string>Plane :</string>
</property> </property>
<property name="singleStep"> </widget>
<double>0.100000000000000</double> <widget class="QLabel" name="label_ColorAttenuationFactor">
<property name="geometry">
<rect>
<x>0</x>
<y>200</y>
<width>201</width>
<height>18</height>
</rect>
</property> </property>
<property name="value"> <property name="text">
<double>0.000000000000000</double> <string>Color Attenuation Factor :</string>
</property> </property>
</widget> </widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_cPlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_ColorAttenuationFactor">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>120</x> <x>0</x>
<y>90</y> <y>230</y>
<width>63</width> <width>63</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="minimum">
<double>-99.989999999999995</double>
</property>
<property name="singleStep"> <property name="singleStep">
<double>0.100000000000000</double> <double>1.000000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_dPlane"> <widget class="QComboBox" name="comboBox_PlaneIndex">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>60</x>
<y>90</y> <y>30</y>
<width>63</width> <width>99</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="minimum"> <property name="focusPolicy">
<double>-99.989999999999995</double> <enum>Qt::NoFocus</enum>
</property> </property>
<property name="singleStep"> <property name="editable">
<double>0.100000000000000</double> <bool>false</bool>
</property>
<property name="currentIndex">
<number>-1</number>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_Plane"> <widget class="QPushButton" name="pushButton_addPlane">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>190</x>
<y>30</y> <y>30</y>
<width>69</width> <width>31</width>
<height>18</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Plane :</string> <string>+</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_aPlane"> <widget class="QPushButton" name="pushButton_deletePlane">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>220</x>
<y>70</y> <y>30</y>
<width>31</width> <width>31</width>
<height>18</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>a :</string> <string>-</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_bPlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1y">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>70</x> <x>70</x>
<y>70</y> <y>90</y>
<width>31</width> <width>63</width>
<height>18</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="minimum">
<string>b :</string> <double>-99.989999999999995</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_cPlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec1z">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>130</x> <x>140</x>
<y>70</y> <y>90</y>
<width>31</width> <width>63</width>
<height>18</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="minimum">
<string>c :</string> <double>-99.989999999999995</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_dPlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2z">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>190</x> <x>140</x>
<y>70</y> <y>120</y>
<width>31</width> <width>63</width>
<height>18</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="minimum">
<string>d :</string> <double>-99.989999999999995</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_ColorAttenuationFactor"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2x">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>140</y> <y>120</y>
<width>201</width> <width>63</width>
<height>18</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="minimum">
<string>Color Attenuation Factor :</string> <double>-99.989999999999995</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_ColorAttenuationFactor"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneVec2y">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>70</x>
<y>160</y> <y>120</y>
<width>63</width> <width>63</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="minimum">
<double>-99.989999999999995</double>
</property>
<property name="singleStep"> <property name="singleStep">
<double>1.000000000000000</double> <double>0.100000000000000</double>
</property> </property>
</widget> <property name="value">
<widget class="QComboBox" name="comboBox_PlaneIndex"> <double>0.000000000000000</double>
<property name="enabled">
<bool>true</bool>
</property> </property>
</widget>
<widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginz">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>80</x> <x>140</x>
<y>30</y> <y>150</y>
<width>99</width> <width>63</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="editable"> <property name="minimum">
<bool>false</bool> <double>-99.989999999999995</double>
</property> </property>
<property name="currentIndex"> <property name="singleStep">
<number>-1</number> <double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_addPlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginy">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>180</x> <x>70</x>
<y>10</y> <y>150</y>
<width>51</width> <width>63</width>
<height>28</height> <height>28</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="minimum">
<string>+</string> <double>-99.989999999999995</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton_deletePlane"> <widget class="QDoubleSpinBox" name="doubleSpinBox_PlaneOriginx">
<property name="geometry"> <property name="geometry"