Commit 921efcb1 authored by untereiner's avatar untereiner

some changes

parent 71e149b3
This diff is collapsed.
......@@ -194,7 +194,12 @@ void MyQT::createMap(int n)
m_render_topo->setDartWidth(4.0f);
m_render_topo->setInitialDartsColor(0.0f,0.0f,0.0f);
m_render_topo->setInitialBoundaryDartsColor(0.0f,0.0f,0.0f);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true); // nb
#ifdef PRIMAL_TOPO
m_render_topo->updateData<PFP>(myMap, position, 0.9);
#else
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true);
#endif
for (Dart d=myMap.begin(); d!=myMap.end(); myMap.next(d))
{
......@@ -213,7 +218,12 @@ void MyQT::createMap(int n)
void MyQT::updateMap()
{
m_render_topo->setInitialBoundaryDartsColor(0.0f,0.0f,0.0f);
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true); // nb
#ifdef PRIMAL_TOPO
m_render_topo->updateData<PFP>(myMap, position, 0.9);
#else
m_render_topo->updateData<PFP>(myMap, position, 0.9f, 0.9f,true);
#endif
for (Dart d=myMap.begin(); d!=myMap.end(); myMap.next(d))
{
if (dm.isMarked(d) && (!myMap.isBoundaryMarked2(d)))
......@@ -229,7 +239,11 @@ void MyQT::updateMap()
void MyQT::cb_initGL()
{
glClearColor(1.0f,1.0f,1.0f,1.0f);
m_render_topo = new Algo::Render::GL2::TopoRender(0.01f) ;
#ifdef PRIMAL_TOPO
m_render_topo = new Algo::Render::GL2::TopoPrimalRender() ;
#else
m_render_topo = new Algo::Render::GL2::TopoRender(0.01f) ;
#endif
}
// redraw GL callback (clear and swap already done)
......
......@@ -27,6 +27,7 @@
//#define USE_GMAP
//#define PRIMAL_TOPO 1
#include "Topology/generic/parameters.h"
......@@ -36,8 +37,11 @@
#include "Topology/map/embeddedMap2.h"
#endif
#include "Algo/Render/GL2/topoRender.h"
#ifdef PRIMAL_TOPO
#include "Algo/Render/GL2/topoPrimalRender.h"
#else
#include "Algo/Render/GL2/topoRender.h"
#endif
#include "ui_tuto_oper2.h"
#include "Utils/Qt/qtui.h"
......@@ -88,7 +92,11 @@ protected:
DartAttribute<VEC3> colorDarts;
// render (for the topo)
Algo::Render::GL2::TopoRender* m_render_topo;
#ifdef PRIMAL_TOPO
Algo::Render::GL2::TopoPrimalRender* m_render_topo;
#else
Algo::Render::GL2::TopoRender* m_render_topo;
#endif
Dart m_selected;
Dart m_selected2;
DartMarker dm;
......
This diff is collapsed.
......@@ -27,6 +27,7 @@
//#define USE_GMAP
#define PRIMAL_TOPO 1
#include "Topology/generic/parameters.h"
......@@ -36,7 +37,12 @@
#include "Topology/map/embeddedMap3.h"
#endif
#include "Algo/Render/GL2/topo3Render.h"
#ifdef PRIMAL_TOPO
#include "Algo/Render/GL2/topo3PrimalRender.h"
#else
#include "Algo/Render/GL2/topo3Render.h"
#endif
#include "Algo/Render/GL2/topoRender.h"
#include "Algo/Geometry/boundingbox.h"
......@@ -71,7 +77,7 @@ class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
public:
MyQT():m_render_topo(NULL),m_selected(NIL),m_selected2(NIL),dm(myMap),m_shift(0.01f),m_ex1(0.9f),m_ex2(0.9f),m_ex3(0.9f), clip_volume(true) , hide_clipping(false) {}
MyQT():m_render_topo(NULL),m_selected(NIL),m_selected2(NIL),m_shift(0.01f),m_ex1(0.9f),m_ex2(0.9f),m_ex3(0.9f), clip_volume(true) , hide_clipping(false) {}
void cb_redraw();
void cb_initGL();
......@@ -95,12 +101,15 @@ protected:
Geom::BoundingBox<PFP::VEC3> bb;
// render (for the topo)
#ifdef PRIMAL_TOPO
Algo::Render::GL2::Topo3PrimalRender* m_render_topo;
#else
Algo::Render::GL2::Topo3Render* m_render_topo;
#endif
Algo::Render::GL2::TopoRender* m_render_topo_boundary;
Dart m_selected;
Dart m_selected2;
std::vector<Dart> m_selecteds;
DartMarker dm;
float m_shift;
float m_ex1, m_ex2, m_ex3;
......
......@@ -150,6 +150,11 @@
<string>unsewVolumes</string>
</property>
</item>
<item>
<property name="text">
<string>deleteVolume</string>
</property>
</item>
</widget>
</item>
<item row="6" column="0">
......
......@@ -50,10 +50,11 @@ namespace Masks
/* MJ96 basic functions : polyhedral meshes
*********************************************************************************/
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
class MJ96VertexVertexFunctor : public FunctorType
{
protected:
typedef typename EMBV::DATA_TYPE EMB;
typename PFP::MAP& m_map ;
EMBV& m_attribut;
//Algo::Volume::IHM::AttributeHandler_IHM<typename PFP::VEC3, VERTEX>& m_position ;
......@@ -118,7 +119,7 @@ public:
Traversor3VW<typename PFP::MAP> travVW(m_map, d);
for(Dart dit = travVW.begin() ; dit != travVW.end() ; dit = travVW.next())
{
Cavg += Algo::Surface::Geometry::volumeCentroidGen<PFP, EMBV, EMB>(m_map, dit, m_attribut);
Cavg += Algo::Surface::Geometry::volumeCentroid<PFP, EMBV>(m_map, dit, m_attribut);
++degree;
}
Cavg /= degree;
......@@ -128,7 +129,7 @@ public:
Traversor3VF<typename PFP::MAP> travVF(m_map, d);
for(Dart dit = travVF.begin() ; dit != travVF.end() ; dit = travVF.next())
{
Aavg += Algo::Surface::Geometry::faceCentroidGen<PFP, EMBV, EMB>(m_map, dit, m_attribut);
Aavg += Algo::Surface::Geometry::faceCentroid<PFP, EMBV>(m_map, dit, m_attribut);
++degree;
}
Aavg /= degree;
......@@ -156,10 +157,11 @@ public:
}
};
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
class MJ96EdgeVertexFunctor : public FunctorType
{
protected:
typedef typename EMBV::DATA_TYPE EMB;
typename PFP::MAP& m_map ;
EMBV& m_attribut;
//Algo::Volume::IHM::AttributeHandler_IHM<typename PFP::VEC3, VERTEX>& m_position ;
......@@ -217,7 +219,7 @@ public:
Traversor3EW<typename PFP::MAP> travEW(m_map, d2);
for(Dart dit = travEW.begin() ; dit != travEW.end() ; dit = travEW.next())
{
Cavg += Algo::Surface::Geometry::volumeCentroidGen<PFP, EMBV, EMB>(m_map, dit, m_attribut);
Cavg += Algo::Surface::Geometry::volumeCentroid<PFP, EMBV>(m_map, dit, m_attribut);
++degree;
}
Cavg /= degree;
......@@ -227,7 +229,7 @@ public:
Traversor3EF<typename PFP::MAP> travEF(m_map, d2);
for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
{
Aavg += Algo::Surface::Geometry::faceCentroidGen<PFP, EMBV, EMB>(m_map, dit, m_attribut);
Aavg += Algo::Surface::Geometry::faceCentroid<PFP, EMBV>(m_map, dit, m_attribut);
++degree;
}
Aavg /= degree;
......@@ -247,10 +249,11 @@ public:
}
};
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
class MJ96FaceVertexFunctor : public FunctorType
{
protected:
typedef typename EMBV::DATA_TYPE EMB;
typename PFP::MAP& m_map ;
EMBV& m_attribut;
//Algo::Volume::IHM::AttributeHandler_IHM<typename PFP::VEC3, VERTEX>& m_position ;
......@@ -291,10 +294,10 @@ public:
m_map.decCurrentLevel() ;
//face points
EMB C0 = Algo::Surface::Geometry::volumeCentroidGen<PFP, EMBV, EMB>(m_map, df, m_attribut);
EMB C1 = Algo::Surface::Geometry::volumeCentroidGen<PFP, EMBV, EMB>(m_map, m_map.phi3(df), m_attribut);
EMB C0 = Algo::Surface::Geometry::volumeCentroid<PFP, EMBV>(m_map, df, m_attribut);
EMB C1 = Algo::Surface::Geometry::volumeCentroid<PFP, EMBV>(m_map, m_map.phi3(df), m_attribut);
EMB A = Algo::Surface::Geometry::faceCentroidGen<PFP, EMBV, EMB>(m_map, df, m_attribut);
EMB A = Algo::Surface::Geometry::faceCentroid<PFP, EMBV>(m_map, df, m_attribut);
EMB fp = C0 + A * 2 + C1;
fp /= 4;
......@@ -309,10 +312,11 @@ public:
};
template <typename PFP, typename EMBV, typename EMB>
template <typename PFP, typename EMBV>
class MJ96VolumeVertexFunctor : public FunctorType
{
protected:
typedef typename EMBV::DATA_TYPE EMB;
typename PFP::MAP& m_map ;
EMBV& m_attribut;
//Algo::Volume::IHM::AttributeHandler_IHM<typename PFP::VEC3, VERTEX>& m_position ;
......@@ -332,7 +336,7 @@ public:
//cell points : these points are the average of the
//vertices of the lattice that bound the cell
EMB p = Algo::Surface::Geometry::volumeCentroidGen<PFP, EMBV, EMB>(m_map,df,m_attribut);
EMB p = Algo::Surface::Geometry::volumeCentroid<PFP, EMBV>(m_map,df,m_attribut);
m_map.incCurrentLevel() ;
......
......@@ -320,42 +320,42 @@ void Map3MR<PFP>::addNewLevelTetraOcta()
}
m_map.setCurrentLevel(m_map.getMaxLevel() - 1) ;
for(Dart dit = traW.begin(); dit != traW.end(); dit = traW.next())
{
Traversor3WV<typename PFP::MAP> traWV(m_map, dit);
for(Dart dit = traW.begin(); dit != traW.end(); dit = traW.next())
{
Traversor3WV<typename PFP::MAP> traWV(m_map, dit);
for(Dart ditWV = traWV.begin(); ditWV != traWV.end(); ditWV = traWV.next())
{
m_map.setCurrentLevel(m_map.getMaxLevel()) ;
Dart x = m_map.phi_1(m_map.phi2(m_map.phi1(ditWV)));
for(Dart ditWV = traWV.begin(); ditWV != traWV.end(); ditWV = traWV.next())
{
m_map.setCurrentLevel(m_map.getMaxLevel()) ;
Dart x = m_map.phi_1(m_map.phi2(m_map.phi1(ditWV)));
if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,x))
{
DartMarkerStore me(m_map);
if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,x))
{
DartMarkerStore me(m_map);
Dart f = x;
Dart f = x;
do
{
Dart f3 = m_map.phi3(f);
do
{
Dart f3 = m_map.phi3(f);
if(!me.isMarked(f3))
{
Dart tmp = m_map.phi_1(m_map.phi2(m_map.phi_1(m_map.phi2(m_map.phi_1(f3))))); //future voisin par phi2
if(!me.isMarked(f3))
{
Dart tmp = m_map.phi_1(m_map.phi2(m_map.phi_1(m_map.phi2(m_map.phi_1(f3))))); //future voisin par phi2
Dart f32 = m_map.phi2(f3);
swapEdges(f3, tmp);
Dart f32 = m_map.phi2(f3);
swapEdges(f3, tmp);
me.markOrbit<EDGE>(f3);
me.markOrbit<EDGE>(f32);
}
me.markOrbit<EDGE>(f3);
me.markOrbit<EDGE>(f32);
}
f = m_map.phi2(m_map.phi_1(f));
}while(f != x);
f = m_map.phi2(m_map.phi_1(f));
}while(f != x);
}
m_map.setCurrentLevel(m_map.getMaxLevel() - 1) ;
}
}
m_map.setCurrentLevel(m_map.getMaxLevel() - 1) ;
}
}
m_map.popLevel() ;
......
......@@ -729,65 +729,65 @@ void AnimatedSVGOut::add(SVGOut* svg)
m_svgs.push_back(svg);
}
void AnimatedSVGOut::write(const std::string& /*filename*/, float /*timeStep*/)
void AnimatedSVGOut::write(const std::string& filename, float timeStep)
{
// std::ofstream outfile(filename.c_str()) ;
//
// unsigned int bbX0=1000000;
// unsigned int bbY0=1000000;
// unsigned int bbX1=0;
// unsigned int bbY1=0;
//
// for (unsigned int i=0; i< m_svgs.size(); ++i)
// m_svgs[i]->computeBB(bbX0, bbY0, bbX1, bbY1);
//
// outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"<< std::endl;
// outfile << "<svg xmlns=\"http://www.w3.org/2000/svg\""<< std::endl;
// outfile << " xmlns:xlink=\"http://www.w3.org/1999/xlink\""<< std::endl;
// outfile << "viewBox=\""<< bbX0 <<" "<< bbY0 <<" "<< bbX1-bbX0 << " " << bbY1-bbY0 <<"\">"<< std::endl;
// outfile << "<title>Animated SVG</title>"<< std::endl;
// outfile << "<desc>"<< std::endl;
// outfile << "Rendered from CGoGN"<< std::endl;
// outfile << "</desc>"<< std::endl;
//
// outfile << "<defs>"<< std::endl;
//
//
// for (unsigned int i=0; i< m_svgs.size(); ++i)
// {
// std::vector<DepthSort> vds;
// m_svgs[i]->sortSimpleDepth(vds);
//
// outfile << "<g id=\"slice"<<i<< "\">" << std::endl;
// for (std::vector<DepthSort>::iterator it = vds.begin(); it != vds.end(); ++it)
// m_svgs[i]->m_objs[it->obj]->saveOne(outfile,it->id, bbX1-bbX0);
// outfile << "</g>" << std::endl;
// }
//
// outfile << "</defs>"<< std::endl;
//
//
// for (unsigned int i=0; i< m_svgs.size(); ++i)
// {
// unsigned int nbo = m_svgs[i]->m_opacities_animations.size();
//
// outfile << "<use xlink:href=\"#slice"<<i<<"\" >" << std::endl;
// outfile << "<animate attributeName=\"opacity\" dur=\""<<timeStep*nbo<<"s\" fill=\"freeze\" values=\"";
//
//
// for (unsigned int j = 0; j < nbo; ++j)
// {
// outfile << m_svgs[i]->m_opacities_animations[j];
// if ( j != (nbo-1))
// outfile<< ";";
// }
//
// outfile << "\" calcMode=\"discrete\" repeatCount=\"indefinite\" />" << std::endl;
// outfile << "</use>" << std::endl;
// }
//
// outfile << "</svg>" << std::endl;
// outfile.close();
// std::ofstream outfile(filename.c_str()) ;
// unsigned int bbX0=1000000;
// unsigned int bbY0=1000000;
// unsigned int bbX1=0;
// unsigned int bbY1=0;
// for (unsigned int i=0; i< m_svgs.size(); ++i)
// m_svgs[i]->computeBB(bbX0, bbY0, bbX1, bbY1);
// outfile << "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"<< std::endl;
// outfile << "<svg xmlns=\"http://www.w3.org/2000/svg\""<< std::endl;
// outfile << " xmlns:xlink=\"http://www.w3.org/1999/xlink\""<< std::endl;
// outfile << "viewBox=\""<< bbX0 <<" "<< bbY0 <<" "<< bbX1-bbX0 << " " << bbY1-bbY0 <<"\">"<< std::endl;
// outfile << "<title>Animated SVG</title>"<< std::endl;
// outfile << "<desc>"<< std::endl;
// outfile << "Rendered from CGoGN"<< std::endl;
// outfile << "</desc>"<< std::endl;
// outfile << "<defs>"<< std::endl;
// for (unsigned int i=0; i< m_svgs.size(); ++i)
// {
// std::vector<DepthSort> vds;
// m_svgs[i]->sortSimpleDepth(vds);
// outfile << "<g id=\"slice"<<i<< "\">" << std::endl;
// for (std::vector<DepthSort>::iterator it = vds.begin(); it != vds.end(); ++it)
// m_svgs[i]->m_groups[it->obj]->saveOne(outfile,it->id, bbX1-bbX0);
// outfile << "</g>" << std::endl;
// }
// outfile << "</defs>"<< std::endl;
// for (unsigned int i=0; i< m_svgs.size(); ++i)
// {
// unsigned int nbo = m_svgs[i]->m_opacities_animations.size();
// outfile << "<use xlink:href=\"#slice"<<i<<"\" >" << std::endl;
// outfile << "<animate attributeName=\"opacity\" dur=\""<<timeStep*nbo<<"s\" fill=\"freeze\" values=\"";
// for (unsigned int j = 0; j < nbo; ++j)
// {
// outfile << m_svgs[i]->m_opacities_animations[j];
// if ( j != (nbo-1))
// outfile<< ";";
// }
// outfile << "\" calcMode=\"discrete\" repeatCount=\"indefinite\" />" << std::endl;
// outfile << "</use>" << std::endl;
// }
// outfile << "</svg>" << std::endl;
// outfile.close();
}
......
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