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
dc7ea6b5
Commit
dc7ea6b5
authored
Feb 26, 2013
by
Thomas Jund
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chgmt taille route et qq modif rendus
parent
c799a614
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
2932 additions
and
52 deletions
+2932
-52
include/env_map.h
include/env_map.h
+1
-1
include/moving_mesh.h
include/moving_mesh.h
+2
-1
include/viewer.h
include/viewer.h
+2
-0
meshRessources/LimaceLvl1.obj
meshRessources/LimaceLvl1.obj
+2833
-0
shaders/Defered2.frag
shaders/Defered2.frag
+3
-3
shaders/Defered2.frag~
shaders/Defered2.frag~
+2
-2
src/agent.cpp
src/agent.cpp
+1
-1
src/env_map.cpp
src/env_map.cpp
+2
-2
src/moving_mesh.cpp
src/moving_mesh.cpp
+11
-14
src/moving_obstacle.cpp
src/moving_obstacle.cpp
+16
-8
src/simulator.cpp
src/simulator.cpp
+5
-3
src/viewer.cpp
src/viewer.cpp
+46
-10
svg/mapRoads.svg
svg/mapRoads.svg
+8
-7
No files found.
include/env_map.h
View file @
dc7ea6b5
...
...
@@ -32,7 +32,7 @@ class ArticulatedObstacle;
#include "pfp.h"
#define EXPORTING3
//
#define EXPORTING3
#ifdef EXPORTING3
#include "Utils/Shaders/shaderPhongTexture.h"
...
...
include/moving_mesh.h
View file @
dc7ea6b5
...
...
@@ -58,7 +58,8 @@ public:
Utils
::
VBO
*
m_texcoordVBO
;
Utils
::
ShaderPhongTexture
*
m_shaderTex
;
ShaderCustomTex
*
m_shaderTex
;
// Utils::ShaderPhongTexture* m_shaderTex;
// Utils::ShaderSimpleTexture* m_shaderTex;
Algo
::
Surface
::
Import
::
OBJModel
<
PFP2
>
m_obj
;
unsigned
int
m_nbIndices
;
...
...
include/viewer.h
View file @
dc7ea6b5
...
...
@@ -89,6 +89,8 @@ public:
void
cb_keyPress
(
int
keycode
)
;
//RENDERING
// Utils::Drawer * dCD;
Geom
::
Vec4f
colDif
;
Geom
::
Vec4f
colSpec
;
Geom
::
Vec4f
colClear
;
...
...
meshRessources/LimaceLvl1.obj
0 → 100644
View file @
dc7ea6b5
This diff is collapsed.
Click to expand it.
shaders/Defered2.frag
View file @
dc7ea6b5
...
...
@@ -126,8 +126,8 @@ void main()
// else
// gl_FragColor = vec4( (0.5+0.5*edgeEnhancement) * texture2D(u_FrameBufferColor,gl_TexCoord[0]).xyz, 1.0 );
if
(
gl_TexCoord
[
0
].
x
>
0
.
5
)
//
if( gl_TexCoord[0].x > 0.5 )
gl_FragColor
=
vec4
(
(
0
.
25
+
0
.
75
*
edgeEnhancement
)
*
texture2D
(
u_FrameBufferColor
,
gl_TexCoord
[
0
]).
xyz
,
1
.
0
);
else
gl_FragColor
=
vec4
(
(
1
.
0
+
0
.
0
*
edgeEnhancement
)
*
texture2D
(
u_FrameBufferColor
,
gl_TexCoord
[
0
]).
xyz
,
1
.
0
);
//
else
//
gl_FragColor = vec4( (1.0+0.0*edgeEnhancement) * texture2D(u_FrameBufferColor,gl_TexCoord[0]).xyz, 1.0 );
}
shaders/Defered2.frag~
View file @
dc7ea6b5
...
...
@@ -128,6 +128,6 @@ void main()
if( gl_TexCoord[0].x > 0.5 )
gl_FragColor = vec4( (0.25+0.75*edgeEnhancement) * texture2D(u_FrameBufferColor,gl_TexCoord[0]).xyz, 1.0 );
else
gl_FragColor = vec4( (0.5+0.5
*edgeEnhancement) * texture2D(u_FrameBufferColor,gl_TexCoord[0]).xyz, 1.0 );
//
else
// gl_FragColor = vec4( (1.0+0.0
*edgeEnhancement) * texture2D(u_FrameBufferColor,gl_TexCoord[0]).xyz, 1.0 );
}
src/agent.cpp
View file @
dc7ea6b5
...
...
@@ -210,7 +210,7 @@ void Agent::updateObstacleNeighbors()
if
((
obstacleNeighbors_
.
size
()
<
maxMovingObstacles_
||
distSq
<
maxDistObst
)
&&
distSq
<
rangeSq_
)
{
if
(
Geom
::
testOrientation2D
(
part_
.
getPosition
(),
(
*
it
)
->
p1
,
(
*
it
)
->
p2
)
==
Geom
::
RIGHT
)
//
if (Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
if
(
distSq
>
maxDistObst
)
...
...
src/env_map.cpp
View file @
dc7ea6b5
...
...
@@ -77,7 +77,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
{
case
0
:
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator
::
generateCity
<
PFP
>
(
*
this
,
1
0
)
;
CityGenerator
::
generateCity
<
PFP
>
(
*
this
,
0
)
;
break
;
case
1
:
// CityGenerator::generateGrid<PFP>(*this) ;
...
...
@@ -187,7 +187,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
//subdivision to create footpath
MapBrowserSelector
mbs
(
map
,
SelectorDartNoBoundary
<
PFP
::
MAP
>
(
map
));
map
.
setBrowser
(
&
mbs
);
Algo
::
Surface
::
Modelisation
::
TwoNPlusOneSubdivision
<
PFP
,
PFP
::
TVEC3
,
VEC3
>
(
map
,
position
);
Algo
::
Surface
::
Modelisation
::
TwoNPlusOneSubdivision
<
PFP
,
PFP
::
TVEC3
,
VEC3
>
(
map
,
position
,
1.0
f
/
5.0
f
);
map
.
setBrowser
(
NULL
);
markPedWay
();
...
...
src/moving_mesh.cpp
View file @
dc7ea6b5
...
...
@@ -61,16 +61,16 @@ void MovingMesh::initGL()
m_texture
->
setWrapping
(
GL_CLAMP_TO_EDGE
);
m_shaderTex
=
new
Utils
::
ShaderPhongTexture
();
m_shaderTex
=
new
ShaderCustomTex
();
// m_shaderTex = new Utils::ShaderSimpleTexture();
m_shaderTex
->
setAttributePosition
(
m_positionVBO
);
m_shaderTex
->
setAttributeTexCoord
(
m_texcoordVBO
);
m_shaderTex
->
setAttributeNormal
(
m_normalVBO
);
//
m_shaderTex->setAttributeNormal(m_normalVBO);
m_shaderTex
->
setTextureUnit
(
GL_TEXTURE0
);
m_shaderTex
->
setTexture
(
m_texture
);
m_shaderTex
->
setShininess
(
10.0
f
);
m_shaderTex
->
setAmbient
(
0.1
f
);
m_shaderTex
->
setSpecular
(
Geom
::
Vec4f
(
0.5
));
//
m_shaderTex->setShininess(10.0f);
//
m_shaderTex->setAmbient(0.1f);
//
m_shaderTex->setSpecular(Geom::Vec4f(0.5));
glEnable
(
GL_TEXTURE_2D
);
...
...
@@ -197,8 +197,8 @@ void MovingMesh::draw()
m_simpleColorShader
->
setColor
(
Geom
::
Vec4f
(
1.0
,
0.627
,
0.0
,
0.
));
m_render
->
draw
(
m_simpleColorShader
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
//
m_simpleColorShader->setColor(Geom::Vec4f(0.0,0.0,0.0,0.));
//
m_render->draw(m_simpleColorShader, Algo::Render::GL2::LINES);
m_simpleColorShader
->
setColor
(
Geom
::
Vec4f
(
0.0
,
0.0
,
0.0
,
0.
));
m_render
->
draw
(
m_simpleColorShader
,
Algo
::
Render
::
GL2
::
LINES
);
#endif
}
...
...
@@ -210,7 +210,9 @@ std::vector<VEC3> MovingMesh::computeProjectedPointSet(float maxHeight)
for
(
Dart
dd
=
tv
.
begin
()
;
dd
!=
tv
.
end
()
;
dd
=
tv
.
next
())
{
if
(
position
[
dd
][
2
]
<
maxHeight
)
{
points
.
push_back
(
position
[
dd
]);
}
}
points
=
jarvisConvexHull
(
points
);
...
...
@@ -232,6 +234,7 @@ std::vector<VEC3> MovingMesh::computeProjectedPointSet(float maxHeight)
{
if
(
active
[
i
])
res
.
push_back
(
points
[
i
]);
// std::cout << "fin " << points[i] << std::endl;
}
std
::
cout
<<
"nb vertices before simplification -> "
<<
points
.
size
()
<<
std
::
endl
;
...
...
@@ -287,7 +290,7 @@ std::vector<VEC3> MovingMesh::jarvisConvexHull(const std::vector<VEC3>& pointSet
if
(
pointSet
[
i
][
1
]
>
pointSet
[
minPoint
][
1
])
minPoint
=
i
;
// convHull.push_back(minPoint
);
res
.
push_back
(
pointSet
[
minPoint
]
);
curr
=
minPoint
;
do
{
...
...
@@ -315,7 +318,6 @@ std::vector<VEC3> MovingMesh::jarvisConvexHull(const std::vector<VEC3>& pointSet
if
(
trouve
)
{
curr
=
i
-
1
;
// convHull.push_back(curr);
res
.
push_back
(
pointSet
[
curr
]);
}
else
...
...
@@ -326,11 +328,6 @@ std::vector<VEC3> MovingMesh::jarvisConvexHull(const std::vector<VEC3>& pointSet
}
while
(
curr
!=
minPoint
);
// res.reserve(convHull.size());
//
// for(std::vector<unsigned int>::iterator it = convHull.begin() ; it != convHull.end() ; ++it)
// res.push_back(pointSet[*it]);
return
res
;
}
...
...
src/moving_obstacle.cpp
View file @
dc7ea6b5
...
...
@@ -498,11 +498,14 @@ void MovingObstacle::update()
float
rigidity
=
70.0
f
;
float
stretch
=
rigidity
*
(
edgeLength
[
dd
]
-
v1
.
norm
());
VEC3
f
=
stretch
*
(
v1
/
norm
);
if
(
norm
>
0.0
f
)
{
VEC3
f
=
stretch
*
(
v1
/
norm
);
//apply force symmetrically
forces
[
dd
]
-=
f
;
forces
[
map
.
phi1
(
dd
)]
+=
f
;
//apply force symmetrically
forces
[
dd
]
-=
f
;
forces
[
map
.
phi1
(
dd
)]
+=
f
;
}
}
dd
=
map
.
phi1
(
dd
);
...
...
@@ -526,11 +529,16 @@ void MovingObstacle::update()
float
angularRig
=
70.0
f
;
float
curAngle
=
Algo
::
Surface
::
Geometry
::
angle
<
PFP
>
(
map
,
map
.
phi_1
(
dd
),
map
.
phi1
(
dd
),
position
);
float
angularStretch
=
angularRig
*
(
restAngle
-
curAngle
);
VEC3
f
=
angularStretch
*
(
v1
/
norm
);
forces
[
dd
]
+=
f
;
forces
[
map
.
phi1
(
dd
)]
-=
f
;
if
(
norm
>
0.0
f
&&
curAngle
==
curAngle
)
//test to avoid NaN
{
VEC3
f
=
angularStretch
*
(
v1
/
norm
);
forces
[
dd
]
+=
f
;
forces
[
map
.
phi1
(
dd
)]
-=
f
;
}
}
}
...
...
@@ -714,7 +722,7 @@ void MovingObstacle::computePrefVelocity() //calcul du vecteur optimal pour atte
float
goalDist2
=
goalVector
.
norm2
()
;
if
(
goalDist2
<
75
0.0
f
)
if
(
goalDist2
<
100
0.0
f
)
{
curGoal_
=
(
curGoal_
+
1
)
%
goals_
.
size
()
;
goalVector
=
goals_
[
curGoal_
]
-
center
;
...
...
src/simulator.cpp
View file @
dc7ea6b5
...
...
@@ -47,7 +47,7 @@ void Simulator::init( float dimension, unsigned int nbAgent, unsigned int nbObst
setupSnakeCorridorScenario
(
nbAgent
,
nbObst
,
10
)
;
break
;
case
3
:
envMap_
.
init
(
config
,
500.0
f
,
5
00.0
f
,
minSize
,
100.0
f
)
;
//grosses cases
envMap_
.
init
(
config
,
1000.0
f
,
10
00.0
f
,
minSize
,
100.0
f
)
;
//grosses cases
setupScenario
(
nbAgent
,
false
)
;
addMovingObstacles
(
nbObst
);
addPathToObstacles
();
...
...
@@ -116,7 +116,7 @@ void Simulator::doStep()
movingObstacles_
[
i
]
->
update
()
;
// commente par Arash
//
movingObstacles_[i]->updateMesh() ;
movingObstacles_
[
i
]
->
updateMesh
()
;
}
for
(
unsigned
int
i
=
0
;
i
<
agents_
.
size
()
;
++
i
)
...
...
@@ -686,7 +686,9 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
break
;
case
1
:
{
mm
=
new
MovingMesh
(
envMap_
,
d
,
"./meshRessources/Limace_2.obj"
);
mm
=
new
MovingMesh
(
envMap_
,
d
,
"./meshRessources/LimaceLvl1.obj"
);
// mm = new MovingMesh(envMap_, d, "./meshRessources/cylinder.obj");
// mm = new MovingMesh(envMap_, d, "./meshRessources/simpleCyl.obj");
movingMeshes_
.
push_back
(
mm
);
vPos
=
mm
->
computeProjectedPointSet
(
maxHeight
);
...
...
src/viewer.cpp
View file @
dc7ea6b5
...
...
@@ -115,7 +115,7 @@ void SocialAgents::cb_initGL()
float tailleX = bb.size(0) ;
float tailleY = bb.size(1) ;
float tailleZ = bb.size(2) ;
float
gWidthObj
=
std
::
max
<
float
>
(
std
::
max
<
float
>
(
tailleX
,
tailleY
),
tailleZ
);
///
1
0.0f ;
float gWidthObj = std::max<float>(std::max<float>(tailleX, tailleY), tailleZ);///
5
0.0f ;
setParamObject(gWidthObj, gPosObj.data()) ;
// choose to use GL version 2
...
...
@@ -188,16 +188,24 @@ void SocialAgents::cb_initGL()
void SocialAgents::initRendering()
{
// dCD = new Utils::Drawer();
// registerShader(dCD->getShader());
if(simulator.config==5)
{
m_render_scenary->initPrimitives<PFP>(simulator.envMap_.mapScenary, Algo::Render::GL2::LINES,false) ;
m_render_scenary->initPrimitives<PFP>(simulator.envMap_.mapScenary, Algo::Render::GL2::TRIANGLES,false) ;
m_render
->
initPrimitives
<
PFP
>
(
simulator
.
envMap_
.
map
,
Algo
::
Render
::
GL2
::
LINES
,
false
)
;
MapBrowserSelector mbs(simulator.envMap_.map,SelectorCellMarked<FACE>(simulator.envMap_.pedWayMark));
simulator.envMap_.map.setBrowser(&mbs);
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES,false) ;
m_renderPedway->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::TRIANGLES,false) ;
simulator.envMap_.map.setBrowser(NULL);
m_render->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::LINES,false) ;
m_renderPedway->initPrimitives<PFP>(simulator.envMap_.map, Algo::Render::GL2::LINES,false) ;
m_renderPedway
->
initPrimitives
<
PFP
>
(
simulator
.
envMap_
.
map
,
Algo
::
Render
::
GL2
::
TRIANGLES
,
false
)
;
}
else
{
...
...
@@ -495,8 +503,8 @@ void SocialAgents::cb_redraw()
glEnable(GL_POINT_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable
(
GL_POLYGON_OFFSET_FILL
)
;
glPolygonOffset
(
2.0
f
,
2.0
f
)
;
//
glEnable(GL_POLYGON_OFFSET_FILL) ;
//
glPolygonOffset( 2.0f,2.0f) ;
#ifdef EXPORTING
// m_Ground_Shader->enableVertexAttribs();
...
...
@@ -507,7 +515,7 @@ void SocialAgents::cb_redraw()
#endif
glDisable
(
GL_POLYGON_OFFSET_FILL
)
;
//
glDisable(GL_POLYGON_OFFSET_FILL) ;
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) ;
...
...
@@ -569,13 +577,30 @@ void SocialAgents::cb_redraw()
moShader->enableVertexAttribs();
glDrawArrays(GL_POLYGON, 0, simulator.movingObstacles_[i]->nbVertices);
moShader->disableVertexAttribs();
// 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)
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)
...
...
@@ -674,7 +699,7 @@ void SocialAgents::cb_redraw()
{
glEnable(GL_LIGHTING) ;
glEnable(GL_POLYGON_OFFSET_FILL) ;
glPolygonOffset
(
1.0
f
,
1
.0
f
)
;
glPolygonOffset(
-3.0f, -3
.0f) ;
switch(m_renderStyle)
{
case SIMPLE:
...
...
@@ -1519,9 +1544,20 @@ void SocialAgents::cb_keyPress(int keycode)
std::string filename2("myAgents.pos") ;
simulator.exportAgents(filename2) ;
std::cout << "exporting meshes" << std::endl ;
std
::
string
filename3
(
"
roadMap
.ply"
)
;
std::string filename3("
pedway
.ply") ;
std::string filename4("buildingMap.ply") ;
std::string filename5("road.ply") ;
MapBrowserSelector mbs(simulator.envMap_.map,SelectorCellMarked<FACE>(simulator.envMap_.pedWayMark));
simulator.envMap_.map.setBrowser(&mbs);
Algo::Surface::Export::exportPLY<PFP>(simulator.envMap_.map, simulator.envMap_.position,filename3.c_str(), false);
MapBrowserSelector mbs2(simulator.envMap_.map,SelectorCellUnmarked<FACE>(simulator.envMap_.pedWayMark));
simulator.envMap_.map.setBrowser(&mbs2);
Algo::Surface::Export::exportPLY<PFP>(simulator.envMap_.map, simulator.envMap_.position,filename5.c_str(), false);
simulator.envMap_.map.setBrowser(NULL);
if(simulator.config==5)
Algo::Surface::Export::exportPLY<PFP>(simulator.envMap_.mapScenary, simulator.envMap_.positionScenary,filename4.c_str(), false);
break ;
...
...
svg/mapRoads.svg
View file @
dc7ea6b5
...
...
@@ -39,9 +39,9 @@
inkscape:window-height="991"
id="namedview20587"
showgrid="false"
inkscape:zoom="
7.2407736
"
inkscape:cx="
340.96034
"
inkscape:cy="8
99.388
78"
inkscape:zoom="
0.32000001
"
inkscape:cx="
1726.1139
"
inkscape:cy="8
42.547
78"
inkscape:window-x="1920"
inkscape:window-y="27"
inkscape:window-maximized="1"
...
...
@@ -18927,9 +18927,10 @@
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#bababa;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="m 465.
15625,-83.187619 0.59766,14.128
9 0.30468,7.0664 1.125,23.7774 0.87891,19.8593 1.42969,31.5664 0.82812,18.2461 1.4375,27.1368"
d="m 465.
75391,-69.05871
9 0.30468,7.0664 1.125,23.7774 0.87891,19.8593 1.42969,31.5664 0.82812,18.2461 1.4375,27.1368"
id="path6395"
inkscape:connector-curvature="0" />
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccc" />
<path
style="fill:none;stroke:#bababa;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="M 68.300781,970.19517 60.59375,958.57407 -7.335938,856.03118 c -21.353094,-33.1877 -42.729473,-66.3603 -64.078124,-99.5508"
...
...
@@ -18969,10 +18970,10 @@
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#bababa;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="
M 465.15625,-83.187619 C 395.91458,-34.292706 323.73073,20.569222 264.35547,64.367081
"
d="
m 465.75391,-69.058719 -28.06047,5.45266 c 0,0 -121.77912,89.941012 -173.33797,127.97314
"
id="path6411"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
sodipodi:nodetypes="cc
c
" />
<path
style="fill:none;stroke:#bababa;stroke-width:16;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1"
d="m 1029.9336,593.50377 c 22.593,-77.74253 58.8961,-154.43335 78.6992,-232.9844"
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment