Commit 90c9261b authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' of /home/git/repositories/thery/cgogn into develop

parents c2fbbbce f80538a5
...@@ -110,10 +110,10 @@ void SimpleMap3::cb_initGL() ...@@ -110,10 +110,10 @@ void SimpleMap3::cb_initGL()
m_render_topo->setInitialDartsColor(1.0f,1.0f,1.0f); m_render_topo->setInitialDartsColor(1.0f,1.0f,1.0f);
m_render_topo->updateData(myMap, position, 0.9f,0.9f,0.8f); m_render_topo->updateData(myMap, position, 0.9f,0.9f,0.8f);
m_render_topo_boundary = new Algo::Render::GL2::TopoRenderMap<PFP>(); m_render_topo_boundary = new Algo::Render::GL2::TopoRender();
m_render_topo_boundary->setDartWidth(2.0f); m_render_topo_boundary->setDartWidth(2.0f);
m_render_topo_boundary->setInitialDartsColor(0.4f,0.8f,0.4f); m_render_topo_boundary->setInitialDartsColor(0.4f,0.8f,0.4f);
m_render_topo_boundary->updateDataBoundary(myMap, position, 0.9f,0.9f,bb.maxSize()/50.0f); m_render_topo_boundary->updateDataBoundary<PFP>(myMap, position, 0.9f,0.9f,bb.maxSize()/50.0f);
m_render_topo_primal = new Algo::Render::GL2::Topo3PrimalRender<PFP>(); m_render_topo_primal = new Algo::Render::GL2::Topo3PrimalRender<PFP>();
m_render_topo_primal->setDartWidth(2.0f); m_render_topo_primal->setDartWidth(2.0f);
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
VertexAttribute<VEC3, MAP> position ; VertexAttribute<VEC3, MAP> position ;
Algo::Render::GL2::Topo3RenderMap<PFP>* m_render_topo; Algo::Render::GL2::Topo3RenderMap<PFP>* m_render_topo;
Algo::Render::GL2::TopoRenderMap<PFP>* m_render_topo_boundary; Algo::Render::GL2::TopoRender* m_render_topo_boundary;
Algo::Render::GL2::Topo3PrimalRender<PFP>* m_render_topo_primal; Algo::Render::GL2::Topo3PrimalRender<PFP>* m_render_topo_primal;
SimpleMap3() ; SimpleMap3() ;
......
...@@ -83,7 +83,7 @@ void Viewer::cb_initGL() ...@@ -83,7 +83,7 @@ void Viewer::cb_initGL()
Utils::GLSLShader::areShadersSupported(); Utils::GLSLShader::areShadersSupported();
m_render = new Algo::Render::GL2::MapRender() ; m_render = new Algo::Render::GL2::MapRender() ;
m_topoRender = new Algo::Render::GL2::TopoRenderMap<PFP>() ; m_topoRender = new Algo::Render::GL2::TopoRender() ;
m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ; m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ;
...@@ -98,12 +98,12 @@ void Viewer::cb_initGL() ...@@ -98,12 +98,12 @@ void Viewer::cb_initGL()
m_phongShader->setSpecular(colSpec) ; m_phongShader->setSpecular(colSpec) ;
m_phongShader->setShininess(shininess) ; m_phongShader->setShininess(shininess) ;
m_flatShader = new Utils::ShaderFlat() ; m_flatShader = new Utils::ShaderSimpleFlat() ;
m_flatShader->setAttributePosition(m_positionVBO) ; m_flatShader->setAttributePosition(m_positionVBO) ;
m_flatShader->setAmbiant(colClear) ; m_flatShader->setAmbiant(colClear) ;
m_flatShader->setDiffuse(colDif) ; m_flatShader->setDiffuse(colDif) ;
m_flatShader->setDiffuseBack(Geom::Vec4f(0,0,0,0)) ; // m_flatShader->setDiffuseBack(Geom::Vec4f(0,0,0,0)) ;
m_flatShader->setExplode(faceShrinkage) ; // m_flatShader->setExplode(faceShrinkage) ;
m_vectorShader = new Utils::ShaderVectorPerVertex() ; m_vectorShader = new Utils::ShaderVectorPerVertex() ;
m_vectorShader->setAttributePosition(m_positionVBO) ; m_vectorShader->setAttributePosition(m_positionVBO) ;
...@@ -130,12 +130,14 @@ void Viewer::cb_redraw() ...@@ -130,12 +130,14 @@ void Viewer::cb_redraw()
{ {
if(m_drawVertices) if(m_drawVertices)
{ {
glDepthFunc(GL_LEQUAL);
m_pointSprite->setSize(vertexScaleFactor) ; m_pointSprite->setSize(vertexScaleFactor) ;
m_render->draw(m_pointSprite, Algo::Render::GL2::POINTS) ; m_render->draw(m_pointSprite, Algo::Render::GL2::POINTS) ;
} }
if(m_drawEdges) if(m_drawEdges)
{ {
glDepthFunc(GL_LEQUAL);
glLineWidth(1.0f) ; glLineWidth(1.0f) ;
m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES) ; m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES) ;
} }
...@@ -146,10 +148,10 @@ void Viewer::cb_redraw() ...@@ -146,10 +148,10 @@ void Viewer::cb_redraw()
glEnable(GL_LIGHTING) ; glEnable(GL_LIGHTING) ;
glEnable(GL_POLYGON_OFFSET_FILL) ; glEnable(GL_POLYGON_OFFSET_FILL) ;
glPolygonOffset(1.0f, 1.0f) ; glPolygonOffset(1.0f, 1.0f) ;
glDepthFunc(GL_LESS);
switch(m_renderStyle) switch(m_renderStyle)
{ {
case FLAT : case FLAT :
m_flatShader->setExplode(faceShrinkage) ;
m_render->draw(m_flatShader, Algo::Render::GL2::TRIANGLES) ; m_render->draw(m_flatShader, Algo::Render::GL2::TRIANGLES) ;
break ; break ;
case PHONG : case PHONG :
...@@ -161,6 +163,7 @@ void Viewer::cb_redraw() ...@@ -161,6 +163,7 @@ void Viewer::cb_redraw()
if(m_drawTopo) if(m_drawTopo)
{ {
glDepthFunc(GL_LEQUAL);
m_topoRender->drawTopo() ; m_topoRender->drawTopo() ;
} }
...@@ -543,7 +546,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -543,7 +546,7 @@ void Viewer::importMesh(std::string& filename)
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ;
m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ; bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
normalBaseSize = bb.diagSize() / 100.0f ; normalBaseSize = bb.diagSize() / 100.0f ;
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
#include "Algo/Render/GL2/topoRender.h" #include "Algo/Render/GL2/topoRender.h"
#include "Utils/Shaders/shaderPhong.h" #include "Utils/Shaders/shaderPhong.h"
#include "Utils/Shaders/shaderFlat.h" #include "Utils/Shaders/shaderSimpleFlat.h"
#include "Utils/Shaders/shaderSimpleColor.h" #include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderVectorPerVertex.h" #include "Utils/Shaders/shaderVectorPerVertex.h"
#include "Utils/pointSprite.h" #include "Utils/pointSprite.h"
...@@ -104,13 +104,13 @@ public: ...@@ -104,13 +104,13 @@ public:
VertexAttribute<VEC3, MAP> normal ; VertexAttribute<VEC3, MAP> normal ;
Algo::Render::GL2::MapRender* m_render ; Algo::Render::GL2::MapRender* m_render ;
Algo::Render::GL2::TopoRenderMap<PFP>* m_topoRender ; Algo::Render::GL2::TopoRender* m_topoRender ;
Utils::VBO* m_positionVBO ; Utils::VBO* m_positionVBO ;
Utils::VBO* m_normalVBO; Utils::VBO* m_normalVBO;
Utils::ShaderPhong* m_phongShader ; Utils::ShaderPhong* m_phongShader ;
Utils::ShaderFlat* m_flatShader ; Utils::ShaderSimpleFlat* m_flatShader ;
Utils::ShaderVectorPerVertex* m_vectorShader ; Utils::ShaderVectorPerVertex* m_vectorShader ;
Utils::ShaderSimpleColor* m_simpleColorShader ; Utils::ShaderSimpleColor* m_simpleColorShader ;
Utils::PointSprite* m_pointSprite ; Utils::PointSprite* m_pointSprite ;
......
...@@ -447,13 +447,13 @@ int main(int argc, char **argv) ...@@ -447,13 +447,13 @@ int main(int argc, char **argv)
{ {
position = myMap.addAttribute<VEC3, VERTEX, MAP>("position"); position = myMap.addAttribute<VEC3, VERTEX, MAP>("position");
int nb = 8; int nb = 64;
Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb); Algo::Volume::Tilings::Cubic::Grid<PFP> cubic(myMap, nb, nb, nb);
cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f); cubic.embedIntoGrid(position, 1.0f, 1.0f, 1.0f);
for (unsigned int i = position.begin(); i != position.end(); position.next(i)) for (unsigned int i = position.begin(); i != position.end(); position.next(i))
{ {
VEC3 pert(float(double(rand())/RAND_MAX/20.0),float(double(rand())/RAND_MAX/20.0),float(double(rand())/RAND_MAX/20.0)); VEC3 pert(float(double(rand())/RAND_MAX/200.0),float(double(rand())/RAND_MAX/200.0),float(double(rand())/RAND_MAX/200.0));
position[i]+= pert; position[i]+= pert;
} }
......
...@@ -85,7 +85,7 @@ void Viewer::cb_initGL() ...@@ -85,7 +85,7 @@ void Viewer::cb_initGL()
Utils::GLSLShader::setCurrentOGLVersion(2) ; Utils::GLSLShader::setCurrentOGLVersion(2) ;
m_render = new Algo::Render::GL2::MapRender() ; m_render = new Algo::Render::GL2::MapRender() ;
m_topoRender = new Algo::Render::GL2::TopoRenderMap<PFP>() ; m_topoRender = new Algo::Render::GL2::TopoRender() ;
m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ; m_topoRender->setInitialDartsColor(0.25f, 0.25f, 0.25f) ;
...@@ -232,7 +232,7 @@ void Viewer::cb_keyPress(int keycode) ...@@ -232,7 +232,7 @@ void Viewer::cb_keyPress(int keycode)
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ; m_normalVBO->updateData(normal) ;
m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
updateGL(); updateGL();
break; break;
...@@ -267,7 +267,7 @@ void Viewer::cb_keyPress(int keycode) ...@@ -267,7 +267,7 @@ void Viewer::cb_keyPress(int keycode)
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ; m_normalVBO->updateData(normal) ;
m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
updateGL(); updateGL();
break; break;
...@@ -338,7 +338,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -338,7 +338,7 @@ void Viewer::importMesh(std::string& filename)
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::LINES) ;
m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, Algo::Render::GL2::TRIANGLES) ;
m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; m_topoRender->updateData<PFP>(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ;
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ; bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
normalBaseSize = bb.diagSize() / 100.0f ; normalBaseSize = bb.diagSize() / 100.0f ;
......
...@@ -103,7 +103,7 @@ public: ...@@ -103,7 +103,7 @@ public:
VertexAttribute<VEC3, MAP> normal ; VertexAttribute<VEC3, MAP> normal ;
Algo::Render::GL2::MapRender* m_render ; Algo::Render::GL2::MapRender* m_render ;
Algo::Render::GL2::TopoRenderMap<PFP>* m_topoRender ; Algo::Render::GL2::TopoRender* m_topoRender ;
Utils::VBO* m_positionVBO ; Utils::VBO* m_positionVBO ;
Utils::VBO* m_normalVBO; Utils::VBO* m_normalVBO;
......
...@@ -75,8 +75,7 @@ void MyQT::traversors(int x) ...@@ -75,8 +75,7 @@ void MyQT::traversors(int x)
// update all color to grey // update all color to grey
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d)) for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{ {
colorDarts[d] = Geom::Vec3f(0.5f,0.5f,0.5f); m_render_topo->addColoredDart(d,0.5f,0.5f,0.5f);
m_render_topo->setDartColor(d,0.5f,0.5f,0.5f);
} }
switch(x) switch(x)
...@@ -85,7 +84,7 @@ void MyQT::traversors(int x) ...@@ -85,7 +84,7 @@ void MyQT::traversors(int x)
{ {
Traversor2VVaE<MAP> trav(myMap,m_selected); Traversor2VVaE<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
...@@ -94,14 +93,14 @@ void MyQT::traversors(int x) ...@@ -94,14 +93,14 @@ void MyQT::traversors(int x)
Traversor2VVaF<MAP> trav(myMap,m_selected); Traversor2VVaF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 2: case 2:
{ {
Traversor2EEaV<MAP> trav(myMap,m_selected); Traversor2EEaV<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 3: case 3:
...@@ -109,63 +108,63 @@ void MyQT::traversors(int x) ...@@ -109,63 +108,63 @@ void MyQT::traversors(int x)
Traversor2EEaF<MAP> trav(myMap,m_selected); Traversor2EEaF<MAP> trav(myMap,m_selected);
float c=0.0f; float c=0.0f;
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,c); m_render_topo->addColoredDart(b,0.0f,1.0f,c);
} }
break; break;
case 4: case 4:
{ {
Traversor2FFaV<MAP> trav(myMap,m_selected); Traversor2FFaV<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 5: case 5:
{ {
Traversor2FFaE<MAP> trav(myMap,m_selected); Traversor2FFaE<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 6: case 6:
{ {
Traversor2FV<MAP> trav(myMap,m_selected); Traversor2FV<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 7: case 7:
{ {
Traversor2FE<MAP> trav(myMap,m_selected); Traversor2FE<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 8: case 8:
{ {
Traversor2EV<MAP> trav(myMap,m_selected); Traversor2EV<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 9: case 9:
{ {
Traversor2EF<MAP> trav(myMap,m_selected); Traversor2EF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 10: case 10:
{ {
Traversor2VE<MAP> trav(myMap,m_selected); Traversor2VE<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
case 11: case 11:
{ {
Traversor2VF<MAP> trav(myMap,m_selected); Traversor2VF<MAP> trav(myMap,m_selected);
for(Dart b=trav.begin(); b!= trav.end(); b=trav.next()) for(Dart b=trav.begin(); b!= trav.end(); b=trav.next())
m_render_topo->setDartColor(b,0.0f,1.0f,0.0f); m_render_topo->addColoredDart(b,0.0f,1.0f,0.0f);
} }
break; break;
default: default:
...@@ -178,9 +177,8 @@ void MyQT::traversors(int x) ...@@ -178,9 +177,8 @@ void MyQT::traversors(int x)
void MyQT::createMap(int n) void MyQT::createMap(int n)
{ {
position = myMap.addAttribute<VEC3, VERTEX, MAP>("position"); position = myMap.addAttribute<VEC3, VERTEX, MAP>("position");
colorDarts = myMap.addAttribute<VEC3, DART, MAP>("color");
Algo::Surface::Tilings::Square::Grid<PFP> grid(myMap, n, n, true); Algo::Surface::Tilings::Square::Grid<PFP> grid(myMap, n, n, true);
grid.embedIntoGrid(position, 1.,1.,0.); grid.embedIntoGrid(position, 1.,1.,0.);
// bounding box of scene // bounding box of scene
...@@ -197,31 +195,28 @@ void MyQT::createMap(int n) ...@@ -197,31 +195,28 @@ void MyQT::createMap(int n)
m_render_topo->setInitialDartsColor(0.5f,0.5f,0.5f); m_render_topo->setInitialDartsColor(0.5f,0.5f,0.5f);
m_render_topo->setInitialBoundaryDartsColor(0.3f,0.3f,0.3f); m_render_topo->setInitialBoundaryDartsColor(0.3f,0.3f,0.3f);
m_render_topo->updateData(myMap, position, 0.9f, 0.9f, dock.withBoundary->isChecked()); std::cout << "markAll OK"<< std::endl;
#ifdef USE_GMAP
m_render_topo->updateDataGMap<PFP>(myMap, position, 0.9f, 0.9f, dock.withBoundary->isChecked());
#else
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f, dock.withBoundary->isChecked());
#endif
std::cout << "markAll OK"<< std::endl;
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{
if (dm.isMarked(d) && (!myMap.isBoundaryMarked<2>(d)))
{
colorDarts[d] = Geom::Vec3f(0.5f,0.5f,0.5f);
m_render_topo->setDartColor(d,0.5f,0.5f,0.5f);
}
}
} }
void MyQT::updateMap() void MyQT::updateMap()
{ {
m_render_topo->setInitialBoundaryDartsColor(0.0f,0.0f,0.0f); m_render_topo->setInitialBoundaryDartsColor(0.0f,0.0f,0.0f);
m_render_topo->updateData(myMap, position, 0.9f, 0.9f, dock.withBoundary->isChecked()); #ifdef USE_GMAP
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d)) m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f, dock.withBoundary->isChecked());
{ #else
if (dm.isMarked(d) && (!myMap.isBoundaryMarked<2>(d))) m_render_topo->updateDataGMap<PFP>(myMap, position, 0.9f, 0.9f, dock.withBoundary->isChecked());
{ #endif
const Geom::Vec3f& C = colorDarts[d];
if (C*C != 0.0f)
m_render_topo->setDartColor(d,C[0],C[1],C[2]);
}
}
updateGL(); updateGL();
} }
...@@ -229,28 +224,24 @@ void MyQT::updateMap() ...@@ -229,28 +224,24 @@ void MyQT::updateMap()
void MyQT::cb_initGL() void MyQT::cb_initGL()
{ {
glClearColor(1.0f,1.0f,1.0f,1.0f); glClearColor(1.0f,1.0f,1.0f,1.0f);
#ifdef USE_GMAP m_render_topo = new Algo::Render::GL2::TopoRender(0.01f) ;
m_render_topo = new Algo::Render::GL2::TopoRenderGMap<PFP>(0.01f) ;
#else
m_render_topo = new Algo::Render::GL2::TopoRenderMap<PFP>(0.01f) ;
#endif
} }
// redraw GL callback (clear and swap already done) // redraw GL callback (clear and swap already done)
void MyQT::cb_redraw() void MyQT::cb_redraw()
{ {
glEnable( GL_POLYGON_OFFSET_FILL );
glPolygonOffset( 1.0f, 1.0f );
glDepthFunc(GL_LESS);
m_render_topo->drawTopo(); m_render_topo->drawTopo();
glDisable( GL_POLYGON_OFFSET_FILL ); glDepthFunc(GL_LEQUAL);
m_render_topo->drawColoredDarts(myMap);
if (m_selected != NIL) if (m_selected != NIL)
m_render_topo->overdrawDart(m_selected, 11, 1.0f, 0.0f, 0.0f); m_render_topo->overdrawDart(myMap, m_selected, 11, 1.0f, 0.0f, 0.0f);
if (m_selected2 != NIL) if (m_selected2 != NIL)
m_render_topo->overdrawDart(m_selected2, 11, 0.0f, 1.0f, 0.0f); m_render_topo->overdrawDart(myMap, m_selected2, 11, 0.0f, 1.0f, 0.0f);
} }
void MyQT::cb_mousePress(int button, int x, int y) void MyQT::cb_mousePress(int button, int x, int y)
...@@ -279,38 +270,6 @@ void MyQT::cb_keyPress(int keycode) ...@@ -279,38 +270,6 @@ void MyQT::cb_keyPress(int keycode)
{ {
switch(keycode) switch(keycode)
{ {
case 'c':
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{
if (!myMap.isBoundaryMarked<2>(d))
{
int n = rand();
float r = float(n&0x7f)/255.0f + 0.25f;
float g = float((n>>8)&0x7f)/255.0f + 0.25f;
float b = float((n>>16)&0x7f)/255.0 + 0.25f;
colorDarts[d] = Geom::Vec3f(r,g,b);
m_render_topo->setDartColor(d,r,g,b);
}
}
break;
case 'g':
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{
colorDarts[d] = Geom::Vec3f(0.5f,0.5f,0.5f);
m_render_topo->setDartColor(d,0.5f,0.5f,0.5f);
}
break;
case 'h':
for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
{
if (!myMap.isBoundaryMarked<2>(d))
{
colorDarts[d] = Geom::Vec3f(0.0f,0.0f,0.0f);