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
CGoGN
CGoGN
Commits
ae997b3c
Commit
ae997b3c
authored
Jun 30, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout culling sur rendu svg faces
parent
a134c4e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
19 deletions
+36
-19
include/Algo/Render/SVG/mapSVGRender.h
include/Algo/Render/SVG/mapSVGRender.h
+1
-1
include/Algo/Render/SVG/mapSVGRender.hpp
include/Algo/Render/SVG/mapSVGRender.hpp
+35
-18
No files found.
include/Algo/Render/SVG/mapSVGRender.h
View file @
ae997b3c
...
...
@@ -153,7 +153,7 @@ public:
void
renderLinesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
template
<
typename
PFP
>
void
renderFacesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
float
shrink
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
void
renderFacesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
float
shrink
,
bool
cull
=
false
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
template
<
typename
PFP
>
void
renderPointsToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
const
FunctorSelect
&
good
=
SelectorTrue
(),
unsigned
int
thread
=
0
);
...
...
include/Algo/Render/SVG/mapSVGRender.hpp
View file @
ae997b3c
...
...
@@ -101,7 +101,7 @@ void SVGOut::renderLinesToSVG(typename PFP::MAP& map, const typename PFP::TVEC3&
template
<
typename
PFP
>
void
SVGOut
::
renderFacesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
float
shrink
,
const
FunctorSelect
&
good
,
unsigned
int
thread
)
void
SVGOut
::
renderFacesToSVG
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
position
,
float
shrink
,
bool
cull
,
const
FunctorSelect
&
good
,
unsigned
int
thread
)
{
glm
::
i32vec4
viewport
;
glGetIntegerv
(
GL_VIEWPORT
,
&
(
viewport
[
0
]));
...
...
@@ -111,25 +111,42 @@ void SVGOut::renderFacesToSVG(typename PFP::MAP& map, const typename PFP::TVEC3&
{
if
(
!
m
.
isMarked
(
d
)
&&
good
(
d
))
{
typename
PFP
::
VEC3
center
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
map
,
d
,
position
);
SvgPolygon
*
pol
=
new
SvgPolygon
();
Dart
dd
=
d
;
do
bool
cullFace
=
false
;
if
(
cull
)
{
Geom
::
Vec3f
P
=
position
[
d
];
P
=
P
*
shrink
+
center
*
(
1.0
f
-
shrink
);
glm
::
vec3
Q
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
m_proj
,
viewport
);
glm
::
vec3
R
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
glm
::
mat4
(
1.0
),
viewport
);
pol
->
addVertex
(
Geom
::
Vec3f
(
Q
[
0
],
float
(
viewport
[
3
])
-
Q
[
1
],
Q
[
2
]));
pol
->
addVertex3D
(
Geom
::
Vec3f
(
R
[
0
],
R
[
1
],
R
[
2
]));
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
pol
->
close
();
pol
->
setColor
(
global_color
);
pol
->
setWidth
(
global_width
);
m_objs
.
push_back
(
pol
);
const
Geom
::
Vec3f
&
P
=
position
[
d
];
glm
::
vec3
Q
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
m_proj
,
viewport
);
const
Geom
::
Vec3f
&
P2
=
position
[
map
.
phi1
(
d
)];
glm
::
vec3
R
=
glm
::
project
(
glm
::
vec3
(
P2
[
0
],
P2
[
1
],
P2
[
2
]),
m_model
,
m_proj
,
viewport
);
const
Geom
::
Vec3f
&
P3
=
position
[
map
.
phi1
(
map
.
phi1
(
d
))];
glm
::
vec3
S
=
glm
::
project
(
glm
::
vec3
(
P3
[
0
],
P3
[
1
],
P3
[
2
]),
m_model
,
m_proj
,
viewport
);
glm
::
vec3
N
=
glm
::
cross
(
S
-
R
,
Q
-
R
);
if
(
N
[
2
]
<
0.0
f
)
cullFace
=
true
;
}
if
(
!
cullFace
)
{
typename
PFP
::
VEC3
center
=
Algo
::
Geometry
::
faceCentroid
<
PFP
>
(
map
,
d
,
position
);
SvgPolygon
*
pol
=
new
SvgPolygon
();
Dart
dd
=
d
;
do
{
Geom
::
Vec3f
P
=
position
[
d
];
P
=
P
*
shrink
+
center
*
(
1.0
f
-
shrink
);
glm
::
vec3
Q
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
m_proj
,
viewport
);
glm
::
vec3
R
=
glm
::
project
(
glm
::
vec3
(
P
[
0
],
P
[
1
],
P
[
2
]),
m_model
,
glm
::
mat4
(
1.0
),
viewport
);
pol
->
addVertex
(
Geom
::
Vec3f
(
Q
[
0
],
float
(
viewport
[
3
])
-
Q
[
1
],
Q
[
2
]));
pol
->
addVertex3D
(
Geom
::
Vec3f
(
R
[
0
],
R
[
1
],
R
[
2
]));
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
pol
->
close
();
pol
->
setColor
(
global_color
);
pol
->
setWidth
(
global_width
);
m_objs
.
push_back
(
pol
);
}
m
.
markOrbit
(
FACE
,
d
);
}
}
...
...
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