Commit 18fa6de9 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' into 'develop'

Develop

See merge request !67
parents 6bd24868 517a6df8
......@@ -72,7 +72,7 @@ int main(int argc, char **argv)
std::vector<VertexAttribute<typename PFP::VEC3, MAP> > attr;
attr.push_back(position);
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.05) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices /20) ;
VertexAttribute<PFP::VEC3, MAP> normal = myMap.addAttribute<PFP::VEC3,VERTEX,MAP>( "normal") ;
VertexAttribute<PFP::VEC3, MAP> position2 = myMap.addAttribute<PFP::VEC3,VERTEX,MAP>( "pos2") ;
......
......@@ -54,19 +54,19 @@ int main(int argc, char **argv)
std::vector<VertexAttribute<typename PFP::VEC3, MAP> > attr;
attr.push_back(position);
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.1) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices / 10) ;
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
nbVertices = Algo::Topo::getNbOrbits<VERTEX>(myMap) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.1) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices / 10);
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
Algo::Surface::Modelisation::LoopSubdivision<PFP>(myMap, position) ;
nbVertices = Algo::Topo::getNbOrbits<VERTEX>(myMap) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices * 0.1) ;
Algo::Surface::Decimation::decimate<PFP>(myMap, Algo::Surface::Decimation::S_QEM, Algo::Surface::Decimation::A_QEM, attr, nbVertices / 10);
Algo::Surface::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position) ;
Algo::Surface::Modelisation::CatmullClarkSubdivision<PFP>(myMap, position) ;
......
......@@ -81,9 +81,11 @@ int main()
});
centerFace /=nbVert;
centerVol += centerFace;
nbFaces++;
});
centerVol /= nbFaces;
centerMesh += centerVol;
nbVols++;
});
centerMesh /= nbVols;
CGoGNout<< "Traverse with foreach in " << ch.elapsed()<< " ms"<< CGoGNendl;
......@@ -110,9 +112,11 @@ int main()
}
centerFace /=nbVert;
centerVol += centerFace;
nbFaces++;
}
centerVol /= nbFaces;
centerMesh += centerVol;
nbVols++;
}
CGoGNout<< "Traverse with traversor in " << ch.elapsed()<< " ms"<< CGoGNendl;
......
......@@ -204,7 +204,7 @@ void Viewer::cb_keyPress(int keycode)
{
std::cout << "PlaneCut"<< std::endl;
Geom::Vec3f n(0.1,0.1,1.0);
Geom::Vec3f n(0.1f,0.1f,1.0f);
Geom::Vec3f o = bb.center();
Geom::Plane3D<PFP::REAL> plan(n,o);
......@@ -239,7 +239,7 @@ void Viewer::cb_keyPress(int keycode)
{
std::cout << "PlaneCut"<< std::endl;
Geom::Vec3f n(0.1,0.1,1.0);
Geom::Vec3f n(0.1f,0.1f,1.0f);
Geom::Vec3f o = bb.center();
Geom::Plane3D<PFP::REAL> plan(n,o);
......
......@@ -119,7 +119,7 @@ void MyQT::squareTiling(int code)
{
std::cout << "square grid twisted strip tiling" << std::endl;
Algo::Surface::Tilings::Square::Grid<PFP> g(myMap, 10, 10, true);
g.embedIntoTwistedStrip(position, 0.2, 0.7, 5);
g.embedIntoTwistedStrip(position, 0.2f, 0.7f, 5);
Geom::Matrix44f trf;
trf.identity();
......@@ -151,11 +151,11 @@ void MyQT::squareTiling(int code)
{
std::cout << "square cylinder tiling" << std::endl;
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.embedIntoCylinder(position,0.5,0.7,1.0);
c.embedIntoCylinder(position,0.5f,0.7f,1.0f);
Geom::Matrix44f trf;
trf.identity();
Geom::translate<float>(0.5,0.5,0.0,trf);
Geom::translate<float>(0.5f,0.5f,0.0f,trf);
c.transform(position, trf);
......@@ -169,7 +169,7 @@ void MyQT::squareTiling(int code)
Algo::Surface::Tilings::Square::Cylinder<PFP> c(myMap,20,20);
c.triangleBottom();
c.triangleTop();
c.embedIntoCylinder(position,0.5,0.7,1.0);
c.embedIntoCylinder(position,0.5f,0.7f,1.0f);
break;
}
......@@ -212,7 +212,7 @@ void MyQT::squareTiling(int code)
{
std::cout << "square tore tiling" << std::endl;
Algo::Surface::Tilings::Square::Tore<PFP> c(myMap,20,10);
c.embedIntoTore(position, 0.9, 0.5);
c.embedIntoTore(position, 0.9f, 0.5f);
c.exportPositions(position, "tore.bs");
break;
......@@ -244,7 +244,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle grid twisted strip tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Grid<PFP> g(myMap,10,10,true);
g.embedIntoTwistedStrip(position, 0.3, 0.8, 5);
g.embedIntoTwistedStrip(position, 0.3f, 0.8f, 5);
break;
}
......@@ -252,7 +252,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle grid helocoid tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Grid<PFP> g(myMap,20,20,true);
g.embedIntoHelicoid(position, 0.3, 0.8, 5.0, 2.0);
g.embedIntoHelicoid(position, 0.3f, 0.8f, 5.0f, 2.0f);
break;
}
......@@ -260,7 +260,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle cylinder tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.embedIntoCylinder(position,0.5,0.7,5.0);
c.embedIntoCylinder(position,0.5f,0.7f,5.0f);
break;
}
......@@ -270,7 +270,7 @@ void MyQT::triangularTiling(int code)
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.triangleBottom();
c.triangleTop();
c.embedIntoCylinder(position,0.5,0.7,5.0);
c.embedIntoCylinder(position,0.5f,0.7f,5.0f);
break;
}
......@@ -280,7 +280,7 @@ void MyQT::triangularTiling(int code)
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.triangleTop();
c.triangleBottom();
c.embedIntoSphere(position,0.5);
c.embedIntoSphere(position,0.5f);
break;
}
......@@ -290,7 +290,7 @@ void MyQT::triangularTiling(int code)
Algo::Surface::Tilings::Triangular::Cylinder<PFP> c(myMap,20,20);
c.triangleTop();
c.triangleBottom();
c.embedIntoCone(position,0.5, 5.0);
c.embedIntoCone(position,0.5f, 5.0f);
break;
}
......@@ -298,7 +298,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle cube tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Cube<PFP> c(myMap,4,4,4);
c.embedIntoCube(position,5.0,5.0, 5.0);
c.embedIntoCube(position,5.0f,5.0f, 5.0f);
break;
}
......@@ -306,7 +306,7 @@ void MyQT::triangularTiling(int code)
{
std::cout << "triangle tore tiling" << std::endl;
Algo::Surface::Tilings::Triangular::Tore<PFP> c(myMap,20,10);
c.embedIntoTore(position,5.0,2.0);
c.embedIntoTore(position,5.0f,2.0f);
break;
}
......
......@@ -82,7 +82,7 @@ int main()
std::cout << "Check arePointsEquals : Start" << std::endl;
VEC3 p1(0,0,0);
VEC3 p2(0.1,0.1,0.1);
VEC3 p2(0.1f,0.1f,0.1f);
if(!Geom::arePointsEquals<VEC3>(p1,p1) || !Geom::arePointsEquals<VEC3>(p2,p2)
|| Geom::arePointsEquals<VEC3>(p1,p2) || Geom::arePointsEquals<VEC3>(p2,p1))
{
......
......@@ -49,7 +49,7 @@ int main(int argc, char **argv)
// example code itself
sqt.createMap(n);
sqt.width(5);
sqt.width(4.0);
// set help message in menu
sqt.setHelpMsg("First Tuto: \nCreate two faces\nsew them\nand affect positions");
......@@ -236,14 +236,11 @@ void MyQT::cb_redraw()
glDepthFunc(GL_LESS);
m_render_topo->drawTopo();
glDepthFunc(GL_LEQUAL);
m_render_topo->drawColoredDarts<MAP>(myMap);
if (m_selected != NIL)
m_render_topo->overdrawDart(myMap, m_selected, 11, 1.0f, 0.0f, 0.0f);
if (m_selected2 != NIL)
m_render_topo->overdrawDart(myMap, m_selected2, 11, 0.0f, 1.0f, 0.0f);
if(!m_selecteds.empty())
{
......@@ -251,7 +248,7 @@ void MyQT::cb_redraw()
m_render_topo->overdrawDart(myMap, *it, 11, 0.0f, 0.0f, 1.0f);
}
m_render_topo->overdrawDart(myMap, m_selected2, 11, 0.0f, 1.0f, 0.0f);
}
......
......@@ -61,6 +61,7 @@ int main(int argc, char **argv)
// final show for redraw
sqt.show();
// and wait for the end
sqt.clipping_onoff(true);
return app.exec();
}
......@@ -73,21 +74,14 @@ void MyQT::clipping_onoff(bool x)
Geom::Vec3f pos = m_PlanePick->getPosition();
float pipo;
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);
float d = -(pos*normal);
m_render_topo->setClippingPlane(Geom::Vec4f(normal[0], normal[1], normal[2], d));
m_render_topo_boundary->setClippingPlane(Geom::Vec4f(normal[0], normal[1], normal[2], d));
}
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_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh3->setClipColorAttenuationFactorRelative(0.0f,0.0f);
}
{
m_render_topo->setNoClippingPlane();
}
updateMap();
updateGL();
}
......@@ -377,23 +371,6 @@ void MyQT::cb_initGL()
m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1);
m_frame = new Utils::FrameManipulator();
m_frame->setSize(bb.maxSize());
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_sh1->insertClippingCode();
m_sh2->insertClippingCode();
m_sh3->insertClippingCode();
clip_id1 = m_sh1->addClipPlane();
clip_id2 = m_sh2->addClipPlane();
clip_id3 = m_sh3->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());
}
// redraw GL callback (clear and swap already done)
......@@ -554,11 +531,9 @@ void MyQT::cb_mouseMove(int buttons, int x, int y)
Geom::Vec3f pos = m_PlanePick->getPosition();
float pipo;
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);
float d = -(pos*normal);
m_render_topo->setClippingPlane(Geom::Vec4f(normal[0], normal[1], normal[2], d));
m_render_topo_boundary->setClippingPlane(Geom::Vec4f(normal[0], normal[1], normal[2], d));
m_begX = x;
m_begY = y;
......
......@@ -133,10 +133,6 @@ protected:
int clip_id2;
int clip_id3;
Utils::ClippingShader* m_sh1;
Utils::ClippingShader* m_sh2;
Utils::ClippingShader* m_sh3;
public:
// example of simple map creation
void createMap(int n);
......
......@@ -375,7 +375,7 @@ public:
m_positionApproximator(posApprox)
{
bb = Algo::Geometry::computeBoundingBox<PFP>(m, pos) ;
radius = bb.diagSize() * 0.003 ;
radius = bb.diagSize() * 0.003f ;
normal = m.template getAttribute<VEC3, VERTEX, MAP>("normal") ;
if(!normal.isValid())
......
......@@ -84,8 +84,8 @@ bool EdgeSelector_Random<PFP>::init()
for(Dart d = m.begin(); d != m.end(); m.next(d))
darts.push_back(d) ;
srand(time(NULL)) ;
int remains = darts.size() ;
srand((unsigned int )(time(NULL))) ;
int remains = int(darts.size()) ;
for(unsigned int i = 0; i < darts.size()-1; ++i) // generate the random permutation
{
int r = (rand() % remains) + i ;
......@@ -1979,11 +1979,10 @@ void EdgeSelector_GeomColOptGradient<PFP>::computeEdgeInfo(Dart d, EdgeInfo& ein
const VEC3& newCol = m_colorApproximator.getApprox(d) ;
// sum of QEM metric and color gradient metric
const REAL t = 0.01 ;
const REAL t = 0.01f ;
const REAL err =
t * quad(newPos) +
(1-t) * (computeEdgeGradientColorError(d, newPos, newCol) + computeEdgeGradientColorError(m.phi2(d), newPos, newCol)).norm() / sqrt(3)
;
(1-t) * (computeEdgeGradientColorError(d, newPos, newCol) + computeEdgeGradientColorError(m.phi2(d), newPos, newCol)).norm() / sqrt(3.0) ;
einfo.it = edges.insert(std::make_pair(err, d)) ;
einfo.valid = true ;
......
......@@ -1031,10 +1031,10 @@ void HalfEdgeSelector_ColorGradient<PFP>::computeHalfEdgeInfo(Dart d, HalfEdgeIn
//std::cout << quadGeom(newPos) / (alpha/M_PI + quadHF(newHF)) << std::endl ;
// sum of QEM metric and color gradient metric
const REAL t = 0.01 ;
const REAL t = 0.01f ;
const REAL& err =
t * quadGeom(newPos) + // geom
(1-t) * computeGradientColorError(v0,v1).norm()/sqrt(3) // color
(1-t) * computeGradientColorError(v0,v1).norm()/sqrt(3.0) // color
;
/*std::cout << quadGeom(newPos) << std::endl ;
......
......@@ -77,7 +77,7 @@ typename PFP::REAL meanEdgeLength(typename PFP::MAP& map, const VertexAttribute<
typename PFP::REAL length(0);
unsigned int nbe = 0;
for (unsigned int i = 0; i < CGoGN::Parallel::NumberOfThreads; ++i)
for (int i = 0; i < CGoGN::Parallel::NumberOfThreads; ++i)
{
length += lengths[i];
nbe += nbedges[i];
......
......@@ -547,7 +547,7 @@ void normalCycles_computeTensor(
{
typename PFP::REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(col.getMap(), e, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), e, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1 / ev.norm());
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1.0 / ev.norm());
}
// collect edges on the border
......@@ -556,7 +556,7 @@ void normalCycles_computeTensor(
typename PFP::REAL edgeangle = Algo::Surface::Geometry::computeAngleBetweenNormalsOnEdge<PFP>(col.getMap(), d, position);
typename PFP::REAL alpha = col.borderEdgeRatio(d, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), d, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1 / ev.norm()) * alpha;
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle * (1.0 / ev.norm()) * alpha;
}
tensor /= col.computeArea(position);
......@@ -575,7 +575,7 @@ void normalCycles_computeTensor(
for (Edge e : col.getInsideEdges())
{
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), e, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1 / ev.norm());
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1.0 / ev.norm());
}
// collect edges on the border
......@@ -583,7 +583,7 @@ void normalCycles_computeTensor(
{
typename PFP::REAL alpha = col.borderEdgeRatio(d, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), d, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1 / ev.norm()) * alpha;
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1.0 / ev.norm()) * alpha;
}
tensor /= col.computeArea(position);
......@@ -603,7 +603,7 @@ void normalCycles_computeTensor(
for (Edge e : col.getInsideEdges())
{
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), e, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1 / ev.norm());
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[e] * (1.0 / ev.norm());
}
// collect edges on the border
......@@ -611,7 +611,7 @@ void normalCycles_computeTensor(
{
typename PFP::REAL alpha = col.borderEdgeRatio(d, position);
typename PFP::VEC3 ev = Algo::Surface::Geometry::vectorOutOfDart<PFP>(col.getMap(), d, position);
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1 / ev.norm()) * alpha;
tensor += Geom::transposed_vectors_mult(ev,ev) * edgeangle[d] * (1.0 / ev.norm()) * alpha;
}
tensor /= col.computeArea(position, edgearea);
......
......@@ -34,8 +34,11 @@
#include "Geometry/vector_gen.h"
#include "Utils/GLSLShader.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderColorPerVertex.h"
//#include "Utils/Shaders/shaderSimpleColor.h"
//#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/Shaders/shaderBoldLines.h"
#include "Utils/Shaders/shaderColorDarts.h"
#include "Utils/Shaders/shaderDarts.h"
#include "Utils/vbo_base.h"
#include "Utils/svg.h"
......@@ -75,8 +78,14 @@ protected:
unsigned int m_vaId;
Utils::ShaderSimpleColor* m_shader1;
Utils::ShaderColorPerVertex* m_shader2;
//Utils::ShaderSimpleColor* m_shader1;
//Utils::ShaderColorPerVertex* m_shader2;
Utils::ShaderBoldLines* m_shader1;
Utils::ShaderColorDarts* m_shader2;
Utils::ShaderDarts* m_shader3;
std::vector<Utils::GLSLShader*> m_shadersVector;
/**
*number of darts to draw
......@@ -157,6 +166,8 @@ public:
Utils::GLSLShader* shader1() { return static_cast<Utils::GLSLShader*>(m_shader1); }
Utils::GLSLShader* shader2() { return static_cast<Utils::GLSLShader*>(m_shader2); }
Utils::GLSLShader* shader3() { return static_cast<Utils::GLSLShader*>(m_shader3); }
const std::vector<Utils::GLSLShader*>& shaders() const { return m_shadersVector; }
void setClippingPlane(const Geom::Vec4f& plane);
......
......@@ -71,8 +71,13 @@ Topo3Render<PFP>::Topo3Render():
m_vbo3->setDataSize(3);
m_vbo4->setDataSize(3);
m_shader1 = new Utils::ShaderSimpleColor(true,false);
m_shader2 = new Utils::ShaderColorPerVertex(true,false);
m_shader1 = new Utils::ShaderBoldLines();
m_shader2 = new Utils::ShaderColorDarts();
m_shader3 = new Utils::ShaderDarts();
m_shadersVector.push_back(m_shader1);
m_shadersVector.push_back(m_shader2);
m_shadersVector.push_back(m_shader3);
// binding VBO - VA
m_vaId = m_shader1->setAttributePosition(m_vbo1);
......@@ -80,17 +85,22 @@ Topo3Render<PFP>::Topo3Render():
m_shader2->setAttributePosition(m_vbo0);
m_shader2->setAttributeColor(m_vbo4);
m_shader3->setAttributePosition(m_vbo0);
// registering for auto matrices update
Utils::GLSLShader::registerShader(NULL, m_shader1);
Utils::GLSLShader::registerShader(NULL, m_shader2);
Utils::GLSLShader::registerShader(NULL, m_shader3);
}
template<typename PFP>
Topo3Render<PFP>::~Topo3Render()
{
Utils::GLSLShader::unregisterShader(NULL, m_shader3);
Utils::GLSLShader::unregisterShader(NULL, m_shader2);
Utils::GLSLShader::unregisterShader(NULL, m_shader1);
delete m_shader3;
delete m_shader2;
delete m_shader1;
delete m_vbo4;
......@@ -115,6 +125,7 @@ void Topo3Render<PFP>::setClippingPlane(const Geom::Vec4f& plane)
{
m_shader1->setClippingPlane(plane);
m_shader2->setClippingPlane(plane);
m_shader3->setClippingPlane(plane);
}
template<typename PFP>
......@@ -175,42 +186,10 @@ void Topo3Render<PFP>::drawDarts()
if (m_nbDarts==0)
return;
m_shader2->setLineWidth(m_topo_dart_width);
m_shader2->enableVertexAttribs();
glLineWidth(m_topo_dart_width);
glDrawArrays(GL_LINES, 0, m_nbDarts*2);
// change the stride to take 1/2 vertices
m_shader2->enableVertexAttribs(6*sizeof(GL_FLOAT));
glPointSize(2.0f*m_topo_dart_width);
glDrawArrays(GL_POINTS, 0, m_nbDarts);
m_shader2->disableVertexAttribs();
//
//// glColor3f(1.0f,1.0f,1.0f);
// glLineWidth(m_topo_dart_width);
// glPointSize(2.0f*m_topo_dart_width);
//
// glBindBuffer(GL_ARRAY_BUFFER, m_VBOBuffers[4]);
// glColorPointer(3, GL_FLOAT, 0, 0);
// glEnableClientState(GL_COLOR_ARRAY);
//
// glBindBuffer(GL_ARRAY_BUFFER, m_VBOBuffers[0]);
// glVertexPointer(3, GL_FLOAT, 0, 0);
// glEnableClientState(GL_VERTEX_ARRAY);
// glDrawArrays(GL_LINES, 0, m_nbDarts*2);
//
// glVertexPointer(3, GL_FLOAT, 6*sizeof(GL_FLOAT), 0);
//
// glBindBuffer(GL_ARRAY_BUFFER, m_VBOBuffers[4]);
// glColorPointer(3, GL_FLOAT, 6*sizeof(GL_FLOAT), 0);
// glDrawArrays(GL_POINTS, 0, m_nbDarts)
// ;
// glDisableClientState(GL_COLOR_ARRAY);
// glDisableClientState(GL_VERTEX_ARRAY);
}
template<typename PFP>
......@@ -219,24 +198,12 @@ void Topo3Render<PFP>::drawRelation1()
if (m_nbDarts==0)
return;
glLineWidth(m_topo_relation_width);
m_shader1->changeVA_VBO(m_vaId, m_vbo1);
m_shader1->setColor(Geom::Vec4f(0.0f,1.0f,1.0f,0.0f));
m_shader1->setLineWidth(m_topo_relation_width);
m_shader1->enableVertexAttribs();
glDrawArrays(GL_LINES, 0, m_nbRel1*2);
m_shader1->disableVertexAttribs();
// glLineWidth(m_topo_relation_width);
// glColor3f(0.0f,1.0f,1.0f);
// glBindBuffer(GL_ARRAY_BUFFER, m_VBOBuffers[1]);
// glVertexPointer(3, GL_FLOAT, 0, 0);
//
// glEnableClientState(GL_VERTEX_ARRAY);
// glDrawArrays(GL_LINES, 0, m_nbDarts*2);
// glDisableClientState(GL_VERTEX_ARRAY);
}
template<typename PFP>
......@@ -246,21 +213,11 @@ void Topo3Render<PFP>::drawRelation2()
return;
m_shader1->changeVA_VBO(m_vaId, m_vbo2);
m_shader1->setColor(Geom::Vec4f(1.0f,0.0f,0.0f,0.0f));
m_shader1->setColor(Geom::Vec4f(1.0f, 0.0f, 0.0f, 0.0f));
m_shader1->setLineWidth(m_topo_relation_width);
m_shader1->enableVertexAttribs();
glDrawArrays(GL_QUADS, 0, m_nbRel2*4);
glDrawArrays(GL_LINES, 0, m_nbRel1 * 2);
m_shader1->disableVertexAttribs();
// glLineWidth(m_topo_relation_width);
// glColor3f(1.0f,0.0f,0.0f);