Commit d19ee728 authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:~kraemer/CGoGN

Conflicts:
	include/Algo/Modelisation/planeCutting.hpp
	include/Topology/generic/genericmap.hpp
parents bf64b2f8 f1dab8f5
......@@ -63,19 +63,17 @@ target_link_libraries( clippingD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( volumeExplorer_ui ../volumeExplorer.ui )
QT4_WRAP_CPP( volumeExplorer_moc ../volumeExplorer.h )
add_executable( volumeExplorerD ../volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc})
target_link_libraries( volumeExplorerD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
target_link_libraries( volumeExplorerD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
add_executable( mcmeshD ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
target_link_libraries( mcmeshD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
#QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
#QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
#add_executable( mcmeshD ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
#target_link_libraries( mcmeshD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( concave_rendering_moc ../concave_rendering.h )
add_executable( concave_renderingD ../concave_rendering.cpp ${concave_rendering_moc} ${concave_rendering_ui} )
target_link_libraries( concave_renderingD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
target_link_libraries( concave_renderingD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( viewerOBJ_moc ../viewerOBJ.h )
add_executable( viewerOBJD ../viewerOBJ.cpp ${viewerOBJ_moc} )
target_link_libraries( viewerOBJD ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
target_link_libraries( viewerOBJD ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
......@@ -31,6 +31,10 @@ QT4_WRAP_CPP( texturesExample_moc ../texturesExample.h )
add_executable( texturesExample ../texturesExample.cpp ${texturesExample_moc} )
target_link_libraries( texturesExample ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP(simpleMap3_moc ../simpleMap3.h)
add_executable( simpleMap3 ../simpleMap3.cpp ${simpleMap3_moc} )
target_link_libraries( simpleMap3 ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( simpleGMap2_moc ../simpleGMap2.h )
add_executable( simpleGMap2 ../simpleGMap2.cpp ${simpleGMap2_moc} )
target_link_libraries( simpleGMap2 ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
......@@ -58,10 +62,10 @@ QT4_WRAP_CPP( volumeExplorer_moc ../volumeExplorer.h )
add_executable( volumeExplorer ../volumeExplorer.cpp ${volumeExplorer_ui} ${volumeExplorer_moc} )
target_link_libraries( volumeExplorer ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
add_executable( mcmesh ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
target_link_libraries( mcmesh ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
#QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
#QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
#add_executable( mcmesh ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
#target_link_libraries( mcmesh ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( concave_rendering_moc ../concave_rendering.h )
add_executable( concave_rendering ../concave_rendering.cpp ${concave_rendering_moc} ${concave_rendering_ui} )
......@@ -69,5 +73,4 @@ target_link_libraries( concave_rendering ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP( viewerOBJ_moc ../viewerOBJ.h )
add_executable( viewerOBJ ../viewerOBJ.cpp ${viewerOBJ_moc} )
target_link_libraries( viewerOBJ ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
target_link_libraries( viewerOBJ ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
......@@ -138,21 +138,21 @@ void Clipping::slot_drawFaces(bool b)
void Clipping::slot_explodTopoPhi1(double c)
{
m_coeffTopoExplod[0] = (float)c;
m_render_topo->updateData<PFP>(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
m_render_topo->updateData(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
updateGL();
}
void Clipping::slot_explodTopoPhi2(double c)
{
m_coeffTopoExplod[1] = (float)c;
m_render_topo->updateData<PFP>(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
m_render_topo->updateData(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
updateGL();
}
void Clipping::slot_explodTopoPhi3(double c)
{
m_coeffTopoExplod[2] = (float)c;
m_render_topo->updateData<PFP>(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
m_render_topo->updateData(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
updateGL();
}
......@@ -814,7 +814,7 @@ void Clipping::importMesh(std::string& filename)
updateVBOprimitives(Algo::Render::GL2::TRIANGLES | Algo::Render::GL2::LINES | Algo::Render::GL2::POINTS) ;
m_render_topo->updateData<PFP>(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
m_render_topo->updateData(myMap, position, m_coeffTopoExplod[0], m_coeffTopoExplod[1], m_coeffTopoExplod[2]);
m_bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
gPosObj = m_bb.center() ;
......@@ -843,7 +843,7 @@ void Clipping::cb_initGL()
// create the render
m_render = new Algo::Render::GL2::MapRender();
m_render_topo = new Algo::Render::GL2::Topo3Render();
m_render_topo = new Algo::Render::GL2::Topo3RenderMap<PFP>();
// create VBO for position
m_positionVBO = new Utils::VBO();
......
......@@ -70,18 +70,18 @@ struct PFP: public PFP_STANDARD
typedef EmbeddedMap3 MAP;
};
typedef PFP::MAP MAP;
typedef PFP::MAP::IMPL MAP_IMPL;
typedef PFP::VEC3 VEC3;
class Clipping: public Utils::QT::SimpleQT
{
Q_OBJECT
public:
typedef PFP::MAP MAP;
typedef PFP::VEC3 VEC3;
//Manip Carte
MAP myMap ;
VertexAttribute<VEC3> position;
VertexAttribute<VEC3, MAP_IMPL> position;
Dart dglobal;
//Render
......@@ -91,7 +91,7 @@ public:
bool m_drawTopo;
Algo::Render::GL2::MapRender* m_render;
Algo::Render::GL2::Topo3Render* m_render_topo;
Algo::Render::GL2::Topo3Render<PFP>* m_render_topo;
Geom::BoundingBox<PFP::VEC3> m_bb;
......
......@@ -128,12 +128,13 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
// declaration of the map
MAP myMap;
// and attribute of position
VertexAttribute<VEC3> position;
VertexAttribute<VEC3, MAP_IMPL> position;
unsigned int nb_ears;
......
......@@ -53,6 +53,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
MAP myMap;
......@@ -103,7 +104,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
MyQT sqt;
VertexAttribute<VEC3> position = myMap.addAttribute<VEC3, VERTEX>("position") ;
VertexAttribute<VEC3, MAP_IMPL> position = myMap.addAttribute<VEC3, VERTEX>("position") ;
// define the face extruded (here a cross)
std::vector<PFP::VEC3> objV;
......
......@@ -197,7 +197,6 @@ void MCMesh::sphere()
myImg = new SAlgo::MC::Image<DATATYPE>(img,128,128,128,1.0f,1.0f,1.0f,false);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
......@@ -210,7 +209,7 @@ int main(int argc, char **argv)
sqt.setGeometry(0, 0, 1000, 800);
sqt.show();
sqt.valLabel=DATATYPE(0);
sqt.valLabel = DATATYPE(0);
if(argc == 2)
{
......
......@@ -29,9 +29,10 @@
#include "Utils/Qt/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
#include "Topology/map/embeddedMap2.h"
#include "Algo/MC/marchingcube.h"
#include "Geometry/vector_gen.h"
#include "Geometry/matrix.h"
......@@ -41,8 +42,6 @@
#include "Utils/vbo.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/MC/marchingcube.h"
using namespace CGoGN ;
......@@ -55,6 +54,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
typedef unsigned char DATATYPE;
......@@ -65,7 +65,6 @@ class MCMesh : public Utils::QT::SimpleQT
public:
MAP myMap ;
SelectorTrue allDarts ;
Utils::QT::uiDockInterface dock ;
......@@ -76,7 +75,7 @@ public:
bool m_drawEdges ;
bool m_drawFaces ;
VertexAttribute<VEC3> position ;
VertexAttribute<VEC3, MAP_IMPL> position ;
Algo::Render::GL2::MapRender* m_render ;
......
......@@ -42,6 +42,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
class SimpleGMap2 : public Utils::QT::SimpleQT
......@@ -51,7 +52,7 @@ class SimpleGMap2 : public Utils::QT::SimpleQT
public:
MAP myMap ;
VertexAttribute<VEC3> position ;
VertexAttribute<VEC3, MAP_IMPL> position ;
SimpleGMap2() ;
......
......@@ -132,10 +132,10 @@ void SimpleGMap3::cb_initGL()
float gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ) ;
setParamObject(gWidthObj, gPosObj.data());
m_render_topo = new Algo::Render::GL2::Topo3Render();
m_render_topo = new Algo::Render::GL2::Topo3RenderGMap<PFP>();
m_render_topo->setDartWidth(2.0f);
m_render_topo->setInitialDartsColor(1.0f,1.0f,1.0f);
m_render_topo->updateData<PFP>(myMap, position, 0.9f,0.9f,0.8f);
m_render_topo->updateData(myMap, position, 0.9f,0.9f,0.8f);
}
void SimpleGMap3::cb_redraw()
......
......@@ -43,6 +43,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
class SimpleGMap3 : public Utils::QT::SimpleQT
......@@ -52,10 +53,10 @@ class SimpleGMap3 : public Utils::QT::SimpleQT
public:
MAP myMap ;
VertexAttribute<VEC3> position ;
VolumeAttribute<VEC3> volume ;
VertexAttribute<VEC3, MAP_IMPL> position ;
VolumeAttribute<VEC3, MAP_IMPL> volume ;
Algo::Render::GL2::Topo3Render* m_render_topo;
Algo::Render::GL2::Topo3Render<PFP>* m_render_topo;
SimpleGMap3() ;
......
......@@ -106,20 +106,20 @@ void SimpleMap3::cb_initGL()
float gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ) ;
setParamObject(gWidthObj, gPosObj.data());
m_render_topo = new Algo::Render::GL2::Topo3Render();
m_render_topo = new Algo::Render::GL2::Topo3RenderMap<PFP>();
m_render_topo->setDartWidth(2.0f);
m_render_topo->setInitialDartsColor(1.0f,1.0f,1.0f);
m_render_topo->updateData<PFP>(myMap, position, 0.9f,0.9f,0.8f);
m_render_topo->updateData(myMap, position, 0.9f,0.9f,0.8f);
m_render_topo_boundary = new Algo::Render::GL2::TopoRender();
m_render_topo_boundary = new Algo::Render::GL2::TopoRenderMap<PFP>();
m_render_topo_boundary->setDartWidth(2.0f);
m_render_topo_boundary->setInitialDartsColor(0.4f,0.8f,0.4f);
m_render_topo_boundary->updateDataBoundary<PFP>(myMap, position, 0.9f,0.9f,bb.maxSize()/50.0f);
m_render_topo_boundary->updateDataBoundary(myMap, position, 0.9f,0.9f,bb.maxSize()/50.0f);
m_render_topo_primal = new Algo::Render::GL2::Topo3PrimalRender();
m_render_topo_primal = new Algo::Render::GL2::Topo3PrimalRender<PFP>();
m_render_topo_primal->setDartWidth(2.0f);
m_render_topo_primal->setInitialDartsColor(1.0f,1.0f,1.0f);
m_render_topo_primal->updateData<PFP>(myMap, position, 0.95f,0.85f);
m_render_topo_primal->updateData(myMap, position, 0.95f,0.85f);
}
void SimpleMap3::cb_keyPress(int code)
......
......@@ -45,6 +45,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
class SimpleMap3 : public Utils::QT::SimpleQT
......@@ -55,11 +56,11 @@ public:
MAP myMap ;
SelectorTrue allDarts ;
VertexAttribute<VEC3> position ;
VertexAttribute<VEC3, MAP_IMPL> position ;
Algo::Render::GL2::Topo3Render* m_render_topo;
Algo::Render::GL2::TopoRender* m_render_topo_boundary;
Algo::Render::GL2::Topo3PrimalRender* m_render_topo_primal;
Algo::Render::GL2::Topo3RenderMap<PFP>* m_render_topo;
Algo::Render::GL2::TopoRenderMap<PFP>* m_render_topo_boundary;
Algo::Render::GL2::Topo3PrimalRender<PFP>* m_render_topo_primal;
SimpleMap3() ;
......@@ -69,4 +70,3 @@ public:
void cb_redraw() ;
void cb_keyPress(int code);
};
......@@ -85,12 +85,11 @@ void TexView::cb_initGL()
m_shader2->setSpecular(Geom::Vec4f(0.5));
registerShader(m_shader2);
glEnable(GL_TEXTURE_2D);
if (!m_obj.hasNormals())
{
VertexAttribute<Geom::Vec3f> normal = myMap.getAttribute<VEC3, VERTEX>("normal") ;
VertexAttribute<Geom::Vec3f, MAP_IMPL> normal = myMap.getAttribute<VEC3, VERTEX>("normal") ;
if(!normal.isValid())
normal = myMap.addAttribute<VEC3, VERTEX>("normal") ;
......@@ -99,7 +98,6 @@ void TexView::cb_initGL()
}
m_nbIndices = m_obj.createSimpleVBO_PTN(m_positionVBO,m_texcoordVBO,m_normalVBO);
}
void TexView::cb_redraw()
......@@ -120,8 +118,6 @@ void TexView::cb_redraw()
glDrawArrays(GL_TRIANGLES, 0, m_nbIndices);
m_shader->disableVertexAttribs();
}
}
void TexView::cb_keyPress(int code)
......@@ -152,7 +148,6 @@ void TexView::cb_keyPress(int code)
m_shader2->setShininess(1.0f);
m_shader2->setSpecular(Geom::Vec4f(0));
break;
}
updateGL();
}
......@@ -179,10 +174,8 @@ void TexView::init(const std::string& fnm, const std::string& fnt)
// send BB info to interface for centering on GL screen
setParamObject(lWidthObj, lPosObj.data());
}
void TexView::computeImage()
{
std::vector<Geom::Vec3f> colorTable;
......@@ -213,8 +206,8 @@ void TexView::computeTore()
{
#define NB 96
VertexAttribute<VEC3> position = myMap.addAttribute<VEC3, VERTEX>("position");
VertexAttribute<Geom::Vec2f> texcoord = myMap.addAttribute<Geom::Vec2f, VERTEX>("texcoord");
VertexAttribute<VEC3, MAP_IMPL> position = myMap.addAttribute<VEC3, VERTEX>("position");
VertexAttribute<Geom::Vec2f, MAP_IMPL> texcoord = myMap.addAttribute<Geom::Vec2f, VERTEX>("texcoord");
//Algo::Surface::Modelisation::Polyhedron<PFP> prim(myMap, position);
Algo::Surface::Tilings::Square::Tore<PFP> prim(myMap, NB, NB);
prim.embedIntoTore(position, 40.0f,20.0f);
......@@ -245,9 +238,6 @@ void TexView::computeTore()
m_obj.setTexCoordAttribute(texcoord);
}
int main(int argc, char**argv)
{
// interface:
......@@ -267,10 +257,8 @@ int main(int argc, char**argv)
tv.init("","x");
}
tv.show();
// et on attend la fin.
return app.exec();
}
......@@ -50,7 +50,9 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
/**
* A class for a little interface and rendering
*/
......
......@@ -80,7 +80,7 @@ void Viewer::cb_initGL()
Utils::GLSLShader::setCurrentOGLVersion(2) ;
m_render = new Algo::Render::GL2::MapRender() ;
m_topoRender = new Algo::Render::GL2::TopoRender() ;
m_topoRender = new Algo::Render::GL2::TopoRenderMap<PFP>() ;
m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ;
......@@ -230,7 +230,7 @@ void Viewer::importMesh(std::string& filename)
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ;
m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
normalBaseSize = bb.diagSize() / 100.0f ;
......@@ -262,7 +262,7 @@ void Viewer::exportMesh(std::string& filename, bool askExportMode)
if (askExportMode)
Utils::QT::inputValues(Utils::QT::VarCombo("binary mode;ascii mode",ascii,"Save in")) ;
std::vector<VertexAttribute<VEC3>*> attributes ;
std::vector<VertexAttribute<VEC3, MAP_IMPL>*> attributes ;
attributes.push_back(&position) ;
Algo::Surface::Export::exportPLYnew<PFP>(myMap, attributes, filename.c_str(), !ascii) ;
}
......
......@@ -64,6 +64,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::MAP::IMPL MAP_IMPL ;
typedef PFP::VEC3 VEC3 ;
//class Viewer : public Utils::QT::SimpleQT
......@@ -100,11 +101,11 @@ public:
bool m_drawTopo ;
bool m_drawBoundaryTopo;
VertexAttribute<VEC3> position ;
VertexAttribute<VEC3> normal ;
VertexAttribute<VEC3, MAP_IMPL> position ;
VertexAttribute<VEC3, MAP_IMPL> normal ;
Algo::Render::GL2::MapRender* m_render ;
Algo::Render::GL2::TopoRender* m_topoRender ;
Algo::Render::GL2::TopoRenderMap<PFP>* m_topoRender ;
Utils::VBO* m_positionVBO ;
Utils::VBO* m_normalVBO;
......
......@@ -22,7 +22,6 @@
* *
*******************************************************************************/
#include "volumeExplorer.h"
#include <iostream>
......@@ -35,10 +34,9 @@
#include "Algo/Export/exportVol.h"
PFP::MAP myMap;
VertexAttribute<PFP::VEC3> position ;
VolumeAttribute<PFP::VEC3> color ;
MAP myMap;
VertexAttribute<VEC3, MAP_IMPL> position ;
VolumeAttribute<VEC3, MAP_IMPL> color ;
void MyQT::volumes_onoff(bool /*x*/)
{
......@@ -59,7 +57,7 @@ void MyQT::topo_onoff(bool /*x*/)
{
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
//TODO MapBrowser
m_topo_render->updateData<PFP>(myMap, position, 0.8f, m_explode_factorf-0.05f, m_explode_factor);
m_topo_render->updateData(myMap, position, 0.8f, m_explode_factorf-0.05f, m_explode_factor);
}
updateGL();
......@@ -96,7 +94,6 @@ void MyQT::hide_onoff(bool /*x*/)
updateGL();
}
void MyQT::slider_explode(int x)
{
m_explode_factor = 0.01f*(x+1)-0.0001f;
......@@ -111,7 +108,6 @@ void MyQT::slider_explodeF(int x)
updateGL();
}
void MyQT::slider_pressed()
{
render_topoTemp = render_topo;
......@@ -119,21 +115,18 @@ void MyQT::slider_pressed()
updateGL();
}
void MyQT::slider_released()
{
render_topo = render_topoTemp;
if (render_topo)
{
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
//TODO MapBrowser
m_topo_render->updateData<PFP>(myMap, position, 0.8f, m_explode_factorf-0.05f, m_explode_factor );
m_topo_render->updateData(myMap, position, 0.8f, m_explode_factorf-0.05f, m_explode_factor );
}
updateGL();
}
void MyQT::cb_Open()
{
std::string filters("all (*.*)") ;
......@@ -190,7 +183,7 @@ void MyQT::cb_Open()
}
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_topo_render->updateData<PFP>(myMap, position, 0.8f, 0.8f, 0.8f);