diff --git a/Apps/Examples/clipping.cpp b/Apps/Examples/clipping.cpp index 777b3e21458f089bf29b44166e3b3d9070c91747..10ece09e10026369cfccc5b68f22a76c51303165 100644 --- a/Apps/Examples/clipping.cpp +++ b/Apps/Examples/clipping.cpp @@ -843,7 +843,7 @@ void Clipping::cb_initGL() // create the render m_render = new Algo::Render::GL2::MapRender(); - m_render_topo = new Algo::Render::GL2::Topo3Render(); + m_render_topo = new Algo::Render::GL2::Topo3RenderMap(); // create VBO for position m_positionVBO = new Utils::VBO(); diff --git a/Apps/Examples/mcmesh.h b/Apps/Examples/mcmesh.h index 61eab5c0d1c0f21f95cdc30995c37971e604c605..e2010e5717d76d0259fe1174e3668a64d97aad2a 100644 --- a/Apps/Examples/mcmesh.h +++ b/Apps/Examples/mcmesh.h @@ -29,7 +29,6 @@ #include "Utils/Qt/qtui.h" #include "Topology/generic/parameters.h" -#include "Topology/map/map2.h" #include "Topology/map/embeddedMap2.h" #include "Geometry/vector_gen.h" @@ -66,7 +65,6 @@ class MCMesh : public Utils::QT::SimpleQT public: MAP myMap ; - SelectorTrue allDarts ; Utils::QT::uiDockInterface dock ; diff --git a/Apps/Examples/simpleGMap3.cpp b/Apps/Examples/simpleGMap3.cpp index af47ae639b325014d322018a10c96f6bc7d83683..997499391f8418a62d9ad4bc3a538b773697fa4b 100644 --- a/Apps/Examples/simpleGMap3.cpp +++ b/Apps/Examples/simpleGMap3.cpp @@ -132,7 +132,7 @@ void SimpleGMap3::cb_initGL() float gWidthObj = std::max(std::max(tailleX, tailleY), tailleZ) ; setParamObject(gWidthObj, gPosObj.data()); - m_render_topo = new Algo::Render::GL2::Topo3Render(); + m_render_topo = new Algo::Render::GL2::Topo3RenderGMap(); m_render_topo->setDartWidth(2.0f); m_render_topo->setInitialDartsColor(1.0f,1.0f,1.0f); m_render_topo->updateData(myMap, position, 0.9f,0.9f,0.8f); diff --git a/Apps/Examples/volumeExplorer.cpp b/Apps/Examples/volumeExplorer.cpp index 3843e97f873f41d9c5e6fc51148edfaed4c613ed..6fa68d50bbf72ded24b806b9f58e096f7c5e47a4 100644 --- a/Apps/Examples/volumeExplorer.cpp +++ b/Apps/Examples/volumeExplorer.cpp @@ -22,7 +22,6 @@ * * *******************************************************************************/ - #include "volumeExplorer.h" #include @@ -35,10 +34,9 @@ #include "Algo/Export/exportVol.h" - -PFP::MAP myMap; -VertexAttribute position ; -VolumeAttribute color ; +MAP myMap; +VertexAttribute position ; +VolumeAttribute color ; void MyQT::volumes_onoff(bool /*x*/) { @@ -59,7 +57,7 @@ void MyQT::topo_onoff(bool /*x*/) { // SelectorDartNoBoundary nb(myMap); //TODO MapBrowser - m_topo_render->updateData(myMap, position, 0.8f, m_explode_factorf-0.05f, m_explode_factor); + m_topo_render->updateData(myMap, position, 0.8f, m_explode_factorf-0.05f, m_explode_factor); } updateGL(); @@ -96,7 +94,6 @@ void MyQT::hide_onoff(bool /*x*/) updateGL(); } - void MyQT::slider_explode(int x) { m_explode_factor = 0.01f*(x+1)-0.0001f; @@ -111,7 +108,6 @@ void MyQT::slider_explodeF(int x) updateGL(); } - void MyQT::slider_pressed() { render_topoTemp = render_topo; @@ -119,10 +115,8 @@ void MyQT::slider_pressed() updateGL(); } - void MyQT::slider_released() { - render_topo = render_topoTemp; if (render_topo) { @@ -190,7 +184,7 @@ void MyQT::cb_Open() } // SelectorDartNoBoundary nb(myMap); - m_topo_render->updateData(myMap, position, 0.8f, 0.8f, 0.8f); + m_topo_render->updateData(myMap, position, 0.8f, 0.8f, 0.8f); m_explode_render->updateData(myMap, position, color); updateGL() ; @@ -206,14 +200,13 @@ void MyQT::cb_Save() Algo::Volume::Export::exportMesh(myMap,position,filename); } - void MyQT::cb_initGL() { // choose to use GL version 2 Utils::GLSLShader::setCurrentOGLVersion(2); // create the renders - m_topo_render = new Algo::Render::GL2::Topo3Render(); + m_topo_render = new Algo::Render::GL2::Topo3RenderMap(); m_explode_render = new Algo::Render::GL2::ExplodeVolumeRender(true,true,true); // SelectorDartNoBoundary nb(myMap); diff --git a/Apps/Examples/volumeExplorer.h b/Apps/Examples/volumeExplorer.h index 6123feaee2207ef65c30edd82ac82f09db3c1687..3e65240a9256a8c307d6f43df6ec51376765e474 100644 --- a/Apps/Examples/volumeExplorer.h +++ b/Apps/Examples/volumeExplorer.h @@ -24,17 +24,10 @@ #ifndef __TUTO5_ #define __TUTO5_ - #include -// #define WITH_GMAP 1 - #include "Topology/generic/parameters.h" -#ifdef WITH_GMAP - #include "Topology/gmap/embeddedGMap3.h" -#else - #include "Topology/map/embeddedMap3.h" -#endif +#include "Topology/map/embeddedMap3.h" #include "Geometry/vector_gen.h" #include "Algo/Geometry/boundingbox.h" @@ -56,17 +49,15 @@ using namespace CGoGN ; struct PFP: public PFP_STANDARD { // definition de la carte -#ifdef WITH_GMAP - typedef EmbeddedGMap3 MAP; -#else typedef EmbeddedMap3 MAP; -#endif }; +typedef PFP::MAP MAP; +typedef PFP::MAP::IMPL MAP_IMPL; +typedef PFP::VEC3 VEC3; using namespace CGoGN ; - /** * Utilisation de designer-qt4: * Faire un DockWiget (laisser le nom par defaut @@ -85,7 +76,7 @@ class MyQT: public Utils::QT::SimpleQT bool clip_volume; bool hide_clipping; - Algo::Render::GL2::Topo3Render* m_topo_render; + Algo::Render::GL2::Topo3RenderMap* m_topo_render; Algo::Render::GL2::ExplodeVolumeRender* m_explode_render; float m_explode_factor; diff --git a/Apps/SandBox/multi_att.cpp b/Apps/SandBox/multi_att.cpp index 744de2d6fa79e6b608080aa77c13dc7b8eae6fe0..2626b470ea4d5311d8b13a790dc6791277d5dcb6 100644 --- a/Apps/SandBox/multi_att.cpp +++ b/Apps/SandBox/multi_att.cpp @@ -50,6 +50,11 @@ struct PFP: public PFP_STANDARD typedef EmbeddedMap2 MAP; }; +typedef typename PFP::MAP MAP; +typedef typename PFP::MAP::IMPL MAP_IMPL; +typedef typename PFP::VEC3 VEC3; +typedef typename PFP::VEC4 VEC4; + /** * Simple example of function that work with generic type of attribute */ @@ -59,7 +64,6 @@ typename V_ATT::DATA_TYPE smooth(typename PFP::MAP& map, Dart d, const V_ATT& at typename V_ATT::DATA_TYPE res(0); int count=0; - if (attributs.getOrbit() == VERTEX) { Traversor2VVaE tra(map,d); @@ -86,7 +90,6 @@ typename V_ATT::DATA_TYPE smooth(typename PFP::MAP& map, Dart d, const V_ATT& at return res; } - template void applySmooth(typename PFP::MAP& map, const V_ATT& att_in, V_ATT& att_out) { @@ -111,11 +114,6 @@ void applySmooth(typename PFP::MAP& map, const V_ATT& att_in, V_ATT& att_out) CGoGNerr << "unsupported orbit"<< CGoGNendl; } - - - - - int main(int argc, char **argv) { if(argc != 3) @@ -131,31 +129,30 @@ int main(int argc, char **argv) iss >> nbSteps; // declaration of the map - PFP::MAP myMap; + MAP myMap; std::vector attrNames ; Algo::Surface::Import::importMesh(myMap, argv[1], attrNames); // get a handler to the 3D vector attribute created by the import - VertexAttribute position = myMap.getAttribute(attrNames[0]); - VertexAttribute pos2 = myMap.addAttribute("pos2"); - VertexAttribute vc = myMap.addAttribute("vertexColor"); - VertexAttribute vc2 = myMap.addAttribute("vertexColor2"); + VertexAttribute position = myMap.getAttribute(attrNames[0]); + VertexAttribute pos2 = myMap.addAttribute("pos2"); + VertexAttribute vc = myMap.addAttribute("vertexColor"); + VertexAttribute vc2 = myMap.addAttribute("vertexColor2"); // classic usage with simple vertex attributes - applySmooth(myMap,position,pos2); - + applySmooth(myMap, position, pos2); // multi attributes usage - Vertex2Attributes pv_in(position,vc); - Vertex2Attributes pv_out(pos2,vc2); - applySmooth(myMap,pv_in,pv_out); + Vertex2Attributes pv_in(position, vc); + Vertex2Attributes pv_out(pos2, vc2); + applySmooth(myMap, pv_in, pv_out); // usage with with a face attribute - FaceAttribute fc = myMap.addAttribute("faceColor"); - FaceAttribute fc2 = myMap.addAttribute("faceColor2"); - applySmooth(myMap,fc,fc2); + FaceAttribute fc = myMap.addAttribute("faceColor"); + FaceAttribute fc2 = myMap.addAttribute("faceColor2"); + applySmooth(myMap, fc, fc2); //// for(unsigned int i = 0; i < nbSteps; ++i) diff --git a/include/Algo/Export/export.h b/include/Algo/Export/export.h index 48b992166210566610306e6a9a7a8c2191b54789..43576715120c2f8a367e897bd385c5096812579b 100644 --- a/include/Algo/Export/export.h +++ b/include/Algo/Export/export.h @@ -52,7 +52,7 @@ namespace Export * @return true */ template -bool exportPLY(typename PFP::MAP& map, const VertexAttribute& position, const char* filename, const bool binary) ; +bool exportPLY(typename PFP::MAP& map, const VertexAttribute& position, const char* filename, const bool binary) ; /** * export the map into a PLY file @@ -63,7 +63,7 @@ bool exportPLY(typename PFP::MAP& map, const VertexAttribute * @return true */ template -bool exportPLYnew(typename PFP::MAP& map, const std::vector* >& attributeHandlers, const char* filename, const bool binary) ; +bool exportPLYnew(typename PFP::MAP& map, const std::vector* >& attributeHandlers, const char* filename, const bool binary) ; /** * export the map into a OFF file @@ -72,7 +72,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector -bool exportOFF(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) ; +bool exportOFF(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) ; /** * export the map into a OBJ file @@ -81,7 +81,7 @@ bool exportOFF(typename PFP::MAP& map, const VertexAttribute * @return true */ template -bool exportOBJ(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) ; +bool exportOBJ(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) ; /** * export the map into a Trian file @@ -90,7 +90,7 @@ bool exportOBJ(typename PFP::MAP& map, const VertexAttribute * @return true */ template -bool exportTrian(typename PFP::MAP& map, const VertexAttribute& position, char* filename) ; +bool exportTrian(typename PFP::MAP& map, const VertexAttribute& position, char* filename) ; @@ -160,12 +160,12 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const VertexAttr * @return */ template -bool exportChoupi(typename PFP::MAP& map, const AttributeHandler& position, const char* filename) ; +bool exportChoupi(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) ; } // namespace Export -} +} // namespace Surface } // namespace Algo diff --git a/include/Algo/Export/export.hpp b/include/Algo/Export/export.hpp index 063a8b1f367fab2573564627c8f19ee299119597..38a37597ca8fd3b534f26a763ac6ad149822d304 100644 --- a/include/Algo/Export/export.hpp +++ b/include/Algo/Export/export.hpp @@ -43,7 +43,7 @@ namespace Export { template -bool exportPLY(typename PFP::MAP& map, const VertexAttribute& position, const char* filename, bool binary) +bool exportPLY(typename PFP::MAP& map, const VertexAttribute& position, const char* filename, bool binary) { typedef typename PFP::MAP MAP; typedef typename PFP::VEC3 VEC3; @@ -72,7 +72,7 @@ bool exportPLY(typename PFP::MAP& map, const VertexAttribute vertices.reserve(nbDarts/6) ; // Go over all faces - CellMarker markV(map) ; + CellMarker markV(map) ; TraversorF t(map) ; for(Dart d = t.begin(); d != t.end(); d = t.next()) { @@ -170,9 +170,10 @@ bool exportPLY(typename PFP::MAP& map, const VertexAttribute } template -bool exportPLYnew(typename PFP::MAP& map, const std::vector*>& attributeHandlers, const char* filename, bool binary) +bool exportPLYnew(typename PFP::MAP& map, const std::vector*>& attributeHandlers, const char* filename, bool binary) { typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; typedef typename PFP::VEC3 VEC3; // open file @@ -199,14 +200,14 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector markV(map) ; + CellMarker markV(map) ; TraversorF t(map) ; for(Dart d = t.begin(); d != t.end(); d = t.next()) { std::vector fidx ; fidx.reserve(8) ; unsigned int degree = 0 ; - Traversor2FV tfv(map, d) ; + Traversor2FV tfv(map, d) ; for(Dart it = tfv.begin(); it != tfv.end(); it = tfv.next()) { ++degree ; @@ -246,7 +247,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) + for (typename std::vector* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) { if ((*attrHandler)->isValid() && ((*attrHandler)->getOrbit() == VERTEX) ) { @@ -287,7 +288,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) + for (typename std::vector* >::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX) out << (*(*attrHandler))[vertices[i]] ; out << std::endl ; @@ -306,10 +307,10 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector*>::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) + for (typename std::vector*>::const_iterator attrHandler = attributeHandlers.begin() ; attrHandler != attributeHandlers.end() ; ++attrHandler) if ((*attrHandler)->isValid() && (*attrHandler)->getOrbit() == VERTEX) { - const typename PFP::VEC3& v = (*(*attrHandler))[vertices[i]] ; + const VEC3& v = (*(*attrHandler))[vertices[i]] ; out.write((char*)(&(v[0])), sizeof(v)) ; } @@ -328,7 +329,7 @@ bool exportPLYnew(typename PFP::MAP& map, const std::vector -bool exportOFF(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) +bool exportOFF(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) { typedef typename PFP::MAP MAP; typedef typename PFP::VEC3 VEC3; @@ -350,7 +351,7 @@ bool exportOFF(typename PFP::MAP& map, const VertexAttribute std::vector vertices ; vertices.reserve(nbDarts/6) ; - CellMarker markV(map) ; + CellMarker markV(map) ; TraversorF t(map) ; for(Dart d = t.begin(); d != t.end(); d = t.next()) { @@ -986,7 +987,7 @@ bool exportPLYPTM(typename PFP::MAP& map, const char* filename, const VertexAttr */ template -bool exportChoupi(typename PFP::MAP& map, const AttributeHandler& position, const char* filename) +bool exportChoupi(typename PFP::MAP& map, const VertexAttribute& position, const char* filename) { typedef typename PFP::MAP MAP; typedef typename PFP::VEC3 VEC3; @@ -1000,13 +1001,13 @@ bool exportChoupi(typename PFP::MAP& map, const AttributeHandler() << " " << map.template getNbOrbits() << std::endl; - TraversorV travV(map); + TraversorV travV(map); for(Dart dit = travV.begin() ; dit != travV.end() ; dit = travV.next()) { out << map.template getEmbedding(dit) << " " << position[dit] << std::endl; } - TraversorE travE(map); + TraversorE travE(map); unsigned int indexE = 0; for(Dart dit = travE.begin() ; dit != travE.end() ; dit = travE.next()) { @@ -1018,11 +1019,9 @@ bool exportChoupi(typename PFP::MAP& map, const AttributeHandler& mts) if (good_dart == map.phi2(good_dart)) { map.sewFaces(d, good_dart, false); - m.unmarkOrbit(d); + m.template unmarkOrbit(d); } else { @@ -132,7 +132,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesSurface& mts) if (good_dart == NIL) { - m.unmarkOrbit(d); + m.template unmarkOrbit(d); ++nbBoundaryEdges; } } diff --git a/include/Algo/Parallel/parallel_foreach.hpp b/include/Algo/Parallel/parallel_foreach.hpp index 0e27bbb4c1e14f5fd3cf3b116d950197fbb5bc9f..7de6c6816b85ee1b10e5b1f3c63200cb2807c000 100644 --- a/include/Algo/Parallel/parallel_foreach.hpp +++ b/include/Algo/Parallel/parallel_foreach.hpp @@ -221,7 +221,7 @@ void foreach_cell(MAP& map, std::vector*>& funcs, bool n { if ((!map.template isBoundaryMarked(d)) && (!dmark->isMarked(d))) { - dmark->markOrbit(d); + dmark->template markOrbit(d); vd[nb%nbth].push_back(d); nb++; } @@ -315,7 +315,7 @@ void foreach_cell(MAP& map, std::vector*>& funcs, bool n { if ((!map.template isBoundaryMarked(d)) && (!dmark->isMarked(d))) { - dmark->markOrbit(d); + dmark->template markOrbit(d); tempo[nb%nbth].push_back(d); nb++; } diff --git a/include/Algo/Render/GL2/explodeVolumeRender.h b/include/Algo/Render/GL2/explodeVolumeRender.h index 7af40b45511c8e995a5cfc84176e6857ba769ea1..f59b12ed64c8388a7ae57063d320c0575252999c 100644 --- a/include/Algo/Render/GL2/explodeVolumeRender.h +++ b/include/Algo/Render/GL2/explodeVolumeRender.h @@ -162,7 +162,6 @@ public: template void updateData(typename PFP::MAP& map, const V_ATT& positions, const W_ATT& colorPerFace) ; - /** * draw edges */ diff --git a/include/Algo/Render/GL2/explodeVolumeRender.hpp b/include/Algo/Render/GL2/explodeVolumeRender.hpp index 59bbd3ba700d8b5c066ea9f27f11a0fc35a8f31f..fff3e0272e3a5b3f6603d86de5633ae4cac0ad9f 100644 --- a/include/Algo/Render/GL2/explodeVolumeRender.hpp +++ b/include/Algo/Render/GL2/explodeVolumeRender.hpp @@ -138,23 +138,23 @@ void ExplodeVolumeRender::computeFace(typename PFP::MAP& map, Dart d, const EMBV } } - //template //void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const VertexAttribute& positions, const VolumeAttribute& colorPerXXX) //{ // updateSmoothGen, typename PFP::VEC3>(map,positions,colorPerXXX); //} - template void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& positions, const W_ATT& colorPerXXX) { typedef typename V_ATT::DATA_TYPE VEC3; typedef typename W_ATT::DATA_TYPE COL3; + typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; typedef typename PFP::REAL REAL; typedef Geom::Vec3f VEC3F; - VolumeAutoAttribute centerVolumes(map, "centerVolumes"); + VolumeAutoAttribute centerVolumes(map, "centerVolumes"); Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes(map, positions, centerVolumes); std::vector buffer; @@ -170,8 +170,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const V_ATT& posi std::vector vertices; vertices.reserve(20); - - TraversorCell traFace(map); + TraversorCell traFace(map); for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next()) { @@ -285,10 +284,12 @@ template void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& positions) { typedef typename EMBV::DATA_TYPE VEC3; + typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; typedef typename PFP::REAL REAL; typedef typename Geom::Vec3f VEC3F; - VolumeAutoAttribute centerVolumes(map, "centerVolumes"); + VolumeAutoAttribute centerVolumes(map, "centerVolumes"); Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes(map, positions, centerVolumes); std::vector buffer; @@ -304,7 +305,7 @@ void ExplodeVolumeRender::updateSmooth(typename PFP::MAP& map, const EMBV& posit std::vector vertices; bufferNormals.reserve(20); - TraversorCell traFace(map); + TraversorCell traFace(map); for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next()) { @@ -431,10 +432,12 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const V_ATT& positi //typedef typename PFP::VEC3 VEC3; typedef typename V_ATT::DATA_TYPE VEC3; + typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; typedef typename PFP::REAL REAL; typedef Geom::Vec3f VEC3F; - VolumeAutoAttribute centerVolumes(map, "centerVolumes"); + VolumeAutoAttribute centerVolumes(map, "centerVolumes"); Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes(map, positions, centerVolumes); std::vector buffer; @@ -444,7 +447,7 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const V_ATT& positi bufferColors.reserve(16384); - TraversorCell traFace(map); + TraversorCell traFace(map); for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next()) { @@ -541,10 +544,12 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const EMBV& positio } typedef typename EMBV::DATA_TYPE VEC3; + typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; typedef typename PFP::REAL REAL; typedef Geom::Vec3f VEC3F; - VolumeAutoAttribute centerVolumes(map, "centerVolumes"); + VolumeAutoAttribute centerVolumes(map, "centerVolumes"); Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes(map, positions, centerVolumes); std::vector buffer; @@ -553,7 +558,7 @@ void ExplodeVolumeRender::updateData(typename PFP::MAP& map, const EMBV& positio std::vector bufferColors; bufferColors.reserve(16384); - TraversorCell traFace(map); + TraversorCell traFace(map); for (Dart d = traFace.begin(); d != traFace.end(); d = traFace.next()) { diff --git a/include/Algo/Render/GL2/topo3PrimalRender.hpp b/include/Algo/Render/GL2/topo3PrimalRender.hpp index 13bb0b0d8e1bdd8f160c4898b079c4ddfa0ae821..19cca1a28b2dcb0b86df09a51493fbb7ac7505f8 100644 --- a/include/Algo/Render/GL2/topo3PrimalRender.hpp +++ b/include/Algo/Render/GL2/topo3PrimalRender.hpp @@ -393,7 +393,7 @@ void Topo3PrimalRender::setDartsIdColor(typename PFP::MAP& map) } template -void Topo3PrimalRender::updateColors(typename PFP::MAP& map, const VertexAttribute& colors) +void Topo3PrimalRender::updateColors(MAP& map, const VertexAttribute& colors) { m_vbo2->bind(); Geom::Vec3f* colorBuffer = reinterpret_cast(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE)); @@ -543,14 +543,14 @@ void Topo3PrimalRender::updateData(MAP& mapx, const VertexAttributebind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), m_bufferDartPosition, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), m_bufferDartPosition, GL_STREAM_DRAW); // alpha2 m_vbo1->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer2 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE); - VEC3F* positionF2 = reinterpret_cast(PositionBuffer2); + Geom::Vec3f* positionF2 = reinterpret_cast(PositionBuffer2); m_nbRel2 = 0; diff --git a/include/Algo/Render/GL2/topo3Render.h b/include/Algo/Render/GL2/topo3Render.h index 8c44ace5675e3d8cd72f82c20cf76bef312d31e1..2b24859fa6023d02910c914122cdb610d3a1208b 100644 --- a/include/Algo/Render/GL2/topo3Render.h +++ b/include/Algo/Render/GL2/topo3Render.h @@ -268,7 +268,7 @@ public: * @param kf exploding coef for face * @param kv exploding coef for face */ - void updateData(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv); + virtual void updateData(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv) = 0; // template // void updateData(typename PFP::MAP& map, const VertexAttribute& positions, float ke, float kf, float kv); @@ -304,26 +304,46 @@ public: Dart raySelection(MAP& map, const Geom::Vec3f& rayA, const Geom::Vec3f& rayAB, float distmax); -protected: - /** - * update all drawing buffers to render a dual map - * @param map the map - * @param positions attribute of position vertices - * @param ke exploding coef for edge - * @param kf exploding coef for face - * @param kv exploding coef for face - */ - void updateDataMap3(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv); +//protected: +// /** +// * update all drawing buffers to render a dual map +// * @param map the map +// * @param positions attribute of position vertices +// * @param ke exploding coef for edge +// * @param kf exploding coef for face +// * @param kv exploding coef for face +// */ +// void updateDataMap3(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv); + +// /** +// * update all drawing buffers to render a gmap +// * @param map the map +// * @param positions attribute of position vertices +// * @param ke exploding coef for edge +// * @param kf exploding coef for face +// * @param kv exploding coef for face +// */ +// void updateDataGMap3(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv); +}; - /** - * update all drawing buffers to render a gmap - * @param map the map - * @param positions attribute of position vertices - * @param ke exploding coef for edge - * @param kf exploding coef for face - * @param kv exploding coef for face - */ - void updateDataGMap3(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv); +template +class Topo3RenderMap : public Topo3Render +{ + typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; + typedef typename PFP::VEC3 VEC3; + + void updateData(MAP &map, const VertexAttribute &positions, float ke, float kf, float kv); +}; + +template +class Topo3RenderGMap : public Topo3Render +{ + typedef typename PFP::MAP MAP; + typedef typename PFP::MAP::IMPL MAP_IMPL; + typedef typename PFP::VEC3 VEC3; + + void updateData(MAP &map, const VertexAttribute &positions, float ke, float kf, float kv); }; }//end namespace GL2 diff --git a/include/Algo/Render/GL2/topo3Render.hpp b/include/Algo/Render/GL2/topo3Render.hpp index 3a1a318f17ff54ed855d330403eaade1d104dadf..933d957399faacbe5a46d4ae7874f65f9d915162 100644 --- a/include/Algo/Render/GL2/topo3Render.hpp +++ b/include/Algo/Render/GL2/topo3Render.hpp @@ -489,35 +489,111 @@ void Topo3Render::toSVG(Utils::SVG::SVGOut& svg) // } //} +//template +//void Topo3Render::updateData(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv) +//{ +// std::string typeName = map.mapTypeName(); +// if (typeName[0] == 'M') // "Map3" +// { +// updateDataMap3(map, positions, ke, kf, kv); +// return; +// } +// if (typeName[0] == 'G') // "GMap3" +// { +// updateDataGMap3(map, positions, ke, kf, kv); +// return; +// } +//} + template -void Topo3Render::updateData(MAP& map, const VertexAttribute& positions, float ke, float kf, float kv) +void Topo3Render::setDartsIdColor(typename PFP::MAP& map) { - std::string typeName = map.mapTypeName(); - if (typeName[0] == "M") // "Map3" + m_vbo4->bind(); + float* colorBuffer = reinterpret_cast(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE)); + unsigned int nb=0; + + for (Dart d = map.begin(); d != map.end(); map.next(d)) { - updateDataMap3(map, positions, ke, kf, kv); - return; + if ( !map.isBoundaryMarked3(d)) // topo3 Render do not traverse boundary + { + if (nb < m_nbDarts) + { + float r,g,b; + dartToCol(d, r,g,b); + + float* local = colorBuffer+3*m_attIndex[d]; // get the right position in VBO + *local++ = r; + *local++ = g; + *local++ = b; + *local++ = r; + *local++ = g; + *local++ = b; + nb++; + } + else + { + CGoGNerr << "Error buffer too small for color picking (change the selector parameter ?)" << CGoGNendl; + break; + } + } } - if (typeName[0] == "G") // "GMap3" + glUnmapBuffer(GL_ARRAY_BUFFER); +} + +template +void Topo3Render::updateColors(MAP& map, const VertexAttribute& colors) +{ + m_vbo4->bind(); + VEC3* colorBuffer = reinterpret_cast(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE)); + unsigned int nb = 0; + + for (Dart d = map.begin(); d != map.end(); map.next(d)) { - updateDataGMap3(map, positions, ke, kf, kv); - return; + if ( !map.isBoundaryMarked3(d)) // topo3 Render do not traverse boundary + { + if (nb < m_nbDarts) + { + colorBuffer[m_attIndex[d]] = colors[d]; + nb++; + } + else + { + CGoGNerr << "Error buffer too small for color picking (change the selector parameter ?)" << CGoGNendl; + break; + } + } } + glUnmapBuffer(GL_ARRAY_BUFFER); } template -void Topo3Render::updateDataMap3(MAP& mapx, const VertexAttribute& positions, float ke, float kf, float kv) +Dart Topo3Render::picking(MAP& map, int x, int y) { - m_attIndex = mapx.template getAttribute("dart_index3"); + pushColors(); + setDartsIdColor(map); + Dart d = pickColor(x,y); + popColors(); + return d; +} - if (!m_attIndex.isValid()) - m_attIndex = mapx.template addAttribute("dart_index3"); - m_nbDarts = 0; + + + + +template +void Topo3RenderMap::updateData(MAP& mapx, const VertexAttribute& positions, float ke, float kf, float kv) +{ + this->m_attIndex = mapx.template getAttribute("dart_index3"); + + if (!this->m_attIndex.isValid()) + this->m_attIndex = mapx.template addAttribute("dart_index3"); + + this->m_nbDarts = 0; for (Dart d = mapx.begin(); d != mapx.end(); mapx.next(d)) { - if (!mapx.isBoundaryMarked3(d)) // in the following code Traversor do not traverse boundary - m_nbDarts++; + if (!mapx.template isBoundaryMarked<3>(d)) // in the following code Traversor do not traverse boundary + this->m_nbDarts++; } // compute center of each volumes @@ -535,18 +611,18 @@ void Topo3Render::updateDataMap3(MAP& mapx, const VertexAttribute fv2(mapx); DartAutoAttribute fv2x(mapx); - m_vbo4->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); + this->m_vbo4->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* colorDartBuf = reinterpret_cast(ColorDartsBuffer); - m_vbo0->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); + this->m_vbo0->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* positionDartBuf = reinterpret_cast(PositionDartsBuffer); std::vector vecDartFaces; - vecDartFaces.reserve(m_nbDarts/3); + vecDartFaces.reserve(this->m_nbDarts/3); unsigned int posDBI = 0; // traverse each face of each volume @@ -562,7 +638,7 @@ void Topo3Render::updateDataMap3(MAP& mapx, const VertexAttribute(mapx,d,positions)*kv +vc*okv; //shrink the face @@ -574,9 +650,9 @@ void Topo3Render::updateDataMap3(MAP& mapx, const VertexAttribute::updateDataMap3(MAP& mapx, const VertexAttributem_attIndex[d] = posDBI; posDBI+=2; *positionDartBuf++ = PFP::toVec3f(P); *positionDartBuf++ = PFP::toVec3f(Q); - *colorDartBuf++ = m_dartsColor; - *colorDartBuf++ = m_dartsColor; + *colorDartBuf++ = this->m_dartsColor; + *colorDartBuf++ = this->m_dartsColor; fv1[d] = P*0.1f + Q*0.9f; fv11[d] = P*0.9f + Q*0.1f; @@ -603,23 +679,23 @@ void Topo3Render::updateDataMap3(MAP& mapx, const VertexAttributebind(); + this->m_vbo0->bind(); glUnmapBuffer(GL_ARRAY_BUFFER); - m_vbo4->bind(); + this->m_vbo4->bind(); glUnmapBuffer(GL_ARRAY_BUFFER); - Geom::Vec3f* positioniF1 = new Geom::Vec3f[ 2*m_nbDarts]; - Geom::Vec3f* positioniF2 = new Geom::Vec3f[ 2*m_nbDarts]; - Geom::Vec3f* positioniF3 = new Geom::Vec3f[ 2*m_nbDarts]; + Geom::Vec3f* positioniF1 = new Geom::Vec3f[ 2*this->m_nbDarts]; + Geom::Vec3f* positioniF2 = new Geom::Vec3f[ 2*this->m_nbDarts]; + Geom::Vec3f* positioniF3 = new Geom::Vec3f[ 2*this->m_nbDarts]; Geom::Vec3f* positionF1 = positioniF1; Geom::Vec3f* positionF2 = positioniF2; Geom::Vec3f* positionF3 = positioniF3; - m_nbRel1 = 0; - m_nbRel2 = 0; - m_nbRel3 = 0; + this->m_nbRel1 = 0; + this->m_nbRel2 = 0; + this->m_nbRel3 = 0; for(std::vector::iterator face = vecDartFaces.begin(); face != vecDartFaces.end(); ++face) { @@ -633,126 +709,60 @@ void Topo3Render::updateDataMap3(MAP& mapx, const VertexAttributem_nbRel2++; } e = mapx.phi3(d); - if (!mapx.isBoundaryMarked3(e) && (d < e) ) + if (!mapx.template isBoundaryMarked<3>(e) && (d < e) ) { *positionF3++ = PFP::toVec3f(fv2[d]); *positionF3++ = PFP::toVec3f(fv2x[e]); *positionF3++ = PFP::toVec3f(fv2[e]); *positionF3++ = PFP::toVec3f(fv2x[d]); - m_nbRel3++; + this->m_nbRel3++; } e = mapx.phi1(d); *positionF1++ = PFP::toVec3f(fv1[d]); *positionF1++ = PFP::toVec3f(fv11[e]); - m_nbRel1++; + this->m_nbRel1++; d = mapx.phi1(d); } while (d != *face ); } - m_vbo3->bind(); - glBufferData(GL_ARRAY_BUFFER, 4*m_nbRel3*sizeof(Geom::Vec3f), positioniF3, GL_STREAM_DRAW); + this->m_vbo3->bind(); + glBufferData(GL_ARRAY_BUFFER, 4*this->m_nbRel3*sizeof(Geom::Vec3f), positioniF3, GL_STREAM_DRAW); - m_vbo2->bind(); - glBufferData(GL_ARRAY_BUFFER, 4*m_nbRel2*sizeof(Geom::Vec3f), positioniF2, GL_STREAM_DRAW); + this->m_vbo2->bind(); + glBufferData(GL_ARRAY_BUFFER, 4*this->m_nbRel2*sizeof(Geom::Vec3f), positioniF2, GL_STREAM_DRAW); - m_vbo1->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbRel1*sizeof(Geom::Vec3f), positioniF1, GL_STREAM_DRAW); + this->m_vbo1->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbRel1*sizeof(Geom::Vec3f), positioniF1, GL_STREAM_DRAW); delete[] positioniF1; delete[] positioniF2; delete[] positioniF3; } -template -void Topo3Render::setDartsIdColor(typename PFP::MAP& map) -{ - m_vbo4->bind(); - float* colorBuffer = reinterpret_cast(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE)); - unsigned int nb=0; - for (Dart d = map.begin(); d != map.end(); map.next(d)) - { - if ( !map.isBoundaryMarked3(d)) // topo3 Render do not traverse boundary - { - if (nb < m_nbDarts) - { - float r,g,b; - dartToCol(d, r,g,b); - float* local = colorBuffer+3*m_attIndex[d]; // get the right position in VBO - *local++ = r; - *local++ = g; - *local++ = b; - *local++ = r; - *local++ = g; - *local++ = b; - nb++; - } - else - { - CGoGNerr << "Error buffer too small for color picking (change the selector parameter ?)" << CGoGNendl; - break; - } - } - } - glUnmapBuffer(GL_ARRAY_BUFFER); -} -template -void Topo3Render::updateColors(MAP& map, const VertexAttribute& colors) -{ - m_vbo4->bind(); - VEC3* colorBuffer = reinterpret_cast(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE)); - unsigned int nb = 0; - for (Dart d = map.begin(); d != map.end(); map.next(d)) - { - if ( !map.isBoundaryMarked3(d)) // topo3 Render do not traverse boundary - { - if (nb < m_nbDarts) - { - colorBuffer[m_attIndex[d]] = colors[d]; - nb++; - } - else - { - CGoGNerr << "Error buffer too small for color picking (change the selector parameter ?)" << CGoGNendl; - break; - } - } - } - glUnmapBuffer(GL_ARRAY_BUFFER); -} template -Dart Topo3Render::picking(MAP& map, int x, int y) -{ - pushColors(); - setDartsIdColor(map); - Dart d = pickColor(x,y); - popColors(); - return d; -} - -template -void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttribute& positions, float ke, float kf, float kv) +void Topo3RenderGMap::updateData(MAP& mapx, const VertexAttribute& positions, float ke, float kf, float kv) { // GMap3& map = dynamic_cast(mapx); // TODO reflechir comment virer ce warning quand on compile avec PFP::MAP=Map3 - if (m_attIndex.map() != &mapx) - m_attIndex = mapx.template getAttribute("dart_index3"); - if (!m_attIndex.isValid()) - m_attIndex = mapx.template addAttribute("dart_index3"); + if (this->m_attIndex.map() != &mapx) + this->m_attIndex = mapx.template getAttribute("dart_index3"); + if (!this->m_attIndex.isValid()) + this->m_attIndex = mapx.template addAttribute("dart_index3"); - m_nbDarts = 0; + this->m_nbDarts = 0; for (Dart d = mapx.begin(); d != mapx.end(); mapx.next(d)) { - if (!mapx.isBoundaryMarked<3>(d)) // in the following code Traversor do not traverse boundary - m_nbDarts++; + if (!mapx.template isBoundaryMarked<3>(d)) // in the following code Traversor do not traverse boundary + this->m_nbDarts++; } // compute center of each volumes @@ -765,15 +775,15 @@ void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttribute fv2(mapx); DartAutoAttribute fv2x(mapx); - m_vbo4->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); + this->m_vbo4->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* colorDartBuf = reinterpret_cast(ColorDartsBuffer); - if (m_bufferDartPosition!=NULL) - delete m_bufferDartPosition; - m_bufferDartPosition = new Geom::Vec3f[2*m_nbDarts]; - Geom::Vec3f* positionDartBuf = reinterpret_cast(m_bufferDartPosition); + if (this->m_bufferDartPosition != NULL) + delete this->m_bufferDartPosition; + this->m_bufferDartPosition = new Geom::Vec3f[2*this->m_nbDarts]; + Geom::Vec3f* positionDartBuf = reinterpret_cast(this->m_bufferDartPosition); // m_vbo0->bind(); // glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); @@ -781,7 +791,7 @@ void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttribute(PositionDartsBuffer); std::vector vecDartFaces; - vecDartFaces.reserve(m_nbDarts/6); + vecDartFaces.reserve(this->m_nbDarts/6); unsigned int posDBI = 0; //traverse each face of each volume @@ -828,12 +838,12 @@ void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttributem_dartsColor; + *colorDartBuf++ = this->m_dartsColor; + *colorDartBuf++ = this->m_dartsColor; + *colorDartBuf++ = this->m_dartsColor; - m_attIndex[d] = posDBI; + this->m_attIndex[d] = posDBI; posDBI+=2; fv1[d] = P*0.9f + PP*0.1f; @@ -844,42 +854,42 @@ void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttributem_attIndex[dx] = posDBI; posDBI+=2; d = mapx.phi1(d); } } - m_vbo0->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), m_bufferDartPosition, GL_STREAM_DRAW); + this->m_vbo0->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(Geom::Vec3f), this->m_bufferDartPosition, GL_STREAM_DRAW); // m_vbo0->bind(); // glUnmapBuffer(GL_ARRAY_BUFFER); - m_vbo4->bind(); + this->m_vbo4->bind(); glUnmapBuffer(GL_ARRAY_BUFFER); // beta3 - m_vbo1->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); + this->m_vbo1->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer1 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE); // beta3 - m_vbo2->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); + this->m_vbo2->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer2 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE); // beta3 - m_vbo3->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); + this->m_vbo3->bind(); + glBufferData(GL_ARRAY_BUFFER, 2*this->m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer3 = glMapBufferARB(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* positionF1 = reinterpret_cast(PositionBuffer1); Geom::Vec3f* positionF2 = reinterpret_cast(PositionBuffer2); Geom::Vec3f* positionF3 = reinterpret_cast(PositionBuffer3); - m_nbRel2 = 0; - m_nbRel3 = 0; + this->m_nbRel2 = 0; + this->m_nbRel3 = 0; for(std::vector::iterator face = vecDartFaces.begin(); face != vecDartFaces.end(); ++face) { @@ -893,16 +903,16 @@ void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttributem_nbRel2++; } e = mapx.beta3(d); - if (!mapx.isBoundaryMarked<3>(e) && (d < e)) + if (!mapx.template isBoundaryMarked<3>(e) && (d < e)) { *positionF3++ = PFP::toVec3f(fv2[d]); *positionF3++ = PFP::toVec3f(fv2x[e]); *positionF3++ = PFP::toVec3f(fv2[e]); *positionF3++ = PFP::toVec3f(fv2x[d]); - m_nbRel3++; + this->m_nbRel3++; } d = mapx.beta0(d); e = mapx.beta2(d); @@ -912,34 +922,34 @@ void Topo3Render::updateDataGMap3(MAP& mapx, const VertexAttributem_nbRel2++; } e = mapx.beta3(d); - if (!mapx.isBoundaryMarked<3>(e) && (d < e)) + if (!mapx.template isBoundaryMarked<3>(e) && (d < e)) { *positionF3++ = PFP::toVec3f(fv2[d]); *positionF3++ = PFP::toVec3f(fv2x[e]); *positionF3++ = PFP::toVec3f(fv2[e]); *positionF3++ = PFP::toVec3f(fv2x[d]); - m_nbRel3++; + this->m_nbRel3++; } *positionF1++ = PFP::toVec3f(fv1[d]); d = mapx.beta1(d); *positionF1++ = PFP::toVec3f(fv1[d]); - m_nbRel1++; + this->m_nbRel1++; } while (d != *face ); } - m_vbo3->bind(); + this->m_vbo3->bind(); glUnmapBufferARB(GL_ARRAY_BUFFER); - m_vbo2->bind(); + this->m_vbo2->bind(); glUnmapBufferARB(GL_ARRAY_BUFFER); - m_vbo1->bind(); + this->m_vbo1->bind(); glUnmapBuffer(GL_ARRAY_BUFFER); - m_vbo4->bind(); + this->m_vbo4->bind(); glUnmapBuffer(GL_ARRAY_BUFFER); } diff --git a/include/Algo/Render/GL2/topoRender.h b/include/Algo/Render/GL2/topoRender.h index 7babf486f48634eef89847399a94c6cc15a2d0f4..e64ca3f8feca578bcef007eb9cac0c0aaebb3e24 100644 --- a/include/Algo/Render/GL2/topoRender.h +++ b/include/Algo/Render/GL2/topoRender.h @@ -57,6 +57,7 @@ class TopoRender typedef typename PFP::MAP MAP; typedef typename PFP::MAP::IMPL MAP_IMPL; typedef typename PFP::VEC3 VEC3; + typedef typename PFP::REAL REAL; protected: /** diff --git a/include/Algo/Render/GL2/topoRender.hpp b/include/Algo/Render/GL2/topoRender.hpp index 891e347f5193134a9a0b11cd102f4cf3f82e6c93..3cafc7f91255775298bbf37d749a22d2bf4352f7 100644 --- a/include/Algo/Render/GL2/topoRender.hpp +++ b/include/Algo/Render/GL2/topoRender.hpp @@ -446,12 +446,13 @@ void TopoRender::updateDataBoundary(MAP& map, const VertexAttribute void TopoRender::updateData(MAP& map, const VertexAttribute& positions, float ke, float kf, bool withBoundary) { - if (map.mapTypeName()[0] == "M") // "Map2" + std::string typeName = map.mapTypeName(); + if (typeName[0] == 'M') // "Map2" { updateDataMap(map, positions, ke, kf, withBoundary); return; } - if (map.mapTypeName()[0] == "G") // "GMap2" + if (typeName[0] == 'G') // "GMap2" { updateDataGMap(map, positions, ke, kf, withBoundary); return; @@ -486,7 +487,7 @@ void TopoRender::updateDataMap(MAP& mapx, const VertexAttribute fv2(mapx); m_vbo3->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* colorDartBuf = reinterpret_cast(ColorDartsBuffer); @@ -605,22 +606,22 @@ void TopoRender::updateDataMap(MAP& mapx, const VertexAttributebind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), m_bufferDartPosition, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), m_bufferDartPosition, GL_STREAM_DRAW); // glUnmapBuffer(GL_ARRAY_BUFFER); m_vbo3->bind(); glUnmapBuffer(GL_ARRAY_BUFFER); m_vbo1->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer1 = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); m_vbo2->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer2 = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); - VEC3F* positionF1 = reinterpret_cast(PositionBuffer1); - VEC3F* positionF2 = reinterpret_cast(PositionBuffer2); + Geom::Vec3f* positionF1 = reinterpret_cast(PositionBuffer1); + Geom::Vec3f* positionF2 = reinterpret_cast(PositionBuffer2); m_nbRel2 =0; for(std::vector::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++) @@ -680,12 +681,12 @@ void TopoRender::updateDataGMap(MAP& map, const VertexAttribute fv2(map); m_vbo3->bind(); - glBufferData(GL_ARRAY_BUFFER, 4*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 4*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* colorDartBuf = reinterpret_cast(ColorDartsBuffer); m_vbo0->bind(); - glBufferData(GL_ARRAY_BUFFER, 4*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 4*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); Geom::Vec3f* positionDartBuf = reinterpret_cast(PositionDartsBuffer); @@ -769,15 +770,15 @@ void TopoRender::updateDataGMap(MAP& map, const VertexAttributebind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer1 = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); m_vbo2->bind(); - glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3F), 0, GL_STREAM_DRAW); + glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(Geom::Vec3f), 0, GL_STREAM_DRAW); GLvoid* PositionBuffer2 = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); - VEC3F* positionF1 = reinterpret_cast(PositionBuffer1); - VEC3F* positionF2 = reinterpret_cast(PositionBuffer2); + Geom::Vec3f* positionF1 = reinterpret_cast(PositionBuffer1); + Geom::Vec3f* positionF2 = reinterpret_cast(PositionBuffer2); m_nbRel2 = 0; for(std::vector::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++) diff --git a/include/Topology/generic/autoAttributeHandler.h b/include/Topology/generic/autoAttributeHandler.h index 9f335268d498417eb38c1bcba8786c0498b671fb..dd2ab0c6c57a188d7fbf915abbc9879c001ea2a5 100644 --- a/include/Topology/generic/autoAttributeHandler.h +++ b/include/Topology/generic/autoAttributeHandler.h @@ -137,7 +137,7 @@ template class VolumeAutoAttribute : public VolumeAttribute { public: - VolumeAutoAttribute(MAP_IMPL& m, const std::string& nameAttr = "") + VolumeAutoAttribute(MapCommon& m, const std::string& nameAttr = "") { this->m_map = &m ; if(!m.template isOrbitEmbedded()) diff --git a/include/Topology/generic/cellmarker.h b/include/Topology/generic/cellmarker.h index a211bbf387d949a7316c3a175f9571f2ed9e428c..3a29a26625fdef5aabad3b98d6b58c654c52bafa 100644 --- a/include/Topology/generic/cellmarker.h +++ b/include/Topology/generic/cellmarker.h @@ -54,7 +54,7 @@ public: releaseOnDestruct(true) {} - ~CellMarkerGen() + virtual ~CellMarkerGen() {} unsigned int getThread() { return m_thread ; } @@ -120,7 +120,7 @@ public: m_map.cellMarkers[m_thread].push_back(this) ; } - /*virtual */~CellMarkerBase() + virtual ~CellMarkerBase() { if(releaseOnDestruct) { @@ -265,7 +265,7 @@ public: CellMarkerBase(map, thread) {} - ~CellMarker() + virtual ~CellMarker() { unmarkAll() ; } @@ -307,7 +307,7 @@ public: CellMarkerBase(map, thread) {} - ~CellMarkerStore() + virtual ~CellMarkerStore() { unmarkAll() ; // assert(isAllUnmarked); @@ -362,7 +362,7 @@ public: CellMarkerBase(map, thread) {} - ~CellMarkerMemo() + virtual ~CellMarkerMemo() { unmarkAll() ; // assert(isAllUnmarked); @@ -419,7 +419,7 @@ public: CellMarkerBase(map, thread) {} - ~CellMarkerNoUnmark() + virtual ~CellMarkerNoUnmark() { // assert(isAllUnmarked()) ; // CGoGN_ASSERT(this->isAllUnmarked()) diff --git a/include/Topology/generic/dartmarker.h b/include/Topology/generic/dartmarker.h index 73848f7eed6774219b1aab5998e5913e091dfc63..ac1f68bc5dbcd82c646f3d0d9b6e2dcb402aef16 100644 --- a/include/Topology/generic/dartmarker.h +++ b/include/Topology/generic/dartmarker.h @@ -56,7 +56,7 @@ public: releaseOnDestruct(true) {} - ~DartMarkerGen() + virtual ~DartMarkerGen() {} inline unsigned int getThread() { return m_thread ; } @@ -106,7 +106,7 @@ public: m_map.dartMarkers[m_thread].push_back(this) ; } - ~DartMarkerTmpl() + virtual ~DartMarkerTmpl() { if (releaseOnDestruct) { @@ -227,7 +227,7 @@ public: DartMarkerTmpl(map, thread) {} - ~DartMarker() + virtual ~DartMarker() { unmarkAll() ; } @@ -267,7 +267,7 @@ public: DartMarkerTmpl(map, thread) {} - ~DartMarkerStore() + virtual ~DartMarkerStore() { unmarkAll() ; // assert(isAllUnmarked) ; @@ -321,7 +321,7 @@ public: DartMarkerTmpl(map, thread) {} - ~DartMarkerNoUnmark() + virtual ~DartMarkerNoUnmark() { // assert(isAllUnmarked) ; // CGoGN_ASSERT(isAllUnmarked()) diff --git a/include/Topology/generic/mapCommon.hpp b/include/Topology/generic/mapCommon.hpp index 15a6870eb3f123ccd2104e7984a9c079d5e620ca..ab6d13be5254bb7935f393dd0d95d815e644c8ab 100644 --- a/include/Topology/generic/mapCommon.hpp +++ b/include/Topology/generic/mapCommon.hpp @@ -365,7 +365,7 @@ void MapCommon::bijectiveOrbitEmbedding() { if(!mark.isMarked(d)) { - mark.markOrbit(d) ; + mark.template markOrbit(d) ; unsigned int emb = getEmbedding(d) ; if (emb != EMBNULL) { diff --git a/include/Topology/generic/multiAttribs.h b/include/Topology/generic/multiAttribs.h index b958476f732dec9815789da39b95b253df2c4e9c..2a6dd3c4deae11a647bfe0dfff48cb791776f5dd 100644 --- a/include/Topology/generic/multiAttribs.h +++ b/include/Topology/generic/multiAttribs.h @@ -97,16 +97,16 @@ double length(const T& v) } -template +template class Vertex2Attributes { - VertexAttribute& m_h1; - VertexAttribute& m_h2; + VertexAttribute& m_h1; + VertexAttribute& m_h2; public: typedef Compo2Type DATA_TYPE; typedef RefCompo2Type REF_DATA_TYPE; - Vertex2Attributes(VertexAttribute& h1, VertexAttribute& h2): + Vertex2Attributes(VertexAttribute& h1, VertexAttribute& h2): m_h1(h1), m_h2(h2) {} RefCompo2Type operator[](unsigned int a) @@ -132,18 +132,16 @@ public: static unsigned int getOrbit() { return VERTEX; } }; - - -template +template class Edge2Attributes { - EdgeAttribute& m_h1; - EdgeAttribute& m_h2; + EdgeAttribute& m_h1; + EdgeAttribute& m_h2; public: typedef Compo2Type DATA_TYPE; typedef RefCompo2Type REF_DATA_TYPE; - Edge2Attributes(EdgeAttribute& h1, EdgeAttribute& h2): + Edge2Attributes(EdgeAttribute& h1, EdgeAttribute& h2): m_h1(h1), m_h2(h2) {} RefCompo2Type operator[](unsigned int a) @@ -169,18 +167,16 @@ public: static unsigned int getOrbit() { return EDGE; } }; - - -template +template class Face2Attributes { - FaceAttribute& m_h1; - FaceAttribute& m_h2; + FaceAttribute& m_h1; + FaceAttribute& m_h2; public: typedef Compo2Type DATA_TYPE; typedef RefCompo2Type REF_DATA_TYPE; - Face2Attributes(FaceAttribute& h1, FaceAttribute& h2): + Face2Attributes(FaceAttribute& h1, FaceAttribute& h2): m_h1(h1), m_h2(h2) {} RefCompo2Type operator[](unsigned int a) @@ -206,16 +202,16 @@ public: static unsigned int getOrbit() { return FACE; } }; -template +template class Volume2Attributes { - VolumeAttribute& m_h1; - VolumeAttribute& m_h2; + VolumeAttribute& m_h1; + VolumeAttribute& m_h2; public: typedef Compo2Type DATA_TYPE; typedef RefCompo2Type REF_DATA_TYPE; - Volume2Attributes(VolumeAttribute& h1, VolumeAttribute& h2): + Volume2Attributes(VolumeAttribute& h1, VolumeAttribute& h2): m_h1(h1), m_h2(h2) {} RefCompo2Type operator[](unsigned int a) @@ -245,16 +241,13 @@ public: /// implementation - template < typename T1, typename T2> Compo2Type::Compo2Type(const RefCompo2Type& v) - { m_v1 = v.m_v1; m_v2 = v.m_v2; } - template < typename T1, typename T2> Compo2Type& Compo2Type::operator =(const Compo2Type& comp) { @@ -263,7 +256,6 @@ Compo2Type& Compo2Type::operator =(const Compo2Type& comp) return *this; } - template < typename T1, typename T2> Compo2Type Compo2Type::operator+(const Compo2Type& v) const { @@ -273,7 +265,6 @@ Compo2Type Compo2Type::operator+(const Compo2Type& v) const return res ; } - template < typename T1, typename T2> Compo2Type Compo2Type::operator-(const Compo2Type& v) const { @@ -317,7 +308,6 @@ Compo2Type& Compo2Type::operator-=(const Compo2Type& v) return *this; } - template < typename T1, typename T2> Compo2Type& Compo2Type::operator*=(double d) { @@ -334,7 +324,6 @@ Compo2Type& Compo2Type::operator/=(double d) return *this; } - /// Ref version template < typename T1, typename T2> @@ -344,7 +333,6 @@ RefCompo2Type::RefCompo2Type (Compo2Type& comp): { } - template < typename T1, typename T2> RefCompo2Type& RefCompo2Type::operator=(const RefCompo2Type& v) { @@ -361,7 +349,6 @@ RefCompo2Type& RefCompo2Type::operator=(Compo2Type v) return *this; } - template < typename T1, typename T2> Compo2Type RefCompo2Type::operator+(const RefCompo2Type& v) const { @@ -380,7 +367,6 @@ Compo2Type RefCompo2Type::operator-(const RefCompo2Type& v) return res ; } - template < typename T1, typename T2> Compo2Type RefCompo2Type::operator/(double d) const { @@ -407,7 +393,6 @@ RefCompo2Type& RefCompo2Type::operator+=(const RefCompo2Type RefCompo2Type& RefCompo2Type::operator-=(const RefCompo2Type& v) { @@ -416,7 +401,6 @@ RefCompo2Type& RefCompo2Type::operator-=(const RefCompo2Type RefCompo2Type& RefCompo2Type::operator*=(double d) { @@ -433,8 +417,6 @@ RefCompo2Type& RefCompo2Type::operator/=(double d) return *this; } - - } // namespace CGoGN #endif /* MULTIATTRIBS_H_ */ diff --git a/include/Topology/generic/traversor2.hpp b/include/Topology/generic/traversor2.hpp index acda7b6894398516bd5099a06f0694606adc15a3..56374ad9cd2937552644c12583b78b2c9550ad20 100644 --- a/include/Topology/generic/traversor2.hpp +++ b/include/Topology/generic/traversor2.hpp @@ -90,7 +90,7 @@ Traversor2VF::Traversor2VF(const MAP& map, Dart dart) : m(map), start(dart) } else { - if(m.isBoundaryMarked2(start)) // jump over a boundary face + if(m.template isBoundaryMarked<2>(start)) // jump over a boundary face start = m.phi2(m.phi_1(start)) ; } } @@ -124,7 +124,7 @@ Dart Traversor2VF::next() if(current != NIL) { current = m.phi2(m.phi_1(current)) ; - if(m.isBoundaryMarked2(current)) // jump over a boundary face + if(m.template isBoundaryMarked<2>(current)) // jump over a boundary face current = m.phi2(m.phi_1(current)) ; if(current == start) current = NIL ; @@ -546,7 +546,7 @@ Traversor2FFaV::Traversor2FFaV(const MAP& map, Dart dart) : m(map),m_QLT(NU } current = start ; stop = dart ; - if(m.isBoundaryMarked2(start)) + if(m.template isBoundaryMarked<2>(start)) start = next() ; } }