Commit 1684fabf authored by pitiot's avatar pitiot

Merge

parents 28c99a9b 7f81911e
...@@ -2,8 +2,15 @@ cmake_minimum_required(VERSION 2.8) ...@@ -2,8 +2,15 @@ cmake_minimum_required(VERSION 2.8)
project(SocialAgents) project(SocialAgents)
#SET ( CMAKE_VERBOSE_MAKEFILE 1 )
#add_definitions(-DSPATIAL_HASHING) #add_definitions(-DSPATIAL_HASHING)
SET(QT_USE_QTXML TRUE )
SET (CGoGN_EXT_INCLUDES ${CGoGN_EXT_INCLUDES} ${QT_INCLUDE_DIR})
SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES})
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir") SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
include(${CGoGN_ROOT_DIR}/apps_cmake.txt) include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
......
...@@ -51,4 +51,4 @@ add_executable( socialAgentsD ...@@ -51,4 +51,4 @@ add_executable( socialAgentsD
add_dependencies(socialAgentsD shader_targetD ) add_dependencies(socialAgentsD shader_targetD )
target_link_libraries( socialAgentsD ${CGoGN_LIBS_D} ${COMMON_LIBS} ) target_link_libraries( socialAgentsD ${CGoGN_LIBS_D} ${COMMON_LIBS} ${CGoGN_EXT_LIBS})
...@@ -10,7 +10,6 @@ ENDIF (WIN32) ...@@ -10,7 +10,6 @@ ENDIF (WIN32)
include_directories( include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/Release ${CMAKE_CURRENT_SOURCE_DIR}/Release
# ${CMAKE_CURRENT_SOURCE_DIR} # ${CMAKE_CURRENT_SOURCE_DIR}
../include ../include
...@@ -30,6 +29,7 @@ add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/shader_to_h ${s ...@@ -30,6 +29,7 @@ add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/shader_to_h ${s
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_src} ) SOURCES ${shaders_src} )
SET(QT_USE_QTXML TRUE )
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui ) QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
...@@ -52,4 +52,4 @@ add_executable( socialAgents ...@@ -52,4 +52,4 @@ add_executable( socialAgents
add_dependencies(socialAgents shader_target ) add_dependencies(socialAgents shader_target )
target_link_libraries( socialAgents ${CGoGN_LIBS_R} ${COMMON_LIBS} ) target_link_libraries( socialAgents ${CGoGN_LIBS_R} ${COMMON_LIBS} ${CGoGN_EXT_LIBS})
...@@ -12,12 +12,19 @@ ...@@ -12,12 +12,19 @@
//#define EXPORTING_AGENT //#define EXPORTING_AGENT
//#define EXPORTING_OBJ //#define EXPORTING_OBJ
#ifdef SECURED #ifdef SECURED
#include "Algo/MovingObjects/particle_cell_2D_secured.h" #include "Algo/MovingObjects/particle_cell_2D_secured.h"
#else #else
#ifdef TWO_AND_HALF_DIM
#include "Algo/MovingObjects/particle_cell_2DandHalf.h"
#else
#include "Algo/MovingObjects/particle_cell_2D.h" #include "Algo/MovingObjects/particle_cell_2D.h"
#endif #endif
#endif
#ifdef EXPORTING_AGENT #ifdef EXPORTING_AGENT
#include "Utils/vbo.h" #include "Utils/vbo.h"
#include "Utils/Shaders/shaderSimpleColor.h" #include "Utils/Shaders/shaderSimpleColor.h"
...@@ -39,6 +46,8 @@ public: ...@@ -39,6 +46,8 @@ public:
Agent(Simulator* sim, const VEC3& position, const VEC3& goals, Dart d) ; Agent(Simulator* sim, const VEC3& position, const VEC3& goals, Dart d) ;
Agent(Simulator* sim, const VEC3& position, const VEC3& goals) ; Agent(Simulator* sim, const VEC3& position, const VEC3& goals) ;
static void rotate(const VEC3& planeN1, const VEC3& planeN2, VEC3& project);
void init(const VEC3& start, const VEC3& goal); void init(const VEC3& start, const VEC3& goal);
void initGL(); void initGL();
void draw(); void draw();
...@@ -80,8 +89,8 @@ public: ...@@ -80,8 +89,8 @@ public:
// VertexAttribute<VEC3> position; // VertexAttribute<VEC3> position;
// VertexAttribute<VEC3> normal; // VertexAttribute<VEC3> normal;
VEC3 previousPos; // VEC3 previousPos;
float previousRot; // float previousRot;
Geom::Matrix44f m_transfo; Geom::Matrix44f m_transfo;
// Algo::Render::GL2::MapRender* m_render; // Algo::Render::GL2::MapRender* m_render;
...@@ -101,7 +110,12 @@ public: ...@@ -101,7 +110,12 @@ public:
#ifdef SECURED #ifdef SECURED
CGoGN::Algo::Surface::MovingObjects::ParticleCell2DSecured<PFP> part_ ; CGoGN::Algo::Surface::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
#else #else
#ifdef TWO_AND_HALF_DIM
CGoGN::Algo::Surface::MovingObjects::ParticleCell2DAndHalf<PFP> part_ ;
#else
CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP> part_ ; CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP> part_ ;
#endif
#endif #endif
#endif #endif
...@@ -114,6 +128,8 @@ public: ...@@ -114,6 +128,8 @@ public:
MovingObstacle **movingObstacles_; MovingObstacle **movingObstacles_;
int nb_mos; int nb_mos;
static VEC3 xyPlane;
static unsigned int maxNeighbors_ ; static unsigned int maxNeighbors_ ;
static unsigned int maxMovingObstacles_; static unsigned int maxMovingObstacles_;
......
...@@ -40,8 +40,10 @@ Algo::Surface::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap) ...@@ -40,8 +40,10 @@ Algo::Surface::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
{ {
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ; unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ; unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
if (nx < 1) nx = 1 ; if (nx < 1)
if (ny < 1) ny = 1 ; nx = 1 ;
if (ny < 1)
ny = 1 ;
std::cout << " - Generate Grid : " << nx << " x " << ny << std::endl ; std::cout << " - Generate Grid : " << nx << " x " << ny << std::endl ;
...@@ -607,15 +609,26 @@ void generatePlanet(EnvMap& envMap) ...@@ -607,15 +609,26 @@ void generatePlanet(EnvMap& envMap)
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ; unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ; unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
if (nx < 1) if (nx < 1)
nx = 1 ; nx = 20 ;
if (ny < 1) if (ny < 1)
ny = 1 ; ny = 20 ;
std::cout << "nx : " << nx << " ny " << ny << std::endl;
Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ; Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
prim.cylinder_topo(nx, ny, true, true) ; prim.cylinder_topo(nx, ny, true, true) ;
double xRadius = envMap.geometry.size(0) / 2 * M_PI; unsigned int count = 0;
double yRadius = envMap.geometry.size(1) / 2 * M_PI ;
for(Dart d = envMap.map.begin() ; d != envMap.map.end() ; envMap.map.next(d))
count++;
std::cout << "count : " << count << std::endl;
double xRadius = envMap.geometry.size(0);
double yRadius = envMap.geometry.size(1);
std::cout << "radius : " << xRadius+yRadius << std::endl;
prim.embedSphere((xRadius+yRadius)/2.0f) ; prim.embedSphere((xRadius+yRadius)/2.0f) ;
} }
......
...@@ -33,6 +33,7 @@ class ArticulatedObstacle; ...@@ -33,6 +33,7 @@ class ArticulatedObstacle;
#include "pfp.h" #include "pfp.h"
//#define EXPORTING3 //#define EXPORTING3
#define TWO_AND_HALF_DIM
#ifdef EXPORTING3 #ifdef EXPORTING3
#include "Utils/Shaders/shaderPhongTexture.h" #include "Utils/Shaders/shaderPhongTexture.h"
...@@ -308,9 +309,7 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d) ...@@ -308,9 +309,7 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
while (ddd != dd) while (ddd != dd)
{ {
if (!map.isBoundaryMarked2(ddd)) if (!map.isBoundaryMarked2(ddd))
{
addElementToVector<Agent*>(neighborAgentvect[ddd],agent); addElementToVector<Agent*>(neighborAgentvect[ddd],agent);
}
// neighborAgentvect[ddd].push_back(agent) ; // neighborAgentvect[ddd].push_back(agent) ;
// nbAgentsIncrease(ddd); // nbAgentsIncrease(ddd);
...@@ -335,9 +334,8 @@ inline void EnvMap::popAgentInCells(Agent* agent, Dart d) ...@@ -335,9 +334,8 @@ inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
while (ddd != dd) while (ddd != dd)
{ {
if (!map.isBoundaryMarked2(ddd)) if (!map.isBoundaryMarked2(ddd))
{
removeElementFromVector<Agent*>(neighborAgentvect[ddd], agent) ; removeElementFromVector<Agent*>(neighborAgentvect[ddd], agent) ;
}
// nbAgentsDecrease(ddd) ; // nbAgentsDecrease(ddd) ;
ddd = map.alpha1(ddd) ; ddd = map.alpha1(ddd) ;
} }
...@@ -366,7 +364,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b ...@@ -366,7 +364,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
neighbor_cells->clear(); neighbor_cells->clear();
CellMarkerMemo<FACE> memo_mark(map); CellMarkerMemo<FACE> memo_mark(map);
CellMarkerMemo<FACE> OneRingMark(map); CellMarkerMemo<FACE> OneRingMark(map);
memo_mark.unmarkAll();
for (std::vector<Dart>::const_iterator it =belonging_cells.begin();it<belonging_cells.end();++it) for (std::vector<Dart>::const_iterator it =belonging_cells.begin();it<belonging_cells.end();++it)
memo_mark.mark(*it); memo_mark.mark(*it);
......
...@@ -6,7 +6,13 @@ ...@@ -6,7 +6,13 @@
#include "utils.h" #include "utils.h"
#include "env_map.h" #include "env_map.h"
#include <set> #include <set>
#include "Algo/MovingObjects/particle_cell_2D_memo.h"
#ifdef TWO_AND_HALF_DIM
#include "Algo/MovingObjects/particle_cell_2DandHalf_memo.h"
#else
#include "Algo/MovingObjects/particle_cell_2D_memo.h"
#endif
#define EXPORTING_BOXES #define EXPORTING_BOXES
...@@ -55,7 +61,11 @@ public: ...@@ -55,7 +61,11 @@ public:
unsigned int nbVertices; unsigned int nbVertices;
#ifdef TWO_AND_HALF_DIM
CGoGN::Algo::Surface::MovingObjects::ParticleCell2DAndHalf<PFP>* * parts_;
#else
CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP>* * parts_; CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP>* * parts_;
#endif
PFP::MAP map; PFP::MAP map;
VertexAttribute<VEC3> position; VertexAttribute<VEC3> position;
......
...@@ -98,6 +98,8 @@ public: ...@@ -98,6 +98,8 @@ public:
void setupCityScenario(int nbLines, int nbRank) ; void setupCityScenario(int nbLines, int nbRank) ;
void setupScenario(unsigned int nbMaxAgent, bool pedWay=false) ; void setupScenario(unsigned int nbMaxAgent, bool pedWay=false) ;
void setupPlanetScenario(unsigned int nbAgents, unsigned int nbObstacles);
void addMovingObstacles(unsigned int nb); void addMovingObstacles(unsigned int nb);
void addMovingObstacle(Dart d, unsigned int obstType=0); void addMovingObstacle(Dart d, unsigned int obstType=0);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <fstream> #include <fstream>
#include <sys/time.h> #include <sys/time.h>
#include "Utils/Qt/qtSimple.h" #include "Utils/Qt/qtQGLV.h"
#include "ui_socialAgents.h" #include "ui_socialAgents.h"
#include "Utils/Qt/qtui.h" #include "Utils/Qt/qtui.h"
...@@ -55,12 +55,14 @@ ...@@ -55,12 +55,14 @@
#include "shaderCustom.h" #include "shaderCustom.h"
//#define EXPORTING //#define EXPORTING
//#define ONERING
#define SHADOWSHELL
using namespace CGoGN ; using namespace CGoGN ;
typedef PFP::MAP MAP ; typedef PFP::MAP MAP ;
class SocialAgents : public Utils::QT::SimpleQT class SocialAgents : public Utils::QT::SimpleQGLV
{ {
Q_OBJECT Q_OBJECT
...@@ -87,7 +89,8 @@ public: ...@@ -87,7 +89,8 @@ public:
float angle_X, float angle_Y, float angle_Z) ; float angle_X, float angle_Y, float angle_Z) ;
#endif #endif
void cb_keyPress(int keycode) ; // void cb_keyPress(int keycode) ;
void keyPressEvent(QKeyEvent *e);
//RENDERING //RENDERING
Geom::Vec4f colDif ; Geom::Vec4f colDif ;
...@@ -104,6 +107,8 @@ public: ...@@ -104,6 +107,8 @@ public:
Utils::VBO* m_colorVBO; Utils::VBO* m_colorVBO;
Utils::ShaderSimpleColor* m_simpleColorShader; Utils::ShaderSimpleColor* m_simpleColorShader;
Algo::Render::GL2::MapRender* m_renderWithin;
//building //building
Algo::Render::GL2::MapRender* m_render_scenary; Algo::Render::GL2::MapRender* m_render_scenary;
Utils::VBO* m_positionVBO_scenary; Utils::VBO* m_positionVBO_scenary;
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#include "agent.h" #include "agent.h"
#include "simulator.h" #include "simulator.h"
#include "Geometry/frame.h" #include "Geometry/frame.h"
#include "Utils/colorMaps.h"
VEC3 Agent::xyPlane = VEC3(0,0,1);
unsigned int Agent::maxNeighbors_ = 10 ; unsigned int Agent::maxNeighbors_ = 10 ;
unsigned int Agent::maxMovingObstacles_ = 20; unsigned int Agent::maxMovingObstacles_ = 20;
...@@ -18,7 +21,8 @@ float Agent::averageMaxSpeed_ = 2.0f ; ...@@ -18,7 +21,8 @@ float Agent::averageMaxSpeed_ = 2.0f ;
float Agent::neighborDist_ = 20.0f ; float Agent::neighborDist_ = 20.0f ;
float Agent::neighborDistSq_ = neighborDist_ * neighborDist_ ; float Agent::neighborDistSq_ = neighborDist_ * neighborDist_ ;
//float Agent::radius_ = 8.0f ; //float Agent::radius_ = 8.0f ;
float Agent::radius_ = 1.5f ; float Agent::radius_ = 3.0f ;
//float Agent::radius_ = 1.5f ;
//float Agent::timeHorizon_ = 10.0f ; //float Agent::timeHorizon_ = 10.0f ;
float Agent::timeHorizon_ = 100.0f ; float Agent::timeHorizon_ = 100.0f ;
float Agent::timeHorizonObst_ = 10.0f ; float Agent::timeHorizonObst_ = 10.0f ;
...@@ -67,6 +71,17 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal) : ...@@ -67,6 +71,17 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal) :
init(start,goal); init(start,goal);
} }
void Agent::rotate(const VEC3& planeN1, const VEC3& planeN2, VEC3& project)
{
// rotate from face plane to (x,y) plane
float angle = Geom::angle(planeN1, planeN2) ;
if(angle > 0.0f)
{
VEC3 axis = planeN1 ^ planeN2 ;
project = Geom::rotate(axis, angle, project) ;
}
}
void Agent::init(const VEC3& start, const VEC3& goal) void Agent::init(const VEC3& start, const VEC3& goal)
{ {
...@@ -94,6 +109,7 @@ void Agent::init(const VEC3& start, const VEC3& goal) ...@@ -94,6 +109,7 @@ void Agent::init(const VEC3& start, const VEC3& goal)
goals_.clear() ; goals_.clear() ;
goals_.push_back(goal) ; goals_.push_back(goal) ;
goals_.push_back(start) ; goals_.push_back(start) ;
float ratio = (80.0f + rand() % 20) / 100.0f ; float ratio = (80.0f + rand() % 20) / 100.0f ;
maxSpeed_ = averageMaxSpeed_ * ratio ; // from 80% to 100% of averageMaxSpeed_ maxSpeed_ = averageMaxSpeed_ * ratio ; // from 80% to 100% of averageMaxSpeed_
// color1 = 1.0f * ratio ; // red = high speed agents // color1 = 1.0f * ratio ; // red = high speed agents
...@@ -107,7 +123,9 @@ void Agent::init(const VEC3& start, const VEC3& goal) ...@@ -107,7 +123,9 @@ void Agent::init(const VEC3& start, const VEC3& goal)
// color1=0; // color1=0;
// color2 = 1.0f; // color2 = 1.0f;
// } // }
for (unsigned int i=0 ; i<4 ; ++i) meanVelocity_[i].set(0) ; for (unsigned int i=0 ; i<4 ; ++i)
meanVelocity_[i].set(0) ;
agentNeighbors_.reserve(maxNeighbors_ * 2) ; agentNeighbors_.reserve(maxNeighbors_ * 2) ;
obstacleNeighbors_.reserve(maxNeighbors_ * 2) ; obstacleNeighbors_.reserve(maxNeighbors_ * 2) ;
movingObstacleNeighbors_.reserve(maxNeighbors_ * 2) ; movingObstacleNeighbors_.reserve(maxNeighbors_ * 2) ;
...@@ -121,7 +139,10 @@ void Agent::initGL() ...@@ -121,7 +139,10 @@ void Agent::initGL()
{ {
#ifdef EXPORTING_AGENT #ifdef EXPORTING_AGENT
m_ghost_shader = new Utils::ShaderSimpleColor(); m_ghost_shader = new Utils::ShaderSimpleColor();
m_ghost_shader->setColor(Geom::Vec4f(1.,0.,0.,0.));
VEC3 col = Utils::color_map_BCGYR(float(agentNo)/float(sim_->agents_.size()));
m_ghost_shader->setColor(Geom::Vec4f(col[0],col[1],col[2],0.));
// m_ghost_shader->setColor(Geom::Vec4f(1.,0.,0.,0.));
// m_ghost_shader->setAmbiant(Geom::Vec4f(1.,1.,0.,0.)) ; // m_ghost_shader->setAmbiant(Geom::Vec4f(1.,1.,0.,0.)) ;
// m_ghost_shader->setDiffuse(Geom::Vec4f(1.,1.,0.,0.)); // m_ghost_shader->setDiffuse(Geom::Vec4f(1.,1.,0.,0.));
...@@ -474,9 +495,12 @@ void Agent::update() ...@@ -474,9 +495,12 @@ void Agent::update()
#endif #endif
#ifdef EXPORTING_AGENT #ifdef EXPORTING_AGENT
m_ghost_previousPos.push_back(target); if(int(sim_->globalTime_ / sim_->timeStep_) % 4 == 0)
if(m_ghost_previousPos.size()>m_ghost_nb) {
m_ghost_previousPos.pop_front(); m_ghost_previousPos.push_back(target);
if(m_ghost_previousPos.size()>m_ghost_nb)
m_ghost_previousPos.pop_front();
}
#endif #endif
#endif #endif
...@@ -511,8 +535,8 @@ void Agent::update() ...@@ -511,8 +535,8 @@ void Agent::update()
Geom::rotateZ(myRot,m_transfo); Geom::rotateZ(myRot,m_transfo);
Geom::translate(displ[0],displ[1],displ[2],m_transfo); Geom::translate(displ[0],displ[1],displ[2],m_transfo);
m_transfo.transpose(); m_transfo.transpose();
previousPos = getPosition(); // previousPos = getPosition();
previousRot = myRot; // previousRot = myRot;
#endif #endif
} }
......
...@@ -85,6 +85,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -85,6 +85,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
break ; break ;
case 2 : case 2 :
CityGenerator::generateGrid<PFP>(*this) ; CityGenerator::generateGrid<PFP>(*this) ;
// CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize); // CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
break ; break ;
case 3 : case 3 :
...@@ -194,6 +195,9 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -194,6 +195,9 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
scale(20.0f); scale(20.0f);
} }
break; break;
case 6:
CityGenerator::generatePlanet<PFP>(*this);
break;
} }
// CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark); // CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
...@@ -204,7 +208,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -204,7 +208,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
map.init() ; map.init() ;
// registerObstaclesInFaces(); // registerObstaclesInFaces();
// TODO Check registerWallInFaces(); // TODO Check registerWallInFaces();
registerWallInFaces() ; // registerWallInFaces() ;
// subdivideAllToMaxLevel(); // subdivideAllToMaxLevel();
for (unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end(); subdivisableFace.next(i)) for (unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end(); subdivisableFace.next(i))
...@@ -349,75 +353,6 @@ void EnvMap::initGL() ...@@ -349,75 +353,6 @@ void EnvMap::initGL()
} }
std::cout << "bb " << bbTest.min() << " & " << bbTest.max() << std::endl; std::cout << "bb " << bbTest.min() << " & " << bbTest.max() << std::endl;
// unsigned int i =0;
// for(std::vector<PFP::MAP * >::iterator it = m_map_Export.begin() ; it != m_map_Export.end() ; ++it, ++i)
// {
//
// CityGenerator::planetify<PFP>(**it, position_nmap[i], 2000.0f, bbTest);
// }
// m_map_Export = new PFP2::MAP();
//
// std::vector<std::string> attrNames ;
// m_obj_Export = new Algo::Surface::Import::OBJModel<PFP2>(m_map_Export);
// m_obj_Export->import("./meshRessources/cityTex/Building11.obj",attrNames);
//
// position_Export = m_map_Export.getAttribute<VEC3, VERTEX>(attrNames[0]) ;
// TraversorV<PFP2::MAP> tV(m_map_Export);
//
// VEC3 bary(0);
// unsigned int count = 0;
// for(Dart d = tV.begin() ; d != tV.end() ; d = tV.next())
// {
// bary += position_Export[d];
// count++;
// }
// bary /= float(count);
//
// for(Dart d = tV.begin() ; d != tV.end() ; d = tV.next())
// {
//// position_Export[d] -= bary;
// position_Export[d] *= 100.0f;
// std::cout << position_Export[d] << std::endl;
// position_Export[d] += VEC3(2000,0,0);
// std::cout << position_Export[d] << std::endl;
// }
//
// m_texcoordVBO_Export = new Utils::VBO();
// m_positionVBO_Export = new Utils::VBO();
// m_normalVBO_Export = new Utils::VBO();
//
// m_texture_Export = new Utils::Texture<2,Geom::Vec3uc>(GL_UNSIGNED_BYTE);
//
// if (m_texture_Export->load("./meshRessources/cityTex/AO_Buildings11.png"))
// m_texture_Export->update();
// else
// std::cout << "problem : loading texture" << std::endl;
//
// m_texture_Export->setWrapping(GL_CLAMP_TO_EDGE);
//
// m_shaderTex_Export = new ShaderCustomTex();
// m_shaderTex_Export->setAttributePosition(m_positionVBO_Export);
// m_shaderTex_Export->setAttributeTexCoord(m_texcoordVBO_Export);
// m_shaderTex_Export->setTextureUnit(GL_TEXTURE0);
// m_shaderTex_Export->setTexture(m_texture_Export);
//
// glEnable(GL_TEXTURE_2D);
//
// m_map_Export.setBrowser(NULL);
//
// if (!m_obj_Export->hasNormals())
// {
// normal_Export = m_map_Export.getAttribute<VEC3, VERTEX>("normal") ;
// if(!normal_Export.isValid())
// normal_Export = m_map_Export.addAttribute<VEC3, VERTEX>("normal") ;
//
// Algo::Surface::Geometry::computeNormalVertices<PFP2>(m_map_Export, m_obj_Export->m_positions, normal_Export) ;