Commit 7d3b619d authored by Thomas Jund's avatar Thomas Jund
Browse files

mise a jour pr video

parent c240a2b6
......@@ -119,6 +119,13 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
}
glEnd() ;
glLineWidth(1.0f) ;
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p = obst->goals_[obst->curGoal_];
glVertex3fv(p.data()) ;
glEnd() ;
}
}
......
......@@ -262,10 +262,17 @@ void Simulator::setupCircleScenario(unsigned int nbAgents , unsigned int nbObsta
for (unsigned int i = 0 ; i < nbObstacles/2 ; i++)
{
VEC3 start = positions[i];
// std::vector<VEC3> goals;
// for(unsigned int k = 0 ; k < nbObstacles/2 ; k++)
// {
// goals.push_back(positions[(i+k)%(nbObstacles/2)]);
// }
unsigned int nbGoals=360;
std::vector<VEC3> goals;
for(unsigned int k = 0 ; k < nbObstacles/2 ; k++)
for(unsigned int k = 0 ; k < nbGoals ; k++)
{
goals.push_back(positions[(i+k)%(nbObstacles/2)]);
goals.push_back(VEC3(std::cos(2.0f*M_PI*k/nbGoals) * (2*radius/3), std::sin(2.0f*M_PI*k/nbGoals) * (2*radius/3), 0)) ;
}
vPos.clear();
......@@ -276,6 +283,7 @@ void Simulator::setupCircleScenario(unsigned int nbAgents , unsigned int nbObsta
vPos.push_back(start-xSide-ySide);
mo4= new MovingObstacle(this, i,vPos,goals, true, true);
mo4->curGoal_ = i*float(nbGoals)/float(nbObstacles/2.0f);
movingObstacles_.push_back(mo4);
}
......@@ -283,10 +291,17 @@ void Simulator::setupCircleScenario(unsigned int nbAgents , unsigned int nbObsta
for (unsigned int i = nbObstacles/2 ; i < nbObstacles ; i++)
{
VEC3 start = positions[i];
// std::vector<VEC3> goals;
// for(unsigned int k = (nbObstacles/2) ; k > 0 ; k--)
// {
// goals.push_back(positions[((i-(nbObstacles/2)+k)%(nbObstacles/2))+nbObstacles/2]);
// }
unsigned int nbGoals=360;
std::vector<VEC3> goals;
for(unsigned int k = (nbObstacles/2) ; k > 0 ; k--)
for(unsigned int k = 0 ; k < nbGoals ; k++)
{
goals.push_back(positions[((i-(nbObstacles/2)+k)%(nbObstacles/2))+nbObstacles/2]);
goals.push_back(VEC3(std::cos(2.0f*M_PI*k/nbGoals) * (radius/2), std::sin(2.0f*M_PI*k/nbGoals) * (radius/2), 0)) ;
}
vPos.clear();
......@@ -297,6 +312,7 @@ void Simulator::setupCircleScenario(unsigned int nbAgents , unsigned int nbObsta
vPos.push_back(start-xSide-ySide);
mo4= new MovingObstacle(this, i,vPos,goals, true, true);
mo4->curGoal_ = (i-nbObstacles/2)*float(nbGoals)/float(nbObstacles/2.0f);
movingObstacles_.push_back(mo4);
}
......
......@@ -718,14 +718,15 @@ void SocialAgents::animate()
{
std::ostringstream oss ;
std::ostringstream tmpNb ;
tmpNb << std::setfill('0') << std::setw(4) << nbIterations ;
oss << "./city/talesOfTwo" << tmpNb.str() << ".pov" ;
tmpNb << std::setfill('0') << std::setw(5) << nbIterations ;
oss << "./DeCirkel/cercle" << tmpNb.str() << ".pov" ;
std::string chaine = oss.str() ;
// VEC3 agPos = sim.agents_[0]->meanPos_ ;
// agPos[2] = agPos[1] ;
// agPos[1] = 0.0f ;
// VEC3 camPos(agPos) ;
// VEC3 camLook(agPos) ;
// camPos = camPos
// + VEC3(-10 - 0.05 * nbGenerated, 30 + 0.05 * nbGenerated,
// log(1.0f + nbGenerated / 700.0f)) ;
......@@ -791,15 +792,19 @@ void SocialAgents::animate()
// VEC3 camLook(1000, 0, 0) ;
//openStreetMap sphere
VEC3 camPos(-200, 100, 500) ;
VEC3 camLook(100, 0, 0) ;
// VEC3 camPos(-200, 100, 500) ;
// VEC3 camLook(100, 0, 0) ;
//diligences
VEC3 camPos(0, 400, 700) ;
VEC3 camLook(0, 0, 0) ;
exportScenePov(simulator.envMap_.map,simulator.envMap_.position,chaine,camPos,camLook,VEC3(0.0f,0,0),0,0,0);
// exportScenePov(sim.envMap_.map,sim.envMap_.position,chaine,VEC3(43,762,65),VEC3(0,762,0),VEC3(1.0f,0,0),0,0,0);
// exportScenePov(sim.envMap_.map,sim.envMap_.position,chaine,VEC3(43,762,65+(1500.0f*float(nbGenerated)/400.0f)),VEC3(0,762,0),VEC3(1.0f,0,0),0,0,0);
if (nbIterations == 3200)
if (nbIterations >= 20000)
{
std::cout << "enough .pov generated" << std::endl ;
exit(0) ;
......@@ -954,14 +959,15 @@ bool SocialAgents::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std
float angle_X, float angle_Y, float angle_Z,
const FunctorSelect& good)
{
static const bool draft = true ;
static const bool draft = false ;
static const bool highlightAgent = false ;
static const bool wireDisplay = false ;
static const bool infoFaces = false ;
static const bool exportPath = false ;
static const bool exportMovObst = true ;
static const bool exportCity = true ;
static const bool exportSphere = true ;
static const bool exportCity = false ;
static const bool exportSphere = false ;
static const bool exportDilatedPos = false;
unsigned int highlightAgentNo = 0 ;
......@@ -1144,10 +1150,15 @@ bool SocialAgents::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std
for(unsigned int i=0; i <= nbPoints ; ++i)
{
const VEC3& pos = (*it)->getPosition(i%nbPoints);
VEC3 pos = (*it)->getPosition(i%nbPoints);
if(exportDilatedPos)
pos = (*it)->getDilatedPosition(i%nbPoints);
out << "<" << pos[0] << "," << pos[1] << ">" << std::endl;
}
out << "pigment { Red }" << std::endl;
if(exportDilatedPos)
out << "pigment { Yellow }" << std::endl;
else
out << "pigment { Red }" << std::endl;
out << "}" << std::endl;
}
}
......@@ -1358,6 +1369,7 @@ void SocialAgents::cb_keyPress(int keycode)
case '9' :
{
render_anim = !render_anim ;
std::cout << "export anim " << render_anim << std::endl;
break ;
}
}
......
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