Commit d648ed89 authored by pitiot's avatar pitiot

up

parent a745baa5
No preview for this file type
......@@ -2,6 +2,8 @@
#define ENV_MAP_H
#define DEBUG_affichage
//#define DEBUG
#include <iostream>
#include <algorithm>
......@@ -26,8 +28,6 @@
//#include "Algo/ImplicitHierarchicalMesh/subdivision3.hxx"
//#define DEBUG_affichage
//#define DEBUG
/////////////////particules
#include "Algo/MovingObjects/particle_cell_3D_memo.h"
......@@ -87,7 +87,7 @@ public:
void pushSegmentInCellAsNeighbor(Segment* o, Dart d);
void popSegmentInCellAsNeighbor(Segment* o, Dart d);
void resetPartSubdiv(Segment* o);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -149,6 +149,7 @@ protected:
void cb_mouseMove(int buttons, int x, int y);
void cb_mousePress(int button, int x, int y);
void cb_mouseRelease(int button, int x, int y);
void cb_keyPress(int code);
void cb_Open();
void animate() ;
......
This diff is collapsed.
......@@ -109,6 +109,7 @@ void Simulator::initMovingObject()
std::pair<VEC3, Dart> startingPoint ;
Dart d=envMap_.map.indexDart(40);
startingPoint.first=Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(envMap_.map,d,envMap_.position);
// startingPoint.first=VEC3(-2.5f,-2.5f,2.5f);
startingPoint.second=d;
aiguille=new Needle(this,startingPoint);
}
......
......@@ -148,6 +148,25 @@ void Volusion::slider_released()
updateGL();
}
void Volusion::cb_keyPress(int code)
{
switch(code)
{
case 'r' :
{
simul.aiguille->refine();
m_MovingObjectVBO->updateData(simul.envMap_.position);
updateGL() ;
break;
}
}
}
void Volusion::cb_Open()
{
std::string filters("all (*.*)") ;
......@@ -209,7 +228,7 @@ void Volusion::cb_initGL()
m_MovingObjectVBO = new Utils::VBO();
m_MovingObjectVBO->setDataSize(3);
m_MovingObjectVBO->allocate(simul.aiguille->nbVertices);
m_MovingObjectVBO->allocate(10000);
//initialisation aiguille
......@@ -267,7 +286,11 @@ void Volusion::cb_redraw()
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);
......@@ -275,8 +298,7 @@ void Volusion::cb_redraw()
m_ds->vertex(p);
}
m_ds->color3f(0,0.5f,1.0f);
m_ds->vertex(simul.aiguille->parts_[1]->getPosition());
m_ds->vertex(simul.aiguille->parts_[0]->getPosition());
m_ds->end();
m_ds->endList();
......@@ -285,12 +307,13 @@ void Volusion::cb_redraw()
// float f;
// VEC3 cylinder_axis =cylinder->getAxisScale(2,f);
PFP::VEC3* data = static_cast<PFP::VEC3*>(m_MovingObjectVBO->lockPtr());
int n= simul.aiguille->nbVertices;
for(int i = 0; i< n; i ++)
int i=0;
for(auto particule : simul.aiguille->parts_)
{
VEC3 p = simul.aiguille->parts_[i]->getPosition();
VEC3 p = particule->getPosition();
data[i] = p;
i++;
}
......@@ -366,14 +389,20 @@ void Volusion::cb_redraw()
}
if (draw_dart && dartSlider < (simul.envMap_.map.end().index))
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_belonging)
{
m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
if (dock.comboBoxEdge->count()<simul.aiguille->nbEdges)
{
dock.comboBoxEdge->clear();
......@@ -430,6 +459,7 @@ void Volusion::cb_redraw()
if(render_neighbors)
{
m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
if(val_comboEdge==0)
{
for(unsigned int i =0;i<simul.aiguille->nbEdges;i++)
......@@ -465,8 +495,10 @@ void Volusion::cb_redraw()
}
if (render_topo)
{
m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
m_topo_render->drawTopo();
}
......@@ -474,6 +506,7 @@ void Volusion::cb_redraw()
if (render_edges)
{
glLineWidth(2.0f);
m_explode_render->updateData<PFP>(simul.envMap_.map, simul.envMap_.position, simul.envMap_.color);
m_explode_render->drawEdges();
}
......
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