diff --git a/include/Algo/Render/GL2/topo3PrimalRender.h b/include/Algo/Render/GL2/topo3PrimalRender.h index 6677b19a1b429fb401688a9d52fe94938e146cf3..d9fb96d3194e471d2dfc5b8eff95f5868772c746 100644 --- a/include/Algo/Render/GL2/topo3PrimalRender.h +++ b/include/Algo/Render/GL2/topo3PrimalRender.h @@ -106,6 +106,11 @@ protected: */ Geom::Vec3f m_dartsColor; + /** + * initial darts color for boundary (set in update) + */ + Geom::Vec3f m_boundaryDartsColor; + /** * attribute index to get easy correspondence dart/color */ @@ -203,6 +208,8 @@ public: */ void setInitialDartsColor(float r, float g, float b); + void setInitialBoundaryDartsColor(float r, float g, float b); + /** * overdraw a dart with given width and color * @param d the dart diff --git a/include/Algo/Render/GL2/topo3PrimalRender.hpp b/include/Algo/Render/GL2/topo3PrimalRender.hpp index a8c8736a930ef3cbc1ee69ee579806362808c469..8172be643cce12d2a8000d54df6d7f3449eb60de 100644 --- a/include/Algo/Render/GL2/topo3PrimalRender.hpp +++ b/include/Algo/Render/GL2/topo3PrimalRender.hpp @@ -56,27 +56,24 @@ void Topo3PrimalRender::setDartsIdColor(typename PFP::MAP& map) 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) { - 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; - } + 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); @@ -91,18 +88,15 @@ void Topo3PrimalRender::updateColors(typename PFP::MAP& map, const VertexAttribu 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) { - 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; - } + 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); @@ -198,22 +192,40 @@ void Topo3PrimalRender::updateData(typename PFP::MAP& mapx, const VertexAttribut *positionDartBuf++ = P; *positionDartBuf++ = PP; - *positionDartBuf++ = Q; - *positionDartBuf++ = QQ; - *colorDartBuf++ = m_dartsColor; - *colorDartBuf++ = m_dartsColor; - *colorDartBuf++ = m_dartsColor; - *colorDartBuf++ = m_dartsColor; + if (map.isBoundaryMarked3(d)) + { + *colorDartBuf++ = m_boundaryDartsColor; + *colorDartBuf++ = m_boundaryDartsColor; + } + else + { + *colorDartBuf++ = m_dartsColor; + *colorDartBuf++ = m_dartsColor; + } m_attIndex[d] = posDBI; posDBI+=2; - fv2[d] = (P+PP)*0.5f; + + + *positionDartBuf++ = Q; + *positionDartBuf++ = QQ; + Dart dx = map.phi3(d); - fv2[dx] = (Q+QQ)*0.5f; + if (map.isBoundaryMarked3(dx)) + { + *colorDartBuf++ = m_boundaryDartsColor; + *colorDartBuf++ = m_boundaryDartsColor; + } + else + { + *colorDartBuf++ = m_dartsColor; + *colorDartBuf++ = m_dartsColor; + } m_attIndex[dx] = posDBI; posDBI+=2; + fv2[dx] = (Q+QQ)*0.5f; d = mapx.phi1(d); } diff --git a/src/Algo/Render/topo3PrimalRender.cpp b/src/Algo/Render/topo3PrimalRender.cpp index 22f26f6a735e6c281e1f180935acf27aebeef692..6397f96f78a4e62229d8eb3ecbf84f94095fa135 100644 --- a/src/Algo/Render/topo3PrimalRender.cpp +++ b/src/Algo/Render/topo3PrimalRender.cpp @@ -48,6 +48,7 @@ Topo3PrimalRender::Topo3PrimalRender(): m_topo_relation_width(3.0f), m_color_save(NULL), m_dartsColor(1.0f,1.0f,1.0f), + m_boundaryDartsColor(0.5f,0.5f,0.5f), m_bufferDartPosition(NULL) { m_vbo0 = new Utils::VBO(); @@ -127,7 +128,6 @@ void Topo3PrimalRender::setAllDartsColor(float r, float g, float b) *colorDartBuf++ = b; } glUnmapBufferARB(GL_ARRAY_BUFFER); - } void Topo3PrimalRender::setInitialDartsColor(float r, float g, float b) @@ -135,6 +135,12 @@ void Topo3PrimalRender::setInitialDartsColor(float r, float g, float b) m_dartsColor = Geom::Vec3f(r,g,b); } +void Topo3PrimalRender::setInitialBoundaryDartsColor(float r, float g, float b) +{ + m_boundaryDartsColor = Geom::Vec3f(r,g,b); +} + + void Topo3PrimalRender::drawDarts() { if (m_nbDarts==0)