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

réparé affichage, pb couleurs

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