/******************************************************************************* * CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * * version 0.1 * * Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by the * * Free Software Foundation; either version 2.1 of the License, or (at your * * option) any later version. * * * * This library is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * * for more details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * * * Web site: http://cgogn.unistra.fr/ * * Contact information: cgogn@unistra.fr * * * *******************************************************************************/ #include "viewer.h" void Volusion::dart_onoff(bool x) { draw_dart = x; updateGL(); } void Volusion::slot_slide(int i) { dartSlider = i; updateGL(); } void Volusion::volumes_onoff(bool x) { render_volumes = x; updateGL(); } void Volusion::edges_onoff(bool x) { render_edges = x; updateGL(); } void Volusion::MovingObject_onoff(bool x) { render_MovingObject = x; updateGL(); } void Volusion::belonging_onoff(bool x) { render_belonging = x; updateGL(); } void Volusion::neighbors_onoff(bool x) { render_neighbors= x; updateGL(); } void Volusion::obj_onoff(bool x) { display_obj= x; updateGL(); } void Volusion::objBelong_onoff(bool x) { obj_belong= x; updateGL(); } void Volusion::objNeighbors_onoff(bool x) { obj_neighbors= x; updateGL(); } void Volusion::comboEdge(int x) { val_comboEdge = x; if(x!=0) CGoGNout<< "affichage uniquement pour l'arete"< nb(simul.envMap_.map); //TODO MapBrowser m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, m_explode_factorf-0.05f, m_explode_factor); } 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) { m_explode_factor = 0.01f*(x+1)-0.0001f; m_explode_render->setExplodeVolumes(m_explode_factor); updateGL(); } void Volusion::slider_explodeF(int x) { m_explode_factorf = 0.01f*(x+1); m_explode_render->setExplodeFaces(m_explode_factorf); updateGL(); } void Volusion::slider_pressed() { render_topoTemp = render_topo; render_topo = false; updateGL(); } void Volusion::slider_released() { render_topo = render_topoTemp; if (render_topo) { // SelectorDartNoBoundary nb(simul.envMap.map); //TODO MapBrowser m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, m_explode_factorf-0.05f, m_explode_factor ); } updateGL(); } void Volusion::cb_keyPress(int code) { switch(code) { case 'r' : { #ifndef IHMap // simul.envMap_.popSegment(simul.objects[0]->Segments_[0]); // simul.envMap_.resetPartSubdiv(simul.objects[0]->Segments_[0]); // simul.envMap_.FirstRegistrationSegment(simul.objects[0]->Segments_[0]); #else simul.aiguille->refine(); m_MovingObjectVBO->updateData(simul.envMap_.position); updateGL() ; #endif break; } } } void Volusion::cb_Open() { std::string filters("all (*.*)") ; std::string filename = selectFile("Open Mesh", "", filters) ; if (filename.empty()) return ; else simul.envMap_.open_file(filename); // SelectorDartNoBoundary nb(simul.envMap_.map); m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); m_explode_render->updateData(simul.envMap_.map, simul.envMap_.position, simul.envMap_.color); updateGL() ; } void Volusion::cb_initGL() { // choose to use GL version 2 Utils::GLSLShader::setCurrentOGLVersion(2); m_ds = new Utils::Drawer(); // create the renders m_topo_render = new Algo::Render::GL2::Topo3RenderMap(); m_explode_render = new Algo::Render::GL2::ExplodeVolumeRender(true,true,true); // SelectorDartNoBoundary nb(simul.envMap_.map); m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); m_explode_render->updateData(simul.envMap_.map, simul.envMap_.position, simul.envMap_.color); m_explode_render->setExplodeVolumes(1.0f); m_explode_render->setExplodeFaces(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->setColorLine(Geom::Vec4f(0.8f,0.2f,0.2f,1.0f)); m_explode_render->setNoClippingPlane(); // m_sh1 = static_cast(m_topo_render->shader1()); // m_sh2 = static_cast(m_topo_render->shader2()); registerShader(m_explode_render->shaderFaces()); registerShader(m_explode_render->shaderLines()); // 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(); // 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_closestVBO = new Utils::VBO(); // m_closestVBO->setDataSize(3); // m_closestVBO->allocate(10000); // PFP::VEC3* data = static_cast(m_closestVBO->lockPtr()); // int j =0; for(Surface * surf : simul.surfaces) { surf->initGL(); registerShader(surf->m_shader); registerShader(surf->m_simpleColorShader); // for(Triangle * t : surf->triangles_) // { // data[j]=t->closest_point; // data[j+1]=t->p1; // j=j+2; // } } // m_closestVBO->releasePtr(); // m_spriteClosest = new Utils::PointSprite(); // m_spriteClosest->setAttributePosition(m_closestVBO); // m_spriteClosest->setSize(simul.aiguille->width); // m_spriteClosest->setColor(Geom::Vec4f(0.0f,1.0f,0.5f,1.0f)); // registerShader(m_spriteClosest); m_MovingObjectVBO = new Utils::VBO(); m_MovingObjectVBO->setDataSize(3); m_MovingObjectVBO->allocate(10000); //initialisation aiguille PFP::VEC3* data = static_cast(m_MovingObjectVBO->lockPtr()); for (unsigned int i=0; i< simul.aiguille->nbVertices; ++i) { VEC3 p = simul.aiguille->parts_[i]->getPosition(); data[i] = p; } // data[simul.aiguille->nbVertices]=simul.aiguille->closest_point; m_MovingObjectVBO->releasePtr(); m_sprite = new Utils::PointSprite(); m_sprite->setAttributePosition(m_MovingObjectVBO); m_sprite->setSize(simul.aiguille->width); registerShader(m_sprite); m_frame_MovingObject = new Utils::FrameManipulator(); m_frame_MovingObject->setSize(5.0f); } void Volusion::displayMO() { m_ds->newList(GL_COMPILE_AND_EXECUTE); m_ds->begin(GL_LINE_STRIP); m_ds->lineWidth(10.0f); if(simul.aiguille->nbEdges>0) { VEC3 origin = simul.aiguille->Segments_[0]->p1; m_ds->vertex(origin); } for(Segment * s : simul.aiguille->Segments_) { m_ds->color3f(s->r,s->g,s->b); VEC3 p = s->p2; m_ds->vertex(p); } m_ds->color3f(0,0.5f,1.0f); m_ds->end(); m_ds->endList(); // VEC3 pos1 = simul.aiguille->parts_[0]->getPosition(); // VEC3 pos2 = simul.aiguille->parts_[1]->getPosition(); // float f; // VEC3 cylinder_axis =cylinder->getAxisScale(2,f); PFP::VEC3* data = static_cast(m_MovingObjectVBO->lockPtr()); int i=0; for(auto particule : simul.aiguille->parts_) { VEC3 p = particule->getPosition(); // if(i==0) // { // m_topo_render->overdrawDart(particule->d,15.0f,1.0f,0.5f,1.0f); // m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); // } data[i] = p; i++; } // data[simul.aiguille->nbVertices]=simul.aiguille->closest_point; m_MovingObjectVBO->releasePtr(); // m_frame_MovingObject->draw(); // CGoGNout<rotate(Geom::angle(pos2-pos1,cylinder_axis),cylinder_axis^(pos2-pos1)); // cylinder->translate((((pos1+pos2)/2)-cylinder->getPosition())/2); // cylinder->draw(); m_sprite->enableVertexAttribs(); glDrawArrays(GL_POINTS, 0, simul.aiguille->nbVertices/*+1*/); m_sprite->disableVertexAttribs(); if(render_belonging) // affichage des cellules qui contiennent l'aiguille { m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); if ((unsigned int)dock.comboBoxEdge->count()nbEdges) { dock.comboBoxEdge->clear(); dock.comboBoxEdge->addItem("Aiguille entiere",2); for(unsigned int i = 0; i< simul.aiguille->nbEdges;i++) { std::ostringstream oss ; oss<<"arete "<addItem(s,2); } } if(val_comboEdge==0) { for(auto vect : simul.aiguille->belonging_cells) { // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(Dart it : vect) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,it)) { m_topo_render->overdrawDart(d,5.0f,0,1.0f,0); } } } // m_topo_render->overdrawDart(simul.aiguille->parts_[simul.aiguille->nbEdges]->d,10.0f,1.0f,0,0); } else { // m_topo_render->overdrawDart(simul.aiguille->parts_[val_comboEdge-1]->d,10.0f,1.0f,0,0); // m_topo_render->overdrawDart(simul.aiguille->parts_[val_comboEdge]->d,10.0f,1.0f,0,0); int i = val_comboEdge-1; for(Dart it : simul.aiguille->belonging_cells[i]) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it))) { m_topo_render->overdrawDart(d,5.0f,0,1.0f,0); } } } } if(render_neighbors) // affichage des cellules voisines de l'aiguille { m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); if(val_comboEdge==0) { for(auto vect : simul.aiguille->neighbor_cells) { // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(Dart it : vect) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it))) { m_topo_render->overdrawDart(d,5.0f,1.0f,0.0f,0.8f); } } } } else { int i = val_comboEdge-1; for(Dart it : simul.aiguille->neighbor_cells[i]) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it))) { m_topo_render->overdrawDart(d,5.0f,1.0f,0.0f,0.8f); } } } } } void Volusion::displayObj() { // PFP::VEC3* data2 = static_cast(m_closestVBO->lockPtr()); // int j =0; for(Surface * surf : simul.surfaces) { surf->draw(); // for(Triangle * t : surf->triangles_) // { // data2[j]=t->closest_point; //// data2[j+1]=t->p1; // j++; // } } // m_closestVBO->releasePtr(); // m_spriteClosest->enableVertexAttribs(); // glDrawArrays(GL_POINTS, 0, j+1); // m_spriteClosest->disableVertexAttribs(); for (ArticulatedObject * art : simul.objects) { m_ds->newList(GL_COMPILE_AND_EXECUTE); m_ds->begin(GL_LINE_STRIP); m_ds->lineWidth(10.0f); if(art->nbEdges>0) { VEC3 origin = art->Segments_[0]->p1; Segment * s=art->Segments_[0]; m_ds->color3f(s->r,s->g,s->b); m_ds->vertex(origin); } for(Segment * s : art->Segments_) { m_ds->color3f(s->r,s->g,s->b); VEC3 p = s->p2; m_ds->vertex(p); } m_ds->end(); m_ds->endList(); // VEC3 pos1 = art->parts_[0]->getPosition(); // VEC3 pos2 = art->parts_[1]->getPosition(); // float f; // VEC3 cylinder_axis =cylinder->getAxisScale(2,f); PFP::VEC3* data = static_cast(m_MovingObjectVBO->lockPtr()); int i=0; for(auto particule : art->parts_) { VEC3 p = particule->getPosition(); // if(i==0) // { // m_topo_render->overdrawDart(particule->d,15.0f,1.0f,0.5f,1.0f); // m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); // } data[i] = p; i++; } m_MovingObjectVBO->releasePtr(); // m_frame_MovingObject->draw(); // CGoGNout<rotate(Geom::angle(pos2-pos1,cylinder_axis),cylinder_axis^(pos2-pos1)); // cylinder->translate((((pos1+pos2)/2)-cylinder->getPosition())/2); // cylinder->draw(); m_sprite->enableVertexAttribs(); glDrawArrays(GL_POINTS, 0, art->nbVertices); m_sprite->disableVertexAttribs(); } if(obj_belong) { m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); for (ArticulatedObject * o : simul.objects) { for(auto vect : o->belonging_cells) { // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(Dart it : vect) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it))) { m_topo_render->overdrawDart(d,5.0f,0.0f,0.6f,0.4f); } } } } m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); for (Surface * o : simul.surfaces) { unsigned int i=0; // for(unsigned int i =0;inbTriangles;i++) { // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(Dart it : o->belonging_cells[i]) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(it))) { m_topo_render->overdrawDart(d,5.0f,0.0f,0.6f,0.4f); } } } } } if(obj_neighbors) { m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); for (ArticulatedObject * o : simul.objects) { for(unsigned int i =0;inbEdges;i++) { // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(auto it = o->neighbor_cells[i].begin(); it !=o->neighbor_cells[i].end();++it) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(*it))) { m_topo_render->overdrawDart(d,5.0f,1.0f,0.0f,0.8f); } } } } m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); for (Surface * o : simul.surfaces) { unsigned int i=0; // for(unsigned int i =0;inbTriangles;i++) { // m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0); for(auto it = o->neighbor_cells[i].begin(); it !=o->neighbor_cells[i].end();++it) { for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(*it))) { m_topo_render->overdrawDart(d,5.0f,1.0f,0.0f,0.8f); } } } } } } void Volusion::cb_redraw() { glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); glEnable(GL_LIGHTING); glEnable(GL_POLYGON_OFFSET_FILL); glPolygonOffset(1.0f, 1.0f); if(render_MovingObject) { displayMO(); } if(display_obj) // affichage objets fixes { displayObj(); } if(false) //affichage des normales { Dart volume=simul.envMap_.map.indexDart(1500); for (Face d : facesIncidentToVolume3(simul.envMap_.map,volume)) { m_ds->newList(GL_COMPILE_AND_EXECUTE); m_ds->begin(GL_LINE_STRIP); m_ds->color3f(0,1.0f,0); m_ds->lineWidth(10.0f); m_ds->vertex(simul.envMap_.facecenter[d]); m_ds->vertex(simul.envMap_.facecenter[d]+simul.envMap_.normaleFromVolume(volume,d)); m_ds->end(); m_ds->endList(); } } if (draw_dart) { m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); dock.spinBox_dart->setRange(0, simul.envMap_.map.end().index) ; if( dartSlider < (simul.envMap_.map.end().index)) { m_topo_render->overdrawDart(simul.envMap_.map.indexDart(dartSlider),15.0f,1.0f,0.0f,1.0f); } } if (render_topo) { m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f); m_topo_render->drawTopo(); } if (render_edges) { glLineWidth(2.0f); // simul.envMap_.map.setCurrentLevel(simul.envMap_.map.getMaxLevel()) ; m_explode_render->updateData(simul.envMap_.map, simul.envMap_.position, simul.envMap_.color); m_explode_render->drawEdges(); } glDisable(GL_POLYGON_OFFSET_FILL); if (render_volumes) { m_explode_render->updateData(simul.envMap_.map, simul.envMap_.position, simul.envMap_.color); m_explode_render->drawFaces(); } // if (clip_volume && !hide_clipping) // { // m_frame->draw(); // m_PlanePick->draw(); // } } void Volusion::cb_mousePress(int /*button*/, int x, int y) { /* if (Shift()) { if (hide_clipping || !clip_volume) return; m_begX = x; m_begY = y; // get ray of selection Geom::Vec3f rayA,rayB; float dist = getOrthoScreenRay(x,y,rayA,rayB); Geom::Vec3f AB = rayB-rayA; unsigned int fr_picked =0; // picking the frame -> axis fr_picked = m_frame->pick(rayA,AB,dist); if (fr_picked != 0) { m_pickedAxis=fr_picked; m_frame->highlight(m_pickedAxis); m_frame->storeProjection(m_pickedAxis); updateGL(); } } else*/ if (Control()) { startX=x; startY=y; m_frame_MovingObject->storeProjection(0); oldPosSprite=m_frame_MovingObject->getPosition(); updateGL(); } } void Volusion::cb_mouseRelease(int /*button*/, int /*x*/, int /*y*/) { // if (!hide_clipping && clip_volume) // { // m_pickedAxis=0; // m_frame->highlight(m_pickedAxis); // updateGL(); // } if (render_MovingObject) updateGL(); } void Volusion::cb_mouseMove(int buttons, int x, int y) { /* if (Shift()) { if (hide_clipping || !clip_volume) return; // rotation selected ? if (Utils::FrameManipulator::rotationAxis(m_pickedAxis)) { if (buttons&1) { float angle = m_frame->angleFromMouse(x,y,x-m_begX, y-m_begY); m_frame->rotate(m_pickedAxis, angle); } else if (buttons&2) m_frame->rotateInScreen(x-m_begX, y-m_begY); m_PlanePick->transfo() = m_frame->transfo(); } // translation selected else if (Utils::FrameManipulator::translationAxis(m_pickedAxis)) { if (buttons&1) { float dist = m_frame->distanceFromMouse(x-m_begX, y-m_begY); m_frame->translate(m_pickedAxis, dist); } else if (buttons&2) m_frame->translateInScreen(x-m_begX, y-m_begY); m_PlanePick->transfo() = m_frame->transfo(); } // scale selected else if (Utils::FrameManipulator::scaleAxis(m_pickedAxis) ) { float scale = m_frame->scaleFromMouse(x-m_begX, y-m_begY); m_frame->scale(m_pickedAxis, scale ); m_PlanePick->transfo() = m_frame->transfo(); } 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); m_begX = x; m_begY = y; updateGL(); return; } else */if(Control()) { m_frame_MovingObject->translateInScreen(x-startX, y-startY); // cylinder->transfo() = m_frame_MovingObject->transfo(); // simul.aiguille->transfo(m_frame_MovingObject->transfo()); VEC3 diff = m_frame_MovingObject->getPosition()-oldPosSprite; // CGoGNout<<"deplacement de : "<nbVertices>0) simul.aiguille->move(diff); startX=x; startY=y; oldPosSprite=m_frame_MovingObject->getPosition(); updateGL(); } } int main(int argc, char **argv) { // un peu d'interface QApplication app(argc, argv); Volusion sqt; sqt.simul.init(argc,argv); // interface de tuto5.ui sqt.setDock(&(sqt.dock)); // bounding box Geom::BoundingBox bb = Algo::Geometry::computeBoundingBox(sqt.simul.envMap_.map, sqt.simul.envMap_.position); sqt.m_WidthObj = std::max(std::max(bb.size(0), bb.size(1)), bb.size(2)); sqt.m_PosObj = (bb.min() + bb.max()) / REAL(2); // envoit info BB a l'interface sqt.setParamObject(sqt.m_WidthObj, sqt.m_PosObj.data()); sqt.setCallBack( sqt.dock.checkBox_volumes, SIGNAL(toggled(bool)), SLOT(volumes_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_edges, SIGNAL(toggled(bool)), SLOT(edges_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_topo, SIGNAL(toggled(bool)), SLOT(topo_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_MovingObject, SIGNAL(toggled(bool)), SLOT(MovingObject_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_belonging, SIGNAL(toggled(bool)), SLOT(belonging_onoff(bool)) ); sqt.setCallBack( sqt.dock.checkBox_neighbors, SIGNAL(toggled(bool)), SLOT(neighbors_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_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.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()) ); sqt.setCallBack(sqt.dock.spinBox_dart, SIGNAL(valueChanged(int)), SLOT(slot_slide(int))) ; sqt.setCallBack(sqt.dock.checkBox_drawDart, SIGNAL(toggled(bool)), SLOT(dart_onoff(bool))) ; sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(valueChanged(int)), SLOT(slider_explodeF(int)) ); sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(sliderPressed()), SLOT(slider_pressed()) ); sqt.setCallBack( sqt.dock.slider_explode_face, SIGNAL(sliderReleased()), SLOT(slider_released()) ); sqt.show(); sqt.dock.slider_explode->setValue(100); sqt.dock.slider_explode_face->setValue(100); // sqt.clipping_onoff(false); sqt.topo_onoff(false); sqt.edges_onoff(true); sqt.dock.checkBox_MovingObject->setChecked(true); sqt.dock.checkBox_displayobjects->setChecked(true); sqt.dock.checkBox_ObjBelong->setChecked(false); sqt.dock.checkBox_ObjNeighbors->setChecked(false); 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_volumes->setChecked(false); sqt.dock.spinBox_dart->setRange(0, sqt.simul.envMap_.map.end().index) ; sqt.dock.comboBoxEdge->addItem("Aiguille entiere",2); for(unsigned int i = 0; i< sqt.simul.aiguille->nbEdges;i++) { std::ostringstream oss ; oss<<"arete "<addItem(s,2); } // et on attend la fin. return app.exec(); // exemple utilisation chrono // Utils::Chrono ch; // // Vertex v(simul.envMap_.map.begin()); //// VEC3 p = Algo::Volume::Geometry::vertexNeighborhoodCentroid(simul.envMap_.map,v,simul.envMap_.position); // // Vol w(simul.envMap_.map.begin()); // VEC3 q = Algo::Surface::Geometry::volumeCentroid(simul.envMap_.map,w,simul.envMap_.position); // ch.start(); // float vol = Algo::Geometry::Parallel::totalVolume(simul.envMap_.map, simul.envMap_.position); // vol += Algo::Geometry::Parallel::totalVolume(simul.envMap_.map, simul.envMap_.position); // vol += Algo::Geometry::Parallel::totalVolume(simul.envMap_.map, simul.envMap_.position); // vol += Algo::Geometry::Parallel::totalVolume(simul.envMap_.map, simul.envMap_.position); // std::cout << ch.elapsed()<< " ms // val="<"<< std::endl; // ch.start(); // vol = Algo::Geometry::totalVolume(simul.envMap_.map, simul.envMap_.position); // std::cout << ch.elapsed()<< " ms val="<(simul.envMap_.map, simul.envMap_.position); // std::cout << ch.elapsed()<< " ms val="<(simul.envMap_.map, simul.envMap_.position); // std::cout << ch.elapsed()<< " ms val="<(simul.envMap_.map, simul.envMap_.position); // std::cout << ch.elapsed()<< " ms val="<