Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 435ef2ea authored by pitiot's avatar pitiot
Browse files

version a jour avec pb Dart==NIL

parent 14a82956
......@@ -9,13 +9,25 @@ ELSE (WIN32)
ENDIF (WIN32)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
../include
${CGoGN_ROOT_DIR}/include
${COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
file(
GLOB
shaders_srcD
../include/*.frag
../include/*.vert
../include/*.geom
)
add_custom_target(shader_targetD ${CGoGN_ROOT_DIR}/ThirdParty/bin/shader_to_h ${shaders_srcD}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_srcD} )
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -p")
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
......@@ -30,8 +42,11 @@ add_executable( socialAgentsD
../src/moving_mesh.cpp
../src/gl2ps.c
../src/ShapeMatching/rigidXfComputation.cpp
../src/shaderCustom.cpp
${socialAgents_moc}
${socialAgents_ui}
)
add_dependencies(socialAgentsD shader_targetD )
target_link_libraries( socialAgentsD ${CGoGN_LIBS_D} ${COMMON_LIBS} )
......@@ -9,13 +9,25 @@ ELSE (WIN32)
ENDIF (WIN32)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
../include
${CGoGN_ROOT_DIR}/include
${COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
file(
GLOB
shaders_src
../include/*.frag
../include/*.vert
../include/*.geom
)
add_custom_target(shader_target ${CGoGN_ROOT_DIR}/ThirdParty/bin/shader_to_h ${shaders_src}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
SOURCES ${shaders_src} )
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
......@@ -30,8 +42,11 @@ add_executable( socialAgents
../src/moving_mesh.cpp
../src/gl2ps.c
../src/ShapeMatching/rigidXfComputation.cpp
../src/shaderCustom.cpp
${socialAgents_moc}
${socialAgents_ui}
)
add_dependencies(socialAgents shader_target )
target_link_libraries( socialAgents ${CGoGN_LIBS_R} ${COMMON_LIBS} )
......@@ -54,9 +54,9 @@ public:
VEC3 pos ;
#else
#ifdef SECURED
CGoGN::Algo::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
CGoGN::Algo::Surface::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
#else
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_ ;
CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP> part_ ;
#endif
#endif
......@@ -85,6 +85,8 @@ public:
static unsigned int cptAgent ;
VEC3 forces;
float color1;
float color2;
float color3;
......
......@@ -13,15 +13,13 @@ namespace CityGenerator
template <typename PFP>
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<FACE>& buildingMark) ;
template <typename PFP> Algo::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap) ;
template <typename PFP> Algo::Surface::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap) ;
template <typename PFP> void generateCity(EnvMap& envMap, unsigned int nbBuildings) ;
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map,
typename PFP::TVEC3& position,
unsigned int cX, unsigned int cY,
float sideLength, CellMarker<EDGE>& obstacleMark,
Algo::Surface::Modelisation::Polyhedron<PFP> generateTrianGrid(EnvMap& envMap,
CellMarker<EDGE>& obstacleMark,
CellMarker<FACE>& buildingMark) ;
template <typename PFP>
......
......@@ -36,7 +36,7 @@ bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<
}
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
Algo::Surface::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
{
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
......@@ -45,7 +45,7 @@ Algo::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
std::cout << " - Generate Grid : " << nx << " x " << ny << std::endl ;
Algo::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
Dart d = prim.grid_topo(nx, ny) ;
prim.embedGrid(envMap.geometry.size(0), envMap.geometry.size(1), 0.0f) ;
......@@ -83,57 +83,59 @@ void generateCity(EnvMap& envMap, unsigned int nbBuildings)
}
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map,
typename PFP::TVEC3& position,
unsigned int cX, unsigned int cY,
float sideLength, CellMarker<EDGE>& obstacleMark,
Algo::Surface::Modelisation::Polyhedron<PFP> generateTrianGrid(EnvMap& envMap,
CellMarker<EDGE>& obstacleMark,
CellMarker<FACE>& buildingMark)
{
Algo::Modelisation::Polyhedron<PFP> prim(map, position) ;
prim.grid_topo(cX, cY) ;
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
if (nx < 1) nx = 1 ;
if (ny < 1) ny = 1 ;
prim.embedGrid(sideLength * cX, sqrt(sideLength * sideLength * 3.0f / 4.0f) * cY) ;
Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
prim.grid_topo(nx, ny) ;
prim.embedGrid(envMap.geometry.size(0), envMap.geometry.size(1), 0.0f) ;
Dart dY = prim.getDart() ; //remind the first quad of the line
Dart dX = prim.getDart() ; //goes through the line
bool odd = true ; //odd line or not
for (unsigned int i = 0; i < cX * cY;)
for (unsigned int i = 0; i < nx * ny;)
{
Dart dNext = map.phi1(map.phi2(map.phi1(dX))) ;
Dart dNext = envMap.map.phi1(envMap.map.phi2(envMap.map.phi1(dX))) ;
Dart toCut = dX ;
if (odd)
{
toCut = map.phi1(toCut) ; //change the side of the split face
position[toCut][0] -= sideLength / 2.0f ; //move vertices for equilateral triangles
toCut = envMap.map.phi1(toCut) ; //change the side of the split face
envMap.position[toCut][0] -= envMap.maxCellSize / 2.0f ; //move vertices for equilateral triangles
}
map.splitFace(toCut, map.phi1(map.phi1(toCut))) ;
envMap.map.splitFace(toCut, envMap.map.phi1(envMap.map.phi1(toCut))) ;
++i ;
if (i % cX == 0 && i > 0) //goes up and change side of split
if (i % nx == 0 && i > 0) //goes up and change side of split
{
Dart endSquare = map.newOrientedFace(3) ; //add triangle add end of lines to make a square
Dart endSquare = envMap.map.newFace(3) ; //add triangle add end of lines to make a square
Dart dN ;
if (odd)
{
dN = map.phi1(map.phi2(map.phi1(dX))) ;
map.sewFaces(dN, endSquare) ;
position[map.phi_1(endSquare)] = position[map.phi1(endSquare)] ;
position[map.phi_1(endSquare)][0] += sideLength / 2.0f ;
dN = envMap.map.phi1(envMap.map.phi2(envMap.map.phi1(dX))) ;
envMap.map.sewFaces(dN, endSquare) ;
envMap.position[envMap.map.phi_1(endSquare)] = envMap.position[envMap.map.phi1(endSquare)] ;
envMap.position[envMap.map.phi_1(endSquare)][0] += envMap.maxCellSize / 2.0f ;
}
else
{
dN = map.phi1(dX) ;
map.sewFaces(dN, endSquare) ;
position[map.phi_1(endSquare)] = position[endSquare] ;
dN = envMap.map.phi1(dX) ;
envMap.map.sewFaces(dN, endSquare) ;
envMap.position[envMap.map.phi_1(endSquare)] = envMap.position[endSquare] ;
}
if (odd)
dY = map.phi2(map.phi_1(map.phi2(map.phi1(dY)))) ;
dY = envMap.map.phi2(envMap.map.phi_1(envMap.map.phi2(envMap.map.phi1(dY)))) ;
else
dY = map.phi2(map.phi1(map.phi2(map.phi_1(dY)))) ;
dY = envMap.map.phi2(envMap.map.phi1(envMap.map.phi2(envMap.map.phi_1(dY)))) ;
dX = dY ;
odd = !odd ;
......@@ -142,44 +144,44 @@ Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map,
dX = dNext ;
}
Dart boundary ;
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
if (map.phi2(d) == d)
{
Dart dA = map.alpha1(map.phi1(d)) ;
if (map.phi2(dA) == dA && position[dA] == position[map.phi1(d)]
&& position[map.phi1(dA)] == position[d])
map.sewFaces(dA, d) ;
else
{
obstacleMark.mark(d) ;
boundary = d ;
}
}
}
map.closeHole(boundary) ;
buildingMark.mark(map.phi2(boundary)) ;
// Dart boundary ;
// for (Dart d = envMap.map.begin(); d != envMap.map.end(); envMap.map.next(d))
// {
// if (envMap.map.phi2(d) == d)
// {
// Dart dA = envMap.map.alpha1(envMap.map.phi1(d)) ;
// if (envMap.map.phi2(dA) == dA && envMap.position[dA] == envMap.position[envMap.map.phi1(d)]
// && envMap.position[envMap.map.phi1(dA)] == envMap.position[d])
// envMap.map.sewFaces(dA, d) ;
// else
// {
// obstacleMark.mark(d) ;
// boundary = d ;
// }
// }
// }
//
// envMap.map.closeHole(boundary) ;
// buildingMark.mark(envMap.map.phi2(boundary)) ;
//
// if (odd) //last top line if odd
// {
// for (unsigned int i = 0; i < nx; ++i)
// {
// dX = envMap.map.phi1(dX) ;
// envMap.position[dX][0] -= envMap.maxCellSize / 2.0f ;
// }
// }
if (odd) //last top line if odd
//add hexagons
for(Dart d = envMap.map.begin(); d != envMap.map.end(); envMap.map.next(d))
{
for (unsigned int i = 0; i < cX; ++i)
if(envMap.map.vertexDegree(d)==6)
{
dX = map.phi1(dX) ;
position[dX][0] -= sideLength / 2.0f ;
envMap.map.deleteVertex(d);
}
}
//add hexagons
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.vertexDegree(d)==6)
// {
// map.deleteVertex(d);
// }
// }
return prim ;
}
......@@ -187,7 +189,7 @@ template <typename PFP>
Dart extrudeFaceAndMark(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d,
CellMarker<FACE>& buildingMark, float height)
{
Dart dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
Dart dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
buildingMark.mark(dRoof) ;
Dart dd = dRoof ;
do
......@@ -207,7 +209,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, height) ;
dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
switch (buildingType)
{
......@@ -217,7 +219,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, height/3.0f) ;
dRoof = Algo::Surface::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 +228,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, height/3.0f) ;
dRoof = Algo::Surface::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 ;
......@@ -242,22 +244,22 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
unsigned int nbStairs = rand() % 5 ;
for (unsigned int i = 0; i < nbStairs; ++i)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
Dart dRoofSmall = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, 0.0f) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
Dart dRoofSmall = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, dRoof, 0.0f) ;
Dart dd = dRoofSmall ;
do
{
position[dd] = position[dd] + (c - position[dd]) / 3.0f ;
dd = map.phi1(dd) ;
} while (dd != dRoofSmall) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoofSmall, height/2.0f) ;
dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, dRoofSmall, height/2.0f) ;
}
bool spike = rand() % 2 ;
if (spike)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
c[2] += height / 1.5f ;
dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof) ;
dRoof = Algo::Surface::Modelisation::trianguleFace<PFP>(map, dRoof) ;
position[dRoof] = c ;
}
break ;
......@@ -327,8 +329,8 @@ bool animateCity(EnvMap* envMap)
}
else
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, d, position) ;
Dart dRoofSmall = Algo::Modelisation::extrudeFace<PFP>(map, position, d, 0.0f) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, d, position) ;
Dart dRoofSmall = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, d, 0.0f) ;
Dart dd = dRoofSmall ;
do
{
......@@ -403,13 +405,13 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
// Thomas's team
Dart x =map.phi2(dd);
if(!map.isBoundaryMarked(x))
if(!map.isBoundaryMarked2(x))
{
addElementToVector<Obstacle*>(envMap.obstvect[x],o);
if(!map.isBoundaryMarked(map.phi2(map.phi1(x))))
if(!map.isBoundaryMarked2(map.phi2(map.phi1(x))))
addElementToVector<Obstacle*>(envMap.obstvect[map.phi2(map.phi1(x))],o);
if(!map.isBoundaryMarked(map.phi2(map.phi_1(x))))
if(!map.isBoundaryMarked2(map.phi2(map.phi_1(x))))
addElementToVector<Obstacle*>(envMap.obstvect[map.phi2(map.phi_1(x))],o);
}
......@@ -454,7 +456,7 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
unsigned int nbStairs = rand() % 5 ;
for (unsigned int i = 0; i < nbStairs; ++i)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
Dart dRoofSmall = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, 0.0f) ;
Dart dd = dRoofSmall ;
do
......@@ -468,9 +470,9 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
bool spike = rand() % 2 ;
if (spike)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
c[2] += height / 1.5f ;
dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof) ;
dRoof = Algo::Surface::Modelisation::trianguleFace<PFP>(map, dRoof) ;
position[dRoof] = c ;
}
break ;
......@@ -485,9 +487,9 @@ void generateMall(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
CellMarker<FACE>& buildingMark, float sideSize)
{
unsigned int side = 5 ;
std::vector<Algo::Modelisation::Polyhedron<PFP> > floors ;
std::vector<Algo::Surface::Modelisation::Polyhedron<PFP> > floors ;
Algo::Modelisation::Polyhedron<PFP> * floor2 = new Algo::Modelisation::Polyhedron<PFP>(
Algo::Surface::Modelisation::Polyhedron<PFP> * floor2 = new Algo::Surface::Modelisation::Polyhedron<PFP>(
map, position) ;
floor2->grid_topo(side, side) ;
......@@ -508,7 +510,7 @@ void generateMall(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
}
}
Algo::Modelisation::Polyhedron<PFP> * floor1 = new Algo::Modelisation::Polyhedron<PFP>(
Algo::Surface::Modelisation::Polyhedron<PFP> * floor1 = new Algo::Surface::Modelisation::Polyhedron<PFP>(
map, position) ;
floor1->grid_topo(side, side) ;
floor1->embedGrid(sideSize * side, sideSize * side) ;
......@@ -607,7 +609,7 @@ void generatePlanet(EnvMap& envMap)
if (nx < 1) nx = 1 ;
if (ny < 1) ny = 1 ;
Algo::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) ;
double pi = 3.14159265358979323846f ;
......@@ -668,7 +670,7 @@ void simplifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position,
VEC_D_A orderedD ;
// compute all heuristic and construct multimap
Algo::Geometry::computeAreaFaces<PFP>(map, position, tableArea) ;
Algo::Surface::Geometry::computeAreaFaces<PFP>(map, position, tableArea) ;
CellMarker<EDGE> eM(map) ;
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
......
......@@ -188,7 +188,6 @@ void displayMO(Obstacle * o);
* INLINE FUNCTIONS *
**************************************/
template <typename T>
inline void addElementToVector(std::vector<T>& a, T ag)
{
......@@ -267,7 +266,6 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
} while (dd != d) ;
}
inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
{
assert(map.getCurrentLevel() == map.getMaxLevel()) ;
......@@ -331,13 +329,9 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
beg = *it;
first = NIL;
d=beg;
// CGoGNout<<"beg : " << beg;
do
{
do {
dd=map.alpha1(map.alpha1(d));
// CGoGNout<<"dd : " << dd;
do
{
do {
if (!memo_mark.isMarked(dd))
{
first = dd;
......@@ -348,11 +342,9 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
d=map.phi1(d);
} while(first==NIL && d!=beg);
// CGoGNout<<CGoGNendl;
++it;
}while(first==NIL && it!=belonging_cells.end());
// assert(!buildingMark.isMarked(d)) ;
assert(first!=NIL) ;
// CGoGNout<<"first : "<<first<<CGoGNendl;
d=first;
......@@ -365,7 +357,6 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
}
find_next(o,&d, memo_mark);
// CGoGNout<<"d : "<<d<<CGoGNendl;
}while(!map.sameFace(d,first));
}
......
......@@ -5,59 +5,68 @@
#include "agent.h"
#include "Utils/colorMaps.h"
#include "Algo/Render/GL1/map_glRender.h"
inline void renderDart(EnvMap& m, Dart d)
{
PFP::VEC3 p1 = m.position[d] ;
PFP::VEC3 p2 = m.position[m.map.phi1(d)] ;
// PFP::VEC3 p1 = m.position[d] ;
// PFP::VEC3 p2 = m.position[m.map.phi1(d)] ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
glBegin(GL_LINES) ;
glVertex3f(p1[0], p1[1], p1[2]) ;
glVertex3f(p2[0], p2[1], p2[2]) ;
glEnd() ;
// glBegin(GL_LINES) ;
// glVertex3f(p1[0], p1[1], p1[2]) ;
// glVertex3f(p2[0], p2[1], p2[2]) ;
// glEnd() ;
}
inline void renderFace(EnvMap& m, Dart d)
{
Dart dd = d ;
do
{
renderDart(m, dd) ;
dd = m.map.phi1(dd) ;
} while (dd != d) ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
// Dart dd = d ;
// do
// {
// renderDart(m, dd) ;
// dd = m.map.phi1(dd) ;
// } while (dd != d) ;
}
inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
{
Geom::Plane3D<float> pl = Algo::Geometry::facePlane<PFP>(m.map, d, m.position) ;
Geom::Plane3D<float> pl = Algo::Surface::Geometry::facePlane<PFP>(m.map, d, m.position) ;
p[2] -= 1000 ;
Geom::intersectionPlaneRay(pl, p, VEC3(0, 0, -1), p) ;
VEC3 pos1(m.position[d]) ;
VEC3 pos2(m.position[m.map.phi1(d)]) ;
pos2[2] += 2 ;
glBegin(GL_LINE_LOOP) ;
glVertex3fv(&p[0]) ;
glVertex3fv(&pos1[0]) ;
glVertex3fv(&pos2[0]) ;
glEnd() ;
// glBegin(GL_LINE_LOOP) ;
// glVertex3fv(&p[0]) ;
// glVertex3fv(&pos1[0]) ;
// glVertex3fv(&pos2[0]) ;
// glEnd() ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
}
inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=false, bool renderPath = false, bool showVertices=false)
{
glBegin(GL_POLYGON) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) ;
// glColor3f(1.0,1.0,1.0);
// glBegin(GL_POLYGON) ;
// for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
// {
// const VEC3& p = obst->getPosition(i) ;
// glVertex3fv(p.data()) ;
// }
// glEnd() ;
// glColor3f(0,1,0);
// Algo::Render::GL1::renderTriQuadPoly<PFP>(obst->map, Algo::Render::GL1::LINE,
// 1.0, obst->position,
......@@ -65,36 +74,26 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
if(showVertices)
{
glPointSize(3.0f) ;
glColor3f(0.0,0.0,1.0);
glBegin(GL_POINTS) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
if (obst->obstacles_[i]==(Obstacle*)0xf09f80 || obst->obstacles_[(i-1)%(obst->nbVertices)]==(Obstacle *)0xf09f80 )
{
glPointSize(10.0f) ;