Commit 0ac354f4 authored by Jund Thomas's avatar Jund Thomas
Browse files

fction de planetification

parent edc6c934
......@@ -58,13 +58,13 @@ template <typename PFP>
void generatePlanet(EnvMap& envMap) ;
template <typename PFP>
typename PFP::VEC3 parametrization(typename PFP::VEC3 p, float r, Geom::BoundingBox<typename PFP::VEC3> bb);
typename PFP::VEC3 parametrization(typename PFP::VEC3 p, float r, const Geom::BoundingBox<typename PFP::VEC3>& bb);
template <typename PFP>
void planetify(typename PFP::MAP& map, typename PFP::TVEC3& position, float r);
template <typename PFP>
void planetify(typename PFP::MAP& map, typename PFP::TVEC3& position, float r, Geom::BoundingBox<typename PFP::VEC3> bb);
void planetify(typename PFP::MAP& map, typename PFP::TVEC3& position, float r, const Geom::BoundingBox<typename PFP::VEC3>& bb);
/*******************************************************************************/
......
......@@ -207,7 +207,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
VEC3 v2(position[map.template phi<11>(d)]-position[d]);
VEC3 sky = (v1^v2);
sky.normalize();
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, d, sky*height) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
switch (buildingType)
{
......@@ -217,7 +217,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
}
case 1 : //with roof 1 slope
{
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, sky*height/3.0f) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, height/3.0f) ;
Dart dNext = map.phi1(dRoof) ;
Dart dPrev = map.phi2(map.phi_1(dRoof)) ;
map.collapseEdge(dNext) ;
......@@ -226,7 +226,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
}
case 2 : //with roof 2 slopes
{
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, sky*height/3.0f) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, height/3.0f) ;
Dart dNext = map.phi1(dRoof) ;
Dart dPrev = map.phi2(map.phi_1(dRoof)) ;
typename PFP::VEC3 mid1 = (position[dNext] + position[map.phi1(dNext)]) / 2.0f ;
......@@ -250,7 +250,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
position[dd] = position[dd] + (c - position[dd]) / 3.0f ;
dd = map.phi1(dd) ;
} while (dd != dRoofSmall) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoofSmall, sky*height/2.0f) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoofSmall, height/2.0f) ;
}
bool spike = rand() % 2 ;
if (spike)
......@@ -618,7 +618,7 @@ void generatePlanet(EnvMap& envMap)
}
template <typename PFP>
typename PFP::VEC3 parametrization(typename PFP::VEC3 p, float r, Geom::BoundingBox<typename PFP::VEC3> bb)
typename PFP::VEC3 parametrization(typename PFP::VEC3 p, float r,const Geom::BoundingBox<typename PFP::VEC3>& bb)
{
p[0] = 2.0f*M_PI*(p[0]-bb.min()[0])/bb.size(0);
p[1] = ((2.0f*M_PI*(p[1]-bb.min()[1])/bb.size(1))-M_PI)/2.0f;
......@@ -645,7 +645,7 @@ void planetify(typename PFP::MAP& map, typename PFP::TVEC3& position, float r)
}
template <typename PFP>
void planetify(typename PFP::MAP& map, typename PFP::TVEC3& position, float r, Geom::BoundingBox<typename PFP::VEC3> bb)
void planetify(typename PFP::MAP& map, typename PFP::TVEC3& position, float r,const Geom::BoundingBox<typename PFP::VEC3>& bb)
{
TraversorV<typename PFP::MAP> tv(map);
for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
......
......@@ -101,12 +101,12 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
Geom::BoundingBox<typename PFP::VEC3> bb1, bb2 ;
bb1 = Algo::Geometry::computeBoundingBox<PFP>(map, position) ;
bb2 = Algo::Geometry::computeBoundingBox<PFP>(map, position) ;
bb2 = Algo::Geometry::computeBoundingBox<PFP>(mapScenary, positionScenary) ;
bb1.addPoint(bb2.min());
bb1.addPoint(bb2.max());
// CityGenerator::planetify<PFP>(map, position, 10.0f, bb1);
// CityGenerator::planetify<PFP>(mapScenary, positionScenary, 10.0f, bb1);
CityGenerator::planetify<PFP>(map, position, 100.0f, bb1);
CityGenerator::planetify<PFP>(mapScenary, positionScenary, 100.0f, bb1);
std::vector<Dart> v;
TraversorF<PFP::MAP> tF(mapScenary);
......@@ -174,6 +174,9 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
Algo::Modelisation::EarTriangulation<PFP> et(mapScenary);
et.triangule();
Algo::Modelisation::EarTriangulation<PFP> et2(map);
et2.triangule();
//subdivision to create footpath
// SelectorDartNoBoundary<PFP::MAP> nb(map);
// Algo::Modelisation::TwoNPlusOneSubdivision<PFP,PFP::TVEC3, VEC3>(map,position,nb);
......
......@@ -697,8 +697,12 @@ void SocialAgents::animate()
// VEC3 camLook(0, 0, 0) ;
//openStreetMap mapRoad & mapBuildings
// VEC3 camPos(-200, 100, 500) ;
// VEC3 camLook(1000, 0, 0) ;
//openStreetMap sphere
VEC3 camPos(-200, 100, 500) ;
VEC3 camLook(1000, 0, 0) ;
VEC3 camLook(100, 0, 0) ;
exportScenePov(simulator.envMap_.map,simulator.envMap_.position,chaine,camPos,camLook,VEC3(0.0f,0,0),0,0,0);
......@@ -867,6 +871,7 @@ bool SocialAgents::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std
static const bool exportPath = false ;
static const bool exportMovObst = true ;
static const bool exportCity = true ;
static const bool exportSphere = true ;
unsigned int highlightAgentNo = 0 ;
......@@ -936,8 +941,15 @@ bool SocialAgents::exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std
//green ground
if(exportCity)
{
out << "plane { <0,1,0>, -0.001" ;
out << "texture{ pigment { color rgb <0.6, 0.8, 0.6>} finish { ambient rgb 0.3 brilliance 0.2 } } }" << std::endl ;
if(exportSphere)
{
out << "sphere { <0,0,0>, 195 texture{ pigment { color rgb <0.6, 0.8, 0.6>} finish { ambient rgb 0.3 brilliance 0.2 } } }" << std::endl;
}
else
{
out << "plane { <0,1,0>, -0.001" ;
out << "texture{ pigment { color rgb <0.6, 0.8, 0.6>} finish { ambient rgb 0.3 brilliance 0.2 } } }" << std::endl ;
}
}
// out << "light_source { <-800, 800, -800> color rgb 0.25 }" << std::endl ;
......@@ -1232,7 +1244,7 @@ void SocialAgents::cb_keyPress(int keycode)
{
animate() ;
break ;
}
}
case '5' :
{
FILE *fp ;
......
......@@ -36,14 +36,14 @@
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1680"
inkscape:window-height="994"
inkscape:window-height="1021"
id="namedview20587"
showgrid="false"
inkscape:zoom="3.620387"
inkscape:cx="1283.4478"
inkscape:cy="1138.1772"
inkscape:window-x="1680"
inkscape:window-y="27"
inkscape:zoom="1.8101935"
inkscape:cx="992.14618"
inkscape:cy="1327.9854"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<defs
......@@ -18026,7 +18026,7 @@
sodipodi:nodetypes="cccccc" />
<path
style="fill:#baa8a8;fill-opacity:0.9;fill-rule:nonzero;stroke:#330066;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1"
d="m 933.23828,76.614844 4.82813,7.789062 -17.71875,10.8125 -4.76563,-8.074218 z"
d="m 930.03828,71.814844 4.82813,7.789062 -17.71875,10.8125 -4.76563,-8.074218 z"
id="path7703"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
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