Commit fdb2571f authored by untereiner's avatar untereiner

Merge cgogn:~jund/CGoGN

parents 95c02e0a 68b2491a
...@@ -144,7 +144,7 @@ protected: ...@@ -144,7 +144,7 @@ protected:
void popColors(); void popColors();
/** /**
* pick dart with color set bey setDartsIdColor * pick dart with color set by setDartsIdColor
* @param x position of mouse (x) * @param x position of mouse (x)
* @param y position of mouse (pass H-y, classic pb of origin) * @param y position of mouse (pass H-y, classic pb of origin)
* @return the dart or NIL * @return the dart or NIL
...@@ -270,7 +270,7 @@ class Topo3RenderMapD: public Topo3Render ...@@ -270,7 +270,7 @@ class Topo3RenderMapD: public Topo3Render
{ {
public: public:
/** /**
* update all drawing buffers * update all drawing buffers to render a dual map
* @param map the map * @param map the map
* @param good selector * @param good selector
* @param positions attribute of position vertices * @param positions attribute of position vertices
...@@ -287,7 +287,7 @@ class Topo3RenderGMap: public Topo3Render ...@@ -287,7 +287,7 @@ class Topo3RenderGMap: public Topo3Render
{ {
public: public:
/** /**
* update all drawing buffers * update all drawing buffers to render a gmap
* @param map the map * @param map the map
* @param good selector * @param good selector
* @param positions attribute of position vertices * @param positions attribute of position vertices
......
...@@ -305,7 +305,6 @@ Dart Topo3Render::picking(typename PFP::MAP& map, const FunctorSelect& good, int ...@@ -305,7 +305,6 @@ Dart Topo3Render::picking(typename PFP::MAP& map, const FunctorSelect& good, int
Dart d = pickColor(x,y); Dart d = pickColor(x,y);
popColors(); popColors();
return d; return d;
} }
template<typename PFP> template<typename PFP>
...@@ -320,7 +319,6 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go ...@@ -320,7 +319,6 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go
AutoAttributeHandler<Geom::Vec3f> vert(map, DART); AutoAttributeHandler<Geom::Vec3f> vert(map, DART);
if (m_attIndex.map() != &map) if (m_attIndex.map() != &map)
// if(!m_attIndex.isValid())
{ {
m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index"); m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
} }
...@@ -388,13 +386,15 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go ...@@ -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(); m_vbo4->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); GLvoid* ColorDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
VEC3* colorDartBuf = reinterpret_cast<VEC3*>(ColorDartsBuffer); VEC3* colorDartBuf = reinterpret_cast<VEC3*>(ColorDartsBuffer);
//darts
m_vbo0->bind(); m_vbo0->bind();
glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW);
GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE); GLvoid* PositionDartsBuffer = glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE);
...@@ -418,8 +418,11 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go ...@@ -418,8 +418,11 @@ void Topo3RenderGMap::updateData(typename PFP::MAP& map, const FunctorSelect& go
{ {
const VEC3& P = positions[dd]; const VEC3& P = positions[dd];
vecPos.push_back(P); 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; posDBI+=2;
center += P; center += P;
dd = map.phi1(dd); dd = map.phi1(dd);
} while (dd != d); } while (dd != d);
......
...@@ -189,7 +189,7 @@ public: ...@@ -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 ! * 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 map the map in which we pick (same as drawn !)
* @param good the selector (same as used during drawing) * @param good the selector (same as used during drawing)
...@@ -205,7 +205,7 @@ class TopoRenderMapD : public TopoRender ...@@ -205,7 +205,7 @@ class TopoRenderMapD : public TopoRender
{ {
public: public:
/** /**
* update all drawing buffers * update all drawing buffers to render a dual map
* @param map the map * @param map the map
* @param positions attribute of position vertices * @param positions attribute of position vertices
* @param ke exploding coef for edge * @param ke exploding coef for edge
...@@ -220,7 +220,7 @@ class TopoRenderGMap : public TopoRender ...@@ -220,7 +220,7 @@ class TopoRenderGMap : public TopoRender
{ {
public: public:
/** /**
* update all drawing buffers * update all drawing buffers to render a gmap
* @param map the map * @param map the map
* @param positions attribute of position vertices * @param positions attribute of position vertices
* @param ke exploding coef for edge * @param ke exploding coef for edge
......
...@@ -227,7 +227,7 @@ Dart TopoRender::pickColor(unsigned int x, unsigned int y) ...@@ -227,7 +227,7 @@ Dart TopoRender::pickColor(unsigned int x, unsigned int y)
// draw in back buffer (not shown on screen) // draw in back buffer (not shown on screen)
drawDarts(); drawDarts();
// restore dart with // restore dart width
m_topo_dart_width = dw; m_topo_dart_width = dw;
// read the pixel under the mouse in back buffer // read the pixel under the mouse in back buffer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment