Commit 4ba00cbe authored by Maire Nicolas's avatar Maire Nicolas

stage_shader_reloaded renommé en clipping. Déplacement vers le dossier examples.

parent 13e7a3cc
...@@ -59,3 +59,9 @@ add_executable( viewerD ../viewer.cpp ${viewer_moc} ${viewer_ui}) ...@@ -59,3 +59,9 @@ add_executable( viewerD ../viewer.cpp ${viewer_moc} ${viewer_ui})
target_link_libraries( viewerD target_link_libraries( viewerD
${CGoGN_LIBS_D} ${NUMERICAL_LIBS} ${COMMON_LIBS} ${QT_LIBRARIES} ) ${CGoGN_LIBS_D} ${NUMERICAL_LIBS} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_UI( clipping_ui ../clipping.ui )
QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable( clippingD ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clippingD
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
...@@ -63,3 +63,9 @@ add_executable( viewer ../viewer.cpp ${viewer_moc} ${viewer_ui}) ...@@ -63,3 +63,9 @@ add_executable( viewer ../viewer.cpp ${viewer_moc} ${viewer_ui})
target_link_libraries( viewer target_link_libraries( viewer
${CGoGN_LIBS_R} ${NUMERICAL_LIBS} ${COMMON_LIBS} ${QT_LIBRARIES} ) ${CGoGN_LIBS_R} ${NUMERICAL_LIBS} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_UI( clipping_ui ../clipping.ui )
QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable( clipping ../clipping.cpp ${clipping_ui} ${clipping_moc})
target_link_libraries( clipping
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
...@@ -22,59 +22,59 @@ ...@@ -22,59 +22,59 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include "stage_shader_reloaded.h" #include "clipping.h"
#include "Utils/static_assert.h" #include "Utils/static_assert.h"
/******************************************************************************* /*******************************************************************************
* SLOTS * SLOTS
*******************************************************************************/ *******************************************************************************/
void StageShaderReloaded::slot_drawTopo(bool b) void Clipping::slot_drawTopo(bool b)
{ {
m_drawTopo = b; m_drawTopo = b;
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_drawVertices(bool b) void Clipping::slot_drawVertices(bool b)
{ {
m_drawVertices = b; m_drawVertices = b;
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_drawLines(bool b) void Clipping::slot_drawLines(bool b)
{ {
m_drawLines = b; m_drawLines = b;
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_drawFaces(bool b) void Clipping::slot_drawFaces(bool b)
{ {
m_drawFaces = b; m_drawFaces = b;
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_explodTopoPhi1(double c) void Clipping::slot_explodTopoPhi1(double c)
{ {
m_coeffTopoExplod[0] = (float)c; m_coeffTopoExplod[0] = (float)c;
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]);
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_explodTopoPhi2(double c) void Clipping::slot_explodTopoPhi2(double c)
{ {
m_coeffTopoExplod[1] = (float)c; m_coeffTopoExplod[1] = (float)c;
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]);
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_explodTopoPhi3(double c) void Clipping::slot_explodTopoPhi3(double c)
{ {
m_coeffTopoExplod[2] = (float)c; m_coeffTopoExplod[2] = (float)c;
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]);
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_pushButton_addPlane() void Clipping::slot_pushButton_addPlane()
{ {
// Create clipping and pickable objects // Create clipping and pickable objects
int newPlaneId = m_shader->addClipPlane(); int newPlaneId = m_shader->addClipPlane();
...@@ -92,13 +92,13 @@ void StageShaderReloaded::slot_pushButton_addPlane() ...@@ -92,13 +92,13 @@ void StageShaderReloaded::slot_pushButton_addPlane()
updateGLMatrices(); updateGLMatrices();
} }
void StageShaderReloaded::slot_spinBox_GridResolution(int i) void Clipping::slot_spinBox_GridResolution(int i)
{ {
m_planeDrawable->updatePrecisionDrawing(i); m_planeDrawable->updatePrecisionDrawing(i);
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_doubleSpinBox_GridColor(double c) void Clipping::slot_doubleSpinBox_GridColor(double c)
{ {
float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorR->value(); float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorR->value();
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorG->value(); float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_GridColorG->value();
...@@ -108,7 +108,7 @@ void StageShaderReloaded::slot_doubleSpinBox_GridColor(double c) ...@@ -108,7 +108,7 @@ void StageShaderReloaded::slot_doubleSpinBox_GridColor(double c)
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_pushButton_addSphere() void Clipping::slot_pushButton_addSphere()
{ {
// Create clipping and pickable objects // Create clipping and pickable objects
int newSphereId = m_shader->addClipSphere(); int newSphereId = m_shader->addClipSphere();
...@@ -128,13 +128,13 @@ void StageShaderReloaded::slot_pushButton_addSphere() ...@@ -128,13 +128,13 @@ void StageShaderReloaded::slot_pushButton_addSphere()
updateGLMatrices(); updateGLMatrices();
} }
void StageShaderReloaded::slot_spinBox_SphereResolution(int i) void Clipping::slot_spinBox_SphereResolution(int i)
{ {
m_sphereDrawable->updatePrecisionDrawing(i); m_sphereDrawable->updatePrecisionDrawing(i);
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_doubleSpinBox_SphereGridColor(double c) void Clipping::slot_doubleSpinBox_SphereGridColor(double c)
{ {
float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorR->value(); float r = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorR->value();
float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorG->value(); float g = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->doubleSpinBox_SphereGridColorG->value();
...@@ -144,13 +144,13 @@ void StageShaderReloaded::slot_doubleSpinBox_SphereGridColor(double c) ...@@ -144,13 +144,13 @@ void StageShaderReloaded::slot_doubleSpinBox_SphereGridColor(double c)
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_doubleSpinBox_ColorAttenuationFactor(double c) void Clipping::slot_doubleSpinBox_ColorAttenuationFactor(double c)
{ {
m_shader->setClipColorAttenuationFactor((float)c); m_shader->setClipColorAttenuationFactor((float)c);
updateGL(); updateGL();
} }
void StageShaderReloaded::slot_horizontalSlider_ClippingMode(int i) void Clipping::slot_horizontalSlider_ClippingMode(int i)
{ {
if (i == 0) if (i == 0)
m_shader->setClipMode(Utils::ClippingShader::CLIPPING_MODE_AND); m_shader->setClipMode(Utils::ClippingShader::CLIPPING_MODE_AND);
...@@ -163,7 +163,7 @@ void StageShaderReloaded::slot_horizontalSlider_ClippingMode(int i) ...@@ -163,7 +163,7 @@ void StageShaderReloaded::slot_horizontalSlider_ClippingMode(int i)
updateGLMatrices(); updateGLMatrices();
} }
void StageShaderReloaded::slot_pushButton_deleteSelectedObject() void Clipping::slot_pushButton_deleteSelectedObject()
{ {
if (m_lastPickedObject) if (m_lastPickedObject)
{ {
...@@ -207,7 +207,7 @@ void StageShaderReloaded::slot_pushButton_deleteSelectedObject() ...@@ -207,7 +207,7 @@ void StageShaderReloaded::slot_pushButton_deleteSelectedObject()
} }
} }
void StageShaderReloaded::button_compile() void Clipping::button_compile()
{ {
QString st1 = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->vertexEdit->toPlainText(); QString st1 = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->vertexEdit->toPlainText();
QString st2 = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->fragmentEdit->toPlainText(); QString st2 = dynamic_cast<Utils::QT::uiDockInterface*>(dockWidget())->fragmentEdit->toPlainText();
...@@ -223,7 +223,7 @@ void StageShaderReloaded::button_compile() ...@@ -223,7 +223,7 @@ void StageShaderReloaded::button_compile()
* Init Functions * Init Functions
*******************************************************************************/ *******************************************************************************/
StageShaderReloaded::StageShaderReloaded(): Clipping::Clipping():
m_drawVertices(false), m_drawVertices(false),
m_drawLines(true), m_drawLines(true),
m_drawFaces(true), m_drawFaces(true),
...@@ -236,7 +236,7 @@ StageShaderReloaded::StageShaderReloaded(): ...@@ -236,7 +236,7 @@ StageShaderReloaded::StageShaderReloaded():
m_coeffTopoExplod = Geom::Vec3f(0.9,0.9,0.9); m_coeffTopoExplod = Geom::Vec3f(0.9,0.9,0.9);
} }
void StageShaderReloaded::initGUI() void Clipping::initGUI()
{ {
CGoGNStream::allToConsole(this) ; CGoGNStream::allToConsole(this) ;
CGoGNStream::allToStd(true) ; CGoGNStream::allToStd(true) ;
...@@ -269,10 +269,10 @@ void StageShaderReloaded::initGUI() ...@@ -269,10 +269,10 @@ void StageShaderReloaded::initGUI()
unsigned int planesPrecision1, planesPrecision2; unsigned int planesPrecision1, planesPrecision2;
m_planeDrawable->getPrecisionDrawing(planesPrecision1, planesPrecision2); m_planeDrawable->getPrecisionDrawing(planesPrecision1, planesPrecision2);
dock.spinBox_GridResolution->setValue(planesPrecision1); dock.spinBox_GridResolution->setValue(planesPrecision1);
Geom::Vec3f planesCol = Geom::Vec3f(1.0, 0.0, 0.0); // TODO : utiliser un getteur Geom::Vec4f planesColor = m_planeDrawable->getColor();
dock.doubleSpinBox_GridColorR->setValue(planesCol[0]); dock.doubleSpinBox_GridColorR->setValue(planesColor[0]);
dock.doubleSpinBox_GridColorG->setValue(planesCol[1]); dock.doubleSpinBox_GridColorG->setValue(planesColor[1]);
dock.doubleSpinBox_GridColorB->setValue(planesCol[2]); dock.doubleSpinBox_GridColorB->setValue(planesColor[2]);
...@@ -286,10 +286,10 @@ void StageShaderReloaded::initGUI() ...@@ -286,10 +286,10 @@ void StageShaderReloaded::initGUI()
unsigned int spheresPrecision1, spheresPrecision2; unsigned int spheresPrecision1, spheresPrecision2;
m_sphereDrawable->getPrecisionDrawing(spheresPrecision1, spheresPrecision2); m_sphereDrawable->getPrecisionDrawing(spheresPrecision1, spheresPrecision2);
dock.spinBox_GridResolution->setValue(spheresPrecision1); dock.spinBox_GridResolution->setValue(spheresPrecision1);
Geom::Vec3f spheresCol = Geom::Vec3f(0.0, 0.4, 1.0); // TODO : utiliser un getteur Geom::Vec4f spheresColor = m_sphereDrawable->getColor();
dock.doubleSpinBox_SphereGridColorR->setValue(spheresCol[0]); dock.doubleSpinBox_SphereGridColorR->setValue(spheresColor[0]);
dock.doubleSpinBox_SphereGridColorG->setValue(spheresCol[1]); dock.doubleSpinBox_SphereGridColorG->setValue(spheresColor[1]);
dock.doubleSpinBox_SphereGridColorB->setValue(spheresCol[2]); dock.doubleSpinBox_SphereGridColorB->setValue(spheresColor[2]);
...@@ -305,7 +305,7 @@ void StageShaderReloaded::initGUI() ...@@ -305,7 +305,7 @@ void StageShaderReloaded::initGUI()
} }
void StageShaderReloaded::cb_Open() void Clipping::cb_Open()
{ {
std::string filters("all (*.*)") ; std::string filters("all (*.*)") ;
std::string filename = selectFile("Open Mesh", "", filters) ; std::string filename = selectFile("Open Mesh", "", filters) ;
...@@ -314,7 +314,7 @@ void StageShaderReloaded::cb_Open() ...@@ -314,7 +314,7 @@ void StageShaderReloaded::cb_Open()
updateGL() ; updateGL() ;
} }
void StageShaderReloaded::importMesh(std::string& filename) void Clipping::importMesh(std::string& filename)
{ {
std::vector<std::string> attrNames ; std::vector<std::string> attrNames ;
...@@ -367,7 +367,7 @@ void StageShaderReloaded::importMesh(std::string& filename) ...@@ -367,7 +367,7 @@ void StageShaderReloaded::importMesh(std::string& filename)
* GL FUNCTIONS * GL FUNCTIONS
*******************************************************************************/ *******************************************************************************/
void StageShaderReloaded::cb_initGL() void Clipping::cb_initGL()
{ {
// choose to use GL version 2 // choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2); Utils::GLSLShader::setCurrentOGLVersion(2);
...@@ -402,7 +402,7 @@ void StageShaderReloaded::cb_initGL() ...@@ -402,7 +402,7 @@ void StageShaderReloaded::cb_initGL()
m_lastPickedObject = NULL; m_lastPickedObject = NULL;
} }
void StageShaderReloaded::updateVBOprimitives(int upType) void Clipping::updateVBOprimitives(int upType)
{ {
if(upType & Algo::Render::GL2::TRIANGLES) if(upType & Algo::Render::GL2::TRIANGLES)
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ;
...@@ -414,7 +414,7 @@ void StageShaderReloaded::updateVBOprimitives(int upType) ...@@ -414,7 +414,7 @@ void StageShaderReloaded::updateVBOprimitives(int upType)
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::POINTS) ;
} }
void StageShaderReloaded::cb_redraw() void Clipping::cb_redraw()
{ {
if(m_drawVertices) if(m_drawVertices)
{ {
...@@ -455,7 +455,7 @@ void StageShaderReloaded::cb_redraw() ...@@ -455,7 +455,7 @@ void StageShaderReloaded::cb_redraw()
} }
void StageShaderReloaded::cb_keyPress(int code) void Clipping::cb_keyPress(int code)
{ {
switch (code) switch (code)
{ {
...@@ -465,7 +465,7 @@ void StageShaderReloaded::cb_keyPress(int code) ...@@ -465,7 +465,7 @@ void StageShaderReloaded::cb_keyPress(int code)
} }
} }
void StageShaderReloaded::cb_mousePress(int button, int x, int y) void Clipping::cb_mousePress(int button, int x, int y)
{ {
if (!Shift()) if (!Shift())
return; return;
...@@ -517,7 +517,7 @@ void StageShaderReloaded::cb_mousePress(int button, int x, int y) ...@@ -517,7 +517,7 @@ void StageShaderReloaded::cb_mousePress(int button, int x, int y)
updateGL(); updateGL();
} }
void StageShaderReloaded::cb_mouseMove(int buttons, int x, int y) void Clipping::cb_mouseMove(int buttons, int x, int y)
{ {
if (!Shift()) if (!Shift())
return; return;
...@@ -605,7 +605,7 @@ int main(int argc, char** argv) ...@@ -605,7 +605,7 @@ int main(int argc, char** argv)
{ {
QApplication app(argc, argv); QApplication app(argc, argv);
StageShaderReloaded sqt; Clipping sqt;
sqt.setGeometry(0, 0, 1000, 800); sqt.setGeometry(0, 0, 1000, 800);
sqt.show(); sqt.show();
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#ifndef __STAGE_SHADER_RELOADED_H__ #ifndef __CLIPPING_H__
#define __STAGE_SHADER_RELOADED_H__ #define __CLIPPING_H__
#include <iostream> #include <iostream>
#include "Utils/qtSimple.h" #include "Utils/qtSimple.h"
#include "ui_stage_shader_reloaded.h" #include "ui_clipping.h"
// inclure qtui.h juste après le ui_xxx.h // inclure qtui.h juste après le ui_xxx.h
#include "Utils/qtui.h" #include "Utils/qtui.h"
...@@ -66,7 +66,7 @@ struct PFP: public PFP_STANDARD ...@@ -66,7 +66,7 @@ struct PFP: public PFP_STANDARD
}; };
class StageShaderReloaded: public Utils::QT::SimpleQT class Clipping: public Utils::QT::SimpleQT
{ {
Q_OBJECT Q_OBJECT
...@@ -115,7 +115,7 @@ public: ...@@ -115,7 +115,7 @@ public:
Utils::Pickable* m_lastPickedObject; Utils::Pickable* m_lastPickedObject;
int m_lastClickedX, m_lastClickedY; int m_lastClickedX, m_lastClickedY;
StageShaderReloaded(); Clipping();
void initGUI(); void initGUI();
void cb_Open(); void cb_Open();
......
...@@ -65,12 +65,6 @@ add_executable( tuto5 tuto5.cpp ${tuto5_ui} ${tuto5_moc}) ...@@ -65,12 +65,6 @@ add_executable( tuto5 tuto5.cpp ${tuto5_ui} ${tuto5_moc})
target_link_libraries( tuto5 target_link_libraries( tuto5
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} ) ${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
QT4_WRAP_UI( stage_shader_reloaded_ui stage_shader_reloaded.ui )
QT4_WRAP_CPP(stage_shader_reloaded_moc stage_shader_reloaded.h)
add_executable( stage_shader_reloaded stage_shader_reloaded.cpp ${stage_shader_reloaded_ui} ${stage_shader_reloaded_moc})
target_link_libraries( stage_shader_reloaded
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} )
#add_executable( tuto_subdivision tuto_subdivision.cpp) #add_executable( tuto_subdivision tuto_subdivision.cpp)
#target_link_libraries( tuto_subdivision #target_link_libraries( tuto_subdivision
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment