Commit ef19be46 authored by Pierre Kraemer's avatar Pierre Kraemer

orbit as template -> examples OK

parent 22b6e6b6
......@@ -726,8 +726,6 @@ void Clipping::initGUI()
m_planeDrawable->getPrecisionDrawing(planesPrecision1, planesPrecision2);
dock.spinBox_GridResolution->setValue(planesPrecision1);
setCallBack(dock.pushButton_addSphere, SIGNAL(clicked()), SLOT(slot_pushButton_addSphere()));
setCallBack(dock.spinBox_SphereResolution, SIGNAL(valueChanged(int)), SLOT(slot_spinBox_SphereResolution(int)));
......@@ -737,8 +735,6 @@ void Clipping::initGUI()
m_sphereDrawable->getPrecisionDrawing(spheresPrecision1, spheresPrecision2);
dock.spinBox_SphereResolution->setValue(spheresPrecision1);
setCallBack(dock.doubleSpinBox_ColorAttenuationFactor, SIGNAL(valueChanged(double)), SLOT(slot_doubleSpinBox_ColorAttenuationFactor(double)));
setCallBack(dock.radioButton_ClippingModeAnd, SIGNAL(toggled(bool)), SLOT(slot_radioButton_ClippingMode(bool)));
setCallBack(dock.radioButton_ColorAttenuationModeLinear, SIGNAL(toggled(bool)), SLOT(slot_radioButton_ColorAttenuationMode(bool)));
......@@ -755,7 +751,6 @@ void Clipping::initGUI()
else if (colorAttMode == Utils::ClippingShader::COLOR_ATTENUATION_MODE_QUADRATIC)
dock.radioButton_ColorAttenuationModeQuadratic->setChecked(true);
setCallBack(dock.PushButton_ApplyStaticClippingPreset, SIGNAL(clicked()), SLOT(slot_pushButton_applyStaticClippingPreset()));
dock.comboBox_StaticClippingPresets->addItem("Dual Planes");
......@@ -763,7 +758,6 @@ void Clipping::initGUI()
dock.comboBox_StaticClippingPresets->addItem("Tube");
dock.comboBox_StaticClippingPresets->addItem("Molecule");
setCallBack(dock.PushButton_ApplyAnimatedClippingPreset, SIGNAL(clicked()), SLOT(slot_pushButton_applyAnimatedClippingPreset()));
dock.comboBox_AnimatedClippingPresets->addItem("Moving Dual Planes");
......@@ -777,7 +771,6 @@ void Clipping::initGUI()
// timer used for animation
m_timer = new QTimer( this );
setCallBack( m_timer, SIGNAL(timeout()), SLOT(slot_animationTimer()) );
}
void Clipping::cb_Open()
......@@ -804,7 +797,7 @@ void Clipping::importMesh(std::string& filename)
return;
}
else
position = myMap.getAttribute<PFP::VEC3>(VERTEX , attrNames[0]) ;
position = myMap.getAttribute<VEC3, VERTEX>(attrNames[0]) ;
}
else if(extension == std::string(".ts"))
{
......@@ -814,7 +807,7 @@ void Clipping::importMesh(std::string& filename)
return;
}
else
position = myMap.getAttribute<PFP::VEC3>(VERTEX , attrNames[0]) ;
position = myMap.getAttribute<VEC3, VERTEX>(attrNames[0]) ;
}
if(extension == std::string(".map"))
{
......@@ -824,10 +817,9 @@ void Clipping::importMesh(std::string& filename)
return;
}
else
position = myMap.getAttribute<PFP::VEC3>(VERTEX , "position") ;
position = myMap.getAttribute<VEC3, VERTEX>("position") ;
}
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], allDarts);
......@@ -1130,7 +1122,7 @@ int main(int argc, char** argv)
}
else
{
sqt.position = sqt.myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
sqt.position = sqt.myMap.addAttribute<PFP::VEC3, VERTEX>("position");
Algo::Modelisation::Primitive3D<PFP> prim(sqt.myMap, sqt.position);
prim.hexaGrid_topo(10,10,10);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
......
......@@ -77,11 +77,11 @@ class Clipping: public Utils::QT::SimpleQT
public:
typedef PFP::MAP MAP;
typedef PFP::TVEC3 TVEC3;
typedef PFP::VEC3 VEC3;
//Manip Carte
MAP myMap ;
TVEC3 position;
AttributeHandler<VEC3, VERTEX> position;
Dart dglobal;
//Render
......
......@@ -50,7 +50,6 @@ using namespace CGoGN ;
float Ifont[74*2]={
0.145434f,0.126469f, 0.141475f,0.096252f, 0.133621f,0.0730446f, 0.120846f,0.0558913f,
0.0764256f,0.0359233f, 0.0f,0.028701f, 0.0f,0.0215257f, 0.0f,0.0143506f, 0.0f,0.00717529f, 0.0f,0.0f,
0.0560801f, 0.0f, 0.11216f,0.0f, 0.16824f,0.0f, 0.22432f,0.0f, 0.2804f,0.0f, 0.33648f,0.0f, 0.39256f,0.0f,
0.448641f,0.0f, 0.448641f,0.00717529f, 0.448641f,0.0143506f, 0.448641f,0.0215257f, 0.448641f,0.028701f,
0.406716f,0.0313208f, 0.373254f,0.0363483f, 0.347367f,0.0446329f, 0.328172f,0.0570242f,
......@@ -127,10 +126,13 @@ struct PFP: public PFP_STANDARD
typedef EmbeddedMap2 MAP;
};
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
// declaration of the map
PFP::MAP myMap;
MAP myMap;
// and attribute of position
AttributeHandler<PFP::VEC3> position;
AttributeHandler<VEC3, VERTEX> position;
unsigned int nb_ears;
......@@ -241,8 +243,7 @@ void MyQT::cb_keyPress(int code)
int main(int argc, char **argv)
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
position = myMap.addAttribute<VEC3, VERTEX>("position");
Dart d0 = myMap.newFace(12);
position[d0] = PFP::VEC3(0, 20, 0);
......@@ -267,8 +268,6 @@ int main(int argc, char **argv)
d0 = myMap.phi1(d0);
position[d0] = PFP::VEC3(0, 30, 0);
d0 = myMap.newFace(4);
position[d0] = PFP::VEC3(-5, 14, -5);
d0 = myMap.phi1(d0);
......@@ -279,8 +278,6 @@ int main(int argc, char **argv)
position[d0] = PFP::VEC3(0, 20, -5);
d0 = myMap.phi1(d0);
Dart d1 = myMap.newFace(10);
position[d1] = PFP::VEC3(0, 0, 0);
......@@ -307,7 +304,6 @@ int main(int argc, char **argv)
d1 = myMap.phi1(d1);
position[d1] = PFP::VEC3(0, 8, 0);
Dart d2 = myMap.newFace(12);
position[d2] = PFP::VEC3(0, -20, 0);
......@@ -335,8 +331,6 @@ int main(int argc, char **argv)
position[d2] = PFP::VEC3(0, -16, 0);
d2 = myMap.phi1(d2);
#define NB 32
//SPIRAL
......@@ -361,7 +355,6 @@ int main(int argc, char **argv)
d3 = myMap.phi1(d3);
}
//CIRCLE
Dart d6 = myMap.newFace(NB);
......@@ -411,7 +404,6 @@ int main(int argc, char **argv)
d9 = myMap.phi1(d9);
}
// interface:
QApplication app(argc, argv);
MyQT sqt;
......
......@@ -51,7 +51,10 @@ struct PFP: public PFP_STANDARD
typedef EmbeddedMap2 MAP;
};
PFP::MAP myMap;
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
MAP myMap;
void MyQT::cb_initGL()
{
......@@ -99,7 +102,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
MyQT sqt;
PFP::TVEC3 position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position") ;
AttributeHandler<VEC3, VERTEX> position = myMap.addAttribute<VEC3, VERTEX>("position") ;
// define the face extruded (here a cross)
std::vector<PFP::VEC3> objV;
......
......@@ -30,8 +30,7 @@ MCMesh::MCMesh() :
m_render(NULL),
m_flatShader(NULL),
m_simpleColorShader(NULL)
{
}
{}
void MCMesh::initGUI()
{
......@@ -130,24 +129,18 @@ void MCMesh::slot_drawFaces(bool b)
updateGL();
}
void MCMesh::MC()
{
myMap.clear(false);
// elargir l'image pour le calcul de la courbure
Algo::MC::Image<DATATYPE>* myImgFr = myImg->addFrame(1);
Algo::MC::WindowingGreater<DATATYPE> myWindFunc;
myWindFunc.setIsoValue(DATATYPE(127));
position = myMap.getAttribute<PFP::VEC3>(VERTEX, "position");
position = myMap.getAttribute<VEC3, VERTEX>("position");
if (!position.isValid())
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
position = myMap.addAttribute<VEC3, VERTEX>("position");
// instanciation du mc
Algo::MC::MarchingCube<DATATYPE, Algo::MC::WindowingGreater,PFP> mc(myImgFr, &myMap, position, myWindFunc, false);
......@@ -159,12 +152,8 @@ void MCMesh::MC()
updateGL();
}
void MCMesh::updateRender()
{
SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_render->initPrimitives<PFP>(myMap, nb, Algo::Render::GL2::LINES);
m_render->initPrimitives<PFP>(myMap, nb, Algo::Render::GL2::TRIANGLES);
......@@ -190,7 +179,9 @@ void MCMesh::sphere()
DATATYPE *img = new DATATYPE[128*128*128];
DATATYPE *ptr = img;
for (int x=0; x<128; ++x)
{
for (int y=0; y<128; ++y)
{
for (int z=0; z<128; ++z)
{
Geom::Vec3f V(x-64, y-64, z-64);
......@@ -199,6 +190,8 @@ void MCMesh::sphere()
else
*ptr++ = 0;
}
}
}
myImg = new Algo::MC::Image<DATATYPE>(img,128,128,128,1.0f,1.0f,1.0f,false);
}
......@@ -235,4 +228,3 @@ int main(int argc, char **argv)
return app.exec();
}
......@@ -52,11 +52,10 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
typedef unsigned char DATATYPE;
class MCMesh : public Utils::QT::SimpleQT
{
Q_OBJECT
......@@ -67,7 +66,6 @@ public:
Utils::QT::uiDockInterface dock ;
float shininess ;
Geom::BoundingBox<PFP::VEC3> bb ;
......@@ -75,7 +73,7 @@ public:
bool m_drawEdges ;
bool m_drawFaces ;
PFP::TVEC3 position ;
AttributeHandler<VEC3, VERTEX> position ;
Algo::Render::GL2::MapRender* m_render ;
......@@ -83,7 +81,6 @@ public:
Utils::ShaderFlat* m_flatShader ;
Utils::ShaderSimpleColor* m_simpleColorShader ;
DATATYPE valLabel;
Algo::MC::Image<DATATYPE>* myImg;
......@@ -100,10 +97,7 @@ public:
void fromFile(char* fname);
void sphere();
public slots:
void slot_drawEdges(bool b) ;
void slot_drawFaces(bool b) ;
};
......@@ -29,7 +29,7 @@
SimpleGMap2::SimpleGMap2()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
position = myMap.addAttribute<VEC3, VERTEX>("position");
Dart d = Algo::Modelisation::createTetrahedron<PFP>(myMap);
position[d] = VEC3(0,0,0);
......@@ -57,7 +57,6 @@ SimpleGMap2::SimpleGMap2()
void SimpleGMap2::initGUI()
{
}
void SimpleGMap2::cb_initGL()
......@@ -80,7 +79,6 @@ void SimpleGMap2::cb_redraw()
Algo::Render::GL1::renderTopoGMD2<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
......@@ -97,4 +95,3 @@ int main(int argc, char **argv)
return app.exec() ;
}
......@@ -51,7 +51,7 @@ class SimpleGMap2 : public Utils::QT::SimpleQT
public:
MAP myMap ;
PFP::TVEC3 position ;
AttributeHandler<VEC3, VERTEX> position ;
SimpleGMap2() ;
......
......@@ -30,9 +30,9 @@
SimpleGMap3::SimpleGMap3()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = myMap.addAttribute<PFP::VEC3>(VERTEX, "normal");
volume = myMap.addAttribute<PFP::VEC3>(VOLUME, "volume");
position = myMap.addAttribute<VEC3, VERTEX>("position");
normal = myMap.addAttribute<VEC3, VERTEX>("normal");
volume = myMap.addAttribute<VEC3, VOLUME>("volume");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(3,1,1);
......@@ -88,12 +88,10 @@ SimpleGMap3::SimpleGMap3()
myMap.unsewVolumes(d);
myMap.check();
}
void SimpleGMap3::initGUI()
{
}
void SimpleGMap3::cb_initGL()
......@@ -122,7 +120,6 @@ void SimpleGMap3::cb_redraw()
Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
......@@ -139,4 +136,3 @@ int main(int argc, char **argv)
return app.exec() ;
}
......@@ -52,9 +52,9 @@ class SimpleGMap3 : public Utils::QT::SimpleQT
public:
MAP myMap ;
PFP::TVEC3 position ;
PFP::TVEC3 normal ;
PFP::TVEC3 volume ;
AttributeHandler<VEC3, VERTEX> position ;
AttributeHandler<VEC3, VERTEX> normal ;
AttributeHandler<VEC3, VOLUME> volume ;
SimpleGMap3() ;
......@@ -63,4 +63,3 @@ public:
void cb_initGL() ;
void cb_redraw() ;
};
......@@ -28,12 +28,11 @@
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/subdivision3.h"
SimpleMap3::SimpleMap3()
{
position = myMap.addAttribute<PFP::VEC3>(VERTEX, "position");
position = myMap.addAttribute<VEC3, VERTEX>("position");
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Algo::Modelisation::Primitive3D<PFP> primCat(myMap, position);
Dart d = primCat.hexaGrid_topo(2,1,1);
primCat.embedHexaGrid(1,1,1);
......@@ -73,7 +72,6 @@ SimpleMap3::SimpleMap3()
void SimpleMap3::initGUI()
{
}
void SimpleMap3::cb_initGL()
......@@ -96,7 +94,6 @@ void SimpleMap3::cb_redraw()
Algo::Render::GL1::renderTopoMD3<PFP>(myMap, position, true, true, true, 0.9f, 0.9f, 0.9f);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
......@@ -113,4 +110,3 @@ int main(int argc, char **argv)
return app.exec() ;
}
......@@ -52,7 +52,7 @@ public:
MAP myMap ;
SelectorTrue allDarts ;
PFP::TVEC3 position ;
AttributeHandler<VEC3, VERTEX> position ;
SimpleMap3() ;
......
......@@ -5,7 +5,6 @@
* Author: thery
*/
#include "texturesExample.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
......@@ -45,7 +44,6 @@ void TexView::cb_initGL()
createMask(8);
m_mask->update();
m_shader = new Utils::ShaderSimpleTexture();
m_shader->setAttributePosition(m_positionVBO);
m_shader->setAttributeTexCoord(m_texcoordVBO);
......@@ -60,10 +58,8 @@ void TexView::cb_initGL()
m_shader2->setTextures(m_texture,m_mask);
registerShader(m_shader2);
glEnable(GL_TEXTURE_2D);
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES);
}
......@@ -73,7 +69,6 @@ void TexView::cb_redraw()
glEnable(GL_LIGHTING);
if (m_shader)
{
if (m_modeMask)
{
m_shader2->activeTextures();
......@@ -84,14 +79,11 @@ void TexView::cb_redraw()
m_shader->activeTexture();
m_render->draw(m_shader, Algo::Render::GL2::TRIANGLES);
}
}
}
void TexView::cb_keyPress(int code)
{
switch(code)
{
case 'l':
......@@ -156,8 +148,6 @@ void TexView::cb_Open()
}
}
void TexView::createMask(unsigned int nb)
{
if (nb ==0)
......@@ -167,6 +157,7 @@ void TexView::createMask(unsigned int nb)
unsigned int sz1 = m_mask->size()[1]/nb;
for (unsigned int j=0; j<m_mask->size()[1]; ++j)
{
for (unsigned int i=0; i<m_mask->size()[0]; ++i)
{
bool b1 = (i/sz0)%2 ==0;
......@@ -176,10 +167,9 @@ void TexView::createMask(unsigned int nb)
else
(*m_mask)(i,j)= 0.0f;
}
}
}
void TexView::computeImage()
{
std::vector<Geom::Vec3f> colorTable;
......@@ -206,8 +196,6 @@ void TexView::computeImage()
#undef WIDTHCHECKER
}
int main(int argc, char**argv)
{
// interface:
......@@ -216,8 +204,8 @@ int main(int argc, char**argv)
PFP::MAP& m = tv.myMap;
AttributeHandler<PFP::VEC3> position = m.addAttribute<PFP::VEC3>(VERTEX, "position");
AttributeHandler<Geom::Vec2f> texcoord = m.addAttribute<Geom::Vec2f>(VERTEX, "texcoord");
AttributeHandler<VEC3, VERTEX> position = m.addAttribute<VEC3, VERTEX>("position");
AttributeHandler<Geom::Vec2f, VERTEX> texcoord = m.addAttribute<Geom::Vec2f, VERTEX>("texcoord");
#define NB 96
......
......@@ -50,6 +50,7 @@ struct PFP: public PFP_STANDARD
};
typedef PFP::MAP MAP ;
typedef PFP::VEC3 VEC3 ;
/**
* A class for a little interface and rendering
*/
......@@ -71,7 +72,6 @@ public:
Utils::VBO* m_positionVBO;
Utils::VBO* m_texcoordVBO;
Utils::Texture<2,Geom::Vec3uc>* m_texture;
Utils::Texture<2,float>* m_mask;
......@@ -97,9 +97,6 @@ public:
void cb_keyPress(int code);
void cb_Open();
};
#endif
......@@ -45,32 +45,32 @@ typedef CPULinearSolverTraits< SparseMatrix<double>, FullVector<double> > CPUSol
template <typename PFP>
void computeCurvatureVertices_QuadraticFitting(
typename PFP::MAP& map,
const typename PFP::TVEC3& position,
const typename PFP::TVEC3& normal,
typename PFP::TREAL& kmax,
typename PFP::TREAL& kmin,
typename PFP::TVEC3& Kmax,
typename PFP::TVEC3& Kmin,
const AttributeHandler<typename PFP::VEC3, VERTEX>& position,
const AttributeHandler<typename PFP::VEC3, VERTEX>& normal,
AttributeHandler<typename PFP::REAL, VERTEX>& kmax,
AttributeHandler<typename PFP::REAL, VERTEX>& kmin,
AttributeHandler<typename PFP::VEC3, VERTEX>& Kmax,
AttributeHandler<typename PFP::VEC3, VERTEX>& Kmin,
const FunctorSelect& select = allDarts) ;
template <typename PFP>
void computeCurvatureVertex_QuadraticFitting(
typename PFP::MAP& map,
Dart dart,
const typename PFP::TVEC3& position,
const typename PFP::TVEC3& normal,
typename PFP::TREAL& kmax,
typename PFP::TREAL& kmin,
typename PFP::TVEC3& Kmax,
typename PFP::TVEC3& Kmin) ;
const AttributeHandler<typename PFP::VEC3, VERTEX>& position,
const AttributeHandler<typename PFP::VEC3, VERTEX>& normal,
AttributeHandler<typename PFP::REAL, VERTEX>& kmax,
AttributeHandler<typename PFP::REAL, VERTEX>& kmin,
AttributeHandler<typename PFP::VEC3, VERTEX>& Kmax,
AttributeHandler<typename PFP::VEC3, VERTEX>& Kmin) ;
template <typename PFP>
void vertexQuadraticFitting(
typename PFP::MAP& map,
Dart dart,
typename PFP::MATRIX33& localFrame,
const typename PFP::TVEC3& position,
const typename PFP::TVEC3& normal,
const AttributeHandler<typename PFP::VEC3, VERTEX>& position,
const AttributeHandler<typename PFP::VEC3, VERTEX>& normal,
float& a, float& b, float& c, float& d, float& e) ;
template <typename PFP>
......@@ -93,14 +93,14 @@ template <typename PFP>
void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map,
typename PFP::REAL radius,
const typename PFP::TVEC3& position,
const typename PFP::TVEC3& normal,
const typename PFP::TREAL& edgeangle,
typename PFP::TREAL& kmax,
typename PFP::TREAL& kmin,
typename PFP::TVEC3& Kmax,
typename PFP::TVEC3& Kmin,
typename PFP::TVEC3& Knormal,
const AttributeHandler<typename PFP::VEC3, VERTEX>& position,
const AttributeHandler<typename PFP::VEC3, VERTEX>& normal,