From ef19be46b44fdac461653f0d222f7e3fb2639ab1 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Fri, 27 Apr 2012 11:04:26 +0200 Subject: [PATCH] orbit as template -> examples OK --- Apps/Examples/clipping.cpp | 20 +-- Apps/Examples/clipping.h | 4 +- Apps/Examples/concave_rendering.cpp | 20 +-- Apps/Examples/extrusionView.cpp | 7 +- Apps/Examples/mcmesh.cpp | 22 ++-- Apps/Examples/mcmesh.h | 10 +- Apps/Examples/simpleGMap2.cpp | 5 +- Apps/Examples/simpleGMap2.h | 2 +- Apps/Examples/simpleGMap3.cpp | 10 +- Apps/Examples/simpleGMap3.h | 7 +- Apps/Examples/simpleMap3.cpp | 8 +- Apps/Examples/simpleMap3.h | 2 +- Apps/Examples/texturesExample.cpp | 20 +-- Apps/Examples/texturesExample.h | 5 +- include/Algo/Geometry/curvature.h | 60 ++++----- include/Algo/Geometry/curvature.hpp | 60 ++++----- include/Algo/MC/marchingcube.h | 25 ++-- include/Algo/MC/marchingcube.hpp | 128 ++++---------------- include/Algo/Modelisation/extrusion.h | 16 +-- include/Algo/Modelisation/extrusion.hpp | 32 ++--- include/Algo/Modelisation/triangulation.h | 17 +-- include/Algo/Modelisation/triangulation.hpp | 17 +-- include/Algo/Render/GL1/map_glRender.h | 8 +- include/Algo/Render/GL1/map_glRender.hpp | 11 +- include/Algo/Render/GL1/renderFunctor.h | 27 ++--- include/Algo/Render/GL1/renderFunctor.hpp | 12 +- include/Algo/Render/GL1/topo_render.h | 11 +- include/Algo/Render/GL1/topo_render.hpp | 47 ++++--- 28 files changed, 233 insertions(+), 380 deletions(-) diff --git a/Apps/Examples/clipping.cpp b/Apps/Examples/clipping.cpp index ede6a9cd..f6b5dbea 100644 --- a/Apps/Examples/clipping.cpp +++ b/Apps/Examples/clipping.cpp @@ -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(VERTEX , attrNames[0]) ; + position = myMap.getAttribute(attrNames[0]) ; } else if(extension == std::string(".ts")) { @@ -814,7 +807,7 @@ void Clipping::importMesh(std::string& filename) return; } else - position = myMap.getAttribute(VERTEX , attrNames[0]) ; + position = myMap.getAttribute(attrNames[0]) ; } if(extension == std::string(".map")) { @@ -824,10 +817,9 @@ void Clipping::importMesh(std::string& filename) return; } else - position = myMap.getAttribute(VERTEX , "position") ; + position = myMap.getAttribute("position") ; } - updateVBOprimitives(Algo::Render::GL2::TRIANGLES | Algo::Render::GL2::LINES | Algo::Render::GL2::POINTS) ; m_render_topo->updateData(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(VERTEX, "position"); + sqt.position = sqt.myMap.addAttribute("position"); Algo::Modelisation::Primitive3D prim(sqt.myMap, sqt.position); prim.hexaGrid_topo(10,10,10); prim.embedHexaGrid(1.0f,1.0f,1.0f); diff --git a/Apps/Examples/clipping.h b/Apps/Examples/clipping.h index 22758932..12109324 100644 --- a/Apps/Examples/clipping.h +++ b/Apps/Examples/clipping.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; + AttributeHandler position; Dart dglobal; //Render diff --git a/Apps/Examples/concave_rendering.cpp b/Apps/Examples/concave_rendering.cpp index f04e9124..d1826b8b 100644 --- a/Apps/Examples/concave_rendering.cpp +++ b/Apps/Examples/concave_rendering.cpp @@ -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 position; +AttributeHandler position; unsigned int nb_ears; @@ -241,8 +243,7 @@ void MyQT::cb_keyPress(int code) int main(int argc, char **argv) { - - position = myMap.addAttribute(VERTEX, "position"); + position = myMap.addAttribute("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; diff --git a/Apps/Examples/extrusionView.cpp b/Apps/Examples/extrusionView.cpp index 8aebcd60..49baaeb3 100644 --- a/Apps/Examples/extrusionView.cpp +++ b/Apps/Examples/extrusionView.cpp @@ -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(VERTEX, "position") ; + AttributeHandler position = myMap.addAttribute("position") ; // define the face extruded (here a cross) std::vector objV; diff --git a/Apps/Examples/mcmesh.cpp b/Apps/Examples/mcmesh.cpp index d55c0a56..d332d79a 100644 --- a/Apps/Examples/mcmesh.cpp +++ b/Apps/Examples/mcmesh.cpp @@ -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* myImgFr = myImg->addFrame(1); - Algo::MC::WindowingGreater myWindFunc; myWindFunc.setIsoValue(DATATYPE(127)); - position = myMap.getAttribute(VERTEX, "position"); + position = myMap.getAttribute("position"); if (!position.isValid()) - position = myMap.addAttribute(VERTEX, "position"); + position = myMap.addAttribute("position"); // instanciation du mc Algo::MC::MarchingCube mc(myImgFr, &myMap, position, myWindFunc, false); @@ -159,12 +152,8 @@ void MCMesh::MC() updateGL(); } - - - void MCMesh::updateRender() { - SelectorDartNoBoundary nb(myMap); m_render->initPrimitives(myMap, nb, Algo::Render::GL2::LINES); m_render->initPrimitives(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(img,128,128,128,1.0f,1.0f,1.0f,false); } @@ -235,4 +228,3 @@ int main(int argc, char **argv) return app.exec(); } - diff --git a/Apps/Examples/mcmesh.h b/Apps/Examples/mcmesh.h index adf50479..17d47edd 100644 --- a/Apps/Examples/mcmesh.h +++ b/Apps/Examples/mcmesh.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 bb ; @@ -75,7 +73,7 @@ public: bool m_drawEdges ; bool m_drawFaces ; - PFP::TVEC3 position ; + AttributeHandler 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* myImg; @@ -100,10 +97,7 @@ public: void fromFile(char* fname); void sphere(); - public slots: void slot_drawEdges(bool b) ; void slot_drawFaces(bool b) ; - }; - diff --git a/Apps/Examples/simpleGMap2.cpp b/Apps/Examples/simpleGMap2.cpp index eb1d74f4..7a59b032 100644 --- a/Apps/Examples/simpleGMap2.cpp +++ b/Apps/Examples/simpleGMap2.cpp @@ -29,7 +29,7 @@ SimpleGMap2::SimpleGMap2() { - position = myMap.addAttribute(VERTEX, "position"); + position = myMap.addAttribute("position"); Dart d = Algo::Modelisation::createTetrahedron(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(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() ; } - diff --git a/Apps/Examples/simpleGMap2.h b/Apps/Examples/simpleGMap2.h index fb86dc70..0f0b0196 100644 --- a/Apps/Examples/simpleGMap2.h +++ b/Apps/Examples/simpleGMap2.h @@ -51,7 +51,7 @@ class SimpleGMap2 : public Utils::QT::SimpleQT public: MAP myMap ; - PFP::TVEC3 position ; + AttributeHandler position ; SimpleGMap2() ; diff --git a/Apps/Examples/simpleGMap3.cpp b/Apps/Examples/simpleGMap3.cpp index f354bc13..bf38d8a1 100644 --- a/Apps/Examples/simpleGMap3.cpp +++ b/Apps/Examples/simpleGMap3.cpp @@ -30,9 +30,9 @@ SimpleGMap3::SimpleGMap3() { - position = myMap.addAttribute(VERTEX, "position"); - normal = myMap.addAttribute(VERTEX, "normal"); - volume = myMap.addAttribute(VOLUME, "volume"); + position = myMap.addAttribute("position"); + normal = myMap.addAttribute("normal"); + volume = myMap.addAttribute("volume"); Algo::Modelisation::Primitive3D 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(myMap, Algo::Render::GL1::LINE, 1.0,position, normal); } - /********************************************************************************************** * MAIN FUNCTION * **********************************************************************************************/ @@ -139,4 +136,3 @@ int main(int argc, char **argv) return app.exec() ; } - diff --git a/Apps/Examples/simpleGMap3.h b/Apps/Examples/simpleGMap3.h index b73c5208..edad527b 100644 --- a/Apps/Examples/simpleGMap3.h +++ b/Apps/Examples/simpleGMap3.h @@ -52,9 +52,9 @@ class SimpleGMap3 : public Utils::QT::SimpleQT public: MAP myMap ; - PFP::TVEC3 position ; - PFP::TVEC3 normal ; - PFP::TVEC3 volume ; + AttributeHandler position ; + AttributeHandler normal ; + AttributeHandler volume ; SimpleGMap3() ; @@ -63,4 +63,3 @@ public: void cb_initGL() ; void cb_redraw() ; }; - diff --git a/Apps/Examples/simpleMap3.cpp b/Apps/Examples/simpleMap3.cpp index 65739f76..70778871 100644 --- a/Apps/Examples/simpleMap3.cpp +++ b/Apps/Examples/simpleMap3.cpp @@ -28,12 +28,11 @@ #include "Algo/Modelisation/primitives3d.h" #include "Algo/Modelisation/subdivision3.h" - SimpleMap3::SimpleMap3() { - position = myMap.addAttribute(VERTEX, "position"); + position = myMap.addAttribute("position"); - Algo::Modelisation::Primitive3D primCat(myMap,position); + Algo::Modelisation::Primitive3D 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(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() ; } - diff --git a/Apps/Examples/simpleMap3.h b/Apps/Examples/simpleMap3.h index f47172e8..7c45dcec 100644 --- a/Apps/Examples/simpleMap3.h +++ b/Apps/Examples/simpleMap3.h @@ -52,7 +52,7 @@ public: MAP myMap ; SelectorTrue allDarts ; - PFP::TVEC3 position ; + AttributeHandler position ; SimpleMap3() ; diff --git a/Apps/Examples/texturesExample.cpp b/Apps/Examples/texturesExample.cpp index 5de82bd0..82fee16d 100644 --- a/Apps/Examples/texturesExample.cpp +++ b/Apps/Examples/texturesExample.cpp @@ -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(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; jsize()[1]; ++j) + { for (unsigned int i=0; isize()[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 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 position = m.addAttribute(VERTEX, "position"); - AttributeHandler texcoord = m.addAttribute(VERTEX, "texcoord"); + AttributeHandler position = m.addAttribute("position"); + AttributeHandler texcoord = m.addAttribute("texcoord"); #define NB 96 diff --git a/Apps/Examples/texturesExample.h b/Apps/Examples/texturesExample.h index 0dd66768..60ae82ff 100644 --- a/Apps/Examples/texturesExample.h +++ b/Apps/Examples/texturesExample.h @@ -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 - diff --git a/include/Algo/Geometry/curvature.h b/include/Algo/Geometry/curvature.h index 8b1ac440..c89c1b99 100644 --- a/include/Algo/Geometry/curvature.h +++ b/include/Algo/Geometry/curvature.h @@ -45,32 +45,32 @@ typedef CPULinearSolverTraits< SparseMatrix, FullVector > CPUSol template 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& position, + const AttributeHandler& normal, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin, const FunctorSelect& select = allDarts) ; template 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& position, + const AttributeHandler& normal, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin) ; template void vertexQuadraticFitting( typename PFP::MAP& map, Dart dart, typename PFP::MATRIX33& localFrame, - const typename PFP::TVEC3& position, - const typename PFP::TVEC3& normal, + const AttributeHandler& position, + const AttributeHandler& normal, float& a, float& b, float& c, float& d, float& e) ; template @@ -93,14 +93,14 @@ template 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& position, + const AttributeHandler& normal, + const AttributeHandler& edgeangle, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin, + AttributeHandler& Knormal, const FunctorSelect& select = allDarts) ; template @@ -108,14 +108,14 @@ void computeCurvatureVertex_NormalCycles( typename PFP::MAP& map, Dart dart, 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& position, + const AttributeHandler& normal, + const AttributeHandler& edgeangle, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin, + AttributeHandler& Knormal) ; } // namespace Geometry diff --git a/include/Algo/Geometry/curvature.hpp b/include/Algo/Geometry/curvature.hpp index e4d8a7b5..fdd2ea5b 100644 --- a/include/Algo/Geometry/curvature.hpp +++ b/include/Algo/Geometry/curvature.hpp @@ -48,12 +48,12 @@ namespace Geometry template 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& position, + const AttributeHandler& normal, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin, const FunctorSelect& select) { TraversorV t(map, select) ; @@ -65,12 +65,12 @@ template 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& position, + const AttributeHandler& normal, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin) { typedef typename PFP::REAL REAL ; typedef typename PFP::VEC3 VEC3 ; @@ -115,8 +115,8 @@ void vertexQuadraticFitting( typename PFP::MAP& map, Dart dart, typename PFP::MATRIX33& localFrame, - const typename PFP::TVEC3& position, - const typename PFP::TVEC3& normal, + const AttributeHandler& position, + const AttributeHandler& normal, float& a, float& b, float& c, float& d, float& e) { typename PFP::VEC3 p = position[dart] ; @@ -281,14 +281,14 @@ template 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& position, + const AttributeHandler& normal, + const AttributeHandler& edgeangle, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin, + AttributeHandler& Knormal, const FunctorSelect& select) { TraversorV t(map, select) ; @@ -301,14 +301,14 @@ void computeCurvatureVertex_NormalCycles( typename PFP::MAP& map, Dart dart, 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& position, + const AttributeHandler& normal, + const AttributeHandler& edgeangle, + AttributeHandler& kmax, + AttributeHandler& kmin, + AttributeHandler& Kmax, + AttributeHandler& Kmin, + AttributeHandler& Knormal) { typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::REAL REAL ; diff --git a/include/Algo/MC/marchingcube.h b/include/Algo/MC/marchingcube.h index 8c16d897..04278e90 100644 --- a/include/Algo/MC/marchingcube.h +++ b/include/Algo/MC/marchingcube.h @@ -50,8 +50,9 @@ template< typename DataType, template < typename D2 > class Windowing, typename class MarchingCube { protected: - typedef typename PFP::MAP L_MAP; - typedef Dart L_DART; + typedef typename PFP::VEC3 VEC3 ; + typedef typename PFP::MAP L_MAP ; + typedef Dart L_DART ; /** * voxel image @@ -73,17 +74,17 @@ protected: */ L_MAP* m_map; - typename PFP::TVEC3 m_positions; + AttributeHandler& m_positions; /** * Origin of image */ - typename PFP::VEC3 m_fOrigin; + VEC3 m_fOrigin; /** * scale of image */ - typename PFP::VEC3 m_fScal; + VEC3 m_fScal; /** * compute the index of a cube:\n @@ -185,7 +186,7 @@ protected: * @param _dec shifting due to interpolation in the cube * @return new position */ - typename PFP::VEC3 recalPoint( const typename PFP::VEC3& _P, const typename PFP::VEC3& _dec ) const; + typename PFP::VEC3 recalPoint(const VEC3& _P, const VEC3& _dec ) const; void setNeighbourSimple(L_DART d1, L_DART d2); @@ -216,7 +217,7 @@ public: * @param wind the windowing class (for inside/outside distinguish) * @param boundRemoved true is bound is going to be removed */ - MarchingCube(Image* img, L_MAP* map, const typename PFP::TVEC3& position, Windowing wind, bool boundRemoved); + MarchingCube(Image* img, L_MAP* map, AttributeHandler& position, Windowing wind, bool boundRemoved); /** * destructor @@ -237,24 +238,24 @@ public: * get pointer on result mesh after processing * @return the mesh */ - L_MAP* getMesh() const { return m_map;} + L_MAP* getMesh() const { return m_map; } /** * get the image */ - Image* getImg() {return m_Image;} + Image* getImg() { return m_Image; } /** * Get the lower corner of bounding AABB */ - Geom::Vec3f boundMin() const {return m_Image->boundMin();} + Geom::Vec3f boundMin() const { return m_Image->boundMin(); } /** * Get the upper corner of bounding AABB */ - Geom::Vec3f boundMax() const {return m_Image->boundMax();} + Geom::Vec3f boundMax() const { return m_Image->boundMax(); } - void removeFacesOfBoundary(AttributeHandler& boundVertices, unsigned int frameWidth); + void removeFacesOfBoundary(AttributeHandler& boundVertices, unsigned int frameWidth); void recalPoints(const Geom::Vec3f& origin); }; diff --git a/include/Algo/MC/marchingcube.hpp b/include/Algo/MC/marchingcube.hpp index e318053f..628767e1 100644 --- a/include/Algo/MC/marchingcube.hpp +++ b/include/Algo/MC/marchingcube.hpp @@ -58,11 +58,10 @@ MarchingCube::MarchingCube(Image* img, Windo m_fOrigin(typename PFP::VEC3(0.0,0.0,0.0)), m_fScal(typename PFP::VEC3(1.0,1.0,1.0)), m_brem(boundRemoved) -{ -} +{} template< typename DataType, template < typename D2 > class Windowing, typename PFP > -MarchingCube::MarchingCube(Image* img, L_MAP* map, const typename PFP::TVEC3& position, Windowing wind, bool boundRemoved): +MarchingCube::MarchingCube(Image* img, L_MAP* map, AttributeHandler& position, Windowing wind, bool boundRemoved): m_Image(img), m_windowFunc(wind), m_Buffer(NULL), @@ -71,8 +70,7 @@ MarchingCube::MarchingCube(Image* img, L_MAP m_fOrigin(typename PFP::VEC3(0.0,0.0,0.0)), m_fScal(typename PFP::VEC3(1.0,1.0,1.0)), m_brem(boundRemoved) -{ -} +{} template< typename DataType, template < typename D2 > class Windowing, typename PFP > @@ -100,20 +98,19 @@ void MarchingCube::deleteMesh() } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > Dart MarchingCube::createTriEmb(unsigned int e1, unsigned int e2, unsigned int e3) { L_DART d = m_map->newFace(3,false); - FunctorSetEmb fsetemb(*m_map, VERTEX, e1); - m_map->foreach_dart_of_orbit(PFP::MAP::ORBIT_IN_PARENT(VERTEX), d, fsetemb); + FunctorSetEmb fsetemb(*m_map, e1); + m_map->template foreach_dart_of_orbit(d, fsetemb); d = m_map->phi1(d); fsetemb.changeEmb(e2); - m_map->foreach_dart_of_orbit(PFP::MAP::ORBIT_IN_PARENT(VERTEX), d, fsetemb); + m_map->template foreach_dart_of_orbit(d, fsetemb); d = m_map->phi1(d); fsetemb.changeEmb(e3); - m_map->foreach_dart_of_orbit(PFP::MAP::ORBIT_IN_PARENT(VERTEX), d, fsetemb); + m_map->template foreach_dart_of_orbit(d, fsetemb); d = m_map->phi1(d); return d; @@ -122,7 +119,6 @@ Dart MarchingCube::createTriEmb(unsigned int e1, unsi template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::simpleMeshing() { - // create the mesh if needed if (m_map==NULL) { @@ -145,8 +141,6 @@ void MarchingCube::simpleMeshing() m_fScal[1] = m_Image->getVoxSizeY(); m_fScal[2] = m_Image->getVoxSizeZ(); - - // get access to data (pointer + size) DataType* ucData = m_Image->getData(); @@ -157,7 +151,6 @@ void MarchingCube::simpleMeshing() int lTy = m_Image->getWidthY(); int lTz = m_Image->getWidthZ(); - /* gmtl::Vec3i orig = m_Image->getOrigin();*/ int lTxm = lTx - 1 ; @@ -229,22 +222,17 @@ void MarchingCube::simpleMeshing() } CGoGNout << "Taille 2-carte:"<getNbDarts()<<" brins"< class Windowing, typename PFP > unsigned char MarchingCube::computeIndex(const DataType* const _ucData) const { unsigned char ucCubeIndex = 0; const DataType* ucDataLocal = _ucData; - int lTx = m_Image->getWidthX(); int lTxy = m_Image->getWidthXY(); - if ( m_windowFunc.inside(*ucDataLocal) ) ucCubeIndex = 1; // point 0 ucDataLocal ++; @@ -284,43 +272,36 @@ typename PFP::VEC3 MarchingCube::recalPoint(const type return point; } - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge0(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 1) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX+1,_lY,_lZ) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(interp, 0., 0.)); // lVertTable[0] = L_EMB::create(newPoint); - lVertTable[0] = m_map->newCell(VERTEX); + lVertTable[0] = m_map->template newCell(); m_positions[lVertTable[0]] = recalPoint(vPos,typename PFP::VEC3(interp, 0., 0.)); m_Buffer->setPointEdge0(_lX, _lY,lVertTable[0]); } } - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge1(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 2) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX,_lY+1,_lZ) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(1.,interp, 0.)); // lVertTable[1] = L_EMB::create(newPoint); - lVertTable[1] = m_map->newCell(VERTEX); + lVertTable[1] = m_map->template newCell(); m_positions[lVertTable[1]] = recalPoint(vPos,typename PFP::VEC3(1.,interp, 0.)); m_Buffer->setPointEdge1(_lX, _lY,lVertTable[1]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge2(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { @@ -330,13 +311,12 @@ void MarchingCube::createPointEdge2(const unsigned cha // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(interp, 1., 0.)); // lVertTable[2] = L_EMB::create(newPoint); - lVertTable[2] = m_map->newCell(VERTEX); + lVertTable[2] = m_map->template newCell(); m_positions[lVertTable[2]] = recalPoint(vPos,typename PFP::VEC3(interp, 1., 0.)); m_Buffer->setPointEdge2(_lX, _lY,lVertTable[2]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge3(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { @@ -346,153 +326,132 @@ void MarchingCube::createPointEdge3(const unsigned cha // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(0., interp, 0.)); // lVertTable[3] = L_EMB::create(newPoint); - lVertTable[3] = m_map->newCell(VERTEX); + lVertTable[3] = m_map->template newCell(); m_positions[lVertTable[3]] = recalPoint(vPos,typename PFP::VEC3(0., interp, 0.)); m_Buffer->setPointEdge3(_lX, _lY,lVertTable[3]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge4(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 16) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX+1,_lY,_lZ) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(interp, 0., 1.)); // lVertTable[4] = L_EMB::create(newPoint); - lVertTable[4] = m_map->newCell(VERTEX); + lVertTable[4] = m_map->template newCell(); m_positions[lVertTable[4]] = recalPoint(vPos,typename PFP::VEC3(interp, 0., 1.)); m_Buffer->setPointEdge4(_lX, _lY,lVertTable[4]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge5(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 32) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX,_lY+1,_lZ) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(1., interp, 1.)); // lVertTable[5] = L_EMB::create(newPoint); - lVertTable[5] = m_map->newCell(VERTEX); + lVertTable[5] = m_map->template newCell(); m_positions[lVertTable[5]] = recalPoint(vPos,typename PFP::VEC3(1., interp, 1.)); m_Buffer->setPointEdge5(_lX, _lY,lVertTable[5]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge6(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 64) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX-1,_lY,_lZ), m_Image->getVoxel(_lX,_lY,_lZ) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(interp, 1., 1.)); // lVertTable[6] = L_EMB::create(newPoint); - lVertTable[6] = m_map->newCell(VERTEX); + lVertTable[6] = m_map->template newCell(); m_positions[lVertTable[6]] = recalPoint(vPos,typename PFP::VEC3(interp, 1., 1.)); m_Buffer->setPointEdge6(_lX, _lY,lVertTable[6]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge7(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 128) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY-1,_lZ), m_Image->getVoxel(_lX,_lY,_lZ) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(0., interp, 1.)); // lVertTable[7] = L_EMB::create(newPoint); - lVertTable[7] = m_map->newCell(VERTEX); + lVertTable[7] = m_map->template newCell(); m_positions[lVertTable[7]] = recalPoint(vPos,typename PFP::VEC3(0., interp, 1.)); m_Buffer->setPointEdge7(_lX, _lY,lVertTable[7]); } } - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge8(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 256) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX,_lY,_lZ+1) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(0., 0., interp)); // lVertTable[8] = L_EMB::create(newPoint); - lVertTable[8] = m_map->newCell(VERTEX); + lVertTable[8] = m_map->template newCell(); m_positions[lVertTable[8]] = recalPoint(vPos,typename PFP::VEC3(0., 0., interp)); m_Buffer->setPointEdge8(_lX, _lY,lVertTable[8]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge9(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 512) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX,_lY,_lZ+1) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(1., 0., interp)); // lVertTable[9] = L_EMB::create(newPoint); - lVertTable[9] = m_map->newCell(VERTEX); + lVertTable[9] = m_map->template newCell(); m_positions[lVertTable[9]] = recalPoint(vPos,typename PFP::VEC3(1., 0., interp)); m_Buffer->setPointEdge9(_lX, _lY,lVertTable[9]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge10(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 1024) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX,_lY,_lZ+1) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(1., 1., interp)); // lVertTable[10] = L_EMB::create(newPoint); - lVertTable[10] = m_map->newCell(VERTEX); + lVertTable[10] = m_map->template newCell(); m_positions[lVertTable[10]] = recalPoint(vPos,typename PFP::VEC3(1., 1., interp)); m_Buffer->setPointEdge10(_lX, _lY,lVertTable[10]); } } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createPointEdge11(const unsigned char _ucCubeIndex, const int _lX, const int _lY, const int _lZ, unsigned int * const lVertTable, const typename PFP::VEC3& vPos) { - if (accelMCTable::m_EdgeTable[_ucCubeIndex] & 2048) { float interp = m_windowFunc.interpole( m_Image->getVoxel(_lX,_lY,_lZ), m_Image->getVoxel(_lX,_lY,_lZ+1) ); // typename PFP::VEC3 newPoint = recalPoint(vPos,typename PFP::VEC3(0., 1., interp)); // lVertTable[11] = L_EMB::create(newPoint); - lVertTable[11] = m_map->newCell(VERTEX); + lVertTable[11] = m_map->template newCell(); m_positions[lVertTable[11]] = recalPoint(vPos,typename PFP::VEC3(0., 1., interp)); m_Buffer->setPointEdge11(_lX, _lY,lVertTable[11]); } } - - - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_1(DataType *vox, const int _lX,const int _lY,const int _lZ, unsigned char tag) { @@ -534,7 +493,6 @@ void MarchingCube::createFaces_1(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //all edges lVertTable[ 0] = m_Buffer->getPointEdge0(_lX, _lY); @@ -552,12 +510,8 @@ void MarchingCube::createFaces_1(DataType *vox, const // create the new faces, the mask (6 bits) of faces to treat is 111111 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x3F, curv, tag); - } - - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_2(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -576,7 +530,6 @@ void MarchingCube::createFaces_2(DataType *vox, const // float curv = m_Curvature.computeCurvatureSimple(vox); float curv=0.0f; - createPointEdge0( ucCubeIndex, lX, lY, lZ, lVertTable, vPos ); lX++; createPointEdge1( ucCubeIndex, lX, lY, lZ, lVertTable, vPos ); @@ -593,7 +546,6 @@ void MarchingCube::createFaces_2(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 3 lVertTable[3] = m_Buffer->getPointEdge3(_lX, _lY); @@ -607,14 +559,10 @@ void MarchingCube::createFaces_2(DataType *vox, const //edge 11 lVertTable[11] = m_Buffer->getPointEdge11(_lX, _lY); - // create the new faces, the mask (6 bits) of faces to treat is 111110 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x3E, curv, tag); - } - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_3(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -649,7 +597,6 @@ void MarchingCube::createFaces_3(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 0 lVertTable[0] = m_Buffer->getPointEdge0(_lX, _lY); @@ -666,10 +613,8 @@ void MarchingCube::createFaces_3(DataType *vox, const // create the new faces, the mask (6 bits) of faces to treat is 111011 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x3B, curv, tag); - } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_4(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -699,7 +644,6 @@ void MarchingCube::createFaces_4(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 3 lVertTable[3] = m_Buffer->getPointEdge3(_lX, _lY); @@ -724,10 +668,8 @@ void MarchingCube::createFaces_4(DataType *vox, const // create the new faces, the mask (6 bits) of faces to treat is 111010 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x3A, curv, tag); - } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_5(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -763,7 +705,6 @@ void MarchingCube::createFaces_5(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 0 lVertTable[0] = m_Buffer->getPointEdge0(_lX, _lY); @@ -780,10 +721,8 @@ void MarchingCube::createFaces_5(DataType *vox, const // create the new faces, the mask (6 bits) of faces to treat is 101111 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x2F, curv, tag); - } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_6(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -815,7 +754,6 @@ void MarchingCube::createFaces_6(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 0 lVertTable[0] = m_Buffer->getPointEdge0(_lX, _lY); @@ -841,10 +779,8 @@ void MarchingCube::createFaces_6(DataType *vox, const // create the new faces, the mask (6 bits) of faces to treat is 101110 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x2E, curv, tag); - } - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_7(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -876,7 +812,6 @@ void MarchingCube::createFaces_7(DataType *vox, const lY++; createPointEdge6( ucCubeIndex, lX, lY, lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 0 lVertTable[0] = m_Buffer->getPointEdge0(_lX, _lY); @@ -904,8 +839,6 @@ void MarchingCube::createFaces_7(DataType *vox, const createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x2B, curv, tag); } - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > void MarchingCube::createFaces_8(DataType *vox, const int _lX, const int _lY, const int _lZ, unsigned char tag) { @@ -928,7 +861,6 @@ void MarchingCube::createFaces_8(DataType *vox, const createPointEdge5( ucCubeIndex, lX, _lY, lZ, lVertTable, vPos); createPointEdge10( ucCubeIndex, lX, lY, _lZ, lVertTable, vPos); - // get the shared vertices corresponding to the shared edges : //edge 0 lVertTable[0] = m_Buffer->getPointEdge0(_lX, _lY); @@ -960,7 +892,6 @@ void MarchingCube::createFaces_8(DataType *vox, const // create the new faces, the mask (6 bits) of faces to treat is 101010 createLocalFaces(ucCubeIndex, _lX, _lY, _lZ, lVertTable, 0x2A, curv, tag); - } template< typename DataType, template < typename D2 > class Windowing, typename PFP > @@ -1117,8 +1048,6 @@ void MarchingCube::createLocalFaces(const unsigned cha } } - - // PASS 2: set the neighbours in buffer for (int i=0; cTriangle[i]!=-1;/* incrementation inside */) @@ -1166,10 +1095,8 @@ void MarchingCube::createLocalFaces(const unsigned cha } } i++; - } - // finish buffer table of faces with -1 // PAS FORCEMENT UTILE A VERIFIER // for(int i=lNumFaces; i <5; i++) @@ -1181,12 +1108,9 @@ void MarchingCube::createLocalFaces(const unsigned cha #undef ODDMASK } - - template< typename DataType, template < typename D2 > class Windowing, typename PFP > -void MarchingCube::removeFacesOfBoundary(AttributeHandler& boundVertices, unsigned int frameWidth) +void MarchingCube::removeFacesOfBoundary(AttributeHandler& boundVertices, unsigned int frameWidth) { - float xmin = frameWidth; float xmax = m_Image->getWidthX() - frameWidth -1; float ymin = frameWidth; @@ -1194,7 +1118,6 @@ void MarchingCube::removeFacesOfBoundary(AttributeHand float zmin = frameWidth; float zmax = m_Image->getWidthZ() - frameWidth -1; - // traverse position and create bound attrib for(unsigned int it = m_positions.begin(); it != m_positions.end(); m_positions.next(it)) { @@ -1227,7 +1150,7 @@ void MarchingCube::removeFacesOfBoundary(AttributeHand if ((boundVertices[dd]!=0) && (boundVertices[e]!=0) && (boundVertices[f]!=0)) m_map->deleteFace(dd,false); else - mf.markOrbit(FACE,dd); + mf.markOrbit(dd); } else m_map->next(d); } @@ -1251,7 +1174,6 @@ void MarchingCube::removeFacesOfBoundary(AttributeHand // } // for (std::vector::iterator it = vecF.begin(); it != vecF.end(); ++it) // m_map->deleteFace(*it); - } template< typename DataType, template < typename D2 > class Windowing, typename PFP > @@ -1269,10 +1191,8 @@ void MarchingCube::recalPoints(const Geom::Vec3f& orig } } +} // namespace MC +} // namespace Algo - - -} // end namespace -} // end namespace -} // end namespace +} // namespace CGoGN diff --git a/include/Algo/Modelisation/extrusion.h b/include/Algo/Modelisation/extrusion.h index aa12f1d3..a78b584c 100644 --- a/include/Algo/Modelisation/extrusion.h +++ b/include/Algo/Modelisation/extrusion.h @@ -55,7 +55,7 @@ namespace Modelisation * size of vector must be the same as path */ template -Dart extrusion_scale(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Dart extrusion_scale(typename PFP::MAP& the_map, AttributeHandler& positions, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, @@ -79,7 +79,7 @@ Dart extrusion_scale(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, * size of vector must be the same as path */ template -Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, AttributeHandler& positions, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, @@ -103,7 +103,7 @@ Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP:: * size of vector must be the same as path */ template -Polyhedron* extrusion_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Polyhedron* extrusion_prim(typename PFP::MAP& the_map, AttributeHandler& positions, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, @@ -124,7 +124,7 @@ Polyhedron* extrusion_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& * size of vector must be the same as path */ template -Dart extrusion(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Dart extrusion(typename PFP::MAP& the_map, AttributeHandler& positions, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normal, @@ -143,7 +143,7 @@ Dart extrusion(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, * @param nbSide number of steps around the revolution */ template -Polyhedron* revolution_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Polyhedron* revolution_prim(typename PFP::MAP& the_map, AttributeHandler& positions, const std::vector& profile, const typename PFP::VEC3& center, const typename PFP::VEC3& axis, @@ -161,7 +161,7 @@ Polyhedron* revolution_prim(typename PFP::MAP& the_map, typename PFP::TVEC3 * @param nbSide number of steps around the revolution */ template -Dart revolution(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Dart revolution(typename PFP::MAP& the_map, AttributeHandler& positions, const std::vector& profile, const typename PFP::VEC3& center, const typename PFP::VEC3& axis, @@ -178,7 +178,7 @@ Dart revolution(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, * @param nbSide number of steps around the revolution */ template -Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Dart extrudeFace(typename PFP::MAP& the_map, AttributeHandler& positions, Dart d, const typename PFP::VEC3& N); /** @@ -191,7 +191,7 @@ Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, * @param nbSide number of steps around the revolution */ template -Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, +Dart extrudeFace(typename PFP::MAP& the_map, AttributeHandler& positions, Dart d, float dist); } // namespace Modelisation diff --git a/include/Algo/Modelisation/extrusion.hpp b/include/Algo/Modelisation/extrusion.hpp index 768b00fd..a4b8d5c7 100644 --- a/include/Algo/Modelisation/extrusion.hpp +++ b/include/Algo/Modelisation/extrusion.hpp @@ -35,7 +35,7 @@ namespace Modelisation { template -Polyhedron* revolution_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const std::vector& profile, const typename PFP::VEC3& center, +Polyhedron* revolution_prim(typename PFP::MAP& the_map, AttributeHandler& position, const std::vector& profile, const typename PFP::VEC3& center, const typename PFP::VEC3& axis, bool profile_closed, int nbSides) { typedef typename PFP::VEC3 VEC3 ; @@ -64,7 +64,7 @@ Polyhedron* revolution_prim(typename PFP::MAP& the_map, typename PFP::TVEC3 } template -Dart revolution(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const std::vector& profile, const typename PFP::VEC3& center, +Dart revolution(typename PFP::MAP& the_map, AttributeHandler& position, const std::vector& profile, const typename PFP::VEC3& center, const typename PFP::VEC3& axis, bool profile_closed, int nbSides) { Polyhedron *prim = revolution_prim(the_map, position, profile, center, axis, profile_closed, nbSides); @@ -75,7 +75,7 @@ Dart revolution(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const template -Dart extrusion_scale(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed, +Dart extrusion_scale(typename PFP::MAP& the_map, AttributeHandler& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed, const std::vector& path, bool path_closed, const std::vector& scalePath) { Polyhedron *prim = extrusion_scale_prim(the_map, position, profile, centerProfile, normalProfile, profile_closed, path, path_closed,scalePath); @@ -85,7 +85,7 @@ Dart extrusion_scale(typename PFP::MAP& the_map, typename PFP::TVEC3& position, } template -Dart extrusion(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed, +Dart extrusion(typename PFP::MAP& the_map, AttributeHandler& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed, const std::vector& path, bool path_closed) { std::vector scalePath; @@ -95,10 +95,8 @@ Dart extrusion(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const return d; } - - template -Polyhedron* extrusion_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed, +Polyhedron* extrusion_prim(typename PFP::MAP& the_map, AttributeHandler& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normalProfile, bool profile_closed, const std::vector& path, bool path_closed) { std::vector scalePath; @@ -106,7 +104,7 @@ Polyhedron* extrusion_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& } template -Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP::TVEC3& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normal, bool profile_closed, const std::vector& path, bool path_closed, const std::vector& scalePath) +Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, AttributeHandler& position, const std::vector& profile, const typename PFP::VEC3& centerProfile, const typename PFP::VEC3& normal, bool profile_closed, const std::vector& path, bool path_closed, const std::vector& scalePath) { // topological creation Polyhedron *prim = new Polyhedron(the_map, position); @@ -228,7 +226,7 @@ Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP:: CGoGNout << "PATH: "<< i<< CGoGNendl; // apply transfo on object to embed Polyhedron. - for(typename std::vector::iterator ip=localObj.begin(); ip!=localObj.end(); ++ip) + for(typename std::vector::iterator ip = localObj.begin(); ip != localObj.end(); ++ip) { if (i!=0) //exept for first point of path { @@ -237,7 +235,7 @@ Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP:: (*ip)= Geom::transform((*ip), transf); - unsigned int em = the_map.newCell(VERTEX); + unsigned int em = the_map.template newCell(); // positions[em] = (*ip); typename PFP::VEC3 P = (*ip); //positions.at(em); @@ -259,7 +257,7 @@ Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP:: else position[em] = P; Dart d = vertD[index++]; - the_map.embedOrbit(VERTEX,d,em); + the_map.template embedOrbit(d, em); // rotate again to put profile in the good position along the path // pos4=Geom::Vec4f ((*ip)[0],(*ip)[1],(*ip)[2], 1.0f); @@ -275,7 +273,7 @@ Polyhedron* extrusion_scale_prim(typename PFP::MAP& the_map, typename PFP:: } template -Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, Dart d, const typename PFP::VEC3& N) +Dart extrudeFace(typename PFP::MAP& the_map, AttributeHandler& positions, Dart d, const typename PFP::VEC3& N) { typedef typename PFP::MAP MAP; @@ -316,7 +314,7 @@ Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& positions, Dar } template -Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& position, Dart d, float dist) +Dart extrudeFace(typename PFP::MAP& the_map, AttributeHandler& position, Dart d, float dist) { typedef typename PFP::MAP MAP; @@ -327,6 +325,8 @@ Dart extrudeFace(typename PFP::MAP& the_map, typename PFP::TVEC3& position, Dart return extrudeFace(the_map, position, d, normal); } -}//end namespace -}//end namespace -}//end namespace +} // namespace Modelisation + +} // namespace Algo + +} // namespace CGoGN diff --git a/include/Algo/Modelisation/triangulation.h b/include/Algo/Modelisation/triangulation.h index 4b9816a1..7b20b272 100644 --- a/include/Algo/Modelisation/triangulation.h +++ b/include/Algo/Modelisation/triangulation.h @@ -45,6 +45,9 @@ namespace Modelisation template class EarTriangulation { + typedef typename PFP::MAP MAP ; + typedef typename PFP::VEC3 VEC3 ; + protected: // forward declaration class VertexPoly; @@ -78,23 +81,23 @@ protected: protected: typename PFP::MAP& m_map; - AutoAttributeHandler m_dartEars; + AutoAttributeHandler m_dartEars; - AttributeHandler m_position; + AttributeHandler m_position; VPMS m_ears; - bool inTriangle(const typename PFP::VEC3& P, const typename PFP::VEC3& normal, const typename PFP::VEC3& Ta, const typename PFP::VEC3& Tb, const typename PFP::VEC3& Tc); + bool inTriangle(const VEC3& P, const VEC3& normal, const VEC3& Ta, const VEC3& Tb, const VEC3& Tc); - void recompute2Ears( Dart d, const typename PFP::VEC3& normalPoly, bool convex); + void recompute2Ears(Dart d, const VEC3& normalPoly, bool convex); - float computeEarInit(Dart d, const typename PFP::VEC3& normalPoly, float& val); + float computeEarInit(Dart d, const VEC3& normalPoly, float& val); public: - EarTriangulation(typename PFP::MAP& map) : m_map(map), m_dartEars(map, VERTEX) + EarTriangulation(MAP& map) : m_map(map), m_dartEars(map) { - m_position = map.template getAttribute(VERTEX,"position"); + m_position = map.template getAttribute("position"); } // void trianguleFace(Dart d, DartMarker& mark); diff --git a/include/Algo/Modelisation/triangulation.hpp b/include/Algo/Modelisation/triangulation.hpp index bf50df03..75bba9db 100644 --- a/include/Algo/Modelisation/triangulation.hpp +++ b/include/Algo/Modelisation/triangulation.hpp @@ -24,12 +24,13 @@ namespace CGoGN { + namespace Algo { + namespace Modelisation { - template bool EarTriangulation::inTriangle(const typename PFP::VEC3& P, const typename PFP::VEC3& normal, const typename PFP::VEC3& Ta, const typename PFP::VEC3& Tb, const typename PFP::VEC3& Tc) { @@ -48,8 +49,6 @@ bool EarTriangulation::inTriangle(const typename PFP::VEC3& P, const typena return true; } - - template void EarTriangulation::recompute2Ears( Dart d, const typename PFP::VEC3& normalPoly, bool convex) { @@ -111,7 +110,6 @@ void EarTriangulation::recompute2Ears( Dart d, const typename PFP::VEC3& no m_dartEars[d] = m_ears.insert(VertexPoly(d,dotpr2,length)); } - template float EarTriangulation::computeEarInit(Dart d, const typename PFP::VEC3& normalPoly, float& val) { @@ -152,8 +150,6 @@ float EarTriangulation::computeEarInit(Dart d, const typename PFP::VEC3& no return (Tb-Tc).norm2(); } - - template //void EarTriangulation::trianguleFace(Dart d, DartMarker& mark) void EarTriangulation::trianguleFace(Dart d) @@ -217,10 +213,8 @@ void EarTriangulation::trianguleFace(Dart d) // mark.markOrbit(e1); // mark last face } m_ears.clear(); - } - template void EarTriangulation::triangule( const FunctorSelect& good, unsigned int thread) { @@ -247,9 +241,8 @@ void EarTriangulation::triangule( const FunctorSelect& good, unsigned int t } } +} // namespace Modelisation +} // namespace Algo -} -} -} - +} // namespace CGoGN diff --git a/include/Algo/Render/GL1/map_glRender.h b/include/Algo/Render/GL1/map_glRender.h index c74c642a..d403c4b0 100644 --- a/include/Algo/Render/GL1/map_glRender.h +++ b/include/Algo/Render/GL1/map_glRender.h @@ -59,19 +59,19 @@ enum RenderPrimitives { NONE=0, TRIANGLES=3, QUADS=4, POLYGONS=5, TRIFAN=6 }; */ template void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, - const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, const FunctorSelect& good = allDarts); + const AttributeHandler& position, const AttributeHandler& normal, const FunctorSelect& good = allDarts); template void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, - const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, const typename PFP::TVEC3& color, const FunctorSelect& good = allDarts); + const AttributeHandler& position, const AttributeHandler& normal, const AttributeHandler& color, const FunctorSelect& good = allDarts); template void renderNormalVertices(typename PFP::MAP& the_map, - const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, float scale, const FunctorSelect& good = allDarts); + const AttributeHandler& position, const AttributeHandler& normal, float scale, const FunctorSelect& good = allDarts); template void renderFrameVertices(typename PFP::MAP& the_map, - const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], float scale, const FunctorSelect& good = allDarts); + const AttributeHandler& position, const AttributeHandler frame[3], float scale, const FunctorSelect& good = allDarts); } // namespace Direct diff --git a/include/Algo/Render/GL1/map_glRender.hpp b/include/Algo/Render/GL1/map_glRender.hpp index 91db6cde..b7d9568f 100644 --- a/include/Algo/Render/GL1/map_glRender.hpp +++ b/include/Algo/Render/GL1/map_glRender.hpp @@ -42,7 +42,7 @@ namespace GL1 { template -void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, const FunctorSelect& good) +void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, const AttributeHandler& position, const AttributeHandler& normal, const FunctorSelect& good) { // RenderType => lighted & smooth ?? bool lighted = (rt != NO_LIGHT) && (rt!= LINE); @@ -51,9 +51,8 @@ void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, // first pass render the triangles FunctorGLFace fgl_tri(the_map, lighted, smooth, 3, explode, true, position, normal, good); - glBegin(GL_TRIANGLES); - the_map.foreach_orbit(FACE, fgl_tri, good); + the_map.template foreach_orbit(fgl_tri, good); glEnd(); // get untreated quads & polygons @@ -108,7 +107,7 @@ void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, template -void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, const typename PFP::TVEC3& color, const FunctorSelect& good) +void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, const AttributeHandler& position, const AttributeHandler& normal, const AttributeHandler& color, const FunctorSelect& good) { // RenderType => lighted & smooth ?? bool lighted = (rt != NO_LIGHT) && (rt!= LINE); @@ -173,7 +172,7 @@ void renderTriQuadPoly(typename PFP::MAP& the_map, RenderType rt, float explode, template -void renderNormalVertices(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, const typename PFP::TVEC3& normal, float scale, const FunctorSelect& good) +void renderNormalVertices(typename PFP::MAP& the_map, const AttributeHandler& position, const AttributeHandler& normal, float scale, const FunctorSelect& good) { FunctorGLNormal fgl_norm(the_map, good, position, normal, scale); @@ -183,7 +182,7 @@ void renderNormalVertices(typename PFP::MAP& the_map, const typename PFP::TVEC3& } template -void renderFrameVertices(typename PFP::MAP& the_map, const typename PFP::TVEC3& position, const typename PFP::TVEC3 frame[3], float scale, const FunctorSelect& good) +void renderFrameVertices(typename PFP::MAP& the_map, const AttributeHandler& position, const AttributeHandler frame[3], float scale, const FunctorSelect& good) { FunctorGLFrame fgl_frame(the_map, good, position, frame, scale) ; diff --git a/include/Algo/Render/GL1/renderFunctor.h b/include/Algo/Render/GL1/renderFunctor.h index 9249c69e..ae4c0933 100644 --- a/include/Algo/Render/GL1/renderFunctor.h +++ b/include/Algo/Render/GL1/renderFunctor.h @@ -39,7 +39,6 @@ namespace Render namespace GL1 { - template class FunctorGLFace: public FunctorMap { @@ -74,12 +73,12 @@ protected: /** * positions of vertices */ - const typename PFP::TVEC3& m_positions; + const AttributeHandler& m_positions; /** * normals of vertices */ - const typename PFP::TVEC3& m_normals; + const AttributeHandler& m_normals; /** * vector of darts (one for each polygon) @@ -103,7 +102,7 @@ public: * @param good dart selector */ FunctorGLFace(MAP& map, bool lighted, bool smooth, int nbe, float expl, bool stor, - const typename PFP::TVEC3& posi, const typename PFP::TVEC3& normals , const FunctorSelect& good); + const AttributeHandler& posi, const AttributeHandler& normals , const FunctorSelect& good); /** * get back the vector of darts of faces that have not been treated @@ -168,17 +167,17 @@ protected: /** * positions of vertices */ - const typename PFP::TVEC3& m_positions; + const AttributeHandler& m_positions; /** * normals of vertices */ - const typename PFP::TVEC3& m_normals; + const AttributeHandler& m_normals; /** * colors of vertices */ - const typename PFP::TVEC3& m_colors; + const AttributeHandler& m_colors; /** * vector of darts (one for each polygon) @@ -194,7 +193,7 @@ protected: public: FunctorGLFaceColor(MAP& map, bool lighted, bool smooth, int nbe, float expl, bool stor, - const typename PFP::TVEC3& posi, const typename PFP::TVEC3& normals , const typename PFP::TVEC3& colors ,const FunctorSelect& good); + const AttributeHandler& posi, const AttributeHandler& normals , const AttributeHandler& colors ,const FunctorSelect& good); std::vector& getPolyDarts(); @@ -215,12 +214,12 @@ protected: /** * positions of vertices */ - const typename PFP::TVEC3& m_positions; + const AttributeHandler& m_positions; /** * normals of vertices */ - const typename PFP::TVEC3& m_normals; + const AttributeHandler& m_normals; /** * Dart selector to restrict the rendering @@ -234,7 +233,7 @@ public: * @param good dart selector */ - FunctorGLNormal(MAP& map, const FunctorSelect& good, const typename PFP::TVEC3& posi, const typename PFP::TVEC3& normals, float scale); + FunctorGLNormal(MAP& map, const FunctorSelect& good, const AttributeHandler& posi, const AttributeHandler& normals, float scale); bool operator() (Dart d); }; @@ -249,12 +248,12 @@ protected: /** * positions of vertices */ - const typename PFP::TVEC3& m_positions; + const AttributeHandler& m_positions; /** * frame of vertices */ - const typename PFP::TVEC3 *m_frames; + const AttributeHandler *m_frames; /** * Dart selector to restrict the rendering @@ -268,7 +267,7 @@ public: * @param good dart selector */ - FunctorGLFrame (MAP& map, const FunctorSelect& good, const typename PFP::TVEC3& posi, const typename PFP::TVEC3 frames[3], float scale); + FunctorGLFrame (MAP& map, const FunctorSelect& good, const AttributeHandler& posi, const AttributeHandler frames[3], float scale); bool operator() (Dart d); }; diff --git a/include/Algo/Render/GL1/renderFunctor.hpp b/include/Algo/Render/GL1/renderFunctor.hpp index c0ed4dd0..ef94ea21 100644 --- a/include/Algo/Render/GL1/renderFunctor.hpp +++ b/include/Algo/Render/GL1/renderFunctor.hpp @@ -49,7 +49,7 @@ namespace GL1 */ template FunctorGLFace::FunctorGLFace(MAP& map, bool lighted, bool smooth, int nbe, float expl, bool stor, - const typename PFP::TVEC3& posi, const typename PFP::TVEC3& normals , const FunctorSelect& good): + const AttributeHandler& posi, const AttributeHandler& normals , const FunctorSelect& good): FunctorMap(map), m_smooth(smooth), m_lighted(lighted), @@ -62,7 +62,6 @@ FunctorGLFace::FunctorGLFace(MAP& map, bool lighted, bool smooth, int nbe, { } - /** * get back the vector of darts of faces that have not been treated */ @@ -339,7 +338,7 @@ void FunctorGLFace::renderFaceExplode(Dart d) } template -FunctorGLNormal::FunctorGLNormal(MAP& map, const FunctorSelect& good, const typename PFP::TVEC3& posi, const typename PFP::TVEC3& normals, float scale): +FunctorGLNormal::FunctorGLNormal(MAP& map, const FunctorSelect& good, const AttributeHandler& posi, const AttributeHandler& normals, float scale): FunctorMap(map), m_positions(posi), m_normals(normals), @@ -362,7 +361,7 @@ bool FunctorGLNormal::operator() (Dart d) } template -FunctorGLFrame::FunctorGLFrame(MAP& map, const FunctorSelect& good, const typename PFP::TVEC3& posi, const typename PFP::TVEC3 frames[3], float scale): +FunctorGLFrame::FunctorGLFrame(MAP& map, const FunctorSelect& good, const AttributeHandler& posi, const AttributeHandler frames[3], float scale): FunctorMap(map), m_positions(posi), m_frames(frames), @@ -390,7 +389,7 @@ bool FunctorGLFrame::operator() (Dart d) template FunctorGLFaceColor::FunctorGLFaceColor(MAP& map, bool lighted, bool smooth, int nbe, float expl, bool stor, - const typename PFP::TVEC3& posi, const typename PFP::TVEC3& normals, const typename PFP::TVEC3& colors , const FunctorSelect& good): + const AttributeHandler& posi, const AttributeHandler& normals, const AttributeHandler& colors , const FunctorSelect& good): FunctorMap(map), m_smooth(smooth), m_lighted(lighted), @@ -409,7 +408,6 @@ std::vector& FunctorGLFaceColor::getPolyDarts() return m_poly; } - template bool FunctorGLFaceColor::operator() (Dart d) { @@ -595,7 +593,6 @@ void FunctorGLFaceColor::renderFace(Dart d) } } - template void FunctorGLFaceColor::renderFaceExplode(Dart d) { @@ -675,7 +672,6 @@ void FunctorGLFaceColor::renderFaceExplode(Dart d) { m_poly.push_back(d); //CGoGNout << "store dart"< -void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positions, bool drawPhi1, bool drawPhi2, float ke, float kf); +void renderTopoMD2(typename PFP::MAP& the_map, const AttributeHandler& positions, bool drawPhi1, bool drawPhi2, float ke, float kf); /** @@ -78,10 +77,10 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi * @param kv exploding coefficient for volumes (1.0 normal draw) */ template -void renderTopoMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv, FunctorType& good); +void renderTopoMD3(typename PFP::MAP& map, const AttributeHandler& positions, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv, FunctorType& good); template -void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv); +void renderTopoMD3(typename PFP::MAP& map, AttributeHandler& positions, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv); /** @@ -94,7 +93,7 @@ void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool * @param kf exploding coefficient for face (1.0 normal draw) */ template -void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, float ke, float kf); +void renderTopoGMD2(typename PFP::MAP& map, const AttributeHandler& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, float ke, float kf); /** * Render darts of g-map @@ -108,7 +107,7 @@ void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions * @param kv exploding coefficient for volumes (1.0 normal draw) */ template -void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, bool drawBeta3, float kd, float ke, float kf, float kv); +void renderTopoGMD3(typename PFP::MAP& map, const AttributeHandler& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, bool drawBeta3, float kd, float ke, float kf, float kv); } // namespace GL1 diff --git a/include/Algo/Render/GL1/topo_render.hpp b/include/Algo/Render/GL1/topo_render.hpp index aa940ce0..0af2b720 100644 --- a/include/Algo/Render/GL1/topo_render.hpp +++ b/include/Algo/Render/GL1/topo_render.hpp @@ -40,15 +40,15 @@ namespace GL1 { template -void renderTopoMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions, bool drawPhi1, bool drawPhi2, float ke, float kf) +void renderTopoMD2(typename PFP::MAP& map, const AttributeHandler& positions, bool drawPhi1, bool drawPhi2, float ke, float kf) { typedef typename PFP::VEC3 VEC3; typedef typename PFP::REAL REAL; - AutoAttributeHandler fv1(map, DART); - AutoAttributeHandler fv11(map, DART); - AutoAttributeHandler fv2(map, DART); - AutoAttributeHandler vert(map, DART); + AutoAttributeHandler fv1(map); + AutoAttributeHandler fv11(map); + AutoAttributeHandler fv2(map); + AutoAttributeHandler vert(map); glLineWidth(2.0f); glColor3f(0.9f,0.9f,0.9f); @@ -138,16 +138,16 @@ void renderTopoMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions, } template -void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv) +void renderTopoMD3(typename PFP::MAP& map, AttributeHandler& positions, bool drawPhi1, bool drawPhi2, bool drawPhi3, float ke, float kf, float kv) { typedef typename PFP::VEC3 VEC3; typedef typename PFP::REAL REAL; - AutoAttributeHandler fv1(map, DART); - AutoAttributeHandler fv11(map, DART); - AutoAttributeHandler fv2(map, DART); - AutoAttributeHandler fv2x(map, DART); - AutoAttributeHandler vert(map, DART); + AutoAttributeHandler fv1(map); + AutoAttributeHandler fv11(map); + AutoAttributeHandler fv2(map); + AutoAttributeHandler fv2x(map); + AutoAttributeHandler vert(map); int m_nbDarts = 0; @@ -164,7 +164,7 @@ void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool DartMarker mark(map); // marker for darts for (Dart d = map.begin(); d != map.end(); map.next(d)) { - CellMarkerStore markVert(map, VERTEX); //marker for vertices + CellMarkerStore markVert(map); //marker for vertices VEC3 center(0, 0, 0); unsigned int nbv = 0; unsigned int nbf = 0; @@ -264,7 +264,6 @@ void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool } } - for(Dart d = map.begin(); d != map.end(); map.next(d)) { Dart e = map.phi2(d); @@ -305,14 +304,14 @@ void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool } template -void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, float kd, float ke, float kf) +void renderTopoGMD2(typename PFP::MAP& map, const AttributeHandler& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, float kd, float ke, float kf) { typedef typename PFP::VEC3 VEC3; typedef typename PFP::REAL REAL; - AutoAttributeHandler posBeta1(map, DART); - AutoAttributeHandler posBeta2(map, DART); - AutoAttributeHandler vert(map, DART); + AutoAttributeHandler posBeta1(map); + AutoAttributeHandler posBeta2(map); + AutoAttributeHandler vert(map); glLineWidth(2.0f); glColor3f(0.9f,0.9f,0.9f); @@ -414,14 +413,14 @@ void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions } template -void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, bool drawBeta3, float kd, float ke, float kf, float kv) +void renderTopoGMD3(typename PFP::MAP& map, const AttributeHandler& positions, bool drawBeta0, bool drawBeta1, bool drawBeta2, bool drawBeta3, float kd, float ke, float kf, float kv) { typedef typename PFP::VEC3 VEC3; typedef typename PFP::REAL REAL; - AutoAttributeHandler posBeta1(map, DART); - AutoAttributeHandler posBeta2(map, DART); //beta 3 link is represented at the same location as beta2 - AutoAttributeHandler vert(map, DART); + AutoAttributeHandler posBeta1(map); + AutoAttributeHandler posBeta2(map); //beta 3 link is represented at the same location as beta2 + AutoAttributeHandler vert(map); // table of face (one dart of each) std::vector vecDartFaces; @@ -436,7 +435,7 @@ void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions vecVolCenters.reserve(vecDartFaces.size()/4); // = nb of volumes for a tetra mesh DartMarker mark(map); // marker for darts - CellMarker mVol(map, VOLUME); + CellMarker mVol(map); // DartMarker mVol(map); //compute barycenter and get a dart by face @@ -447,7 +446,7 @@ void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions mVol.mark(d); // mVol.markOrbit(VOLUME,d); - CellMarkerStore markVert(map, VERTEX); //marker for vertices + CellMarkerStore markVert(map); //marker for vertices VEC3 center(0); unsigned int nbVertices = 0; unsigned int nbf = 0; @@ -565,7 +564,6 @@ void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions } } - //draw beta1, beta2, beta3 if required for(Dart d = map.begin(); d != map.end(); map.next(d)) { @@ -606,7 +604,6 @@ void renderTopoGMD3(typename PFP::MAP& map, const typename PFP::TVEC3& positions glVertex3fv(vert[d].data()); } glEnd(); - } } // namespace GL1 -- GitLab