Commit ad03bdaf authored by Pierre Kraemer's avatar Pierre Kraemer

merge..

parent 5ac4eeac
...@@ -80,8 +80,8 @@ void MyQT::cb_initGL() ...@@ -80,8 +80,8 @@ void MyQT::cb_initGL()
m_shader2->setColor(Geom::Vec4f(1.,1.,0.,0.)); m_shader2->setColor(Geom::Vec4f(1.,1.,0.,0.));
registerRunning(m_shader); registerShader(m_shader);
registerRunning(m_shader2); registerShader(m_shader2);
} }
......
...@@ -44,18 +44,14 @@ ...@@ -44,18 +44,14 @@
using namespace CGoGN; using namespace CGoGN;
struct PFP: public PFP_STANDARD struct PFP: public PFP_STANDARD
{ {
// definition de la carte // definition de la carte
typedef EmbeddedMap2<Map2> MAP; typedef EmbeddedMap2<Map2> MAP;
}; };
PFP::MAP myMap; PFP::MAP myMap;
void MyQT::cb_initGL() void MyQT::cb_initGL()
{ {
// choose to use GL version 2 // choose to use GL version 2
...@@ -78,11 +74,10 @@ void MyQT::cb_initGL() ...@@ -78,11 +74,10 @@ void MyQT::cb_initGL()
m_shader2->setColor(Geom::Vec4f(1.,1.,0.,0.)); m_shader2->setColor(Geom::Vec4f(1.,1.,0.,0.));
registerRunning(m_shader); registerShader(m_shader);
registerRunning(m_shader2); registerShader(m_shader2);
} }
void MyQT::cb_redraw() void MyQT::cb_redraw()
{ {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
...@@ -98,8 +93,6 @@ void MyQT::cb_redraw() ...@@ -98,8 +93,6 @@ void MyQT::cb_redraw()
glDisable(GL_POLYGON_OFFSET_FILL); glDisable(GL_POLYGON_OFFSET_FILL);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// interface: // interface:
...@@ -108,7 +101,6 @@ int main(int argc, char **argv) ...@@ -108,7 +101,6 @@ int main(int argc, char **argv)
PFP::TVEC3 position = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ; PFP::TVEC3 position = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
// create a cylinder // create a cylinder
Algo::Modelisation::Polyhedron<PFP> prim1(myMap, position); Algo::Modelisation::Polyhedron<PFP> prim1(myMap, position);
prim1.cylinder_topo(16,8, true, false); prim1.cylinder_topo(16,8, true, false);
...@@ -148,7 +140,6 @@ int main(int argc, char **argv) ...@@ -148,7 +140,6 @@ int main(int argc, char **argv)
Geom::translate<float>(270.0f,0.0,0.0,trf); Geom::translate<float>(270.0f,0.0,0.0,trf);
prim4.transform(trf); prim4.transform(trf);
// bounding box // bounding box
Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position); Geom::BoundingBox<PFP::VEC3> bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position);
float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2)); float lWidthObj = std::max<PFP::REAL>(std::max<PFP::REAL>(bb.size(0), bb.size(1)), bb.size(2));
...@@ -174,8 +165,5 @@ int main(int argc, char **argv) ...@@ -174,8 +165,5 @@ int main(int argc, char **argv)
// et on attend la fin. // et on attend la fin.
return app.exec(); return app.exec();
return 0; return 0;
} }
...@@ -49,11 +49,9 @@ ...@@ -49,11 +49,9 @@
#include "Utils/drawer.h" #include "Utils/drawer.h"
/// pour simplifier l'ecriture du code /// pour simplifier l'ecriture du code
using namespace CGoGN; using namespace CGoGN;
/// definition de la structure qui decrit le type de carte utilise /// definition de la structure qui decrit le type de carte utilise
struct PFP: public PFP_STANDARD struct PFP: public PFP_STANDARD
...@@ -95,10 +93,6 @@ Dart d_maison; ...@@ -95,10 +93,6 @@ Dart d_maison;
/// ///
/// Fonction Carre: construit un carre et renvoit un brin /// Fonction Carre: construit un carre et renvoit un brin
/// ///
...@@ -347,8 +341,8 @@ void MyQT::cb_initGL() ...@@ -347,8 +341,8 @@ void MyQT::cb_initGL()
m_shader2 = new Utils::ShaderSimpleColor(); m_shader2 = new Utils::ShaderSimpleColor();
m_shader2->setAttributePosition(m_positionVBO); m_shader2->setAttributePosition(m_positionVBO);
m_shader2->setColor(Geom::Vec4f(0.,0.1,0.,0.)); m_shader2->setColor(Geom::Vec4f(0.,0.1,0.,0.));
registerRunning(m_shader); registerShader(m_shader);
registerRunning(m_shader2); registerShader(m_shader2);
} }
......
...@@ -25,15 +25,13 @@ ...@@ -25,15 +25,13 @@
#ifndef TP_MASTER_H_ #ifndef TP_MASTER_H_
#define TP_MASTER_H_ #define TP_MASTER_H_
#include <iostream> #include <iostream>
#include "Utils/qtSimple.h" #include "Utils/qtSimple.h"
// forward definitions (minimize includes) // forward definitions (minimize includes)
namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class MapRender; }}}} namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class MapRender; } } } }
namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class TopoRenderMapD; }}}} namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class TopoRenderMapD; } } } }
namespace CGoGN { namespace Utils { class VBO; } } namespace CGoGN { namespace Utils { class VBO; } }
namespace CGoGN { namespace Utils { class ShaderPhong; } } namespace CGoGN { namespace Utils { class ShaderPhong; } }
namespace CGoGN { namespace Utils { class ShaderSimpleColor; } } namespace CGoGN { namespace Utils { class ShaderSimpleColor; } }
...@@ -44,7 +42,6 @@ using namespace CGoGN ; ...@@ -44,7 +42,6 @@ using namespace CGoGN ;
/** /**
* A class for a little interface and rendering * A class for a little interface and rendering
*/ */
class MyQT: public Utils::QT::SimpleQT class MyQT: public Utils::QT::SimpleQT
{ {
Q_OBJECT Q_OBJECT
...@@ -52,6 +49,7 @@ class MyQT: public Utils::QT::SimpleQT ...@@ -52,6 +49,7 @@ class MyQT: public Utils::QT::SimpleQT
protected: protected:
bool m_drawTopo; bool m_drawTopo;
void drawSelected(); void drawSelected();
public: public:
// render // render
Algo::Render::GL2::MapRender* m_render; Algo::Render::GL2::MapRender* m_render;
...@@ -76,7 +74,8 @@ public: ...@@ -76,7 +74,8 @@ public:
m_render(NULL), m_render_topo(NULL), m_render(NULL), m_render_topo(NULL),
m_positionVBO(NULL), m_normalVBO(NULL), m_positionVBO(NULL), m_normalVBO(NULL),
m_shader(NULL), m_shader2(NULL), m_shader(NULL), m_shader2(NULL),
renderTopo(true) {} renderTopo(true)
{}
// callbacks of simpleQT to overdefine: // callbacks of simpleQT to overdefine:
void cb_redraw(); void cb_redraw();
...@@ -87,4 +86,3 @@ public: ...@@ -87,4 +86,3 @@ public:
}; };
#endif #endif
...@@ -21,7 +21,9 @@ ...@@ -21,7 +21,9 @@
* Contact information: cgogn@unistra.fr * * Contact information: cgogn@unistra.fr *
* * * *
*******************************************************************************/ *******************************************************************************/
//#define GL3_PROTOTYPES //#define GL3_PROTOTYPES
#include "tuto1.h" #include "tuto1.h"
#include <iostream> #include <iostream>
...@@ -37,13 +39,10 @@ ...@@ -37,13 +39,10 @@
#include "Algo/Render/GL2/mapRender.h" #include "Algo/Render/GL2/mapRender.h"
#include "Utils/shaderSimpleColor.h" #include "Utils/shaderSimpleColor.h"
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
using namespace CGoGN ; using namespace CGoGN ;
/** /**
* Struct that contains some informations about the types of the manipulated objects * Struct that contains some informations about the types of the manipulated objects
* Mainly here to be used by the algorithms that are parameterized by it * Mainly here to be used by the algorithms that are parameterized by it
...@@ -54,8 +53,6 @@ struct PFP: public PFP_STANDARD ...@@ -54,8 +53,6 @@ struct PFP: public PFP_STANDARD
typedef EmbeddedMap2<Map2> MAP; typedef EmbeddedMap2<Map2> MAP;
}; };
void MyQT::cb_initGL() void MyQT::cb_initGL()
{ {
// choose to use GL version 2 // choose to use GL version 2
...@@ -70,12 +67,10 @@ void MyQT::cb_initGL() ...@@ -70,12 +67,10 @@ void MyQT::cb_initGL()
// using simple shader with color // using simple shader with color
m_shader = new Utils::ShaderSimpleColor(); m_shader = new Utils::ShaderSimpleColor();
m_shader->setAttributePosition(m_positionVBO); m_shader->setAttributePosition(m_positionVBO);
m_shader->setColor(Geom::Vec4f(0.,1.,0.,0.)); m_shader->setColor(Geom::Vec4f(0.0f, 1.0f, 0.0f, 0.0f));
registerRunning(m_shader); registerShader(m_shader);
} }
void MyQT::cb_redraw() void MyQT::cb_redraw()
{ {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
...@@ -97,7 +92,6 @@ void MyQT::cb_redraw() ...@@ -97,7 +92,6 @@ void MyQT::cb_redraw()
} }
} }
void MyQT::cb_keyPress(int code) void MyQT::cb_keyPress(int code)
{ {
if ((code >65) && (code< 123 )) if ((code >65) && (code< 123 ))
...@@ -105,17 +99,13 @@ void MyQT::cb_keyPress(int code) ...@@ -105,17 +99,13 @@ void MyQT::cb_keyPress(int code)
if ((code >'0') && (code<='9')) if ((code >'0') && (code<='9'))
CGoGNout << " key num " << code-'0' << "pressed"<< CGoGNendl; CGoGNout << " key num " << code-'0' << "pressed"<< CGoGNendl;
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
// declaration of the map // declaration of the map
PFP::MAP myMap; PFP::MAP myMap;
// creation of 2 new faces: 1 triangle and 1 square // creation of 2 new faces: 1 triangle and 1 square
Dart d1 = myMap.newFace(3); Dart d1 = myMap.newFace(3);
Dart d2 = myMap.newFace(4); Dart d2 = myMap.newFace(4);
...@@ -135,9 +125,6 @@ int main(int argc, char **argv) ...@@ -135,9 +125,6 @@ int main(int argc, char **argv)
position[myMap.phi<11>(d2)] = PFP::VEC3(0, -2, 0); position[myMap.phi<11>(d2)] = PFP::VEC3(0, -2, 0);
position[myMap.phi_1(d2)] = PFP::VEC3(2, -2, 0); position[myMap.phi_1(d2)] = PFP::VEC3(2, -2, 0);
// interface: // interface:
QApplication app(argc, argv); QApplication app(argc, argv);
MyQT sqt; MyQT sqt;
...@@ -157,7 +144,7 @@ int main(int argc, char **argv) ...@@ -157,7 +144,7 @@ int main(int argc, char **argv)
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2); Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
// envoit info BB a l'interface // envoit info BB a l'interface
sqt.setParamObject(lWidthObj,lPosObj.data()); sqt.setParamObject(lWidthObj, lPosObj.data());
// show 1 pour GL context // show 1 pour GL context
sqt.show(); sqt.show();
...@@ -175,5 +162,4 @@ int main(int argc, char **argv) ...@@ -175,5 +162,4 @@ int main(int argc, char **argv)
// et on attend la fin. // et on attend la fin.
return app.exec(); return app.exec();
} }
...@@ -21,18 +21,17 @@ ...@@ -21,18 +21,17 @@
* Contact information: cgogn@unistra.fr * * Contact information: cgogn@unistra.fr *
* * * *
*******************************************************************************/ *******************************************************************************/
#ifndef TUTO1
#define TUTO1
#ifndef _TUTO1_
#define _TUTO1_
#include <iostream> #include <iostream>
#include "Utils/qtSimple.h" #include "Utils/qtSimple.h"
#include "Utils/cgognStream.h" #include "Utils/cgognStream.h"
// forward definitions (minimize includes) // forward definitions (minimize includes)
namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class MapRender; }}}} namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class MapRender; } } } }
namespace CGoGN { namespace Utils { class VBO; } } namespace CGoGN { namespace Utils { class VBO; } }
namespace CGoGN { namespace Utils { class ShaderSimpleColor; } } namespace CGoGN { namespace Utils { class ShaderSimpleColor; } }
...@@ -41,10 +40,10 @@ using namespace CGoGN ; ...@@ -41,10 +40,10 @@ using namespace CGoGN ;
/** /**
* A class for a little interface and rendering * A class for a little interface and rendering
*/ */
class MyQT : public Utils::QT::SimpleQT
class MyQT: public Utils::QT::SimpleQT
{ {
Q_OBJECT Q_OBJECT
public: public:
// render // render
Algo::Render::GL2::MapRender* m_render; Algo::Render::GL2::MapRender* m_render;
...@@ -55,25 +54,22 @@ public: ...@@ -55,25 +54,22 @@ public:
// shader basic // shader basic
Utils::ShaderSimpleColor* m_shader; Utils::ShaderSimpleColor* m_shader;
MyQT():m_render(NULL), m_positionVBO(NULL), m_shader(NULL) {} MyQT() : m_render(NULL), m_positionVBO(NULL), m_shader(NULL)
{}
// callbacks of simpleQT to overdefine: // callbacks of simpleQT to overdefine:
void cb_redraw();
void cb_initGL(); void cb_initGL();
void cb_redraw();
void cb_keyPress(int code); void cb_keyPress(int code);
void cb_New() { CGoGNout << "New ..."<< CGoGNendl;} void cb_New() { CGoGNout << "New ..." << CGoGNendl; }
void cb_Save() { CGoGNout << "Rien a sauver ..."<< CGoGNendl; void cb_Save() { CGoGNout << "Rien a sauver ..." << CGoGNendl; }
}
// callbacks (slots) locally defined // callbacks (slots) locally defined
public slots: public slots:
void menu_slot1() { CGoGNout << "Exemple de menu"<< CGoGNendl; } void menu_slot1() { CGoGNout << "Exemple de menu" << CGoGNendl; }
}; };
#endif #endif
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include "tuto2.h" #include "tuto2.h"
using namespace CGoGN ; using namespace CGoGN ;
struct PFP: public PFP_STANDARD struct PFP: public PFP_STANDARD
...@@ -46,7 +44,6 @@ struct PFP: public PFP_STANDARD ...@@ -46,7 +44,6 @@ struct PFP: public PFP_STANDARD
typedef Map2 MAP; typedef Map2 MAP;
}; };
PFP::MAP myMap; PFP::MAP myMap;
SelectorTrue allDarts; SelectorTrue allDarts;
...@@ -55,7 +52,6 @@ PFP::TVEC3 position ; ...@@ -55,7 +52,6 @@ PFP::TVEC3 position ;
PFP::TVEC3 normal ; PFP::TVEC3 normal ;
AttributeHandler<Geom::Vec4f> color ; AttributeHandler<Geom::Vec4f> color ;
void MyQT::cb_initGL() void MyQT::cb_initGL()
{ {
// choose to use GL version 2 // choose to use GL version 2
...@@ -74,15 +70,12 @@ void MyQT::cb_initGL() ...@@ -74,15 +70,12 @@ void MyQT::cb_initGL()
m_color = Geom::Vec4f(0.,1.,0.,0.); m_color = Geom::Vec4f(0.,1.,0.,0.);
m_shader->setColor(m_color); m_shader->setColor(m_color);
registerRunning(m_shader); registerShader(m_shader);
m_with_lines=true;
m_line_width=4.0;
m_with_lines = true;
m_line_width = 4.0;
} }
void MyQT::cb_redraw() void MyQT::cb_redraw()
{ {
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
...@@ -106,15 +99,12 @@ void MyQT::cb_redraw() ...@@ -106,15 +99,12 @@ void MyQT::cb_redraw()
} }
} }
void MyQT::lines_slot(bool x) void MyQT::lines_slot(bool x)
{ {
m_with_lines = x; m_with_lines = x;
updateGL(); updateGL();
} }
void MyQT::line_width_slot(int x) void MyQT::line_width_slot(int x)
{ {
...@@ -122,8 +112,6 @@ void MyQT::line_width_slot(int x) ...@@ -122,8 +112,6 @@ void MyQT::line_width_slot(int x)
updateGL(); updateGL();
} }
void MyQT::color_slot() void MyQT::color_slot()
{ {
QColor col = QColorDialog::getColor (); QColor col = QColorDialog::getColor ();
...@@ -135,12 +123,11 @@ void MyQT::color_slot() ...@@ -135,12 +123,11 @@ void MyQT::color_slot()
} }
else else
{ {
CGoGNout << "Cancel Color"<< CGoGNendl; CGoGNout << "Cancel Color" << CGoGNendl;
} }
} }
// Algorithme qui parcours une carte et affiche l'attribut position de chaque brin // Algorithme qui parcours une carte et affiche l'attribut position de chaque brin
//
template<typename PFP> template<typename PFP>
void TestDeParcoursAFF(typename PFP::MAP& m, MapBrowser& mb, const typename PFP::TVEC3& pos) void TestDeParcoursAFF(typename PFP::MAP& m, MapBrowser& mb, const typename PFP::TVEC3& pos)
{ {
...@@ -151,7 +138,6 @@ void TestDeParcoursAFF(typename PFP::MAP& m, MapBrowser& mb, const typename PFP: ...@@ -151,7 +138,6 @@ void TestDeParcoursAFF(typename PFP::MAP& m, MapBrowser& mb, const typename PFP:
} }
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/// Utilisation des MapBrowsers /// Utilisation des MapBrowsers
...@@ -160,7 +146,7 @@ int main(int argc, char **argv) ...@@ -160,7 +146,7 @@ int main(int argc, char **argv)
Dart d2 = myMap.newOrientedFace(3); Dart d2 = myMap.newOrientedFace(3);
Dart d3 = myMap.newOrientedFace(4); Dart d3 = myMap.newOrientedFace(4);
myMap.sewFaces(d2,d3); myMap.sewFaces(d2, d3);
position = myMap.addAttribute<Geom::Vec3f>(VERTEX_ORBIT, "position"); position = myMap.addAttribute<Geom::Vec3f>(VERTEX_ORBIT, "position");
...@@ -176,12 +162,11 @@ int main(int argc, char **argv) ...@@ -176,12 +162,11 @@ int main(int argc, char **argv)
position[d3] = PFP::VEC3(2.0f, -2.0f, 0.0f); position[d3] = PFP::VEC3(2.0f, -2.0f, 0.0f);
d3 = myMap.phi1(d3); d3 = myMap.phi1(d3);