Commit 65c76644 authored by Thomas Pitiot 's avatar Thomas Pitiot

réparé affichage, pb couleurs

parent d7cf160e
...@@ -5,9 +5,9 @@ project(Volusion) ...@@ -5,9 +5,9 @@ project(Volusion)
#SET ( CMAKE_VERBOSE_MAKEFILE 1 ) #SET ( CMAKE_VERBOSE_MAKEFILE 1 )
SET(QT_USE_QTXML TRUE ) #SET(QT_USE_QTXML TRUE )
SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR}) #SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR})
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRAIRIES}) #SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRAIRIES})
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir") SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
...@@ -20,12 +20,11 @@ include(${CGoGN_ROOT_DIR}/apps_cmake.txt) ...@@ -20,12 +20,11 @@ include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
#ENDIF (NOT WIN32) #ENDIF (NOT WIN32)
include_directories( include_directories(
${CGoGN_ROOT_DIR}/include # ${CGoGN_ROOT_DIR}/include
${COMMON_INCLUDES} # ${COMMON_INCLUDES}
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
include include
) )
...@@ -42,8 +41,8 @@ file( GLOB ...@@ -42,8 +41,8 @@ file( GLOB
include/*.h include/*.h
) )
QT4_WRAP_UI( Volusion_ui include/Volusion.ui ) qt_wrap_ui( Volusion_ui include/Volusion.ui )
QT4_WRAP_CPP( Volusion_moc include/viewer.h ) qt_wrap_cpp( Volusion_moc include/viewer.h )
add_executable( Volusion add_executable( Volusion
${includes} ${includes}
${sources} ${sources}
...@@ -51,4 +50,5 @@ add_executable( Volusion ...@@ -51,4 +50,5 @@ add_executable( Volusion
${Volusion_ui} ${Volusion_ui}
) )
target_link_libraries( Volusion ${CGoGN_LIBS} ${COMMON_LIBS} ${CGoGN_EXT_LIBS}) target_link_libraries( Volusion ${CGoGN_LIBS} ${CGoGN_EXT_LIBS})
qt_use_modules(Volusion Gui OpenGL Xml Svg)
No preview for this file type
...@@ -11,8 +11,8 @@ ...@@ -11,8 +11,8 @@
#include "Algo/Render/GL2/mapRender.h" #include "Algo/Render/GL2/mapRender.h"
#include "Utils/vbo.h" #include "Utils/vbo.h"
//#include "Utils/Shaders/shaderSimpleColor.h" #include "Utils/Shaders/shaderSimpleColor.h"
//#include "Algo/Render/GL2/colorPerFaceRender.h" #include "Algo/Render/GL2/colorPerFaceRender.h"
#include "Utils/Shaders/shaderColorPerVertex.h" #include "Utils/Shaders/shaderColorPerVertex.h"
//particules //particules
...@@ -74,20 +74,12 @@ public: ...@@ -74,20 +74,12 @@ public:
// visualisation // visualisation
void initGL(); // initialisation GL void initGL(); // initialisation GL
void draw(); // redessiner l'objet void draw(); // redessiner l'objet
float rToDraw; // indice de rouge de la couleur a dessiner
float gToDraw; // indice de VERT de la couleur a dessiner
float bToDraw; // indice de BLeu de la couleur a dessiner
void changeColor(Triangle *t, float distance); void changeColor(Triangle *t, float distance);
Algo::Render::GL2::MapRender* m_render; // render de l'objet // Algo::Render::GL2::MapRender* m_render; // render de l'objet
// Algo::Render::GL2::ColorPerFaceRender * m_render; Algo::Render::GL2::ColorPerFaceRender * m_render;
Utils::VBO* m_positionVBO; //VBO Utils::VBO* m_positionVBO; //VBO
Utils::VBO* m_colorVBO; Utils::VBO* m_colorVBO;
// Utils::ShaderSimpleColor* m_simpleColorShader; // shader // Utils::ShaderSimpleColor* m_simpleColorShader; // shader
......
...@@ -43,7 +43,10 @@ ...@@ -43,7 +43,10 @@
#include "Utils/cgognStream.h" #include "Utils/cgognStream.h"
#include "Utils/Qt/qtSimple.h" //#include "Utils/Qt/qtSimple.h"
#include "Utils/Qt/qtQGLV.h"
#include "Utils/frameManipulator.h" #include "Utils/frameManipulator.h"
///// UI ///// UI
#include "ui_Volusion.h" #include "ui_Volusion.h"
...@@ -68,7 +71,7 @@ using namespace CGoGN ; ...@@ -68,7 +71,7 @@ using namespace CGoGN ;
* Ajouter les widgets necessaires, mettre des noms clairs pour * Ajouter les widgets necessaires, mettre des noms clairs pour
* les utiliser dans le .cpp (pour les call back principalement) * les utiliser dans le .cpp (pour les call back principalement)
*/ */
class Volusion: public Utils::QT::SimpleQT class Volusion: public Utils::QT::SimpleQGLV
{ {
Q_OBJECT Q_OBJECT
...@@ -77,8 +80,8 @@ class Volusion: public Utils::QT::SimpleQT ...@@ -77,8 +80,8 @@ class Volusion: public Utils::QT::SimpleQT
bool render_topo; bool render_topo;
bool render_MovingObject; bool render_MovingObject;
bool render_topoTemp; bool render_topoTemp;
bool clip_volume; // bool clip_volume;
bool hide_clipping; // bool hide_clipping;
bool draw_dart; bool draw_dart;
float m_explode_factor; float m_explode_factor;
float m_explode_factorf; float m_explode_factorf;
...@@ -106,17 +109,17 @@ class Volusion: public Utils::QT::SimpleQT ...@@ -106,17 +109,17 @@ class Volusion: public Utils::QT::SimpleQT
// for clipping plane manipulation // for clipping plane manipulation
Utils::Pickable* m_PlanePick; // Utils::Pickable* m_PlanePick;
Utils::FrameManipulator* m_frame; // Utils::FrameManipulator* m_frame;
unsigned int m_pickedAxis; // unsigned int m_pickedAxis;
int m_begX; // int m_begX;
int m_begY; // int m_begY;
int clip_id1; // int clip_id1;
int clip_id2; // int clip_id2;
// shader of toporender3 // // shader of toporender3
Utils::ClippingShader* m_sh1; // Utils::ClippingShader* m_sh1;
Utils::ClippingShader* m_sh2; // Utils::ClippingShader* m_sh2;
public: public:
float m_WidthObj; float m_WidthObj;
...@@ -131,8 +134,8 @@ public: ...@@ -131,8 +134,8 @@ public:
render_topo(false), render_topo(false),
render_MovingObject(true), render_MovingObject(true),
render_topoTemp(false), render_topoTemp(false),
clip_volume(false), // clip_volume(false),
hide_clipping(true), // hide_clipping(true),
draw_dart(false), draw_dart(false),
m_explode_factor(1.0f), m_explode_factor(1.0f),
render_belonging(false), render_belonging(false),
......
...@@ -9,7 +9,7 @@ Needle::Needle(Simulator* sim,std::pair<VEC3, Dart> startingPoint) ...@@ -9,7 +9,7 @@ Needle::Needle(Simulator* sim,std::pair<VEC3, Dart> startingPoint)
g=0.0f; g=0.0f;
b=1.0f; b=1.0f;
sim_=sim; sim_=sim;
width=1.0; width=0.1;
Needle_or_knife=true; Needle_or_knife=true;
nbVertices=1; nbVertices=1;
nbEdges=0; nbEdges=0;
......
...@@ -89,8 +89,8 @@ void Surface::initGL() ...@@ -89,8 +89,8 @@ void Surface::initGL()
// m_render = new Algo::Render::GL2::MapRender(); // m_render = new Algo::Render::GL2::MapRender();
m_positionVBO = new Utils::VBO(); m_positionVBO = new Utils::VBO();
m_colorVBO= new Utils::VBO(); m_colorVBO= new Utils::VBO();
m_render = new Algo::Render::GL2::MapRender(); m_render = new Algo::Render::GL2::ColorPerFaceRender();
// m_render->updateVBO<PFPSurface,FACE>(*m_positionVBO,*m_colorVBO,surfaceMap,positionSurface,faceColor); //
m_shader= new Utils::ShaderColorPerVertex(); m_shader= new Utils::ShaderColorPerVertex();
m_shader->setAttributeColor(m_colorVBO); m_shader->setAttributeColor(m_colorVBO);
...@@ -99,26 +99,25 @@ void Surface::initGL() ...@@ -99,26 +99,25 @@ void Surface::initGL()
// m_simpleColorShader->setAttributePosition(m_positionVBO); // m_simpleColorShader->setAttributePosition(m_positionVBO);
// m_simpleColorShader->setColor(Geom::Vec4f(0.,1.,0.,0.)); // m_simpleColorShader->setColor(Geom::Vec4f(0.,1.,0.,0.));
m_render->updateVBO<PFPSurface,FACE>(*m_positionVBO,*m_colorVBO,surfaceMap,positionSurface,faceColor);
m_positionVBO->updateData(positionSurface) ; // m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::LINES) ;
m_colorVBO->updateData(faceColor); // m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::TRIANGLES) ;
m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFPSurface>(surfaceMap, Algo::Render::GL2::TRIANGLES) ;
} }
void Surface::draw() void Surface::draw()
{ {
m_positionVBO->updateData(positionSurface) ; // m_positionVBO->updateData(positionSurface) ;
m_colorVBO->updateData(faceColor); // m_colorVBO->updateData(faceColor);
// colorRender->updateVBO<PFPSurface,FACE>(m_positionVBO,m_colorVBO,surfaceMap,positionSurface,colorRender); // colorRender->updateVBO<PFPSurface,FACE>(m_positionVBO,m_colorVBO,surfaceMap,positionSurface,colorRender);
glLineWidth(1.0f); glLineWidth(1.0f);
// m_render->updateVBO<PFPSurface,FACE>(*m_positionVBO,*m_colorVBO,surfaceMap,positionSurface,faceColor); m_render->updateVBO<PFPSurface,FACE>(*m_positionVBO,*m_colorVBO,surfaceMap,positionSurface,faceColor);
// m_simpleColorShader->setColor(Geom::Vec4f(0.0,0.0,0.0,0.)); // m_simpleColorShader->setColor(Geom::Vec4f(0.0,0.0,0.0,0.));
m_render->draw(m_shader, Algo::Render::GL2::TRIANGLES); m_render->draw(m_shader);
} }
......
...@@ -86,32 +86,32 @@ void Volusion::topo_onoff(bool x) ...@@ -86,32 +86,32 @@ void Volusion::topo_onoff(bool x)
void Volusion::clipping_onoff(bool x) void Volusion::clipping_onoff(bool x)
{ {
clip_volume = x; // clip_volume = x;
if (clip_volume) // if (clip_volume)
{ // {
Geom::Vec3f pos = m_PlanePick->getPosition(); // Geom::Vec3f pos = m_PlanePick->getPosition();
float pipo; // float pipo;
Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal // Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal
float d = -(pos*normal); // float d = -(pos*normal);
m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d)); // m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d));
m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos); // m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos); // m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
} // }
else // else
{ // {
m_explode_render->setNoClippingPlane(); // m_explode_render->setNoClippingPlane();
m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f)); // m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f)); // m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
m_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f); // m_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f); // m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
} // }
updateGL(); updateGL();
} }
void Volusion::hide_onoff(bool x) void Volusion::hide_onoff(bool x)
{ {
hide_clipping = x; // hide_clipping = x;
updateGL(); updateGL();
} }
...@@ -215,26 +215,26 @@ void Volusion::cb_initGL() ...@@ -215,26 +215,26 @@ void Volusion::cb_initGL()
m_explode_render->setBackColor(Geom::Vec4f(0.9f,0.9f,0.9f,1.0f)); m_explode_render->setBackColor(Geom::Vec4f(0.9f,0.9f,0.9f,1.0f));
m_explode_render->setColorLine(Geom::Vec4f(0.8f,0.2f,0.2f,1.0f)); m_explode_render->setColorLine(Geom::Vec4f(0.8f,0.2f,0.2f,1.0f));
m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1()); // m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1());
m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2()); // m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2());
registerShader(m_explode_render->shaderFaces()); registerShader(m_explode_render->shaderFaces());
registerShader(m_explode_render->shaderLines()); registerShader(m_explode_render->shaderLines());
m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1); // m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1);
m_frame = new Utils::FrameManipulator(); // m_frame = new Utils::FrameManipulator();
m_frame->setSize(m_WidthObj/2.0f); // m_frame->setSize(m_WidthObj/2.0f);
m_sh1->insertClippingCode(); // m_sh1->insertClippingCode();
m_sh2->insertClippingCode(); // m_sh2->insertClippingCode();
clip_id1 = m_sh1->addClipPlane(); // clip_id1 = m_sh1->addClipPlane();
clip_id2 = m_sh2->addClipPlane(); // clip_id2 = m_sh2->addClipPlane();
m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), m_PosObj); // m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), m_PosObj);
m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), m_PosObj); // m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), m_PosObj);
m_explode_render->setClippingPlane(Geom::Vec4f(0,0,1,m_PosObj*Geom::Vec3f(0,0,-1))); m_explode_render->setClippingPlane(Geom::Vec4f(0,0,1,m_PosObj*Geom::Vec3f(0,0,-1)));
for(Surface * surf : simul.surfaces) for(Surface * surf : simul.surfaces)
{ {
...@@ -261,7 +261,7 @@ void Volusion::cb_initGL() ...@@ -261,7 +261,7 @@ void Volusion::cb_initGL()
m_sprite = new Utils::PointSprite(); m_sprite = new Utils::PointSprite();
m_sprite->setAttributePosition(m_MovingObjectVBO); m_sprite->setAttributePosition(m_MovingObjectVBO);
m_sprite->setSize(simul.aiguille->width); m_sprite->setSize(simul.aiguille->width/2.0);
registerShader(m_sprite); registerShader(m_sprite);
m_frame_MovingObject = new Utils::FrameManipulator(); m_frame_MovingObject = new Utils::FrameManipulator();
...@@ -595,17 +595,17 @@ void Volusion::cb_redraw() ...@@ -595,17 +595,17 @@ void Volusion::cb_redraw()
m_explode_render->drawFaces(); m_explode_render->drawFaces();
} }
if (clip_volume && !hide_clipping) // if (clip_volume && !hide_clipping)
{ // {
m_frame->draw(); // m_frame->draw();
m_PlanePick->draw(); // m_PlanePick->draw();
} // }
} }
void Volusion::cb_mousePress(int /*button*/, int x, int y) void Volusion::cb_mousePress(int /*button*/, int x, int y)
{ {
if (Shift()) /* if (Shift())
{ {
if (hide_clipping || !clip_volume) if (hide_clipping || !clip_volume)
...@@ -631,7 +631,7 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y) ...@@ -631,7 +631,7 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
updateGL(); updateGL();
} }
} }
else if (Control()) else*/ if (Control())
{ {
startX=x; startX=x;
startY=y; startY=y;
...@@ -644,13 +644,13 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y) ...@@ -644,13 +644,13 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/) void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
{ {
if (!hide_clipping && clip_volume) // if (!hide_clipping && clip_volume)
{ // {
m_pickedAxis=0; // m_pickedAxis=0;
m_frame->highlight(m_pickedAxis); // m_frame->highlight(m_pickedAxis);
updateGL(); // updateGL();
} // }
if (render_MovingObject) if (render_MovingObject)
updateGL(); updateGL();
...@@ -658,7 +658,7 @@ void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/) ...@@ -658,7 +658,7 @@ void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
void Volusion::cb_mouseMove(int buttons, int x, int y) void Volusion::cb_mouseMove(int buttons, int x, int y)
{ {
if (Shift()) /* if (Shift())
{ {
...@@ -713,7 +713,7 @@ void Volusion::cb_mouseMove(int buttons, int x, int y) ...@@ -713,7 +713,7 @@ void Volusion::cb_mouseMove(int buttons, int x, int y)
updateGL(); updateGL();
return; return;
} }
else if(Control()) else */if(Control())
{ {
m_frame_MovingObject->translateInScreen(x-startX, y-startY); m_frame_MovingObject->translateInScreen(x-startX, y-startY);
......
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