Commit 7a5a7687 authored by Thomas's avatar Thomas

merge with new revision

parents 1475c9ee 70500ef4
......@@ -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);
......@@ -1125,12 +1117,12 @@ int main(int argc, char** argv)
if(argc == 2)
{
std::string filename(argv[1]);
sqt.importMesh(filename);
std::string filename(argv[1]);
sqt.importMesh(filename);
}
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);
......
......@@ -28,11 +28,11 @@
#include <iostream>
#include "Utils/Qt/qtSimple.h"
#include "Utils/qtInputs.h"
#include "Utils/Qt/qtInputs.h"
#include "ui_clipping.h"
// inclure qtui.h juste après le ui_xxx.h
#include "Utils/qtui.h"
#include "Utils/Qt/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap3.h"
......@@ -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;
VertexAttribute<VEC3> 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;
VertexAttribute<VEC3> 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") ;
VertexAttribute<VEC3> 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();
}
......@@ -26,7 +26,7 @@
#include "Utils/Qt/qtSimple.h"
#include "ui_mcmesh.h"
#include "Utils/qtui.h"
#include "Utils/Qt/qtui.h"
#include "Topology/generic/parameters.h"
#include "Topology/map/map2.h"
......@@ -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 ;
VertexAttribute<VEC3> 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 ;
VertexAttribute<VEC3> position ;
SimpleGMap2() ;
......
......@@ -30,11 +30,11 @@
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");
CellMarker mE(myMap,EDGE);
CellMarker<EDGE> mE(myMap);
Algo::Modelisation::Primitive3D<PFP> primCat(myMap,position);
Dart d = primCat.hexaGrid_topo(3,1,1);
......@@ -96,12 +96,10 @@ SimpleGMap3::SimpleGMap3()
myMap.unsewVolumes(d);
myMap.check();
}
void SimpleGMap3::initGUI()
{
}
void SimpleGMap3::cb_initGL()
......@@ -131,7 +129,6 @@ void SimpleGMap3::cb_redraw()
// Algo::Render::GL1::renderTriQuadPoly<PFP>(myMap, Algo::Render::GL1::LINE, 1.0,position, normal);
}
/**********************************************************************************************
* MAIN FUNCTION *
**********************************************************************************************/
......@@ -148,4 +145,3 @@ int main(int argc, char **argv)
return app.exec() ;
}
......@@ -54,9 +54,9 @@ class SimpleGMap3 : public Utils::QT::SimpleQT
public:
MAP myMap ;
PFP::TVEC3 position ;
PFP::TVEC3 normal ;
PFP::TVEC3 volume ;
VertexAttribute<VEC3> position ;
VertexAttribute<VEC3> normal ;
VolumeAttribute<VEC3> volume ;
SimpleGMap3() ;
......@@ -65,4 +65,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 ;
VertexAttribute<VEC3> position ;
SimpleMap3() ;
......
/*
* texturesExample.cpp
*
* Created on: Jul 21, 2011
* Author: thery
*/
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#include "texturesExample.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Modelisation/polyhedron.h"
TexView::TexView():
m_render(NULL), m_positionVBO(NULL), m_texcoordVBO(NULL), m_texture(NULL), m_shader(NULL),m_modeMask(false),m_fileName("")
{
}
m_render(NULL),
m_positionVBO(NULL),
m_texcoordVBO(NULL),
m_texture(NULL),
m_shader(NULL),
m_modeMask(false),
m_fileName("")
{}
TexView::~TexView()
{
......@@ -45,7 +66,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 +80,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 +91,6 @@ void TexView::cb_redraw()
glEnable(GL_LIGHTING);
if (m_shader)
{
if (m_modeMask)
{
m_shader2->activeTextures();
......@@ -84,14 +101,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 +170,6 @@ void TexView::cb_Open()
}
}
void TexView::createMask(unsigned int nb)
{
if (nb ==0)
......@@ -167,6 +179,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)
{