Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SocialAgents3D
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
6f108282
Commit
6f108282
authored
Mar 15, 2013
by
Thomas Jund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout affich onering
parent
00301910
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
176 additions
and
194 deletions
+176
-194
include/env_map.h
include/env_map.h
+2
-5
include/viewer.h
include/viewer.h
+4
-0
src/agent.cpp
src/agent.cpp
+13
-6
src/env_map.cpp
src/env_map.cpp
+2
-1
src/moving_obstacle.cpp
src/moving_obstacle.cpp
+31
-12
src/simulator.cpp
src/simulator.cpp
+14
-21
src/viewer.cpp
src/viewer.cpp
+110
-149
No files found.
include/env_map.h
View file @
6f108282
...
...
@@ -308,9 +308,7 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
while
(
ddd
!=
dd
)
{
if
(
!
map
.
isBoundaryMarked2
(
ddd
))
{
addElementToVector
<
Agent
*>
(
neighborAgentvect
[
ddd
],
agent
);
}
// neighborAgentvect[ddd].push_back(agent) ;
// nbAgentsIncrease(ddd);
...
...
@@ -335,9 +333,8 @@ inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
while
(
ddd
!=
dd
)
{
if
(
!
map
.
isBoundaryMarked2
(
ddd
))
{
removeElementFromVector
<
Agent
*>
(
neighborAgentvect
[
ddd
],
agent
)
;
}
// nbAgentsDecrease(ddd) ;
ddd
=
map
.
alpha1
(
ddd
)
;
}
...
...
@@ -366,7 +363,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
neighbor_cells
->
clear
();
CellMarkerMemo
<
FACE
>
memo_mark
(
map
);
CellMarkerMemo
<
FACE
>
OneRingMark
(
map
);
memo_mark
.
unmarkAll
();
for
(
std
::
vector
<
Dart
>::
const_iterator
it
=
belonging_cells
.
begin
();
it
<
belonging_cells
.
end
();
++
it
)
memo_mark
.
mark
(
*
it
);
...
...
include/viewer.h
View file @
6f108282
...
...
@@ -54,6 +54,8 @@
#include "shaderCustom.h"
//#define EXPORTING
//#define ONERING
//#define SHADOWSHELL
using
namespace
CGoGN
;
...
...
@@ -104,6 +106,8 @@ public:
Utils
::
VBO
*
m_colorVBO
;
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
Algo
::
Render
::
GL2
::
MapRender
*
m_renderWithin
;
//building
Algo
::
Render
::
GL2
::
MapRender
*
m_render_scenary
;
Utils
::
VBO
*
m_positionVBO_scenary
;
...
...
src/agent.cpp
View file @
6f108282
...
...
@@ -9,11 +9,12 @@
#include "agent.h"
#include "simulator.h"
#include "Geometry/frame.h"
#include "Utils/colorMaps.h"
unsigned
int
Agent
::
maxNeighbors_
=
10
;
unsigned
int
Agent
::
maxMovingObstacles_
=
20
;
float Agent::averageMaxSpeed_ = 2.0f ;
//
float Agent::averageMaxSpeed_ = 20.0f ;
//
float Agent::averageMaxSpeed_ = 2.0f ;
float
Agent
::
averageMaxSpeed_
=
20.0
f
;
// float Agent::neighborDist_ = 10.0f ;
float
Agent
::
neighborDist_
=
20.0
f
;
float
Agent
::
neighborDistSq_
=
neighborDist_
*
neighborDist_
;
...
...
@@ -122,7 +123,10 @@ void Agent::initGL()
{
#ifdef EXPORTING_AGENT
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->setDiffuse(Geom::Vec4f(1.,1.,0.,0.));
...
...
@@ -475,9 +479,12 @@ void Agent::update()
#endif
#ifdef EXPORTING_AGENT
m_ghost_previousPos.push_back(target);
if(m_ghost_previousPos.size()>m_ghost_nb)
m_ghost_previousPos.pop_front();
if
(
int
(
sim_
->
globalTime_
/
sim_
->
timeStep_
)
%
4
==
0
)
{
m_ghost_previousPos
.
push_back
(
target
);
if
(
m_ghost_previousPos
.
size
()
>
m_ghost_nb
)
m_ghost_previousPos
.
pop_front
();
}
#endif
#endif
...
...
src/env_map.cpp
View file @
6f108282
...
...
@@ -85,6 +85,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
break
;
case
2
:
CityGenerator
::
generateGrid
<
PFP
>
(
*
this
)
;
// CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
break
;
case
3
:
...
...
@@ -204,7 +205,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
map
.
init
()
;
// registerObstaclesInFaces();
// TODO Check registerWallInFaces();
registerWallInFaces() ;
//
registerWallInFaces() ;
// subdivideAllToMaxLevel();
for
(
unsigned
int
i
=
subdivisableFace
.
begin
();
i
<
subdivisableFace
.
end
();
subdivisableFace
.
next
(
i
))
...
...
src/moving_obstacle.cpp
View file @
6f108282
...
...
@@ -36,6 +36,7 @@ void MovingObstacle::addGeneralCell ( Dart d)
general_belonging
.
push_back
(
std
::
make_pair
(
d
,
1
));
}
}
bool
MovingObstacle
::
removeGeneralCell
(
Dart
d
)
{
std
::
vector
<
std
::
pair
<
Dart
,
int
>
>::
iterator
it
=
general_belonging
.
begin
();
...
...
@@ -775,15 +776,20 @@ void MovingObstacle::update()
Obstacle
*
o
=
obstacles_
[
i
];
o
->
p1
=
getDilatedPosition
(
i
);
o
->
p2
=
getDilatedPosition
((
i
+
1
)
%
nbVertices
);
#ifndef POTENTIAL
o
->
prevP
=
getDilatedPosition
((
i
-
1
+
nbVertices
)
%
nbVertices
);
o
->
nextP
=
getDilatedPosition
((
i
+
2
+
nbVertices
)
%
nbVertices
);
#endif
Dart
d1
=
parts_
[
i
]
->
d
;
Dart
d2
=
parts_
[(
i
+
1
)
%
nbVertices
]
->
d
;
if
(
!
((
sim_
->
envMap_
.
map
.
sameFace
(
d1
,
d2
))
&&
(
parts_
[
i
]
->
crossCell
==
CGoGN
::
Algo
::
Surface
::
MovingObjects
::
NO_CROSS
&&
parts_
[(
i
+
1
)
%
nbVertices
]
->
crossCell
==
CGoGN
::
Algo
::
Surface
::
MovingObjects
::
NO_CROSS
)))
{
sim_
->
envMap_
.
popAndPushObstacleInCells
(
o
,
i
);
sim_
->
envMap_
.
popAndPushObstacleInCells
(
o
,
i
);
}
/////affichage des belonging cells
// CGoGNout<< CGoGNendl;
// CGoGNout << "Obstacle "<< i << ": ";
...
...
@@ -859,13 +865,14 @@ void resetObstPartInFace(Obstacle* o, Dart d1)
{
MovingObstacle
*
mo
=
o
->
mo
;
if
(
mo
!=
NULL
)
{
if
(
mo
!=
NULL
)
{
unsigned
int
n
=
o
->
index
;
VEC3
pos1
=
mo
->
parts_
[
n
]
->
getPosition
();
if
(
Algo
::
Surface
::
Geometry
::
isPointInConvexFace2D
<
PFP
>
(
mo
->
sim_
->
envMap_
.
map
,
d1
,
mo
->
sim_
->
envMap_
.
position
,
pos1
,
true
))
{
if
(
Algo
::
Surface
::
Geometry
::
isPointInConvexFace2D
<
PFP
>
(
mo
->
sim_
->
envMap_
.
map
,
d1
,
mo
->
sim_
->
envMap_
.
position
,
pos1
,
true
))
mo
->
parts_
[
n
]
->
d
=
d1
;
}
if
(
n
==
0
)
mo
->
dDir
=
mo
->
parts_
[
0
]
->
d
;
}
...
...
@@ -880,10 +887,9 @@ void resetPart(Obstacle * o, Dart d1)
if
(
mo
->
parts_
[
n
]
->
d
==
mo
->
sim_
->
envMap_
.
map
.
phi1
(
d1
))
mo
->
parts_
[
n
]
->
d
=
d1
;
if
(
n
==
0
)
mo
->
dDir
=
mo
->
parts_
[
n
]
->
d
;
}
}
...
...
@@ -902,7 +908,7 @@ void displayMO(Obstacle * o)
void
MovingObstacle
::
computePrefVelocity
()
//calcul du vecteur optimal pour atteindre l'objectif // changer pour 2.5 ?
{
VEC3
goalVector
;
if
(
index_parent
<
1
)
if
(
index_parent
<
1
)
//not articulated
{
if
(
rigid_
||
goals_
.
size
()
>
1
)
{
...
...
@@ -976,9 +982,9 @@ void MovingObstacle::computePrefVelocity() //calcul du vecteur optimal pour atte
}
}
}
else
else
//articulated
{
goalVector
=
get_center
(
parent
,
index_parent
-
1
)
-
center
;
goalVector
=
(
get_center
(
parent
,
index_parent
-
1
)
-
center
)
;
float
goalDist2
=
goalVector
.
norm2
()
;
if
(
goalDist2
>
maxSpeed_
)
{
...
...
@@ -988,7 +994,20 @@ void MovingObstacle::computePrefVelocity() //calcul du vecteur optimal pour atte
}
if
(
spinning
)
angle
=
get_angle
(
goalVector
,
front
-
center
);
{
float
n_angle
=
get_angle
(
goalVector
,
front
-
center
);
float
bornAngle
=
M_PI
/
64.0
f
;
if
(
fabs
(
n_angle
-
angle
)
<
bornAngle
)
angle
=
n_angle
;
else
{
if
(
n_angle
-
angle
>=
0.0
f
)
angle
+=
bornAngle
;
else
angle
-=
bornAngle
;
}
}
prefVelocity_
=
goalVector
;
...
...
src/simulator.cpp
View file @
6f108282
...
...
@@ -160,8 +160,10 @@ void Simulator::doStep()
}
}
#else
if
(
multires
)
envMap_
.
map
.
setCurrentLevel
(
envMap_
.
map
.
getMaxLevel
())
;
nb_dead
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
agents_
.
size
()
;
++
i
)
{
...
...
@@ -170,17 +172,8 @@ void Simulator::doStep()
Dart
oldFace
=
agents_
[
i
]
->
part_
.
d
;
agents_
[
i
]
->
update
()
;
// if(envMap_.map.getEmbedding(oldFace, FACE) != envMap_.map.getEmbedding(agents_[i]->part_.d, FACE))
if
(
agents_
[
i
]
->
part_
.
crossCell
!=
CGoGN
::
Algo
::
Surface
::
MovingObjects
::
NO_CROSS
)
// switch(agents_[i]->part_.crossCell)
{
// case CGoGN::Algo::MovingObjects::CROSS_EDGE :
// envMap_.agentChangeFaceThroughEdge(agents_[i]);
// break;
// case CGoGN::Algo::MovingObjects::CROSS_OTHER :
envMap_
.
agentChangeFace
(
agents_
[
i
],
oldFace
)
;
// break;
}
}
else
nb_dead
++
;
...
...
@@ -223,14 +216,9 @@ void Simulator::addAgent(const VEC3& start, const VEC3& goal, Dart d)
void
Simulator
::
setupCircleScenario
(
unsigned
int
nbAgents
,
unsigned
int
nbObstacles
)
{
if
(
multires
)
{
envMap_
.
init
(
config
,
2000.0
f
,
2000.0
f
,
minSize
,
400.0
f
)
;
//grosses cases
}
else
{
envMap_
.
init
(
config
,
2000.0
f
,
2000.0
f
,
minSize
,
400.0
f
)
;
//cases fines
}
std
::
cout
<<
" - Setup Circle Scenario : "
<<
nbAgents
<<
" agents et "
<<
nbObstacles
<<
" obstacles"
<<
std
::
endl
;
...
...
@@ -508,17 +496,17 @@ void Simulator::setupSnakeCorridorScenario(unsigned int nbAgents, unsigned int n
xStartMin
=
envMap_
.
geometry
.
min
()[
0
]
+
envMap_
.
geometry
.
size
(
0
)
/
4
;
xStartDelta
=
envMap_
.
geometry
.
size
(
0
)
/
2
;
yStartMin
=
envMap_
.
geometry
.
min
()[
1
]
+
yBorder
;
yStartDelta
=
envMap_
.
geometry
.
size
(
1
)
/
2
0
;
yStartDelta
=
envMap_
.
geometry
.
size
(
1
)
/
1
0
;
// Arrivée des obstacles à l'opposée
yGoalDelta
=
3
*
envMap_
.
geometry
.
size
(
1
)
/
5
;
yGoalDelta
=
envMap_
.
geometry
.
size
(
1
)
/
5
;
yGoalMin
=
envMap_
.
geometry
.
max
()[
1
]
-
yBorder
-
yGoalDelta
;
VEC3
xSide
(
5.0
f
,
0.0
f
,
0.0
f
);
VEC3
ySide
(
0.0
f
,
10.0
f
,
0.0
f
);
std
::
cout
<<
"geom : "
<<
envMap_
.
geometry
<<
std
::
endl
;
int
sumObstacles
=
0
;
for
(
unsigned
int
j
=
0
;
j
<
nbSnakes
;
j
++
)
...
...
@@ -541,12 +529,17 @@ void Simulator::setupSnakeCorridorScenario(unsigned int nbAgents, unsigned int n
std
::
vector
<
VEC3
>
goals
;
goals
.
push_back
(
start
);
int
r
=
0
;
while
(
r
<
4
0
)
while
(
r
<
8
0
)
{
x
=
xStartMin
+
rand
()
%
xStartDelta
;
goal
=
VEC3
(
x
,
yGoalMin
+
rand
()
%
yGoalDelta
,
0
)
;
if
((
goal
-
goals
[
r
]).
norm2
()
>
1000
)
if
((
r
==
0
||
angle
(
goal
-
goals
[
r
],
goals
[
r
]
-
goals
[
r
-
1
])
<
M_PI
/
2.0
f
)
)
{
std
::
cout
<<
"new goal "
<<
goal
<<
std
::
endl
;
goals
.
push_back
(
goal
);
r
++
;
}
...
...
@@ -604,8 +597,8 @@ void Simulator::setupScenario(unsigned int nbMaxAgent, bool pedWay)
TraversorF
<
PFP
::
MAP
>
tF
(
envMap_
.
map
);
Dart
d
=
tF
.
begin
()
;
unsigned
int
nbx
=
4
;
unsigned
int
nby
=
4
;
unsigned
int
nbx
=
1
;
unsigned
int
nby
=
1
;
unsigned
int
bMax
=
nbx
*
nby
>
0
?
nbMaxAgent
/
(
nbx
*
nby
)
:
nbMaxAgent
;
...
...
src/viewer.cpp
View file @
6f108282
...
...
@@ -133,6 +133,10 @@ void SocialAgents::cb_initGL()
// create the render
m_render = new Algo::Render::GL2::MapRender();
#ifdef ONERING
m_renderWithin = new Algo::Render::GL2::MapRender();
#endif
m_renderTopo = new Algo::Render::GL2::TopoRender();
m_ds = new Utils::Drawer();
...
...
@@ -222,6 +226,10 @@ void SocialAgents::initRendering()
{
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::LINES,false) ;
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES,false) ;
#ifdef ONERING
m_renderWithin->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES,false) ;
#endif
}
m_renderTopo->updateData<PFP>(simulator.envMap_.map, simulator.envMap_.position, 0.9, 0.9);
...
...
@@ -471,9 +479,46 @@ void SocialAgents::updateAgentPredTriVBO()
void SocialAgents::updateVBOprimitives(int upType)
{
#ifdef ONERING
CellMarker<FACE> cmF(simulator.envMap_.map);
TraversorF<PFP::MAP> tF(simulator.envMap_.map);
for(Dart d = tF.begin() ; d != tF.end() ; d = tF.next())
{
if(simulator.envMap_.neighborObstvect[d].size() > 0 && !(simulator.envMap_.obstvect[d].size()>0))
cmF.mark(d);
}
MapBrowserSelector mbs1(simulator.envMap_.map,SelectorCellMarked<FACE>(cmF));
simulator.envMap_.map.setBrowser(&mbs1);
if(upType & Algo::Render::GL2::TRIANGLES)
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES, false) ;
simulator.envMap_.map.setBrowser(NULL);
CellMarker<FACE> cmF2(simulator.envMap_.map);
TraversorF<PFP::MAP> tF2(simulator.envMap_.map);
for(Dart d = tF.begin() ; d != tF.end() ; d = tF.next())
{
if(simulator.envMap_.obstvect[d].size() > 0)
{
cmF2.mark(d);
}
}
MapBrowserSelector mbs2(simulator.envMap_.map,SelectorCellMarked<FACE>(cmF2));
simulator.envMap_.map.setBrowser(&mbs2);
if(upType & Algo::Render::GL2::TRIANGLES)
m_renderWithin->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES, false) ;
simulator.envMap_.map.setBrowser(NULL);
#else
if(upType & Algo::Render::GL2::TRIANGLES)
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES, false) ;
#endif
if(upType & Algo::Render::GL2::LINES)
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::LINES,false) ;
...
...
@@ -573,7 +618,6 @@ void SocialAgents::cb_redraw()
fbo.createAttachDepthTexture();
fbo.bind();
fbo.enableAllColorAttachments();
#endif
glClearColor( 0.8f, 0.8f, 1.0f, 1.0f );
...
...
@@ -586,21 +630,6 @@ void SocialAgents::cb_redraw()
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
// glEnable(GL_POLYGON_OFFSET_FILL) ;
// glPolygonOffset( 2.0f,2.0f) ;
#ifdef EXPORTING
// m_Ground_Shader->enableVertexAttribs();
// glDrawArrays(GL_QUADS, 0, 4*N_THETA*N_PHI );
// glDrawArrays(GL_POLYGON, 0, 4);
// m_Ground_Shader->disableVertexAttribs();
#endif
// glDisable(GL_POLYGON_OFFSET_FILL) ;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) ;
glEnable(GL_LIGHTING);
...
...
@@ -609,41 +638,34 @@ void SocialAgents::cb_redraw()
dock.check_slide->setRange(0, simulator.envMap_.map.end().index) ;
if (draw_posX)
{
}
if (drawAgents)
{
#ifdef EXPORTING_OBJ
for (unsigned int i=0; i< simulator.agents_.size(); ++i)
{
m_nbIndicesAgent = m_objAgent.createSimpleVBO_PTN(m_positionVBOAgent,m_texcoordVBOAgent,m_normalVBOAgent);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
m_shaderTexAgent->setTransformation(simulator.agents_[i]->m_transfo);
m_shaderTexAgent->activeTexture();
m_shaderTexAgent->enableVertexAttribs();
glDrawArrays(GL_TRIANGLES, 0, m_nbIndicesAgent);
m_shaderTexAgent->disableVertexAttribs();
}
// glDrawArraysInstanced(GL_TRIANGLES, 0, m_nbIndicesAgent, simulator.agents_.size());
for (unsigned int i=0; i< simulator.agents_.size(); ++i)
{
m_nbIndicesAgent = m_objAgent.createSimpleVBO_PTN(m_positionVBOAgent,m_texcoordVBOAgent,m_normalVBOAgent);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
m_shaderTexAgent->setTransformation(simulator.agents_[i]->m_transfo);
m_shaderTexAgent->activeTexture();
m_shaderTexAgent->enableVertexAttribs();
glDrawArrays(GL_TRIANGLES, 0, m_nbIndicesAgent);
m_shaderTexAgent->disableVertexAttribs();
}
#else
PFP::VEC3* data = static_cast<PFP::VEC3*>(m_agentsVBO->lockPtr());
for (unsigned int i=0; i< simulator.agents_.size(); ++i)
{
VEC3 p = simulator.agents_[i]->getPosition();
data[i] = p;
}
m_agentsVBO->releasePtr();
PFP::VEC3* data = static_cast<PFP::VEC3*>(m_agentsVBO->lockPtr());
for (unsigned int i=0; i< simulator.agents_.size(); ++i)
{
VEC3 p = simulator.agents_[i]->getPosition();
data[i] = p;
}
m_agentsVBO->releasePtr();
m_sprite->predraw(Geom::Vec3f(1.0f, 0.0f ,0.0f));
m_sprite->enableVertexAttribs();
glDrawArrays(GL_POINTS, 0, simulator.agents_.size());
m_sprite->disableVertexAttribs();
m_sprite->postdraw();
m_sprite->predraw(Geom::Vec3f(1.0f, 0.0f ,0.0f));
m_sprite->enableVertexAttribs();
glDrawArrays(GL_POINTS, 0, simulator.agents_.size());
m_sprite->disableVertexAttribs();
m_sprite->postdraw();
#endif
#ifdef EXPORTING_AGENT
...
...
@@ -653,20 +675,11 @@ void SocialAgents::cb_redraw()
}
#endif
// for (std::vector<Agent*>::iterator it = simulator.agents_.begin() ; it != simulator.agents_.end() ; ++it)
// {
// glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) ;
// renderAgent(simulator.envMap_, *it, drawAgentsNeighborDist, drawAgentsObstacleDist, drawAgentsPath,
// (*it)->color1, (*it)->color2, (*it)->color3) ;
// }
if(target_Agent)
{
glDisable(GL_LIGHTING);
VEC3 pos =simulator.agents_[agentSlider]->part_.getPosition();
CGoGNout<<"agent "<<agentSlider<< " sélectionné, à la position :"<<pos<<CGoGNendl;
m_ds->newList(GL_COMPILE);
m_ds->newList(GL_COMPILE_AND_EXECUTE);
m_ds->lineWidth(5.0f);
m_ds->pointSize(10.0f);
m_ds->begin(GL_POINTS);
...
...
@@ -678,72 +691,40 @@ void SocialAgents::cb_redraw()
m_ds->vertex(pos+VEC3(0,0,50));
m_ds->vertex(pos+VEC3(0,10,50));
// m_ds->vertex(VEC3 (pos[0]+10,pos[1]-10,pos[2]));
m_ds->end();
m_ds->endList();
m_ds->callList();
}
}
if (drawMovingObstacles)
{
#ifdef SHADOWSHELL
updateObstacleVBO();
#endif
for(unsigned int i = 0 ; i < simulator.movingObstacles_.size() ; ++i)
{
#ifdef SHADOWSHELL
Utils::ShaderFlat* moShader = m_obstShader[i];
// moShader->setAmbiant(Geom::Vec4f(0.43137254902,0.76862745098,0.8862745098,0.));
moShader->setAmbiant(Geom::Vec4f(0,0,0,0.));
moShader->setDiffuse(Geom::Vec4f(0.,0.,0.,0.));
moShader->enableVertexAttribs();
glDrawArrays(GL_POLYGON, 0, simulator.movingObstacles_[i]->nbVertices);
moShader->disableVertexAttribs();
#endif
#ifdef EXPORTING_BOXES
simulator.movingObstacles_[i]->draw();
#endif
// dCD->newList(GL_COMPILE_AND_EXECUTE);
// dCD->begin(GL_POINTS);
// dCD->lineWidth(1.0f);
// dCD->pointSize(10.0f);
// dCD->color3f(0,1,0);
// for(unsigned int j = 0 ; j < simulator.movingObstacles_[i]->nbVertices ; ++j)
// {
// VEC3 p = simulator.movingObstacles_[i]->getPosition(j);
// dCD->vertex3f(p[0], p[1], p[2]) ;
// }
//
// dCD->end();
// dCD->endList();
}
// Commente par Arash
for (std::vector<MovingMesh*>::iterator it = simulator.movingMeshes_.begin() ; it != simulator.movingMeshes_.end() ; ++it)
{
(*it)->draw();
}
glColor3f(1.0f, 1.0f, 1.0f) ;
for (std::vector<MovingObstacle*>::iterator it = simulator.movingObstacles_.begin() ; it != simulator.movingObstacles_.end() ; ++it)
{
if (draw_elipse)
{ // Dessiner les foyers
// glBegin(GL_POINTS);
// glColor3f(1.0,0.0,0.0);
// glVertex3fv((*it)->focus1.data());
// glColor3f(0.0,1.0,0.0);
// glVertex3fv((*it)->focus2.data());
// glEnd();
//
// // Dessiner l'ellipse
// drawEllipse((*it)->focus1,(*it)->focus2,(*it)->sum_dist_foci,20);
}
// renderObstacle(simulator.envMap_, *it,false,drawObstPath, true);
}
}
#ifndef SPATIAL_HASHING
...
...
@@ -785,65 +766,31 @@ void SocialAgents::cb_redraw()
if (drawEnvTopo)
{
m_renderTopo->drawTopo();
if (draw_dart)
{
if (dartSlider < (simulator.envMap_.map.end().index))
{
m_renderTopo->overdrawDart(dartSlider,5.0f,0,1.0f,0.5f);
}
}
}
if (drawObstacles)
{
glColor3f(0.0f, 0.0f, 1.0f) ;
glLineWidth(3.0f) ;
TraversorE<PFP::MAP> tE(simulator.envMap_.map);
for (Dart d = tE.begin() ; d != tE.end() ; d = tE.next())
{
///show buildings
// if(simulator.envMap_.buildingMark.isMarked(d))
// {
// renderFace(simulator.envMap_,d);
// }
// if ((simulator.envMap_.obstvect[d].size()) != 0)
// {
// renderFace(simulator.envMap_, d) ;
// }
if(simulator.envMap_.obstacleMark.isMarked(d))
{
// renderDart(simulator.envMap_,d);
}
if(simulator.envMap_.map.isBoundaryEdge(d))
{
// renderDart(simulator.envMap_,d);
}
}
if (draw_dart && dartSlider < (simulator.envMap_.map.end().index))
m_renderTopo->overdrawDart(dartSlider,5.0f,0,1.0f,0.5f);
}
if (drawEnvFaces)
{
// glEnable(GL_LIGHTING) ;
glEnable(GL_POLYGON_OFFSET_FILL) ;
glPolygonOffset(1.0f, -0.5f) ;
switch(m_renderStyle)
{
case SIMPLE:
#ifdef ONERING
m_simpleColorShader->setColor(Geom::Vec4f(0.9,0.9,0.9,0.));
#else
m_simpleColorShader->setColor(Geom::Vec4f(0.9,0.9,0.9,0.));
#endif
m_render->draw(m_simpleColorShader, Algo::Render::GL2::TRIANGLES);
// if(simulator.config==5)
// {
// m_render_scenary->draw(m_flatShader_scenary, Algo::Render::GL2::TRIANGLES);
// }
#ifdef ONERING
// m_simpleColorShader->setColor(Geom::Vec4f(1.0,0.8,0.7,0.));
m_simpleColorShader->setColor(Geom::Vec4f(0.7,0.7,0.75,0.));
m_renderWithin->draw(m_simpleColorShader, Algo::Render::GL2::TRIANGLES);
#endif
break;
}
glDisable(GL_POLYGON_OFFSET_FILL) ;
...
...
@@ -856,7 +803,7 @@ void SocialAgents::cb_redraw()
elapsedTime += realTime.tv_sec - startTime.tv_sec ;
clock_gettime(CLOCK_MONOTONIC, &startTime) ;
if(display_times)
{
{
CGoGNout <<CGoGNendl;