Commit ad03bdaf authored by Pierre Kraemer's avatar Pierre Kraemer

merge..

parent 5ac4eeac
......@@ -80,8 +80,8 @@ void MyQT::cb_initGL()
m_shader2->setColor(Geom::Vec4f(1.,1.,0.,0.));
registerRunning(m_shader);
registerRunning(m_shader2);
registerShader(m_shader);
registerShader(m_shader2);
}
......
......@@ -44,18 +44,14 @@
using namespace CGoGN;
struct PFP: public PFP_STANDARD
{
// definition de la carte
typedef EmbeddedMap2<Map2> MAP;
};
PFP::MAP myMap;
void MyQT::cb_initGL()
{
// choose to use GL version 2
......@@ -78,11 +74,10 @@ void MyQT::cb_initGL()
m_shader2->setColor(Geom::Vec4f(1.,1.,0.,0.));
registerRunning(m_shader);
registerRunning(m_shader2);
registerShader(m_shader);
registerShader(m_shader2);
}
void MyQT::cb_redraw()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
......@@ -98,8 +93,6 @@ void MyQT::cb_redraw()
glDisable(GL_POLYGON_OFFSET_FILL);
}
int main(int argc, char **argv)
{
// interface:
......@@ -108,7 +101,6 @@ int main(int argc, char **argv)
PFP::TVEC3 position = myMap.addAttribute<PFP::VEC3>(VERTEX_ORBIT, "position") ;
// create a cylinder
Algo::Modelisation::Polyhedron<PFP> prim1(myMap, position);
prim1.cylinder_topo(16,8, true, false);
......@@ -148,7 +140,6 @@ int main(int argc, char **argv)
Geom::translate<float>(270.0f,0.0,0.0,trf);
prim4.transform(trf);
// bounding box
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));
......@@ -174,8 +165,5 @@ int main(int argc, char **argv)
// et on attend la fin.
return app.exec();
return 0;
}
......@@ -49,11 +49,9 @@
#include "Utils/drawer.h"
/// pour simplifier l'ecriture du code
using namespace CGoGN;
/// definition de la structure qui decrit le type de carte utilise
struct PFP: public PFP_STANDARD
......@@ -95,10 +93,6 @@ Dart d_maison;
///
/// Fonction Carre: construit un carre et renvoit un brin
///
......@@ -347,8 +341,8 @@ void MyQT::cb_initGL()
m_shader2 = new Utils::ShaderSimpleColor();
m_shader2->setAttributePosition(m_positionVBO);
m_shader2->setColor(Geom::Vec4f(0.,0.1,0.,0.));
registerRunning(m_shader);
registerRunning(m_shader2);
registerShader(m_shader);
registerShader(m_shader2);
}
......
......@@ -25,15 +25,13 @@
#ifndef TP_MASTER_H_
#define TP_MASTER_H_
#include <iostream>
#include "Utils/qtSimple.h"
// forward definitions (minimize includes)
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 MapRender; } } } }
namespace CGoGN { namespace Algo { namespace Render { namespace GL2 { class TopoRenderMapD; } } } }
namespace CGoGN { namespace Utils { class VBO; } }
namespace CGoGN { namespace Utils { class ShaderPhong; } }
namespace CGoGN { namespace Utils { class ShaderSimpleColor; } }
......@@ -44,7 +42,6 @@ using namespace CGoGN ;
/**
* A class for a little interface and rendering
*/
class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
......@@ -52,6 +49,7 @@ class MyQT: public Utils::QT::SimpleQT
protected:
bool m_drawTopo;
void drawSelected();
public:
// render
Algo::Render::GL2::MapRender* m_render;
......@@ -76,7 +74,8 @@ public:
m_render(NULL), m_render_topo(NULL),
m_positionVBO(NULL), m_normalVBO(NULL),
m_shader(NULL), m_shader2(NULL),
renderTopo(true) {}
renderTopo(true)
{}
// callbacks of simpleQT to overdefine:
void cb_redraw();
......@@ -87,4 +86,3 @@ public:
};
#endif
......@@ -21,7 +21,9 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
//#define GL3_PROTOTYPES
#include "tuto1.h"
#include <iostream>
......@@ -37,13 +39,10 @@
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/shaderSimpleColor.h"
#include <glm/gtc/type_ptr.hpp>
using namespace CGoGN ;
/**
* 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
......@@ -54,8 +53,6 @@ struct PFP: public PFP_STANDARD
typedef EmbeddedMap2<Map2> MAP;
};
void MyQT::cb_initGL()
{
// choose to use GL version 2
......@@ -70,12 +67,10 @@ void MyQT::cb_initGL()
// using simple shader with color
m_shader = new Utils::ShaderSimpleColor();
m_shader->setAttributePosition(m_positionVBO);
m_shader->setColor(Geom::Vec4f(0.,1.,0.,0.));
registerRunning(m_shader);
m_shader->setColor(Geom::Vec4f(0.0f, 1.0f, 0.0f, 0.0f));
registerShader(m_shader);
}
void MyQT::cb_redraw()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
......@@ -97,7 +92,6 @@ void MyQT::cb_redraw()
}
}
void MyQT::cb_keyPress(int code)
{
if ((code >65) && (code< 123 ))
......@@ -105,17 +99,13 @@ void MyQT::cb_keyPress(int code)
if ((code >'0') && (code<='9'))
CGoGNout << " key num " << code-'0' << "pressed"<< CGoGNendl;
}
int main(int argc, char **argv)
{
// declaration of the map
PFP::MAP myMap;
// creation of 2 new faces: 1 triangle and 1 square
Dart d1 = myMap.newFace(3);
Dart d2 = myMap.newFace(4);
......@@ -135,9 +125,6 @@ int main(int argc, char **argv)
position[myMap.phi<11>(d2)] = PFP::VEC3(0, -2, 0);
position[myMap.phi_1(d2)] = PFP::VEC3(2, -2, 0);
// interface:
QApplication app(argc, argv);
MyQT sqt;
......@@ -157,7 +144,7 @@ int main(int argc, char **argv)
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
// envoit info BB a l'interface
sqt.setParamObject(lWidthObj,lPosObj.data());
sqt.setParamObject(lWidthObj, lPosObj.data());
// show 1 pour GL context
sqt.show();
......@@ -175,5 +162,4 @@ int main(int argc, char **argv)
// et on attend la fin.
return app.exec();
}
......@@ -21,18 +21,17 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef TUTO1
#define TUTO1
#ifndef _TUTO1_
#define _TUTO1_
#include <iostream>
#include "Utils/qtSimple.h"
#include "Utils/cgognStream.h"
// 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 ShaderSimpleColor; } }
......@@ -41,10 +40,10 @@ using namespace CGoGN ;
/**
* A class for a little interface and rendering
*/
class MyQT: public Utils::QT::SimpleQT
class MyQT : public Utils::QT::SimpleQT
{
Q_OBJECT
public:
// render
Algo::Render::GL2::MapRender* m_render;
......@@ -55,25 +54,22 @@ public:
// shader basic
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:
void cb_redraw();
void cb_initGL();
void cb_redraw();
void cb_keyPress(int code);
void cb_New() { CGoGNout << "New ..."<< CGoGNendl;}
void cb_Save() { CGoGNout << "Rien a sauver ..."<< CGoGNendl;
}
void cb_New() { CGoGNout << "New ..." << CGoGNendl; }
void cb_Save() { CGoGNout << "Rien a sauver ..." << CGoGNendl; }
// callbacks (slots) locally defined
public slots:
void menu_slot1() { CGoGNout << "Exemple de menu"<< CGoGNendl; }
void menu_slot1() { CGoGNout << "Exemple de menu" << CGoGNendl; }
};
#endif
......@@ -36,8 +36,6 @@
#include "tuto2.h"
using namespace CGoGN ;
struct PFP: public PFP_STANDARD
......@@ -46,7 +44,6 @@ struct PFP: public PFP_STANDARD
typedef Map2 MAP;
};
PFP::MAP myMap;
SelectorTrue allDarts;
......@@ -55,7 +52,6 @@ PFP::TVEC3 position ;
PFP::TVEC3 normal ;
AttributeHandler<Geom::Vec4f> color ;
void MyQT::cb_initGL()
{
// choose to use GL version 2
......@@ -74,15 +70,12 @@ void MyQT::cb_initGL()
m_color = Geom::Vec4f(0.,1.,0.,0.);
m_shader->setColor(m_color);
registerRunning(m_shader);
m_with_lines=true;
m_line_width=4.0;
registerShader(m_shader);
m_with_lines = true;
m_line_width = 4.0;
}
void MyQT::cb_redraw()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
......@@ -106,15 +99,12 @@ void MyQT::cb_redraw()
}
}
void MyQT::lines_slot(bool x)
{
m_with_lines = x;
updateGL();
}
void MyQT::line_width_slot(int x)
{
......@@ -122,8 +112,6 @@ void MyQT::line_width_slot(int x)
updateGL();
}
void MyQT::color_slot()
{
QColor col = QColorDialog::getColor ();
......@@ -135,12 +123,11 @@ void MyQT::color_slot()
}
else
{
CGoGNout << "Cancel Color"<< CGoGNendl;
CGoGNout << "Cancel Color" << CGoGNendl;
}
}
// Algorithme qui parcours une carte et affiche l'attribut position de chaque brin
//
template<typename PFP>
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:
}
}
int main(int argc, char **argv)
{
/// Utilisation des MapBrowsers
......@@ -160,7 +146,7 @@ int main(int argc, char **argv)
Dart d2 = myMap.newOrientedFace(3);
Dart d3 = myMap.newOrientedFace(4);
myMap.sewFaces(d2,d3);
myMap.sewFaces(d2, d3);
position = myMap.addAttribute<Geom::Vec3f>(VERTEX_ORBIT, "position");
......@@ -176,12 +162,11 @@ int main(int argc, char **argv)
position[d3] = PFP::VEC3(2.0f, -2.0f, 0.0f);
d3 = myMap.phi1(d3);
// MapBrowser: la carte elle meme
CGoGNout << "Parcours avec la carte"<<CGoGNendl;
CGoGNout << "Parcours avec la carte" << CGoGNendl;
TestDeParcoursAFF<PFP>(myMap, myMap, position);
// MapBrowserLinkedAuto
// sous-carte dans une liste avec attribut gere par le browser
CGoGNout << "Parcours avec le browser (les sommets)"<<CGoGNendl;
......@@ -196,7 +181,6 @@ int main(int argc, char **argv)
TestDeParcoursAFF<PFP>(myMap, mbl, position);
// MapBrowserLinkedAttr
// sous-carte dans une liste avec attribut gere par l'appelant
CGoGNout << "Parcours avec le browser (le triangle)"<<CGoGNendl;
......@@ -217,7 +201,6 @@ int main(int argc, char **argv)
TestDeParcoursAFF<PFP>(myMap, mbl2, position);
// MapBrowserSelector
// sous-carte avec des brins marques (equivalent de l'utilisation de good dans les algos)
CGoGNout << "Parcours avec le browser selector"<<CGoGNendl;
......@@ -248,7 +231,6 @@ int main(int argc, char **argv)
sqt.setCallBack( dock.color_button , SIGNAL(pressed()), SLOT(color_slot()) );
sqt.setCallBack( dock.dial_line_width , SIGNAL(valueChanged(int)), SLOT(line_width_slot(int)) );
// message d'aide
sqt.setHelpMsg("Second Tuto");
......@@ -278,5 +260,4 @@ int main(int argc, char **argv)
// et on attend la fin.
return app.exec();
}
......@@ -21,13 +21,12 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __TUTO2_
#define __TUTO2_
#ifndef _TUTO2_
#define _TUTO2_
#include <iostream>
#include "Utils/qtSimple.h"
#include "ui_tuto2.h"
#include "Utils/qtui.h"
......@@ -35,7 +34,7 @@
#include "Geometry/vector_gen.h"
// 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 ShaderSimpleColor; } }
......@@ -56,8 +55,8 @@ class MyQT: public Utils::QT::SimpleQT
bool m_with_lines;
Geom::Vec4f m_color;
int m_line_width;
public:
public:
// render
Algo::Render::GL2::MapRender* m_render;
......@@ -67,8 +66,8 @@ public:
// shader basic
Utils::ShaderSimpleColor* m_shader;
MyQT():m_render(NULL), m_positionVBO(NULL), m_shader(NULL) {}
MyQT():m_render(NULL), m_positionVBO(NULL), m_shader(NULL)
{}
void cb_redraw();
......@@ -79,9 +78,6 @@ public slots:
void lines_slot(bool x);
void line_width_slot(int x);
void color_slot();
};
#endif
......@@ -47,10 +47,6 @@ struct PFP: public PFP_STANDARD
typedef Map2 MAP;
};
void MyQT::cb_initGL()
{
// choose to use GL version 2
......@@ -72,12 +68,10 @@ void MyQT::cb_initGL()
m_shader2->setAttributePosition(m_positionVBO);
m_shader2->setAttributeColor(m_colorVBO);
registerRunning(m_shader);
registerRunning(m_shader2);
registerShader(m_shader);
registerShader(m_shader2);
}
void MyQT::cb_redraw()
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
......@@ -90,10 +84,8 @@ void MyQT::cb_redraw()
glPolygonOffset(1.0f, 1.0f);
m_render->draw(m_shader2, Algo::Render::GL2::TRIANGLES);
glDisable(GL_POLYGON_OFFSET_FILL);
}
void MyQT::cb_keyPress(int code)
{
switch(code)
......@@ -105,14 +97,10 @@ void MyQT::cb_keyPress(int code)
sqt2_ptr->synchronize(sqt1_ptr);
break;
}
}
int main(int argc, char **argv)
{
PFP::MAP myMap;
SelectorTrue allDarts;
......@@ -144,7 +132,6 @@ int main(int argc, char **argv)
color[d3] = PFP::VEC3(0.0f, 1.0f, 1.0f);
d3 = myMap.phi1(d3);
//MARK !!!
// on reserve des marqueur de brins
......@@ -169,19 +156,17 @@ int main(int argc, char **argv)
CGoGNout << "Sommet de dart "<< d.label() << " marque par mcv"<< CGoGNendl;
}
//nettoyage
cm.unmarkAll();
// interface:
// interface:
QApplication app(argc, argv);
MyQT sqt;
sqt1_ptr= &sqt;
sqt1_ptr = &sqt;
MyQT sqt2;
sqt2_ptr= &sqt2;
sqt2_ptr = &sqt2;
// message d'aide
sqt.setHelpMsg("Tuto3:\n"
......@@ -194,7 +179,7 @@ int main(int argc, char **argv)
Geom::Vec3f lPosObj = (bb.min() + bb.max()) / PFP::REAL(2);
// envoit info BB a l'interface
sqt.setParamObject(lWidthObj,lPosObj.data());
sqt.setParamObject(lWidthObj, lPosObj.data());
// show 1 pour GL context
sqt.show();
......@@ -204,7 +189,6 @@ int main(int argc, char **argv)
// update du VBO color
sqt.m_colorVBO->updateData(color);
// update des primitives du renderer
sqt.m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES);
sqt.m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::LINES);
......@@ -235,8 +219,6 @@ int main(int argc, char **argv)
position2[dx] = PFP::VEC3(0.0f, 2.0f, 0.0f);
color2[dx] = PFP::VEC3(0.0f, 1.0f, 1.0f);
sqt2.setHelpMsg("Fenetre 2!!");
sqt2.setParamObject(lWidthObj,lPosObj.data());
......@@ -249,13 +231,10 @@ int main(int argc, char **argv)
// update du VBO color
sqt2.m_colorVBO->updateData(color2);
// update des primitives du renderer
sqt2.m_render->initPrimitives<PFP>(myMap2, allDarts, Algo::Render::GL2::TRIANGLES);
sqt2.m_render->initPrimitives<PFP>(myMap2, allDarts, Algo::Render::GL2::LINES);
// et on attend la fin.
return app.exec();
}
......@@ -21,21 +21,22 @@
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef _TUTO3_H_
#define _TUTO3_H_
#include "Utils/qtSimple.h"
// forward definition (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 ShaderSimpleColor; class ShaderColorPerVertex; } }
using namespace CGoGN ;
/**
* A class for a little interface and rendering
*/
class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
......@@ -53,7 +54,8 @@ public:
bool m_sync;
MyQT():m_render(NULL), m_positionVBO(NULL), m_shader(NULL), m_sync(false) {}
MyQT() : m_render(NULL), m_positionVBO(NULL), m_shader(NULL), m_sync(false)
{}
// callbacks of simpleQT to overdefine:
void cb_redraw();
......
......@@ -42,7 +42,6 @@
#include "Utils/cgognStream.h"
using namespace CGoGN ;
struct PFP: public PFP_STANDARD
......@@ -58,7 +57,6 @@ PFP::TVEC3 position ;
PFP::TVEC3 normal ;
AttributeHandler<Geom::Vec4f> color ;
void MyQT::cb_initGL()
{
// choose to use GL version 2
......@@ -80,15 +78,12 @@ void MyQT::cb_initGL()
m_shader2 = new Utils::ShaderFlat();
m_shader2->setAttributePosition(m_positionVBO);
registerRunning(m_shader);
registerRunning(m_shader2);
registerShader(m_shader);
registerShader(m_shader2);
}
void MyQT::cb_redraw()
{
if(