Commit df2d8970 authored by Sylvain Thery's avatar Sylvain Thery

resolving bug render picking and coloring

parent ac81c9b3
......@@ -93,9 +93,6 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
{
if (good(d))
{
m_attIndex[d] = posDBI;
posDBI+=2;
CellMarkerStore markVert(map, VERTEX); //marker for vertices
VEC3 center(0, 0, 0);
unsigned int nbv = 0;
......@@ -196,6 +193,9 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
VEC3 P = vecPos[i]*ke + vecPos[i+1]*oke;
VEC3 Q = vecPos[i+1]*ke + vecPos[i]*oke;
m_attIndex[d] = posDBI;
posDBI+=2;
*positionDartBuf++ = P;
*positionDartBuf++ = Q;
*colorDartBuf++ = VEC3(1.,1.,1.0);
......@@ -364,9 +364,6 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
{
if (good(d))
{
m_attIndex[d] = posDBI;
posDBI+=2;
CellMarkerStore markVert(map, VERTEX); //marker for vertices
VEC3 center(0, 0, 0);
unsigned int nbv = 0;
......@@ -477,6 +474,10 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
*colorDartBuf++ = VEC3(1.,1.,1.);
*colorDartBuf++ = VEC3(1.,1.,1.);
m_attIndex[d] = posDBI;
posDBI+=2;
fv1[d] = P*0.9f + PP*0.1f;
fv2x[d] = P*0.52f + PP*0.48f;
fv2[d] = P*0.48f + PP*0.52f;
......@@ -484,6 +485,10 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
fv1[dx] = Q*0.9f + QQ*0.1f;
fv2[dx] = Q*0.52f + QQ*0.48f;
fv2x[dx] = Q*0.48f + QQ*0.52f;
m_attIndex[dx] = posDBI;
posDBI+=2;
d = map.phi1(d);
}
......
......@@ -75,10 +75,7 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
for(Dart d = map.begin(); d!= map.end(); map.next(d))
{
if (good(d))
{
vecDarts.push_back(d);
m_attIndex[d] = (vecDarts.size()-1)*2;
}
}
m_nbDarts = vecDarts.size();
......@@ -102,6 +99,8 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
std::vector<VEC3> vecPos;
vecPos.reserve(16);
unsigned int indexDC=0;
DartMarker mf(map);
for(std::vector<Dart>::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++)
{
......@@ -137,11 +136,12 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const typename PFP::TVEC
VEC3 P = vecPos[i]*ke + vecPos[i+1]*k;
VEC3 Q = vecPos[i+1]*ke + vecPos[i]*k;
m_attIndex[d] = indexDC;
indexDC+=2;
*positionDartBuf++ = P;
*colorDartBuf++ = VEC3(1.,0.,0.);
*positionDartBuf++ = Q;
*colorDartBuf++ = VEC3(1.,1.,1.);
*colorDartBuf++ = VEC3(1.,1.,1.);
VEC3 f = P*0.5f + Q*0.5f;
fv2[d] = f;
f = P*0.1f + Q*0.9f;
......@@ -220,10 +220,7 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
for(Dart d = map.begin(); d!= map.end(); map.next(d))
{
if (good(d))
{
vecDarts.push_back(d);
m_attIndex[d] = (vecDarts.size()-1)*2;
}
}
m_nbDarts = vecDarts.size();
......@@ -248,6 +245,8 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
std::vector<VEC3> vecPos;
vecPos.reserve(16);
unsigned int indexDC=0;
DartMarker mf(map);
for(std::vector<Dart>::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++)
{
......@@ -285,6 +284,8 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
VEC3 PP = REAL(0.52)*P + REAL(0.48)*Q;
VEC3 QQ = REAL(0.52)*Q + REAL(0.48)*P;
m_attIndex[d] = indexDC;
indexDC+=2;
*positionDartBuf++ = P;
*colorDartBuf++ = VEC3(1.,1.,1.);
*positionDartBuf++ = PP;
......@@ -304,6 +305,9 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const typename PFP::TVE
fv2[dd] = f;
f = Q*0.9f + QQ*0.1f;
fv1[dd] = f;
m_attIndex[dd] = indexDC;
indexDC+=2;
d = map.phi1(d);
}
......@@ -367,9 +371,9 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
if (nb < m_nbDarts)
if (good(d))
{
if (good(d))
if (nb < m_nbDarts)
{
float r,g,b;
dartToCol(d, r,g,b);
......@@ -380,7 +384,6 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
*local++ = r;
*local++ = g;
*local++ = b;
nb++;
}
else
......@@ -389,7 +392,6 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& go
break;
}
}
}
glUnmapBuffer(GL_ARRAY_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