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
d69e3ee7
Commit
d69e3ee7
authored
Mar 23, 2015
by
Thomas Pitiot
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of icube-forge.unistra.fr:pitiot/volusion into develop
parents
300f655d
5e2f8327
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
43 deletions
+80
-43
include/pfp.h
include/pfp.h
+1
-1
include/surface.h
include/surface.h
+56
-18
src/env_map.cpp
src/env_map.cpp
+10
-11
src/surface.cpp
src/surface.cpp
+11
-11
src/viewer.cpp
src/viewer.cpp
+2
-2
No files found.
include/pfp.h
View file @
d69e3ee7
...
...
@@ -61,7 +61,7 @@ struct PFPSurface : public PFP_STANDARD
}
;
typedef
PFPSurface
::
MAP
S
URFACE
;
typedef
PFPSurface
::
MAP
S
urfaceMap
;
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
VEC3
VEC3
;
typedef
PFP
::
REAL
REAL
;
...
...
include/surface.h
View file @
d69e3ee7
...
...
@@ -25,9 +25,10 @@ class Surface
{
public:
Surface
(
Simulator
*
sim
,
VEC3
offset
)
;
~
Surface
();
inline
const
VEC3
&
getPosition
(
int
index
)
const
inline
const
VEC3
&
getP
articleP
osition
(
int
index
)
const
{
return
getParticule
(
index
)
->
getPosition
();
}
...
...
@@ -42,6 +43,44 @@ public:
return
parts_
[
index
];
}
inline
int
getIndexOfParticuleAtVertex
(
Dart
d
)
const
{
return
indexParticule
[
d
];
}
inline
const
VEC3
&
getFaceColor
(
Dart
d
)
const
{
return
faceColor
[
d
];
}
inline
const
VEC3
&
getSurfacePosition
(
Dart
d
)
const
{
return
positionSurface
[
d
];
}
void
changeColor
(
Triangle
*
t
,
float
distance
);
inline
int
getIndexOfTriangle
(
Dart
d
)
const
{
return
indexTriangle
[
d
];
}
inline
const
SurfaceMap
&
getSurfaceMap
()
const
{
return
surfaceMap
;
}
Utils
::
ShaderColorPerVertex
*
getShader
()
{
return
m_shader
;
}
Utils
::
ShaderSimpleColor
*
getSimpleColorShader
()
{
return
m_simpleColorShader
;
}
void
initPlane
();
//initialisation d'une grille
REAL
faceMaxdistance
(
Face
face
);
//calcul du rayon max d'une face
...
...
@@ -64,15 +103,18 @@ public:
Simulator
*
sim_
;
unsigned
int
index_surface
;
float
r
;
// indice de couleur rouge
float
g
;
// indice de couleur vert
float
b
;
// indice de couleur bleu
float
distanceColorationMini
;
// distance minimale pour commencer a virer rouge
float
distanceColorationMaxi
;
// distance a partir de laquelle on est completement rouge
// visualisation
void
initGL
();
// initialisation GL
void
draw
();
// redessiner l'objet
private:
SurfaceMap
surfaceMap
;
// map
CGoGN
::
Algo
::
MR
::
Primal
::
Adaptive
::
IHM2
<
PFPSurface
>
mapOperator
;
VertexAttribute
<
VEC3
,
SurfaceMap
>
positionSurface
;
//position
VertexAttribute
<
int
,
SurfaceMap
>
indexParticule
;
// index des particules de chaque sommet
FaceAttribute
<
VEC3
,
SurfaceMap
>
faceColor
;
FaceAttribute
<
int
,
SurfaceMap
>
indexTriangle
;
unsigned
int
nbVertices
;
unsigned
int
nbTriangles
;
...
...
@@ -80,16 +122,6 @@ public:
std
::
vector
<
Particule
*>
parts_
;
std
::
vector
<
Triangle
*>
triangles_
;
SURFACE
surfaceMap
;
// map
CGoGN
::
Algo
::
MR
::
Primal
::
Adaptive
::
IHM2
<
PFPSurface
>
mapOperator
;
VertexAttribute
<
VEC3
,
SURFACE
>
positionSurface
;
//position
VertexAttribute
<
int
,
SURFACE
>
indexParticule
;
// index des particules de chaque sommet
FaceAttribute
<
int
,
SURFACE
>
indexTriangle
;
FaceAttribute
<
VEC3
,
SURFACE
>
faceColor
;
// visualisation
void
initGL
();
// initialisation GL
void
draw
();
// redessiner l'objet
void
changeColor
(
Triangle
*
t
,
float
distance
);
Algo
::
Render
::
GL2
::
MapRender
*
m_render_map
;
// render de l'objet
Algo
::
Render
::
GL2
::
ColorPerFaceRender
*
m_render
;
Utils
::
VBO
*
m_positionVBO
;
//VBO
...
...
@@ -97,6 +129,12 @@ public:
Utils
::
ShaderSimpleColor
*
m_simpleColorShader
;
// shader
Utils
::
ShaderColorPerVertex
*
m_shader
;
float
r
;
// indice de couleur rouge
float
g
;
// indice de couleur vert
float
b
;
// indice de couleur bleu
float
distanceColorationMini
;
// distance minimale pour commencer a virer rouge
float
distanceColorationMaxi
;
// distance a partir de laquelle on est completement rouge
};
...
...
src/env_map.cpp
View file @
d69e3ee7
...
...
@@ -434,16 +434,16 @@ void EnvMap::FirstRegistrationTriangle(Triangle * o)// réenregistre l'Triangle
Dart
cell
=
o
->
cell
;
std
::
vector
<
Dart
>
memo
;
for
(
Edge
e
:
edgesIncidentToFace2
<
S
URFACE
>
(
mo
->
surfaceMap
,
cell
))
// first mark inside
for
(
Edge
e
:
edgesIncidentToFace2
<
S
urfaceMap
>
(
mo
->
getSurfaceMap
()
,
cell
))
// first mark inside
{
Dart
cell2
=
mo
->
surfaceMap
.
phi1
(
e
);
Dart
cell2
=
mo
->
getSurfaceMap
()
.
phi1
(
e
);
// on récupère les aprticules correspondant a chaque edge du triangle a enregistrer
const
Particule
*
p1
=
mo
->
getParticule
(
mo
->
indexParticule
[
cell
]
);
const
Particule
*
p1
=
mo
->
getParticule
(
mo
->
getIndexOfParticuleAtVertex
(
cell
)
);
Dart
d1
=
p1
->
getCell
();
// darts de la carte 3D contenant les particules
memo
=
getMemoCross
(
p1
->
getPosition
(),
mo
->
positionSurface
[
cell2
]
,
d1
);
memo
=
getMemoCross
(
p1
->
getPosition
(),
mo
->
getSurfacePosition
(
cell2
)
,
d1
);
for
(
Dart
d
:
memo
)
inside
.
mark
(
d
);
...
...
@@ -519,8 +519,7 @@ void EnvMap::popTriangle(Triangle* o)
{
Dart
cell
=
o
->
cell
;
int
n
=
mo
->
indexTriangle
[
cell
];
int
n
=
mo
->
getIndexOfTriangle
(
cell
);
for
(
Dart
d
:
mo
->
belonging_cells
[
n
])
...
...
@@ -838,11 +837,11 @@ void EnvMap::resetPartSubdiv(Triangle * o)
Surface
*
mo
=
o
->
surf
;
Dart
cell
=
o
->
cell
;
Dart
cell2
=
mo
->
surfaceMap
.
phi1
(
cell
);
Dart
cell3
=
mo
->
surfaceMap
.
phi1
(
cell2
);
Particule
*
p
=
mo
->
getParticule
(
mo
->
indexParticule
[
cell
]
);
Particule
*
p2
=
mo
->
getParticule
(
mo
->
indexParticule
[
cell2
]
);
Particule
*
p3
=
mo
->
getParticule
(
mo
->
indexParticule
[
cell3
]
);
Dart
cell2
=
mo
->
getSurfaceMap
()
.
phi1
(
cell
);
Dart
cell3
=
mo
->
getSurfaceMap
()
.
phi1
(
cell2
);
Particule
*
p
=
mo
->
getParticule
(
mo
->
getIndexOfParticuleAtVertex
(
cell
)
);
Particule
*
p2
=
mo
->
getParticule
(
mo
->
getIndexOfParticuleAtVertex
(
cell2
)
);
Particule
*
p3
=
mo
->
getParticule
(
mo
->
getIndexOfParticuleAtVertex
(
cell3
)
);
if
(
mo
!=
NULL
)
{
...
...
src/surface.cpp
View file @
d69e3ee7
...
...
@@ -16,13 +16,13 @@ Surface::Surface(Simulator* sim,VEC3 offset):
distanceColorationMini
=
2.0
f
;
surfaceMap
.
initImplicitProperties
();
positionSurface
=
surfaceMap
.
addAttribute
<
VEC3
,
VERTEX
,
S
URFACE
>
(
"positionSurface"
);
positionSurface
=
surfaceMap
.
addAttribute
<
VEC3
,
VERTEX
,
S
urfaceMap
>
(
"positionSurface"
);
initOperators
(
LERP
);
initPlane
();
indexParticule
=
surfaceMap
.
addAttribute
<
int
,
VERTEX
,
S
URFACE
>
(
"indexParticule"
);
indexTriangle
=
surfaceMap
.
addAttribute
<
int
,
FACE
,
S
URFACE
>
(
"indexTriangle"
);
faceColor
=
surfaceMap
.
addAttribute
<
VEC3
,
FACE
,
S
URFACE
>
(
"faceColor"
);
indexParticule
=
surfaceMap
.
addAttribute
<
int
,
VERTEX
,
S
urfaceMap
>
(
"indexParticule"
);
indexTriangle
=
surfaceMap
.
addAttribute
<
int
,
FACE
,
S
urfaceMap
>
(
"indexTriangle"
);
faceColor
=
surfaceMap
.
addAttribute
<
VEC3
,
FACE
,
S
urfaceMap
>
(
"faceColor"
);
index_surface
=
sim
->
surfaces
.
size
();
...
...
@@ -30,7 +30,7 @@ Surface::Surface(Simulator* sim,VEC3 offset):
// initialisation des particules et des attributs de sommet
TraversorV
<
S
URFACE
>
tv
(
surfaceMap
);
TraversorV
<
S
urfaceMap
>
tv
(
surfaceMap
);
for
(
Dart
d
=
tv
.
begin
()
;
d
!=
tv
.
end
()
;
d
=
tv
.
next
())
{
positionSurface
[
d
]
+=
offset
;
...
...
@@ -39,7 +39,7 @@ Surface::Surface(Simulator* sim,VEC3 offset):
nbVertices
++
;
}
// initialisation tableaux de vecteurs qui vont stocker les belonging cells
TraversorE
<
S
URFACE
>
tF2
(
surfaceMap
);
TraversorE
<
S
urfaceMap
>
tF2
(
surfaceMap
);
for
(
Dart
d
=
tF2
.
begin
(),
end
=
tF2
.
end
()
;
d
!=
end
;
d
=
tF2
.
next
())
{
nbTriangles
++
;
...
...
@@ -49,7 +49,7 @@ Surface::Surface(Simulator* sim,VEC3 offset):
// initialisation des segments et des attributs d'edge
TraversorF
<
S
URFACE
>
tE
(
surfaceMap
);
TraversorF
<
S
urfaceMap
>
tE
(
surfaceMap
);
for
(
Dart
d
=
tE
.
begin
()
,
end
=
tE
.
end
();
d
!=
end
;
d
=
tE
.
next
())
{
faceColor
[
d
]
=
VEC3
(
r
,
g
,
b
);
...
...
@@ -143,7 +143,7 @@ void Surface::initPlane()
prim
.
embedIntoGrid
(
positionSurface
,
1.0
f
,
1.0
f
,
0.0
f
)
;
TraversorV
<
S
URFACE
>
tv
(
surfaceMap
);
TraversorV
<
S
urfaceMap
>
tv
(
surfaceMap
);
for
(
Dart
d
=
tv
.
begin
()
;
d
!=
tv
.
end
()
;
d
=
tv
.
next
())
{
positionSurface
[
d
]
*=
4
;
...
...
@@ -153,7 +153,7 @@ void Surface::initPlane()
TraversorF
<
S
URFACE
>
tF
(
surfaceMap
);
TraversorF
<
S
urfaceMap
>
tF
(
surfaceMap
);
for
(
Dart
d
=
tF
.
begin
()
;
d
!=
tF
.
end
()
;
d
=
tF
.
next
())
{
REAL
dist
=
faceMaxdistance
(
d
);
...
...
@@ -177,7 +177,7 @@ bool Surface::subdiveMap()
{
bool
res
=
true
;
std
::
vector
<
Dart
>
toCheck
;
TraversorF
<
S
URFACE
>
tF
(
surfaceMap
);
TraversorF
<
S
urfaceMap
>
tF
(
surfaceMap
);
surfaceMap
.
setCurrentLevel
(
surfaceMap
.
getMaxLevel
())
;
for
(
Dart
d
=
tF
.
begin
()
;
d
!=
tF
.
end
()
;
d
=
tF
.
next
())
{
...
...
@@ -209,7 +209,7 @@ REAL Surface::faceMaxdistance(Face face)
{
Dart
d
=
face
;
VEC3
center
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFPSurface
,
VertexAttribute
<
VEC3
,
S
URFACE
>>
(
surfaceMap
,
face
,
positionSurface
);
VEC3
center
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFPSurface
,
VertexAttribute
<
VEC3
,
S
urfaceMap
>>
(
surfaceMap
,
face
,
positionSurface
);
REAL
res
=
(
positionSurface
[
d
]
-
center
).
norm2
();
for
(
Vertex
vert
:
verticesIncidentToFace2
(
surfaceMap
,
face
))
...
...
src/viewer.cpp
View file @
d69e3ee7
...
...
@@ -262,8 +262,8 @@ void Volusion::cb_initGL()
for
(
Surface
*
surf
:
simul
.
surfaces
)
{
surf
->
initGL
();
registerShader
(
surf
->
m_shader
);
registerShader
(
surf
->
m_simpleColorShader
);
registerShader
(
surf
->
getShader
()
);
registerShader
(
surf
->
getSimpleColorShader
()
);
// for(Triangle * t : surf->triangles_)
// {
// data[j]=t->closest_point;
...
...
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