Commit f1de7f4e authored by Thomas's avatar Thomas
Browse files

qq chgmts pr l'export

parent ac9025fd
......@@ -88,7 +88,7 @@ public :
CellMarker obstacleMark;
CellMarker buildingMark;
static const unsigned int nbAgentsToSubdivide = 3;
static const unsigned int nbAgentsToSubdivide = 9;
static const unsigned int nbAgentsToSimplify = 7;
std::map<unsigned int, Dart> refineCandidate;
......
......@@ -41,10 +41,10 @@ Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
void EnvMap::init()
{
float sideSize = 70.0f;
unsigned int nbSquares = 7;
unsigned int nbSquares = 10;
CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
// CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
map.init();
registerObstaclesInFaces();
}
......@@ -101,7 +101,6 @@ void EnvMap::registerObstaclesInFaces()
{
if(m.isMarked(d) && !buildingMark.isMarked(d)) {
m.unmark(d);
std::cout << "obstvect size " << obstvect[d].size() << std::endl;
}
}
}
......
#include "simulator.h"
Simulator::Simulator() : globalTime_(0.0f), timeStep_(0.05f)
Simulator::Simulator() : globalTime_(0.0f), timeStep_(0.1f)
{
srand(10);
envMap_.init();
......@@ -128,7 +128,7 @@ void Simulator::addPathsToAgents()
Dart dStart = agents_[i]->part_.d;
Dart dStop = dStart;
for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop) || j < dartDistForPath; ++j)
for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop) || j < dartDistForPath+rand()*10; ++j)
{
if(dStop == envMap_.map.end())
dStop = envMap_.map.begin();
......@@ -141,7 +141,7 @@ void Simulator::addPathsToAgents()
agents_[i]->goals_.push_back(Algo::Geometry::faceCentroid<PFP>(envMap_.map, *it, envMap_.position));
Dart dStop2 = dStop;
for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop2) || j < dartDistForPath; ++j)
for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop2) || j < dartDistForPath+rand()*10; ++j)
{
if(dStop2 == envMap_.map.end())
dStop2 = envMap_.map.begin();
......
......@@ -172,6 +172,36 @@ void MyGlutWin::myRedraw()
}
}
*/
glPushMatrix();
glBegin(GL_LINES);
unsigned int iter = 100;
for(int i=0;i<700;i=i+iter)
{
VEC3 camPos(-800,-800,10);
camPos = camPos + VEC3(-10-0.3*i,400.0f*log(1.0f+i/700.0f),30+0.3*i);
glVertex3fv(&camPos[0]);
camPos = VEC3(-800,-800,10);
camPos = camPos + VEC3(-10-0.3*(i+iter),400.0f*log(1.0f+(i+iter)/700.0f),30+0.3*(i+iter));
glVertex3fv(&camPos[0]);
}
glEnd();
glPopMatrix();
glPushMatrix();
glBegin(GL_LINES);
for(int i=0;i<700;i=i+iter)
{
VEC3 camLook(0,0,0);
camLook = camLook + VEC3(-10-0.1*i,400.0f*log(1.0f+i/700.0f),30+0.1*i);
glVertex3fv(&camLook[0]);
camLook = VEC3(0,0,0);
camLook = camLook + VEC3(-10-0.1*(i+iter),400.0f*log(1.0f+(i+iter)/700.0f),30+0.1*(i+iter));
glVertex3fv(&camLook[0]);
}
glEnd();
glPopMatrix();
//count fps
if(displayFps)
{
......@@ -199,6 +229,9 @@ void MyGlutWin::animate()
sim.doStep();
glutPostRedisplay();
if(sim.globalTime_<300+sim.timeStep_ && sim.globalTime_>=300)
b_animate=false;
if(render_anim)
{
std::ostringstream oss;
......@@ -207,12 +240,19 @@ void MyGlutWin::animate()
nbGenerated++;
oss << "./planSerre/exportSceneOle" << 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);
camPos = camPos+VEC3(-10-0.05*nbGenerated,10+0.05*nbGenerated,log(1.0f+nbGenerated/700.0f));
VEC3 camLook(agPos);
// 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));
VEC3 camPos(-800,10,-800);
camPos = camPos + VEC3(-10-0.3*nbGenerated,30+0.3*nbGenerated,400.0f*log(1.0f+nbGenerated/700.0f));
VEC3 camLook(0,0,0);
camLook = camLook + VEC3(-10-0.1*nbGenerated,30+0.1*nbGenerated,400.0f*log(1.0f+nbGenerated/700.0f));
exportScenePov(sim.envMap_.map,sim.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);
......@@ -228,7 +268,7 @@ void MyGlutWin::animate()
bool MyGlutWin::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::string& filename, PFP::VEC3 cameraPos, PFP::VEC3 cameraLook, PFP::VEC3 translate, 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;
......@@ -260,9 +300,14 @@ bool MyGlutWin::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::s
}
//define the camera position
out << "#include \"sombrero2_highres_POV_geom.inc\"" << std::endl;
out << "#include \"sombrero2_lowres_POV_geom.inc\"" << std::endl;
out << "#include \"sombrero3_highres_POV_geom.inc\"" << std::endl;
if(draft)
out << "#include \"sombrero2_lowres_POV_geom.inc\"" << std::endl;
else {
out << "#include \"Sheriff_animated_POV_geom.inc\"" << std::endl;
out << "#include \"Cowbow_animated_POV_geom.inc\"" << std::endl;
out << "#include \"sombrero2_highres_POV_geom.inc\"" << std::endl;
out << "#include \"sombrero3_highres_POV_geom.inc\"" << std::endl;
}
out << "#include \"transforms.inc\"" << std::endl;
......@@ -306,25 +351,40 @@ bool MyGlutWin::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::s
out << "}" << std::endl;
}
out << "cylinder {" << std::endl;
out << "<100,100,100>, <100,200,100>,0.05" << std::endl;
out << "rotate <" << angleX << "," << angleY << "," << angleZ << "> " << std::endl;
out << "texture{ pigment{ color rgb<0.5,0.5,1.0>} finish { ambient rgb 0.1 brilliance 0.5 } }" << std::endl;
out << "}" << std::endl;
for(unsigned int i = 0; i< sim.agents_.size() ; ++i) {
int typeOfAgent=0;
if(draft) {
typeOfAgent=2;
out << "object {" << " sheriff_lowres_ " << std::endl;
out << "object {" << " sombrero2_lowres_ " << std::endl;
out << "scale 0.0638297872" << std::endl;
}
else {
if(i==highlightAgentNo) {
if(i==0) {
typeOfAgent=3;
out << "object {" << " Sheriff_animated_ " << std::endl;
out << "scale 0.165745856" << std::endl;
}
else if(i%7==0) {
typeOfAgent=2;
out << "object {" << " sombrero2_highres_ " << std::endl;
out << "object {" << " Cowbow_animated_ " << std::endl;
out << "scale 0.170454545" << std::endl;
}
if(i%3!=0) {
else if(i%7<5) {
typeOfAgent=1;
out << "object {" << " sombrero2_highres_ " << std::endl;
out << "object {" << " sombrero2_lowres_ " << std::endl;
out << "scale 0.127659574" << std::endl;
}
else {
typeOfAgent=0;
out << "object {" << " sombrero3_highres_ " << std::endl;
out << "scale 0.132743363" << std::endl;
}
}
......@@ -341,12 +401,12 @@ bool MyGlutWin::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::s
//57,2957795 : conversion from radian to degree
float myRot = acos(-dir[1])*57.2957795f;
out << "scale 0.0638297872" << std::endl;
out << "rotate <0,0," << sign*myRot << ">"<< std::endl;
// out << "translate <" << posR[0] << "," << posR[1] << "," << posR[2]+1+typeOfAgent*4*0.0638297872 << "> " << std::endl;
out << "translate <" << posR[0] << "," << posR[1] << "," << posR[2] << "> " << std::endl;
out << "rotate <" << angleX-90 << "," << angleY << "," << angleZ << "> " << std::endl;
out << "translate <" << posR[0] << "," << posR[2] << "," << posR[1] << "> " << std::endl;
out << "rotate <" << angleX << "," << angleY << "," << angleZ << "> " << std::endl;
out << "translate <" << translate[0] << "," << translate[1] << "," << translate[2] << ">" << std::endl;
out << "}" << std::endl;
......@@ -383,15 +443,15 @@ bool MyGlutWin::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::s
if(wireDisplay) {
Algo::ExportPov::exportMeshWire<PFP>(out,map,position,"myMeshWire",good);
out << "object {myMeshWire" << std::endl;
out << "translate <" << translate[0] << "," << translate[1] << "," << translate[2] << ">" << std::endl;
out << "rotate <" << angleX << "," << angleY << "," << angleZ << "> " << std::endl;
out << "translate <" << translate[0] << "," << translate[1] << "," << translate[2] << ">" << std::endl;
out << "texture{ pigment{ color rgb<0,0,0>} } }" << std::endl;
}
out << "object {myMesh" << std::endl;
out << "translate <" << translate[0] << "," << translate[1] << "," << translate[2] << ">" << std::endl;
out << "rotate <" << angleX << "," << angleY << "," << angleZ << "> " << std::endl;
out << "texture{ pigment{ color rgb 0.8} finish { ambient rgb 0.3 brilliance 0.5 } } }" << std::endl;
out << "translate <" << translate[0] << "," << translate[1] << "," << translate[2] << ">" << std::endl;
out << "texture{ pigment{ color rgb 0.7} finish { ambient rgb 0.3 brilliance 0.5 } } }" << std::endl;
}
// out << "texture{ pigment{ color rgb<1.0,1.0,1>} finish { ambient rgb 0.05 brilliance 0.5 } } }" << std::endl;
......@@ -426,6 +486,10 @@ void MyGlutWin::myKeyboard(unsigned char keycode, int x, int y)
displayFps = ! displayFps;
break;
}
case 'p': {
std::cout << sim.globalTime_ << std::endl;
break;
}
case 'r' : {
exportScenePov(sim.envMap_.map,sim.envMap_.position,"planSerre/exportSceneOle0000.pov",VEC3(10,3,10),VEC3(0,0,0),VEC3(1.0f,0,0),0,0,0);
// exportScenePov(sim.envMap_.map,sim.envMap_.position,"exportScene0002.pov",VEC3(43,762,1565),VEC3(0,762,0),VEC3(1.0f,0,0),0,0,0);
......
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