Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
KennethVanhoey
CGoGN
Commits
5a707d34
Commit
5a707d34
authored
Oct 03, 2011
by
Thomas
Browse files
topoRender GMD2 rendu OK
parent
68b357cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/simpleGMap2.cpp
View file @
5a707d34
...
...
@@ -61,7 +61,7 @@ void SimpleGMap2::cb_redraw()
{
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
Algo
::
Render
::
GL1
::
renderTopoGMD2
<
PFP
>
(
myMap
,
position
,
fals
e
,
true
,
0.9
f
,
0.9
f
);
Algo
::
Render
::
GL1
::
renderTopoGMD2
<
PFP
>
(
myMap
,
position
,
true
,
tru
e
,
true
,
0.9
f
,
0.9
f
,
0.9
f
);
}
...
...
include/Algo/Render/GL1/topo_render.hpp
View file @
5a707d34
...
...
@@ -641,14 +641,13 @@ void renderTopoMD3(typename PFP::MAP& map, typename PFP::TVEC3& positions, bool
}
template
<
typename
PFP
>
void
renderTopoGMD2
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
bool
drawBeta1
,
bool
drawBeta2
,
float
ke
,
float
kf
)
void
renderTopoGMD2
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
bool
drawBeta0
,
bool
drawBeta1
,
bool
drawBeta2
,
float
kd
,
float
ke
,
float
kf
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv1
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv11
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
fv2
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
posBeta1
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
posBeta2
(
map
,
DART
);
AutoAttributeHandler
<
Geom
::
Vec3f
>
vert
(
map
,
DART
);
glLineWidth
(
2.0
f
);
...
...
@@ -656,6 +655,7 @@ void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions
glBegin
(
GL_LINES
);
DartMarker
mf
(
map
);
//draw all darts and potentially all beta0
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
mf
.
isMarked
(
d
))
...
...
@@ -663,28 +663,24 @@ void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions
std
::
vector
<
VEC3
>
vecPos
;
vecPos
.
reserve
(
16
);
std
::
vector
<
VEC3
>
vecF1
;
vecF1
.
reserve
(
16
);
// store the face & center
VEC3
center
(
0
.0
f
,
0.0
f
,
0.0
f
);
VEC3
center
(
0
);
Dart
dd
=
d
;
do
{
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
positions
[
d
]);
const
VEC3
&
P
=
positions
[
d
d
];
vecPos
.
push_back
(
positions
[
d
d
]);
center
+=
P
;
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
d
d
);
d
d
=
map
.
phi1
(
d
d
);
}
while
(
d
d
!=
d
);
center
/=
REAL
(
vecPos
.
size
());
//shrink the face
unsigned
int
nb
=
vecPos
.
size
();
float
k
=
1.0
f
-
kf
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
vecPos
[
i
]
=
center
*
k
+
vecPos
[
i
]
*
kf
;
}
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
k
=
1.0
f
-
ke
;
...
...
@@ -692,42 +688,61 @@ void renderTopoGMD2(typename PFP::MAP& map, const typename PFP::TVEC3& positions
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
k
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
k
;
VEC3
P_mid
=
P
+
(
Q
-
P
)
*
kd
*
0.5
f
;
VEC3
Q_mid
=
Q
+
(
P
-
Q
)
*
kd
*
0.5
f
;
glVertex3fv
(
P
.
data
());
glVertex3fv
(
P_mid
.
data
());
if
(
drawBeta0
)
{
glColor3f
(
0.0
f
,
0.0
f
,
1.0
f
);
glVertex3fv
(
P_mid
.
data
());
glVertex3fv
(
Q_mid
.
data
());
}
glColor3f
(
0.9
f
,
0.9
f
,
0.9
f
);
glVertex3fv
(
Q
.
data
());
glVertex3fv
(
Q_mid
.
data
());
vert
[
d
]
=
P
;
VEC3
f
=
P
*
0.5
f
+
Q
*
0.5
f
;
fv2
[
d
]
=
f
;
f
=
P
*
0.1
f
+
Q
*
0.9
f
;
fv1
[
d
]
=
f
;
f
=
P
*
0.9
f
+
Q
*
0.1
f
;
fv11
[
d
]
=
f
;
VEC3
f
=
P
*
0.5
f
+
P_mid
*
0.5
f
;
posBeta2
[
d
]
=
f
;
f
=
Q
*
0.5
f
+
Q_mid
*
0.5
f
;
posBeta2
[
map
.
beta0
(
d
)]
=
f
;
f
=
P
*
0.9
f
+
P_mid
*
0.1
f
;
posBeta1
[
d
]
=
f
;
f
=
Q
*
0.9
f
+
Q_mid
*
0.1
f
;
posBeta1
[
map
.
beta0
(
d
)]
=
f
;
d
=
map
.
phi1
(
d
);
}
mf
.
markOrbit
(
FACE
,
d
);
}
}
//draw links beta 1 and beta 2
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
Dart
e
=
map
.
beta2
(
d
);
if
(
(
d
<
e
)
&&
drawBeta2
)
if
(
drawBeta2
)
{
glColor3f
(
1.0
,
0.0
,
0.0
);
glVertex3fv
(
fv
2
[
d
].
data
());
glVertex3fv
(
fv
2
[
e
].
data
());
glVertex3fv
(
posBeta
2
[
d
].
data
());
glVertex3fv
(
posBeta
2
[
e
].
data
());
}
e
=
map
.
beta1
(
d
);
if
((
d
<
e
)
&&
drawBeta1
)
{
glColor3f
(
0.0
f
,
1.0
f
,
1.0
f
);
glVertex3fv
(
fv
1
[
d
].
data
());
glVertex3fv
(
fv1
1
[
e
].
data
());
glVertex3fv
(
posBeta
1
[
d
].
data
());
glVertex3fv
(
posBeta
1
[
e
].
data
());
}
}
glEnd
();
// LINES
//draw vertices
glPointSize
(
5.0
f
);
glColor3f
(
0.0
f
,
0.0
f
,
0.0
f
);
glBegin
(
GL_POINTS
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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