Commit 7bbd4da3 authored by Sylvain Thery's avatar Sylvain Thery

render topo3 primal final

parent 745e55e3
......@@ -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
......
......@@ -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);
}
......
......@@ -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)
......
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