Commit 60a61619 authored by pitiot's avatar pitiot
Browse files

3D focntionne pas avec building

parent 3dcf2166
...@@ -70,7 +70,7 @@ void generateCity(EnvMap& envMap, unsigned int nbBuildings) ...@@ -70,7 +70,7 @@ void generateCity(EnvMap& envMap, unsigned int nbBuildings)
unsigned int nbBuilding = nbBuildings ; unsigned int nbBuilding = nbBuildings ;
std::cout << " - Generate City : " << nbBuilding << " buildings" << std::endl ; std::cout << " - Generate City : " << nbBuilding << " buildings" << std::endl ;
generateGrid<PFP>(envMap) ;
Dart dEnd = envMap.map.end() ; Dart dEnd = envMap.map.end() ;
for (Dart d = envMap.map.begin(); d != dEnd && nbBuilding > 0; envMap.map.next(d)) for (Dart d = envMap.map.begin(); d != dEnd && nbBuilding > 0; envMap.map.next(d))
...@@ -78,7 +78,12 @@ void generateCity(EnvMap& envMap, unsigned int nbBuildings) ...@@ -78,7 +78,12 @@ void generateCity(EnvMap& envMap, unsigned int nbBuildings)
if (!envMap.buildingMark.isMarked(d) && (rand() % 12 == 0) if (!envMap.buildingMark.isMarked(d) && (rand() % 12 == 0)
&& notDiagonalAdjacentToAnObstacle<PFP>(envMap.map, d, envMap.buildingMark)) && notDiagonalAdjacentToAnObstacle<PFP>(envMap.map, d, envMap.buildingMark))
{ {
#ifndef TWO_AND_HALF_DIM
generateBuilding<PFP>(envMap, d, (1 + (rand() % 3)) * 50.0f, rand() % 4) ; generateBuilding<PFP>(envMap, d, (1 + (rand() % 3)) * 50.0f, rand() % 4) ;
#else
generateBuilding<PFP>(envMap, d, (1 + (rand() % 3)) * 10.0f, rand() % 3) ;
#endif
--nbBuilding ; --nbBuilding ;
} }
} }
...@@ -374,8 +379,7 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin ...@@ -374,8 +379,7 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
Dart next = map.phi1(dd) ; Dart next = map.phi1(dd) ;
Dart previous = map.phi_1(dd) ; Dart previous = map.phi_1(dd) ;
Obstacle* o = new Obstacle(position[dd], position[next], position[previous], Obstacle* o = new Obstacle(position[next], position[dd],position[map.phi1(next)] , position[previous] , NIL, NIL, NULL, 0);
position[map.phi1(next)], NIL, NIL, NULL, 0);
#ifdef SPATIAL_HASHING #ifdef SPATIAL_HASHING
VEC3 ov = o->p2 - o->p1 ; VEC3 ov = o->p2 - o->p1 ;
......
...@@ -77,6 +77,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -77,6 +77,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
{ {
case 0 : case 0 :
// CityGenerator::generateGrid<PFP>(*this) ; // CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateCity<PFP>(*this,0) ; CityGenerator::generateCity<PFP>(*this,0) ;
break ; break ;
case 1 : case 1 :
...@@ -89,10 +90,12 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -89,10 +90,12 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize); // CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
break ; break ;
case 3 : case 3 :
CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateCity<PFP>(*this,10) ; CityGenerator::generateCity<PFP>(*this,10) ;
break ; break ;
case 4 : case 4 :
CityGenerator::generatePlanet<PFP>(*this) ; CityGenerator::generatePlanet<PFP>(*this) ;
CityGenerator::generateCity<PFP>(*this,10) ;
break ; break ;
case 5 : case 5 :
{ {
...@@ -197,6 +200,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -197,6 +200,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
break; break;
case 6: case 6:
CityGenerator::generatePlanet<PFP>(*this); CityGenerator::generatePlanet<PFP>(*this);
CityGenerator::generateCity<PFP>(*this,200) ;
break; break;
} }
......
...@@ -877,7 +877,7 @@ void MovingObstacle::updateForces() ...@@ -877,7 +877,7 @@ void MovingObstacle::updateForces()
//stretch spring : /!\ max rigidity relative to the timestep used (unstable otherwise) //stretch spring : /!\ max rigidity relative to the timestep used (unstable otherwise)
float norm = v1.norm(); float norm = v1.norm();
float rigidity = 100.0f; float rigidity = 50.0f;
float stretch = rigidity*(edgeLength[e]-norm); float stretch = rigidity*(edgeLength[e]-norm);
if(norm>0.0f) if(norm>0.0f)
......
...@@ -752,7 +752,7 @@ void Simulator::setupPlanetScenario(unsigned int nbAgents, unsigned int nbObstac ...@@ -752,7 +752,7 @@ void Simulator::setupPlanetScenario(unsigned int nbAgents, unsigned int nbObstac
CellMarker<FACE> filled(envMap_.map); CellMarker<FACE> filled(envMap_.map);
unsigned int nbx =1; unsigned int nbx =1;
unsigned int nby = 5; unsigned int nby = 1;
unsigned int bMax = nbx * nby > 0 ? nbAgents / (nbx * nby) : nbAgents ; unsigned int bMax = nbx * nby > 0 ? nbAgents / (nbx * nby) : nbAgents ;
......
Supports Markdown
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