Commit 6026152a authored by Thomas Pitiot 's avatar Thomas Pitiot

up

parent 78d89f5c
...@@ -169,6 +169,20 @@ ...@@ -169,6 +169,20 @@
<item> <item>
<widget class="QSpinBox" name="spinBox_dart"/> <widget class="QSpinBox" name="spinBox_dart"/>
</item> </item>
<item>
<widget class="QCheckBox" name="checkBox_plane">
<property name="text">
<string>Clipping</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_hide">
<property name="text">
<string>hide clipping plane</string>
</property>
</widget>
</item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
......
...@@ -83,8 +83,8 @@ class Volusion: public Utils::QT::SimpleQGLV ...@@ -83,8 +83,8 @@ class Volusion: public Utils::QT::SimpleQGLV
bool display_obj; bool display_obj;
bool obj_belong; bool obj_belong;
bool obj_neighbors; bool obj_neighbors;
// bool clip_volume; bool clip_volume;
// bool hide_clipping; bool hide_clipping;
bool draw_dart; bool draw_dart;
float m_explode_factor; float m_explode_factor;
float m_explode_factorf; float m_explode_factorf;
...@@ -120,17 +120,17 @@ class Volusion: public Utils::QT::SimpleQGLV ...@@ -120,17 +120,17 @@ class Volusion: public Utils::QT::SimpleQGLV
// for clipping plane manipulation // for clipping plane manipulation
// Utils::Pickable* m_PlanePick; Utils::Pickable* m_PlanePick;
// Utils::FrameManipulator* m_frame; Utils::FrameManipulator* m_frame;
// unsigned int m_pickedAxis; unsigned int m_pickedAxis;
// int m_begX; int m_begX;
// int m_begY; int m_begY;
// int clip_id1; int clip_id1;
// int clip_id2; int clip_id2;
// // shader of toporender3 // // shader of toporender3
// Utils::ClippingShader* m_sh1; Utils::ClippingShader* m_sh1;
// Utils::ClippingShader* m_sh2; Utils::ClippingShader* m_sh2;
public: public:
float m_WidthObj; float m_WidthObj;
...@@ -149,8 +149,8 @@ public: ...@@ -149,8 +149,8 @@ public:
display_obj(true), display_obj(true),
obj_belong(false), obj_belong(false),
obj_neighbors(false), obj_neighbors(false),
// clip_volume(false), clip_volume(false),
// hide_clipping(true), hide_clipping(true),
draw_dart(false), draw_dart(false),
m_explode_factor(1.0f), m_explode_factor(1.0f),
render_belonging(false), render_belonging(false),
...@@ -192,8 +192,8 @@ public slots: ...@@ -192,8 +192,8 @@ public slots:
void obj_onoff(bool x); void obj_onoff(bool x);
void objBelong_onoff(bool x); void objBelong_onoff(bool x);
void objNeighbors_onoff(bool x); void objNeighbors_onoff(bool x);
// void clipping_onoff(bool x); void clipping_onoff(bool x);
// void hide_onoff(bool x); void hide_onoff(bool x);
void slider_explode(int x); void slider_explode(int x);
void slider_pressed(); void slider_pressed();
void slider_released(); void slider_released();
......
...@@ -866,19 +866,22 @@ bool EnvMap::subdivideMap() ...@@ -866,19 +866,22 @@ bool EnvMap::subdivideMap()
bool res =false; bool res =false;
for(Dart volume : refineMark.get_markedCells()) for(Dart volume : refineMark.get_markedCells())
{ {
refineMark.unmark(volume); if(refineMark.isMarked(volume))
if(!CellOnMaxLevel[volume] && RegisteredAgents[volume].size()>nbAgentsToSubdivide)
{ {
// CGoGNout<<" volume :"<<volume<< " has agents : "<<RegisteredAgents[volume].size()<<CGoGNendl; refineMark.unmark(volume);
REAL rayon = volumeMaxdistance(volume) ; if(!CellOnMaxLevel[volume] && RegisteredAgents[volume].size()>nbAgentsToSubdivide)
if(rayon >2* maxCellRay ) // on subdivise si le rayon est 2 fois le maxCellRay
{ {
subdivideVolume(volume); // CGoGNout<<" volume :"<<volume<< " has agents : "<<RegisteredAgents[volume].size()<<CGoGNendl;
res=true; REAL rayon = volumeMaxdistance(volume) ;
} if(rayon >2* maxCellRay ) // on subdivise si le rayon est 2 fois le maxCellRay
else {
{ subdivideVolume(volume);
CellOnMaxLevel[volume]=true; res=true;
}
else
{
CellOnMaxLevel[volume]=true;
}
} }
} }
...@@ -904,10 +907,10 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -904,10 +907,10 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
#endif #endif
// la subdivision ne doit pas mettre plus d'un level de différence entre des cellules adjacentes // la subdivision ne doit pas mettre plus d'un level de différence entre des cellules adjacentes
// on commence donc par subdiviser les voisins qui ont trop de différence // on commence donc par subdiviser les voisins qui ont trop de différence
map.setCurrentLevel(vLevel) ;
if(OneLevelDifference) if(OneLevelDifference)
{ {
map.setCurrentLevel(vLevel) ;
for ( Face dit : facesIncidentToVolume3(map,old)) for ( Face dit : facesIncidentToVolume3(map,old))
{ {
#ifdef DEBUG_affichage #ifdef DEBUG_affichage
...@@ -930,8 +933,14 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference) ...@@ -930,8 +933,14 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
if(map.checkForSurrounded(nv)) if(map.checkForSurrounded(nv))
{ {
if(map.checkForSurrounded(dit))
subdivideVolume(nv,false); {
// CGoGNout<<"cas horrible de deux volumes entierement subdivisés sur les faces"<<CGoGNendl;
map.setCurrentLevel(map.getMaxLevel()) ;
return false; // cas a traiter !
}
subdivideVolume(nv,false);
} }
} }
......
...@@ -25,7 +25,7 @@ void Simulator::init(int argc, char **argv) ...@@ -25,7 +25,7 @@ void Simulator::init(int argc, char **argv)
Needle_or_knife = atoi(argv[1]) ; Needle_or_knife = atoi(argv[1]) ;
else else
Needle_or_knife=true; Needle_or_knife=true;
initAgents(500); initAgents(10000);
envMap_.subdivideToMaxLevel(); envMap_.subdivideToMaxLevel();
// initFixedObjects(); // initFixedObjects();
// initSurfaces(); // initSurfaces();
......
...@@ -107,36 +107,36 @@ void Volusion::topo_onoff(bool x) ...@@ -107,36 +107,36 @@ void Volusion::topo_onoff(bool x)
updateGL(); updateGL();
} }
//void Volusion::clipping_onoff(bool x) void Volusion::clipping_onoff(bool x)
//{ {
// clip_volume = x; clip_volume = x;
// if (clip_volume) if (clip_volume)
// { {
// Geom::Vec3f pos = m_PlanePick->getPosition(); Geom::Vec3f pos = m_PlanePick->getPosition();
// float pipo; float pipo;
// Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal
// float d = -(pos*normal); float d = -(pos*normal);
// m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d)); m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d));
// m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos); m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
// m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos); m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
// } }
// else else
// { {
// m_explode_render->setNoClippingPlane(); m_explode_render->setNoClippingPlane();
// m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f)); 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_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), Geom::Vec3f(0,0,999999.9f));
// m_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f); m_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
// m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f); m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
// } }
// updateGL(); updateGL();
//} }
//void Volusion::hide_onoff(bool x) void Volusion::hide_onoff(bool x)
//{ {
// hide_clipping = x; hide_clipping = x;
// updateGL(); updateGL();
//} }
void Volusion::slider_explode(int x) void Volusion::slider_explode(int x)
{ {
...@@ -238,7 +238,7 @@ void Volusion::cb_initGL() ...@@ -238,7 +238,7 @@ void Volusion::cb_initGL()
connect(timer, SIGNAL(timeout()), this, SLOT(animate())) ; connect(timer, SIGNAL(timeout()), this, SLOT(animate())) ;
// choose to use GL version 2 // choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2); // Utils::GLSLShader::setCurrentOGLVersion(2);
m_ds = new Utils::Drawer(); m_ds = new Utils::Drawer();
// create the renders // create the renders
m_topo_render = new Algo::Render::GL2::Topo3RenderMap<PFP>(); m_topo_render = new Algo::Render::GL2::Topo3RenderMap<PFP>();
...@@ -253,30 +253,30 @@ void Volusion::cb_initGL() ...@@ -253,30 +253,30 @@ void Volusion::cb_initGL()
m_explode_render->setAmbiant(Geom::Vec4f(0.2f,0.2f,0.2f,1.0f)); m_explode_render->setAmbiant(Geom::Vec4f(0.2f,0.2f,0.2f,1.0f));
m_explode_render->setBackColor(Geom::Vec4f(0.9f,0.9f,0.9f,1.0f)); m_explode_render->setBackColor(Geom::Vec4f(0.9f,0.9f,0.9f,1.0f));
m_explode_render->setColorLine(Geom::Vec4f(0.8f,0.2f,0.2f,1.0f)); m_explode_render->setColorLine(Geom::Vec4f(0.8f,0.2f,0.2f,1.0f));
m_explode_render->setNoClippingPlane(); // m_explode_render->setNoClippingPlane();
// m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1()); m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1());
// m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2()); m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2());
registerShader(m_explode_render->shaderFaces()); registerShader(m_explode_render->shaderFaces());
registerShader(m_explode_render->shaderLines()); registerShader(m_explode_render->shaderLines());
////clipping ////clipping
// m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1); m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1);
// m_frame = new Utils::FrameManipulator(); m_frame = new Utils::FrameManipulator();
// m_frame->setSize(m_WidthObj/2.0f); m_frame->setSize(m_WidthObj/2.0f);
// m_sh1->insertClippingCode(); m_sh1->insertClippingCode();
// m_sh2->insertClippingCode(); m_sh2->insertClippingCode();
// clip_id1 = m_sh1->addClipPlane(); clip_id1 = m_sh1->addClipPlane();
// clip_id2 = m_sh2->addClipPlane(); clip_id2 = m_sh2->addClipPlane();
// m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), m_PosObj); m_sh1->setClipPlaneParamsAll(clip_id1, Geom::Vec3f(0,0,1), m_PosObj);
// m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), m_PosObj); m_sh2->setClipPlaneParamsAll(clip_id2, Geom::Vec3f(0,0,1), m_PosObj);
// m_explode_render->setClippingPlane(Geom::Vec4f(0,0,1,m_PosObj*Geom::Vec3f(0,0,-1))); m_explode_render->setClippingPlane(Geom::Vec4f(0,0,1,m_PosObj*Geom::Vec3f(0,0,-1)));
///agents ///agents
...@@ -706,7 +706,7 @@ void Volusion::cb_redraw() ...@@ -706,7 +706,7 @@ void Volusion::cb_redraw()
glEnable(GL_POLYGON_OFFSET_FILL); glEnable(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(1.0f, 1.0f); glPolygonOffset(1.0f, 1.0f);
if(true)// affichage agents if(render_MovingObject)// affichage agents
{ {
PFP::VEC3* data = static_cast<PFP::VEC3*>(m_agentsPosVBO->lockPtr()); PFP::VEC3* data = static_cast<PFP::VEC3*>(m_agentsPosVBO->lockPtr());
PFP::VEC3* dataColor = static_cast<PFP::VEC3*>(m_agentsColorVBO->lockPtr()); PFP::VEC3* dataColor = static_cast<PFP::VEC3*>(m_agentsColorVBO->lockPtr());
...@@ -793,11 +793,11 @@ void Volusion::cb_redraw() ...@@ -793,11 +793,11 @@ void Volusion::cb_redraw()
m_explode_render->drawFaces(); m_explode_render->drawFaces();
} }
// if (clip_volume && !hide_clipping) if (clip_volume && !hide_clipping)
// { {
// m_frame->draw(); m_frame->draw();
// m_PlanePick->draw(); m_PlanePick->draw();
// } }
// Affichage des stats dans la barre d'état // Affichage des stats dans la barre d'état
...@@ -825,7 +825,7 @@ void Volusion::cb_redraw() ...@@ -825,7 +825,7 @@ void Volusion::cb_redraw()
void Volusion::cb_mousePress(int /*button*/, int x, int y) void Volusion::cb_mousePress(int /*button*/, int x, int y)
{ {
/* if (Shift()) if (Shift())
{ {
if (hide_clipping || !clip_volume) if (hide_clipping || !clip_volume)
...@@ -851,7 +851,7 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y) ...@@ -851,7 +851,7 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
updateGL(); updateGL();
} }
} }
else*/ if (Control()) else if (Control())
{ {
startX=x; startX=x;
startY=y; startY=y;
...@@ -864,13 +864,13 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y) ...@@ -864,13 +864,13 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/) void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
{ {
// if (!hide_clipping && clip_volume) if (!hide_clipping && clip_volume)
// { {
// m_pickedAxis=0; m_pickedAxis=0;
// m_frame->highlight(m_pickedAxis); m_frame->highlight(m_pickedAxis);
// updateGL(); updateGL();
// } }
if (render_MovingObject) if (render_MovingObject)
updateGL(); updateGL();
...@@ -878,7 +878,7 @@ void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/) ...@@ -878,7 +878,7 @@ void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/)
void Volusion::cb_mouseMove(int buttons, int x, int y) void Volusion::cb_mouseMove(int buttons, int x, int y)
{ {
/* if (Shift()) if (Shift())
{ {
...@@ -933,7 +933,7 @@ void Volusion::cb_mouseMove(int buttons, int x, int y) ...@@ -933,7 +933,7 @@ void Volusion::cb_mouseMove(int buttons, int x, int y)
updateGL(); updateGL();
return; return;
} }
else */if(Control()) else if(Control())
{ {
m_frame_MovingObject->translateInScreen(x-startX, y-startY); m_frame_MovingObject->translateInScreen(x-startX, y-startY);
...@@ -981,8 +981,8 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt) ...@@ -981,8 +981,8 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt)
sqt.setCallBack( sqt.dock.checkBox_displayobjects, SIGNAL(toggled(bool)), SLOT(obj_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_displayobjects, SIGNAL(toggled(bool)), SLOT(obj_onoff(bool)) );
sqt.setCallBack( sqt.dock.checkBox_ObjBelong, SIGNAL(toggled(bool)), SLOT(objBelong_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_ObjBelong, SIGNAL(toggled(bool)), SLOT(objBelong_onoff(bool)) );
sqt.setCallBack( sqt.dock.checkBox_ObjNeighbors, SIGNAL(toggled(bool)), SLOT(objNeighbors_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_ObjNeighbors, SIGNAL(toggled(bool)), SLOT(objNeighbors_onoff(bool)) );
// sqt.setCallBack( sqt.dock.checkBox_hide, SIGNAL(toggled(bool)), SLOT(hide_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_hide, SIGNAL(toggled(bool)), SLOT(hide_onoff(bool)) );
// sqt.setCallBack( sqt.dock.checkBox_plane, SIGNAL(toggled(bool)), SLOT(clipping_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_plane, SIGNAL(toggled(bool)), SLOT(clipping_onoff(bool)) );
sqt.setCallBack( sqt.dock.comboBoxEdge, SIGNAL( activated(int)), SLOT(comboEdge(int)) ); sqt.setCallBack( sqt.dock.comboBoxEdge, SIGNAL( activated(int)), SLOT(comboEdge(int)) );
sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderPressed()), SLOT(slider_pressed()) ); sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderPressed()), SLOT(slider_pressed()) );
sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderReleased()), SLOT(slider_released()) ); sqt.setCallBack( sqt.dock.slider_explode, SIGNAL(sliderReleased()), SLOT(slider_released()) );
...@@ -996,7 +996,7 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt) ...@@ -996,7 +996,7 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt)
sqt.show(); sqt.show();
sqt.dock.slider_explode->setValue(100); sqt.dock.slider_explode->setValue(100);
sqt.dock.slider_explode_face->setValue(100); sqt.dock.slider_explode_face->setValue(100);
// sqt.clipping_onoff(false); sqt.clipping_onoff(false);
sqt.topo_onoff(false); sqt.topo_onoff(false);
sqt.edges_onoff(true); sqt.edges_onoff(true);
sqt.dock.check_timer->setChecked(false); sqt.dock.check_timer->setChecked(false);
...@@ -1007,8 +1007,8 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt) ...@@ -1007,8 +1007,8 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt)
sqt.dock.checkBox_topo->setChecked(false); sqt.dock.checkBox_topo->setChecked(false);
sqt.dock.checkBox_belonging->setChecked(false); sqt.dock.checkBox_belonging->setChecked(false);
sqt.dock.checkBox_neighbors->setChecked(false); sqt.dock.checkBox_neighbors->setChecked(false);
// sqt.dock.checkBox_plane->setChecked(false); sqt.dock.checkBox_plane->setChecked(false);
// sqt.dock.checkBox_hide->setChecked(true); sqt.dock.checkBox_hide->setChecked(true);
sqt.dock.checkBox_volumes->setChecked(false); sqt.dock.checkBox_volumes->setChecked(false);
sqt.dock.spinBox_dart->setRange(0, sqt.simul.envMap_.map.end().index) ; sqt.dock.spinBox_dart->setRange(0, sqt.simul.envMap_.map.end().index) ;
......
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