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

up

parent 78d89f5c
......@@ -169,6 +169,20 @@
<item>
<widget class="QSpinBox" name="spinBox_dart"/>
</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>
<spacer name="verticalSpacer">
<property name="orientation">
......
......@@ -83,8 +83,8 @@ class Volusion: public Utils::QT::SimpleQGLV
bool display_obj;
bool obj_belong;
bool obj_neighbors;
// bool clip_volume;
// bool hide_clipping;
bool clip_volume;
bool hide_clipping;
bool draw_dart;
float m_explode_factor;
float m_explode_factorf;
......@@ -120,17 +120,17 @@ class Volusion: public Utils::QT::SimpleQGLV
// for clipping plane manipulation
// Utils::Pickable* m_PlanePick;
// Utils::FrameManipulator* m_frame;
// unsigned int m_pickedAxis;
// int m_begX;
// int m_begY;
// int clip_id1;
// int clip_id2;
Utils::Pickable* m_PlanePick;
Utils::FrameManipulator* m_frame;
unsigned int m_pickedAxis;
int m_begX;
int m_begY;
int clip_id1;
int clip_id2;
// // shader of toporender3
// Utils::ClippingShader* m_sh1;
// Utils::ClippingShader* m_sh2;
Utils::ClippingShader* m_sh1;
Utils::ClippingShader* m_sh2;
public:
float m_WidthObj;
......@@ -149,8 +149,8 @@ public:
display_obj(true),
obj_belong(false),
obj_neighbors(false),
// clip_volume(false),
// hide_clipping(true),
clip_volume(false),
hide_clipping(true),
draw_dart(false),
m_explode_factor(1.0f),
render_belonging(false),
......@@ -192,8 +192,8 @@ public slots:
void obj_onoff(bool x);
void objBelong_onoff(bool x);
void objNeighbors_onoff(bool x);
// void clipping_onoff(bool x);
// void hide_onoff(bool x);
void clipping_onoff(bool x);
void hide_onoff(bool x);
void slider_explode(int x);
void slider_pressed();
void slider_released();
......
......@@ -866,19 +866,22 @@ bool EnvMap::subdivideMap()
bool res =false;
for(Dart volume : refineMark.get_markedCells())
{
refineMark.unmark(volume);
if(!CellOnMaxLevel[volume] && RegisteredAgents[volume].size()>nbAgentsToSubdivide)
if(refineMark.isMarked(volume))
{
// CGoGNout<<" volume :"<<volume<< " has agents : "<<RegisteredAgents[volume].size()<<CGoGNendl;
REAL rayon = volumeMaxdistance(volume) ;
if(rayon >2* maxCellRay ) // on subdivise si le rayon est 2 fois le maxCellRay
refineMark.unmark(volume);
if(!CellOnMaxLevel[volume] && RegisteredAgents[volume].size()>nbAgentsToSubdivide)
{
subdivideVolume(volume);
res=true;
}
else
{
CellOnMaxLevel[volume]=true;
// CGoGNout<<" volume :"<<volume<< " has agents : "<<RegisteredAgents[volume].size()<<CGoGNendl;
REAL rayon = volumeMaxdistance(volume) ;
if(rayon >2* maxCellRay ) // on subdivise si le rayon est 2 fois le maxCellRay
{
subdivideVolume(volume);
res=true;
}
else
{
CellOnMaxLevel[volume]=true;
}
}
}
......@@ -904,10 +907,10 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
#endif
// 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
map.setCurrentLevel(vLevel) ;
if(OneLevelDifference)
{
map.setCurrentLevel(vLevel) ;
for ( Face dit : facesIncidentToVolume3(map,old))
{
#ifdef DEBUG_affichage
......@@ -930,8 +933,14 @@ bool EnvMap::subdivideVolume(Dart dglobal, bool OneLevelDifference)
if(map.checkForSurrounded(nv))
{
subdivideVolume(nv,false);
if(map.checkForSurrounded(dit))
{
// 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)
Needle_or_knife = atoi(argv[1]) ;
else
Needle_or_knife=true;
initAgents(500);
initAgents(10000);
envMap_.subdivideToMaxLevel();
// initFixedObjects();
// initSurfaces();
......
......@@ -107,36 +107,36 @@ void Volusion::topo_onoff(bool x)
updateGL();
}
//void Volusion::clipping_onoff(bool x)
//{
// clip_volume = x;
// if (clip_volume)
// {
// Geom::Vec3f pos = m_PlanePick->getPosition();
// float pipo;
// Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal
// float d = -(pos*normal);
// m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d));
// m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
// m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
// }
// else
// {
// m_explode_render->setNoClippingPlane();
// 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_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
// m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
// }
// updateGL();
//}
//void Volusion::hide_onoff(bool x)
//{
// hide_clipping = x;
// updateGL();
//}
void Volusion::clipping_onoff(bool x)
{
clip_volume = x;
if (clip_volume)
{
Geom::Vec3f pos = m_PlanePick->getPosition();
float pipo;
Geom::Vec3f normal = m_PlanePick->getAxisScale(2, pipo); // 2 = Z axis = plane normal
float d = -(pos*normal);
m_explode_render->setClippingPlane(Geom::Vec4f(normal[0],normal[1],normal[2],d));
m_sh1->setClipPlaneParamsAll(clip_id1, normal, pos);
m_sh2->setClipPlaneParamsAll(clip_id2, normal, pos);
}
else
{
m_explode_render->setNoClippingPlane();
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_sh1->setClipColorAttenuationFactorRelative(0.0f,0.0f);
m_sh2->setClipColorAttenuationFactorRelative(0.0f,0.0f);
}
updateGL();
}
void Volusion::hide_onoff(bool x)
{
hide_clipping = x;
updateGL();
}
void Volusion::slider_explode(int x)
{
......@@ -238,7 +238,7 @@ void Volusion::cb_initGL()
connect(timer, SIGNAL(timeout()), this, SLOT(animate())) ;
// choose to use GL version 2
Utils::GLSLShader::setCurrentOGLVersion(2);
// Utils::GLSLShader::setCurrentOGLVersion(2);
m_ds = new Utils::Drawer();
// create the renders
m_topo_render = new Algo::Render::GL2::Topo3RenderMap<PFP>();
......@@ -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->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->setNoClippingPlane();
// m_explode_render->setNoClippingPlane();
// m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1());
// m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2());
m_sh1 = static_cast<Utils::ClippingShader*>(m_topo_render->shader1());
m_sh2 = static_cast<Utils::ClippingShader*>(m_topo_render->shader2());
registerShader(m_explode_render->shaderFaces());
registerShader(m_explode_render->shaderLines());
////clipping
// m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1);
// m_frame = new Utils::FrameManipulator();
// m_frame->setSize(m_WidthObj/2.0f);
m_PlanePick = new Utils::Pickable(Utils::Pickable::GRID,1);
m_frame = new Utils::FrameManipulator();
m_frame->setSize(m_WidthObj/2.0f);
// m_sh1->insertClippingCode();
// m_sh2->insertClippingCode();
m_sh1->insertClippingCode();
m_sh2->insertClippingCode();
// clip_id1 = m_sh1->addClipPlane();
// clip_id2 = m_sh2->addClipPlane();
clip_id1 = m_sh1->addClipPlane();
clip_id2 = m_sh2->addClipPlane();
// 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_explode_render->setClippingPlane(Geom::Vec4f(0,0,1,m_PosObj*Geom::Vec3f(0,0,-1)));
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_explode_render->setClippingPlane(Geom::Vec4f(0,0,1,m_PosObj*Geom::Vec3f(0,0,-1)));
///agents
......@@ -706,7 +706,7 @@ void Volusion::cb_redraw()
glEnable(GL_POLYGON_OFFSET_FILL);
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* dataColor = static_cast<PFP::VEC3*>(m_agentsColorVBO->lockPtr());
......@@ -793,11 +793,11 @@ void Volusion::cb_redraw()
m_explode_render->drawFaces();
}
// if (clip_volume && !hide_clipping)
// {
// m_frame->draw();
// m_PlanePick->draw();
// }
if (clip_volume && !hide_clipping)
{
m_frame->draw();
m_PlanePick->draw();
}
// Affichage des stats dans la barre d'état
......@@ -825,7 +825,7 @@ void Volusion::cb_redraw()
void Volusion::cb_mousePress(int /*button*/, int x, int y)
{
/* if (Shift())
if (Shift())
{
if (hide_clipping || !clip_volume)
......@@ -851,7 +851,7 @@ void Volusion::cb_mousePress(int /*button*/, int x, int y)
updateGL();
}
}
else*/ if (Control())
else if (Control())
{
startX=x;
startY=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*/)
{
// if (!hide_clipping && clip_volume)
// {
if (!hide_clipping && clip_volume)
{
// m_pickedAxis=0;
// m_frame->highlight(m_pickedAxis);
// updateGL();
// }
m_pickedAxis=0;
m_frame->highlight(m_pickedAxis);
updateGL();
}
if (render_MovingObject)
updateGL();
......@@ -878,7 +878,7 @@ void Volusion::cb_mouseRelease(int /*button*/, 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)
updateGL();
return;
}
else */if(Control())
else if(Control())
{
m_frame_MovingObject->translateInScreen(x-startX, y-startY);
......@@ -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_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_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_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.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(sliderReleased()), SLOT(slider_released()) );
......@@ -996,7 +996,7 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt)
sqt.show();
sqt.dock.slider_explode->setValue(100);
sqt.dock.slider_explode_face->setValue(100);
// sqt.clipping_onoff(false);
sqt.clipping_onoff(false);
sqt.topo_onoff(false);
sqt.edges_onoff(true);
sqt.dock.check_timer->setChecked(false);
......@@ -1007,8 +1007,8 @@ void setupQtWidgets(char **argv, int argc,Volusion& sqt)
sqt.dock.checkBox_topo->setChecked(false);
sqt.dock.checkBox_belonging->setChecked(false);
sqt.dock.checkBox_neighbors->setChecked(false);
// sqt.dock.checkBox_plane->setChecked(false);
// sqt.dock.checkBox_hide->setChecked(true);
sqt.dock.checkBox_plane->setChecked(false);
sqt.dock.checkBox_hide->setChecked(true);
sqt.dock.checkBox_volumes->setChecked(false);
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