Commit 998fd0e2 authored by Sylvain Thery's avatar Sylvain Thery

remove bug between Markers and ContainerBrowsers (appear in tuto_oper3)

parent 9a60ef71
......@@ -75,13 +75,21 @@ void MyQT::clipping_onoff(bool x)
Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal
m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
m_sh3->setClipPlaneParamsAll(clip_id3, normal, pos);
m_sh4->setClipPlaneParamsAll(clip_id4, normal, pos);
}
else
{
m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
m_sh3->setClipPlaneParamsAll(clip_id3, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
m_sh4->setClipPlaneParamsAll(clip_id4, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
m_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh3->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh4->setClipColorAttenuationFactorRelative(0.0f,0.0f);
}
updateMap();
updateGL();
......@@ -252,26 +260,27 @@ void MyQT::operation(int x)
dock.listOper->setCurrentRow(-1);
}
void MyQT::createMap(int /*n*/)
void MyQT::createMap(int n)
{
myMap.clear(true);
position = myMap.getAttribute<VEC3, VERTEX>("position");
if (!position.isValid())
position = myMap.addAttribute<VEC3, VERTEX>("position");
// Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
// prim.hexaGrid_topo(n,n,n);
// prim.embedHexaGrid(1.0f,1.0f,1.0f);
Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
prim.hexaGrid_topo(n,n,n);
prim.embedHexaGrid(1.0f,1.0f,1.0f);
// Algo::Surface::Modelisation::Polyhedron<PFP> poly(myMap, position);
// poly.cylinder_topo(6,1,true,true);
// poly.embedCylinder(6.0,6.0,5.0);
// myMap.closeMap();
Dart d = Algo::Surface::Modelisation::embedPrism<PFP>(myMap, position, 5, true,6.0,6.0,5.0);
Dart d2 = Algo::Surface::Modelisation::embedPyramid<PFP>(myMap, position, 4, true,6.0,5.0);
myMap.closeMap();
myMap.sewVolumes(myMap.phi2(d),d2);
position[myMap.phi_1(myMap.phi2(d2))] += VEC3(9.0,-5.0,-2.5);
// Dart d = Algo::Surface::Modelisation::embedPrism<PFP>(myMap, position, 5, true,6.0,6.0,5.0);
// Dart d2 = Algo::Surface::Modelisation::embedPyramid<PFP>(myMap, position, 4, true,6.0,5.0);
// myMap.sewVolumes(myMap.phi2(d),d2);
// position[myMap.phi_1(myMap.phi2(d2))] += VEC3(9.0,-5.0,-2.5);
myMap.check();
......@@ -287,17 +296,13 @@ void MyQT::createMap(int /*n*/)
m_render_topo->setDartWidth(3.0f);
m_render_topo->setInitialDartsColor(0.0f,0.0f,0.0f);
m_render_topo->updateData<PFP>(myMap, position, m_ex1,m_ex2,m_ex3/*, nb*/);
m_render_topo_boundary->updateDataBoundary<PFP>(myMap,position,m_ex1,m_ex2,m_shift);
updateMap();
}
void MyQT::updateMap()
{
std::cout << "updateMap"<< std::endl;
m_render_topo->updateData<PFP>(myMap, position, m_ex1,m_ex2,m_ex3/*, nb*/);
m_render_topo_boundary->updateDataBoundary<PFP>(myMap,position,m_ex1,m_ex2,m_shift);
}
// initialization GL callback
......@@ -315,15 +320,27 @@ void MyQT::cb_initGL()
m_sh1 = static_cast<Utils::ClippingShader*>(m_render_topo->shader1());
m_sh2 = static_cast<Utils::ClippingShader*>(m_render_topo->shader2());
m_sh3 = static_cast<Utils::ClippingShader*>(m_render_topo_boundary->shader1());
m_sh4 = static_cast<Utils::ClippingShader*>(m_render_topo_boundary->shader2());
m_sh1->insertClippingCode();
m_sh2->insertClippingCode();
m_sh3->insertClippingCode();
m_sh4->insertClippingCode();
clip_id1 = m_sh1->addClipPlane();
clip_id2 = m_sh2->addClipPlane();
clip_id3 = m_sh3->addClipPlane();
clip_id4 = m_sh4->addClipPlane();
m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), bb.center());
m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), bb.center());
m_sh3->setClipPlaneParamsAll(clip_id3, Geom::Vec3f(0,0,1), bb.center());
m_sh4->setClipPlaneParamsAll(clip_id4, Geom::Vec3f(0,0,1), bb.center());
}
......@@ -494,6 +511,9 @@ void MyQT::cb_mouseMove(int buttons, int x, int y)
m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
m_sh3->setClipPlaneParamsAll(clip_id3, normal, pos);
m_sh4->setClipPlaneParamsAll(clip_id4, normal, pos);
m_begX = x;
m_begY = y;
......@@ -691,14 +711,8 @@ void MyQT::importMesh(std::string& filename)
m_selected = NIL;
m_selected2 = NIL;
m_render_topo->updateData<PFP>(myMap, position, m_ex1,m_ex2,m_ex3/*, nb*/);
// SelectorDartBoundary<PFP::MAP> sdb(myMap);
// MapBrowserSelector mbs(myMap,sdb);
// myMap.setBrowser(&mbs);
// m_render_topo_boundary->updateData<PFP>(myMap,position,m_ex1,m_ex2);
// myMap.setBrowser(NULL);
m_render_topo_boundary->updateDataBoundary<PFP>(myMap,position,m_ex1,m_ex2,m_shift);
// m_render_topo->updateData<PFP>(myMap, position, m_ex1,m_ex2,m_ex3/*, nb*/);
// m_render_topo_boundary->updateDataBoundary<PFP>(myMap,position,m_ex1,m_ex2,m_shift);
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
setParamObject(bb.maxSize(), bb.center().data()) ;
......
......@@ -113,8 +113,6 @@ protected:
unsigned int m_pickedAxis;
int m_begX;
int m_begY;
int clip_id1;
int clip_id2;
// just for more compact writing
inline Dart PHI1(Dart d) {return myMap.phi1(d);}
......@@ -124,8 +122,15 @@ protected:
template<int X>
Dart PHI(Dart d) {return myMap.phi<X>(d);}
int clip_id1;
int clip_id2;
int clip_id3;
int clip_id4;
Utils::ClippingShader* m_sh1;
Utils::ClippingShader* m_sh2;
Utils::ClippingShader* m_sh3;
Utils::ClippingShader* m_sh4;
public:
......
......@@ -86,10 +86,10 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const EMBV& positions,
typedef EMB VEC3;
typedef typename PFP::REAL REAL;
m_attIndex = mapx.template getAttribute<unsigned int, DART>("dart_index");
m_attIndex = mapx.template getAttribute<unsigned int, DART>("dart_index3");
if (!m_attIndex.isValid())
m_attIndex = mapx.template addAttribute<unsigned int, DART>("dart_index");
m_attIndex = mapx.template addAttribute<unsigned int, DART>("dart_index3");
m_nbDarts = 0;
for (Dart d = mapx.begin(); d != mapx.end(); mapx.next(d))
......@@ -104,7 +104,6 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const EMBV& positions,
Algo::Volume::Geometry::Parallel::computeCentroidELWVolumes<PFP>(mapx, positions, centerVolumes,3);
// debut phi1
DartAutoAttribute<VEC3> fv1(mapx);
// fin phi1
......@@ -334,9 +333,9 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const EMBV& positions
GMap3& map = dynamic_cast<GMap3&>(mapx); // TODO reflechir comment virer ce warning quand on compile avec PFP::MAP=Map3
if (m_attIndex.map() != &mapx)
m_attIndex = mapx.template getAttribute<unsigned int, DART>("dart_index");
m_attIndex = mapx.template getAttribute<unsigned int, DART>("dart_index3");
if (!m_attIndex.isValid())
m_attIndex = mapx.template addAttribute<unsigned int, DART>("dart_index");
m_attIndex = mapx.template addAttribute<unsigned int, DART>("dart_index3");
m_nbDarts = 0;
for (Dart d = mapx.begin(); d != mapx.end(); mapx.next(d))
......@@ -562,9 +561,9 @@ void Topo3Render::computeDartMiddlePositions(typename PFP::MAP& map, DartAttribu
//
// if (m_attIndex.map() != &map)
// {
// m_attIndex = map.template getAttribute<unsigned int>(DART, "dart_index");
// m_attIndex = map.template getAttribute<unsigned int>(DART, "dart_index3");
// if (!m_attIndex.isValid())
// m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index");
// m_attIndex = map.template addAttribute<unsigned int>(DART, "dart_index3");
// }
//
// m_nbDarts = 0;
......
......@@ -268,8 +268,7 @@ public:
* Special update function used to draw boundary of map3
*/
template<typename PFP>
void updateDataBoundary(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, float ke, float kf,float ns);
void updateDataBoundary(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, float ke, float kf, float ns);
/**
* render to svg struct
......
......@@ -54,20 +54,11 @@ template<typename PFP>
void TopoRender::updateDataBoundary(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& positions, float ke, float kf,float ns)
{
m_normalShift = ns;
// SelectorDartBoundary<typename PFP::MAP> sdb(map);
// MapBrowserSelector mbs(map,sdb);
// MapBrowserSelector mbs(map,SelectorDartBoundary<typename PFP::MAP>(map));
// map.setBrowser(&mbs);
SelectorDartBoundary<typename PFP::MAP> sdb(map);
DartContainerBrowserSelector browser(map,sdb);
browser.enable();
updateData<PFP>(map,positions, ke, kf,true);
browser.disable();
// map.setBrowser(NULL);
m_normalShift = 0.0f;
}
......@@ -100,10 +91,10 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute<ty
std::vector<Dart> vecDarts;
vecDarts.reserve(mapx.getNbDarts()); // no problem dart is int: no problem of memory
m_attIndex = mapx.template getAttribute<unsigned int, DART>("dart_index");
m_attIndex = mapx.template getAttribute<unsigned int, DART>("dart_index2");
if (!m_attIndex.isValid())
m_attIndex = mapx.template addAttribute<unsigned int, DART>("dart_index");
m_attIndex = mapx.template addAttribute<unsigned int, DART>("dart_index2");
for(Dart d = mapx.begin(); d!= mapx.end(); mapx.next(d))
{
......@@ -299,10 +290,10 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const VertexAttribute<t
vecDarts.reserve(map.getNbDarts()); // no problem dart is int: no problem of memory
if (m_attIndex.map() != &map)
m_attIndex = map.template getAttribute<unsigned int, DART>("dart_index");
m_attIndex = map.template getAttribute<unsigned int, DART>("dart_index2");
if (!m_attIndex.isValid())
m_attIndex = map.template addAttribute<unsigned int, DART>("dart_index");
m_attIndex = map.template addAttribute<unsigned int, DART>("dart_index2");
for(Dart d = map.begin(); d!= map.end(); map.next(d))
......@@ -454,7 +445,7 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map, bool withBoundary)
float* colorBuffer = reinterpret_cast<float*>(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_WRITE));
unsigned int nb = 0;
m_attIndex = map.template getAttribute<unsigned int, DART>("dart_index");
m_attIndex = map.template getAttribute<unsigned int, DART>("dart_index2");
if (!m_attIndex.isValid())
{
CGoGNerr << "Error attribute_dartIndex does not exist during TopoRender::picking" << CGoGNendl;
......
......@@ -254,7 +254,7 @@ public:
assert(this->m_markVector != NULL);
AttributeContainer& cont = this->m_map.template getAttributeContainer<CELL>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
this->m_markVector->operator[](i).unsetMark(this->m_mark) ;
}
};
......@@ -389,7 +389,7 @@ public:
assert(this->m_markVector != NULL);
AttributeContainer& cont = this->m_map.template getAttributeContainer<CELL>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
this->m_markVector->operator[](i).unsetMark(this->m_mark) ;
}
};
......
......@@ -240,7 +240,7 @@ public:
{
assert(m_map.getMarkerSet<DART>(m_thread).testMark(m_mark));
AttributeContainer& cont = m_map.getAttributeContainer<DART>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
m_markVector->operator[](i).unsetMark(m_mark) ;
}
} ;
......@@ -352,7 +352,7 @@ public:
{
assert(m_map.getMarkerSet<DART>(m_thread).testMark(m_mark));
AttributeContainer& cont = m_map.getAttributeContainer<DART>() ;
for (unsigned int i = cont.begin(); i != cont.end(); cont.next(i))
for (unsigned int i = cont.realBegin(); i != cont.realEnd(); cont.realNext(i))
m_markVector->operator[](i).unsetMark(m_mark) ;
}
} ;
......
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