Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
72b44877
Commit
72b44877
authored
Mar 06, 2013
by
pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge fini
parent
d8445613
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1025 additions
and
343 deletions
+1025
-343
Debug/CMakeLists.txt
Debug/CMakeLists.txt
+1
-0
Release/CMakeLists.txt
Release/CMakeLists.txt
+1
-0
include/agent.h
include/agent.h
+44
-0
include/env_generator.hpp
include/env_generator.hpp
+7
-5
include/env_map.h
include/env_map.h
+67
-20
include/moving_mesh.h
include/moving_mesh.h
+19
-2
include/moving_obstacle.h
include/moving_obstacle.h
+19
-0
include/pfp.h
include/pfp.h
+7
-0
include/simulator.h
include/simulator.h
+1
-2
include/viewer.h
include/viewer.h
+1
-2
src/agent.cpp
src/agent.cpp
+208
-77
src/env_map.cpp
src/env_map.cpp
+280
-36
src/moving_mesh.cpp
src/moving_mesh.cpp
+89
-40
src/moving_obstacle.cpp
src/moving_obstacle.cpp
+74
-37
src/simulator.cpp
src/simulator.cpp
+21
-32
src/viewer.cpp
src/viewer.cpp
+178
-83
svg/mapRoads.svg
svg/mapRoads.svg
+8
-7
No files found.
Debug/CMakeLists.txt
View file @
72b44877
...
@@ -43,6 +43,7 @@ add_executable( socialAgentsD
...
@@ -43,6 +43,7 @@ add_executable( socialAgentsD
../src/gl2ps.c
../src/gl2ps.c
../src/ShapeMatching/rigidXfComputation.cpp
../src/ShapeMatching/rigidXfComputation.cpp
../src/shaderCustom.cpp
../src/shaderCustom.cpp
../src/shaderCustomTex.cpp
${
socialAgents_moc
}
${
socialAgents_moc
}
${
socialAgents_ui
}
${
socialAgents_ui
}
)
)
...
...
Release/CMakeLists.txt
View file @
72b44877
...
@@ -43,6 +43,7 @@ add_executable( socialAgents
...
@@ -43,6 +43,7 @@ add_executable( socialAgents
../src/gl2ps.c
../src/gl2ps.c
../src/ShapeMatching/rigidXfComputation.cpp
../src/ShapeMatching/rigidXfComputation.cpp
../src/shaderCustom.cpp
../src/shaderCustom.cpp
../src/shaderCustomTex.cpp
${
socialAgents_moc
}
${
socialAgents_moc
}
${
socialAgents_ui
}
${
socialAgents_ui
}
)
)
...
...
include/agent.h
View file @
72b44877
...
@@ -7,7 +7,10 @@
...
@@ -7,7 +7,10 @@
#include "env_map.h"
#include "env_map.h"
#include "spatialHashing.h"
#include "spatialHashing.h"
//#define SECURED
//#define SECURED
#define EXPORTING_AGENT
//#define EXPORTING_OBJ
#ifdef SECURED
#ifdef SECURED
#include "Algo/MovingObjects/particle_cell_2D_secured.h"
#include "Algo/MovingObjects/particle_cell_2D_secured.h"
...
@@ -15,6 +18,19 @@
...
@@ -15,6 +18,19 @@
#include "Algo/MovingObjects/particle_cell_2D.h"
#include "Algo/MovingObjects/particle_cell_2D.h"
#endif
#endif
#ifdef EXPORTING_AGENT
#include "Utils/vbo.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#endif
#ifdef EXPORTING_OBJ
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/vbo.h"
#include "Algo/Import/importObjTex.h"
#include "shaderCustomTex.h"
#endif
class
Simulator
;
class
Simulator
;
class
Agent
class
Agent
...
@@ -24,6 +40,8 @@ public:
...
@@ -24,6 +40,8 @@ public:
Agent
(
Simulator
*
sim
,
const
VEC3
&
position
,
const
VEC3
&
goals
)
;
Agent
(
Simulator
*
sim
,
const
VEC3
&
position
,
const
VEC3
&
goals
)
;
void
init
(
const
VEC3
&
start
,
const
VEC3
&
goal
);
void
init
(
const
VEC3
&
start
,
const
VEC3
&
goal
);
void
initGL
();
void
draw
();
VEC3
getPosition
()
;
VEC3
getPosition
()
;
...
@@ -50,6 +68,32 @@ public:
...
@@ -50,6 +68,32 @@ public:
std
::
vector
<
std
::
pair
<
float
,
Obstacle
*>
>
obstacleNeighbors_
;
std
::
vector
<
std
::
pair
<
float
,
Obstacle
*>
>
obstacleNeighbors_
;
std
::
vector
<
std
::
pair
<
float
,
Obstacle
*>
>
movingObstacleNeighbors_
;
std
::
vector
<
std
::
pair
<
float
,
Obstacle
*>
>
movingObstacleNeighbors_
;
#ifdef EXPORTING_AGENT
static
const
int
m_ghost_nb
=
500
;
std
::
list
<
VEC3
>
m_ghost_previousPos
;
Utils
::
VBO
*
m_ghost_VBO
;
Utils
::
ShaderSimpleColor
*
m_ghost_shader
;
#endif
#ifdef EXPORTING_OBJ
PFP2
::
MAP
map
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
normal
;
VEC3
previousPos
;
float
previousRot
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_normalVBO
;
Utils
::
Texture
<
2
,
Geom
::
Vec3uc
>*
m_texture
;
Utils
::
VBO
*
m_texcoordVBO
;
ShaderCustomTex
*
m_shaderTex
;
Algo
::
Surface
::
Import
::
OBJModel
<
PFP2
>
m_obj
;
unsigned
int
m_nbIndices
;
#endif
#ifdef SPATIAL_HASHING
#ifdef SPATIAL_HASHING
VEC3
pos
;
VEC3
pos
;
#else
#else
...
...
include/env_generator.hpp
View file @
72b44877
...
@@ -606,15 +606,16 @@ void generatePlanet(EnvMap& envMap)
...
@@ -606,15 +606,16 @@ 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
)
nx
=
1
;
if
(
nx
<
1
)
if
(
ny
<
1
)
ny
=
1
;
nx
=
1
;
if
(
ny
<
1
)
ny
=
1
;
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
pi
=
3.14159265358979323846
f
;
double
xRadius
=
envMap
.
geometry
.
size
(
0
)
/
2
*
M_PI
;
double
xRadius
=
envMap
.
geometry
.
size
(
0
)
/
2
*
pi
;
double
yRadius
=
envMap
.
geometry
.
size
(
1
)
/
2
*
M_PI
;
double
yRadius
=
envMap
.
geometry
.
size
(
1
)
/
2
*
pi
;
prim
.
embedSphere
((
xRadius
+
yRadius
)
/
2.0
f
)
;
prim
.
embedSphere
((
xRadius
+
yRadius
)
/
2.0
f
)
;
}
}
...
@@ -624,6 +625,7 @@ typename PFP::VEC3 parametrization(typename PFP::VEC3 p, float r,const Geom::Bou
...
@@ -624,6 +625,7 @@ typename PFP::VEC3 parametrization(typename PFP::VEC3 p, float r,const Geom::Bou
{
{
p
[
0
]
=
2.0
f
*
M_PI
*
(
p
[
0
]
-
bb
.
min
()[
0
])
/
bb
.
size
(
0
);
p
[
0
]
=
2.0
f
*
M_PI
*
(
p
[
0
]
-
bb
.
min
()[
0
])
/
bb
.
size
(
0
);
p
[
1
]
=
((
2.0
f
*
M_PI
*
(
p
[
1
]
-
bb
.
min
()[
1
])
/
bb
.
size
(
1
))
-
M_PI
)
/
2.0
f
;
p
[
1
]
=
((
2.0
f
*
M_PI
*
(
p
[
1
]
-
bb
.
min
()[
1
])
/
bb
.
size
(
1
))
-
M_PI
)
/
2.0
f
;
r
+=
p
[
2
];
return
typename
PFP
::
VEC3
(
2.0
f
*
r
*
cos
(
p
[
0
])
*
cos
(
p
[
1
]),
return
typename
PFP
::
VEC3
(
2.0
f
*
r
*
cos
(
p
[
0
])
*
cos
(
p
[
1
]),
2.0
f
*
r
*
sin
(
p
[
0
])
*
cos
(
p
[
1
]),
2.0
f
*
r
*
sin
(
p
[
0
])
*
cos
(
p
[
1
]),
...
...
include/env_map.h
View file @
72b44877
...
@@ -32,6 +32,15 @@ class ArticulatedObstacle;
...
@@ -32,6 +32,15 @@ class ArticulatedObstacle;
#include "pfp.h"
#include "pfp.h"
#define EXPORTING3
#ifdef EXPORTING3
#include "Utils/Shaders/shaderPhongTexture.h"
#include "Utils/Shaders/shaderSimpleTexture.h"
#include "shaderCustomTex.h"
#include "Algo/Import/importObjTex.h"
#endif
class
EnvMap
class
EnvMap
{
{
public:
public:
...
@@ -52,6 +61,9 @@ public:
...
@@ -52,6 +61,9 @@ public:
EnvMap
()
;
EnvMap
()
;
void
init
(
unsigned
int
config
,
REAL
width
,
REAL
height
,
REAL
minSize
,
REAL
maxSize
)
;
void
init
(
unsigned
int
config
,
REAL
width
,
REAL
height
,
REAL
minSize
,
REAL
maxSize
)
;
void
initGL
();
void
draw
();
void
scale
(
float
val
);
void
scale
(
float
val
);
void
markPedWay
()
;
void
markPedWay
()
;
...
@@ -96,6 +108,8 @@ public:
...
@@ -96,6 +108,8 @@ public:
PFP
::
TVEC3
position
;
PFP
::
TVEC3
position
;
PFP
::
TVEC3
normal
;
PFP
::
TVEC3
normal
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
;
PFP
::
MAP
mapScenary
;
PFP
::
MAP
mapScenary
;
PFP
::
TVEC3
positionScenary
;
PFP
::
TVEC3
positionScenary
;
PFP
::
TVEC3
normalScenary
;
PFP
::
TVEC3
normalScenary
;
...
@@ -112,6 +126,32 @@ public:
...
@@ -112,6 +126,32 @@ public:
void
popObstNeighborInCells
(
Obstacle
*
o
,
Dart
d
);
void
popObstNeighborInCells
(
Obstacle
*
o
,
Dart
d
);
void
find_next
(
Obstacle
*
o
,
Dart
*
d
,
CellMarkerMemo
<
FACE
>&
cms
);
void
find_next
(
Obstacle
*
o
,
Dart
*
d
,
CellMarkerMemo
<
FACE
>&
cms
);
#ifdef EXPORTING3
std
::
vector
<
PFP
::
MAP
*>
m_map_Export
;
std
::
vector
<
Algo
::
Surface
::
Import
::
OBJModel
<
PFP2
>
*>
m_obj_Export
;
std
::
vector
<
Utils
::
Texture
<
2
,
Geom
::
Vec3uc
>*>
m_texture_Export
;
std
::
vector
<
Utils
::
VBO
*>
m_positionVBO_Export
;
std
::
vector
<
Utils
::
VBO
*>
m_normalVBO_Export
;
std
::
vector
<
Utils
::
VBO
*>
m_texcoordVBO_Export
;
std
::
vector
<
ShaderCustomTex
*>
m_shaderTex_Export
;
std
::
vector
<
unsigned
int
>
m_nbIndice_Export
;
// PFP2::MAP m_map_Export;
// VertexAttribute<VEC3> position_Export ;
// VertexAttribute<VEC3> normal_Export ;
// Algo::Surface::Import::OBJModel<PFP2> * m_obj_Export;
//
// Utils::Texture<2,Geom::Vec3uc>* m_texture_Export;
// Utils::VBO* m_positionVBO_Export;
// Utils::VBO* m_normalVBO_Export;
// Utils::VBO* m_texcoordVBO_Export;
// ShaderCustomTex* m_shaderTex_Export;
//
// unsigned int m_nbIndice_Export;
#endif
std
::
vector
<
Dart
>
newBuildings
;
std
::
vector
<
Dart
>
newBuildings
;
...
@@ -247,15 +287,15 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
...
@@ -247,15 +287,15 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
// assert(std::find(agentvect[d].begin(), agentvect[d].end(), agent) == agentvect[d].end());
// assert(std::find(agentvect[d].begin(), agentvect[d].end(), agent) == agentvect[d].end());
// map.check();
// map.check();
TraversorF
<
PFP
::
MAP
>
tF
(
map
);
//
TraversorF<PFP::MAP> tF(map);
for
(
Dart
ddd
=
tF
.
begin
()
;
ddd
!=
tF
.
end
()
;
ddd
=
tF
.
next
())
//
for(Dart ddd = tF.begin() ; ddd != tF.end() ; ddd = tF.next())
{
//
{
if
(
std
::
find
(
agentvect
[
ddd
].
begin
(),
agentvect
[
ddd
].
end
(),
agent
)
!=
agentvect
[
ddd
].
end
())
//
if(std::find(agentvect[ddd].begin(), agentvect[ddd].end(), agent) != agentvect[ddd].end())
std
::
cout
<<
agent
<<
" SO WRONG ADD"
<<
ddd
.
index
<<
std
::
endl
;
//
std::cout <<agent << " SO WRONG ADD" <<ddd.index<< std::endl;
//
if
(
std
::
find
(
neighborAgentvect
[
ddd
].
begin
(),
neighborAgentvect
[
ddd
].
end
(),
agent
)
!=
neighborAgentvect
[
ddd
].
end
())
//
if(std::find(neighborAgentvect[ddd].begin(), neighborAgentvect[ddd].end(), agent) != neighborAgentvect[ddd].end())
std
::
cout
<<
agent
<<
" SO SO WRONG ADD"
<<
ddd
.
index
<<
std
::
endl
;
//
std::cout <<agent<< " SO SO WRONG ADD" <<ddd.index<< std::endl;
}
//
}
addElementToVector
<
Agent
*>
(
agentvect
[
d
],
agent
);
addElementToVector
<
Agent
*>
(
agentvect
[
d
],
agent
);
// agentvect[d].push_back(agent) ;
// agentvect[d].push_back(agent) ;
...
@@ -267,7 +307,11 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
...
@@ -267,7 +307,11 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
Dart
ddd
=
map
.
alpha1
(
map
.
alpha1
(
dd
))
;
Dart
ddd
=
map
.
alpha1
(
map
.
alpha1
(
dd
))
;
while
(
ddd
!=
dd
)
while
(
ddd
!=
dd
)
{
{
addElementToVector
<
Agent
*>
(
neighborAgentvect
[
ddd
],
agent
);
if
(
!
map
.
isBoundaryMarked2
(
ddd
))
{
addElementToVector
<
Agent
*>
(
neighborAgentvect
[
ddd
],
agent
);
}
// neighborAgentvect[ddd].push_back(agent) ;
// neighborAgentvect[ddd].push_back(agent) ;
// nbAgentsIncrease(ddd);
// nbAgentsIncrease(ddd);
ddd
=
map
.
alpha1
(
ddd
)
;
ddd
=
map
.
alpha1
(
ddd
)
;
...
@@ -289,22 +333,25 @@ inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
...
@@ -289,22 +333,25 @@ inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
Dart
ddd
=
map
.
alpha1
(
map
.
alpha1
(
dd
))
;
Dart
ddd
=
map
.
alpha1
(
map
.
alpha1
(
dd
))
;
while
(
ddd
!=
dd
)
while
(
ddd
!=
dd
)
{
{
removeElementFromVector
<
Agent
*>
(
neighborAgentvect
[
ddd
],
agent
)
;
if
(
!
map
.
isBoundaryMarked2
(
ddd
))
{
removeElementFromVector
<
Agent
*>
(
neighborAgentvect
[
ddd
],
agent
)
;
}
// nbAgentsDecrease(ddd) ;
// nbAgentsDecrease(ddd) ;
ddd
=
map
.
alpha1
(
ddd
)
;
ddd
=
map
.
alpha1
(
ddd
)
;
}
}
dd
=
map
.
phi1
(
dd
)
;
dd
=
map
.
phi1
(
dd
)
;
}
while
(
dd
!=
d
)
;
}
while
(
dd
!=
d
)
;
TraversorF
<
PFP
::
MAP
>
tF
(
map
);
//
TraversorF<PFP::MAP> tF(map);
for
(
Dart
ddd
=
tF
.
begin
()
;
ddd
!=
tF
.
end
()
;
ddd
=
tF
.
next
())
//
for(Dart ddd = tF.begin() ; ddd != tF.end() ; ddd = tF.next())
{
//
{
if
(
std
::
find
(
agentvect
[
ddd
].
begin
(),
agentvect
[
ddd
].
end
(),
agent
)
!=
agentvect
[
ddd
].
end
())
//
if(std::find(agentvect[ddd].begin(), agentvect[ddd].end(), agent) != agentvect[ddd].end())
std
::
cout
<<
agent
<<
" SO WRONG"
<<
ddd
.
index
<<
std
::
endl
;
//
std::cout <<agent << " SO WRONG" <<ddd.index<< std::endl;
//
if
(
std
::
find
(
neighborAgentvect
[
ddd
].
begin
(),
neighborAgentvect
[
ddd
].
end
(),
agent
)
!=
neighborAgentvect
[
ddd
].
end
())
//
if(std::find(neighborAgentvect[ddd].begin(), neighborAgentvect[ddd].end(), agent) != neighborAgentvect[ddd].end())
std
::
cout
<<
agent
<<
" SO SO WRONG "
<<
ddd
.
index
<<
std
::
endl
;
//
std::cout <<agent<< " SO SO WRONG " <<ddd.index<< std::endl;
}
//
}
}
}
...
...
include/moving_mesh.h
View file @
72b44877
...
@@ -13,15 +13,20 @@
...
@@ -13,15 +13,20 @@
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Qt/qtSimple.h"
#include "Utils/Qt/qtSimple.h"
using
namespace
std
;
#include "Utils/Shaders/shaderSimpleTexture.h"
#include "Algo/Import/importObjTex.h"
using
namespace
std
;
//#define EXPORTING2
class
MovingMesh
class
MovingMesh
{
{
public:
public:
MovingMesh
(
EnvMap
&
envMap
,
Dart
d
,
std
::
string
filename
);
MovingMesh
(
EnvMap
&
envMap
,
Dart
d
,
std
::
string
filename
);
void
initGL
();
void
linkWithObstacle
(
MovingObstacle
*
mo
);
void
linkWithObstacle
(
MovingObstacle
*
mo
);
void
transform
(
Geom
::
Matrix44f
m
);
void
transform
(
Geom
::
Matrix44f
m
);
...
@@ -40,14 +45,26 @@ public:
...
@@ -40,14 +45,26 @@ public:
PFP
::
MAP
&
motherMap
;
PFP
::
MAP
&
motherMap
;
VertexAttribute
<
VEC3
>&
motherPosition
;
VertexAttribute
<
VEC3
>&
motherPosition
;
PFP
::
MAP
map
;
PFP
2
::
MAP
map
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
normal
;
VertexAttribute
<
VEC3
>
normal
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_normalVBO
;
Utils
::
VBO
*
m_normalVBO
;
#ifdef EXPORTING2
Utils
::
Texture
<
2
,
Geom
::
Vec3uc
>*
m_texture
;
Utils
::
VBO
*
m_texcoordVBO
;
ShaderCustomTex
*
m_shaderTex
;
// Utils::ShaderPhongTexture* m_shaderTex;
// Utils::ShaderSimpleTexture* m_shaderTex;
Algo
::
Surface
::
Import
::
OBJModel
<
PFP2
>
m_obj
;
unsigned
int
m_nbIndices
;
#else
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
#endif
float
scaleValue
;
float
scaleValue
;
...
...
include/moving_obstacle.h
View file @
72b44877
...
@@ -8,6 +8,15 @@
...
@@ -8,6 +8,15 @@
#include <set>
#include <set>
#include "Algo/MovingObjects/particle_cell_2D_memo.h"
#include "Algo/MovingObjects/particle_cell_2D_memo.h"
//#define EXPORTING_BOXES
#ifdef EXPORTING_BOXES
#include "Algo/Render/GL2/mapRender.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Utils/Shaders/shaderFlat.h"
#include "Utils/vbo.h"
#endif
using
namespace
std
;
using
namespace
std
;
PFP
::
VEC3
rotate
(
PFP
::
VEC3
pos1
,
PFP
::
VEC3
center
,
float
angle
);
PFP
::
VEC3
rotate
(
PFP
::
VEC3
pos1
,
PFP
::
VEC3
center
,
float
angle
);
float
get_angle
(
PFP
::
VEC3
v1
,
PFP
::
VEC3
v2
);
float
get_angle
(
PFP
::
VEC3
v1
,
PFP
::
VEC3
v2
);
...
@@ -19,6 +28,9 @@ class MovingObstacle
...
@@ -19,6 +28,9 @@ class MovingObstacle
{
{
public:
public:
MovingObstacle
(
Simulator
*
sim
,
int
index
,
std
::
vector
<
PFP
::
VEC3
>
pos
,
std
::
vector
<
VEC3
>
goals
,
bool
rigid
,
bool
spin
,
int
curGoal
=
0
,
Dart
d
=
NIL
,
ArticulatedObstacle
*
art
=
NULL
,
int
indParent
=-
1
);
MovingObstacle
(
Simulator
*
sim
,
int
index
,
std
::
vector
<
PFP
::
VEC3
>
pos
,
std
::
vector
<
VEC3
>
goals
,
bool
rigid
,
bool
spin
,
int
curGoal
=
0
,
Dart
d
=
NIL
,
ArticulatedObstacle
*
art
=
NULL
,
int
indParent
=-
1
);
void
initGL
();
void
draw
();
bool
test_opposition
(
VEC3
o
,
VEC3
p1
,
VEC3
p2
);
bool
test_opposition
(
VEC3
o
,
VEC3
p1
,
VEC3
p2
);
// void contournerBatiment();
// void contournerBatiment();
void
updateAgentNeighbors
()
;
void
updateAgentNeighbors
()
;
...
@@ -53,6 +65,13 @@ public:
...
@@ -53,6 +65,13 @@ public:
Dart
groundFace
;
Dart
groundFace
;
#ifdef EXPORTING_BOXES
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_normalVBO
;
Utils
::
ShaderSimpleColor
*
m_shader
;
#endif
//vector de détails pour la deformation
//vector de détails pour la deformation
// std::vector<PFP::VEC3> verticesDeformation;
// std::vector<PFP::VEC3> verticesDeformation;
...
...
include/pfp.h
View file @
72b44877
...
@@ -24,6 +24,13 @@ struct PFP : public PFP_STANDARD
...
@@ -24,6 +24,13 @@ struct PFP : public PFP_STANDARD
typedef
NoMathIONameAttribute
<
std
::
pair
<
bool
,
bool
>
>
BOOLATTRIB
;
typedef
NoMathIONameAttribute
<
std
::
pair
<
bool
,
bool
>
>
BOOLATTRIB
;
}
;
}
;
struct
PFP2
:
public
PFP_STANDARD
{
// definition de la carte
// typedef EmbeddedMap2 MAP ;
typedef
Algo
::
Surface
::
IHM
::
ImplicitHierarchicalMap
MAP
;
}
;
typedef
PFP
::
VEC3
VEC3
;
typedef
PFP
::
VEC3
VEC3
;
typedef
PFP
::
REAL
REAL
;
typedef
PFP
::
REAL
REAL
;
...
...
include/simulator.h
View file @
72b44877
...
@@ -94,7 +94,7 @@ public:
...
@@ -94,7 +94,7 @@ public:
void
setupCorridorScenario
(
unsigned
int
nbAgents
,
unsigned
int
nbObstacles
)
;
void
setupCorridorScenario
(
unsigned
int
nbAgents
,
unsigned
int
nbObstacles
)
;
void
setupSnakeCorridorScenario
(
unsigned
int
nbAgents
,
unsigned
int
nbSnakes
,
int
snakeSize
)
;
void
setupSnakeCorridorScenario
(
unsigned
int
nbAgents
,
unsigned
int
nbSnakes
,
int
snakeSize
)
;
void
setupCityScenario
(
int
nbLines
,
int
nbRank
)
;
void
setupCityScenario
(
int
nbLines
,
int
nbRank
)
;
void
setupScenario
(
unsigned
int
nbMaxAgent
,
bool
p
ath
)
;
void
setupScenario
(
unsigned
int
nbMaxAgent
,
bool
p
edWay
=
false
)
;
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
);
...
@@ -112,7 +112,6 @@ public:
...
@@ -112,7 +112,6 @@ public:
bool
importAgents
(
std
::
string
filename
)
;
bool
importAgents
(
std
::
string
filename
)
;
bool
exportAgents
(
std
::
string
filename
)
;
bool
exportAgents
(
std
::
string
filename
)
;
void
checkRegistering
();
void
swapAgentsGoals
()
;
void
swapAgentsGoals
()
;
Geom
::
BoundingBox
<
VEC3
>
getAgentsBB
()
;
Geom
::
BoundingBox
<
VEC3
>
getAgentsBB
()
;
...
...
include/viewer.h
View file @
72b44877
...
@@ -83,8 +83,7 @@ public:
...
@@ -83,8 +83,7 @@ public:
void
exportInfoFace
(
std
::
ofstream
&
out
,
Dart
d
)
;
void
exportInfoFace
(
std
::
ofstream
&
out
,
Dart
d
)
;
bool
exportScenePov
(
PFP
::
MAP
&
map
,
PFP
::
TVEC3
&
position
,
const
std
::
string
&
filename
,
bool
exportScenePov
(
PFP
::
MAP
&
map
,
PFP
::
TVEC3
&
position
,
const
std
::
string
&
filename
,
PFP
::
VEC3
cameraPos
,
PFP
::
VEC3
cameraLook
,
PFP
::
VEC3
translate
,
PFP
::
VEC3
cameraPos
,
PFP
::
VEC3
cameraLook
,
PFP
::
VEC3
translate
,
float
angle_X
,
float
angle_Y
,
float
angle_Z
,
float
angle_X
,
float
angle_Y
,
float
angle_Z
)
;
const
FunctorSelect
&
good
=
SelectorTrue
())
;
#endif
#endif
void
cb_keyPress
(
int
keycode
)
;
void
cb_keyPress
(
int
keycode
)
;
...
...
src/agent.cpp
View file @
72b44877
...
@@ -27,6 +27,9 @@ float Agent::rangeSq_ = range_ * range_ ;
...
@@ -27,6 +27,9 @@ float Agent::rangeSq_ = range_ * range_ ;
unsigned
int
Agent
::
cptAgent
=
0
;
unsigned
int
Agent
::
cptAgent
=
0
;
Agent
::
Agent
(
Simulator
*
sim
,
const
VEC3
&
start
,
const
VEC3
&
goal
,
Dart
d
)
:
Agent
::
Agent
(
Simulator
*
sim
,
const
VEC3
&
start
,
const
VEC3
&
goal
,
Dart
d
)
:
#ifdef EXPORTING_OBJ
m_obj
(
map
),
#endif
#ifdef SPATIAL_HASHING
#ifdef SPATIAL_HASHING
pos
(
position
),
pos
(
position
),
#else
#else
...
@@ -44,6 +47,9 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal, Dart d) :
...
@@ -44,6 +47,9 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal, Dart d) :
}
}
Agent
::
Agent
(
Simulator
*
sim
,
const
VEC3
&
start
,
const
VEC3
&
goal
)
:
Agent
::
Agent
(
Simulator
*
sim
,
const
VEC3
&
start
,
const
VEC3
&
goal
)
:
#ifdef EXPORTING_OBJ
m_obj
(
map
),
#endif
#ifdef SPATIAL_HASHING
#ifdef SPATIAL_HASHING
pos
(
position
),
pos
(
position
),
#else
#else
...
@@ -62,6 +68,12 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal) :
...
@@ -62,6 +68,12 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal) :
void
Agent
::
init
(
const
VEC3
&
start
,
const
VEC3
&
goal
)
void
Agent
::
init
(
const
VEC3
&
start
,
const
VEC3
&
goal
)
{
{
#ifdef EXPORTING_OBJ
std
::
vector
<
std
::
string
>
attrNames
;
m_obj
.
import
(
"./meshRessources/Mexicainlowres.obj"
,
attrNames
);
position
=
map
.
getAttribute
<
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
#endif
#ifdef SPATIAL_HASHING
#ifdef SPATIAL_HASHING
sim
->
envMap_
.
addAgentInGrid
(
this
)
;
sim
->
envMap_
.
addAgentInGrid
(
this
)
;
#endif
#endif
...
@@ -88,9 +100,97 @@ void Agent::init(const VEC3& start, const VEC3& goal)
...
@@ -88,9 +100,97 @@ void Agent::init(const VEC3& start, const VEC3& goal)
movingObstacles_
=
new
MovingObstacle
*
[
maxMovingObstacles_
];
movingObstacles_
=
new
MovingObstacle
*
[
maxMovingObstacles_
];
nb_mos
=
0
;
nb_mos
=
0
;
agentNo
=
cptAgent
++
;
agentNo
=
cptAgent
++
;
CGoGNout
<<
this
<<
" = agent n°"
<<
agentNo
<<
CGoGNendl
;
//
CGoGNout<<this<<" = agent n°"<<agentNo<<CGoGNendl;
}
}
void
Agent
::
initGL
()
{
#ifdef EXPORTING_AGENT
m_ghost_shader
=
new
Utils
::
ShaderSimpleColor
();
m_ghost_shader
->
setColor
(
Geom
::
Vec4f
(
1.
,
0.
,
0.
,
0.
));
// m_ghost_shader->setAmbiant(Geom::Vec4f(1.,1.,0.,0.)) ;
// m_ghost_shader->setDiffuse(Geom::Vec4f(1.,1.,0.,0.));
m_ghost_VBO
=
new
Utils
::
VBO
();
m_ghost_VBO
->
setDataSize
(
3
);
m_ghost_VBO
->
allocate
(
m_ghost_nb
);
m_ghost_shader
->
setAttributePosition
(
m_ghost_VBO
);
// registerShader(m_ghost_shader);
#endif
#ifdef EXPORTING_OBJ
m_texcoordVBO
=
new
Utils
::
VBO
();
m_positionVBO
=
new
Utils
::
VBO
();
m_normalVBO
=
new
Utils
::
VBO
();
m_texture
=
new
Utils
::
Texture
<
2
,
Geom
::
Vec3uc
>
(
GL_UNSIGNED_BYTE
);
if
(
m_texture
->
load
(
"./meshRessources/sombrero2lowres_grp.png"
))
m_texture
->
update
();
else
std
::
cout
<<
"problem : loading texture"
<<
std
::
endl
;
m_texture
->
setWrapping
(
GL_CLAMP_TO_EDGE
);
m_shaderTex
=
new
ShaderCustomTex
();
m_shaderTex
->
setAttributePosition
(
m_positionVBO
);
m_shaderTex
->
setAttributeTexCoord
(
m_texcoordVBO
);
m_shaderTex
->
setTextureUnit
(
GL_TEXTURE0
);
m_shaderTex
->
setTexture
(
m_texture
);