From 68b2491aeccc94be6a681526e881ed3e3a268f4f Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 28 Nov 2011 10:55:03 +0100 Subject: [PATCH] picking g-carte fonctionnel --- include/Algo/Render/GL2/topo3Render.h | 6 +++--- include/Algo/Render/GL2/topo3Render.hpp | 11 +++++++---- include/Algo/Render/GL2/topoRender.h | 6 +++--- src/Algo/Render/topoRender.cpp | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/include/Algo/Render/GL2/topo3Render.h b/include/Algo/Render/GL2/topo3Render.h index 463ebb99..a8cc1f76 100644 --- a/include/Algo/Render/GL2/topo3Render.h +++ b/include/Algo/Render/GL2/topo3Render.h @@ -144,7 +144,7 @@ protected: void popColors(); /** - * pick dart with color set bey setDartsIdColor + * pick dart with color set by setDartsIdColor * @param x position of mouse (x) * @param y position of mouse (pass H-y, classic pb of origin) * @return the dart or NIL @@ -270,7 +270,7 @@ class Topo3RenderMapD: public Topo3Render { public: /** - * update all drawing buffers + * update all drawing buffers to render a dual map * @param map the map * @param good selector * @param positions attribute of position vertices @@ -287,7 +287,7 @@ class Topo3RenderGMap: public Topo3Render { public: /** - * update all drawing buffers + * update all drawing buffers to render a gmap * @param map the map * @param good selector * @param positions attribute of position vertices diff --git a/include/Algo/Render/GL2/topo3Render.hpp b/include/Algo/Render/GL2/topo3Render.hpp index 2c4b4fb5..d0abf807 100644 --- a/include/Algo/Render/GL2/topo3Render.hpp +++ b/include/Algo/Render/GL2/topo3Render.hpp @@ -305,7 +305,6 @@ Dart Topo3Render::picking(typename PFP::MAP& map, const FunctorSelect& good, int Dart d = pickColor(x,y); popColors(); return d; - } template @@ -320,7 +319,6 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go AutoAttributeHandler vert(map, DART); if (m_attIndex.map() != &map) -// if(!m_attIndex.isValid()) { m_attIndex = map.template addAttribute(DART, "dart_index"); } @@ -388,13 +386,15 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go } } - m_nbDarts *= 2; + m_nbDarts *= 2; // x2 : only one orientation is used for the previous computation, multiply by 2 to get the number of darts + //colors m_vbo4->bind(); glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); VEC3* colorDartBuf = reinterpret_cast(ColorDartsBuffer); + //darts m_vbo0->bind(); glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); @@ -418,8 +418,11 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go { const VEC3& P = positions[dd]; vecPos.push_back(P); -// m_attIndex[dd] = posDBI; + m_attIndex[dd] = posDBI; + posDBI+=2; + m_attIndex[map.beta0(dd)] = posDBI; //for gmap : also affect a number to the other orientation for picking posDBI+=2; + center += P; dd = map.phi1(dd); } while (dd != d); diff --git a/include/Algo/Render/GL2/topoRender.h b/include/Algo/Render/GL2/topoRender.h index 9b38e9c9..eefffce6 100644 --- a/include/Algo/Render/GL2/topoRender.h +++ b/include/Algo/Render/GL2/topoRender.h @@ -189,7 +189,7 @@ public: /** - * pick dart with color set bey setDartsIdColor + * pick dart with color set by setDartsIdColor * Do not forget to apply same transformation to scene before picking than before drawing ! * @param map the map in which we pick (same as drawn !) * @param good the selector (same as used during drawing) @@ -205,7 +205,7 @@ class TopoRenderMapD : public TopoRender { public: /** - * update all drawing buffers + * 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 @@ -220,7 +220,7 @@ class TopoRenderGMap : public TopoRender { public: /** - * update all drawing buffers + * update all drawing buffers to render a gmap * @param map the map * @param positions attribute of position vertices * @param ke exploding coef for edge diff --git a/src/Algo/Render/topoRender.cpp b/src/Algo/Render/topoRender.cpp index 204ab8b8..ac4748ab 100644 --- a/src/Algo/Render/topoRender.cpp +++ b/src/Algo/Render/topoRender.cpp @@ -227,7 +227,7 @@ Dart TopoRender::pickColor(unsigned int x, unsigned int y) // draw in back buffer (not shown on screen) drawDarts(); - // restore dart with + // restore dart width m_topo_dart_width = dw; // read the pixel under the mouse in back buffer -- GitLab