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
Sauvage
CGoGN
Commits
b6872481
Commit
b6872481
authored
Nov 07, 2011
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ajout rendu bord (ALGO::RENDER::GL2::BOUNDARY)
test dans tuto1 functor SelectorEdgeNoBoundary/SelectorEdgeBoundary
parent
58858e5a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
29 deletions
+95
-29
Apps/Tuto/tuto1.cpp
Apps/Tuto/tuto1.cpp
+8
-2
include/Algo/Render/GL2/mapRender.h
include/Algo/Render/GL2/mapRender.h
+10
-1
include/Algo/Render/GL2/mapRender.hpp
include/Algo/Render/GL2/mapRender.hpp
+38
-19
include/Topology/generic/functor.h
include/Topology/generic/functor.h
+27
-3
include/Topology/generic/traversorCell.h
include/Topology/generic/traversorCell.h
+1
-1
src/Algo/Render/mapRender.cpp
src/Algo/Render/mapRender.cpp
+11
-2
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+0
-1
No files found.
Apps/Tuto/tuto1.cpp
View file @
b6872481
...
...
@@ -88,6 +88,11 @@ void MyQT::cb_redraw()
m_shader
->
setColor
(
Geom
::
Vec4f
(
1.
,
1.
,
0.
,
0.
));
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
LINES
);
m_shader
->
setColor
(
Geom
::
Vec4f
(
0.
,
1.
,
1.
,
0.
));
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
BOUNDARY
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
...
...
@@ -169,9 +174,10 @@ int main(int argc, char **argv)
// update des primitives du renderer
SelectorTrue
allDarts
;
//
SelectorNoBoundary<PFP::MAP>
allDarts(myMap);
Selector
Edge
NoBoundary
<
PFP
::
MAP
>
insideEdges
(
myMap
);
// just to draw only inside edges
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
insideEdges
,
Algo
::
Render
::
GL2
::
LINES
);
sqt
.
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
BOUNDARY
);
// special primitive for boundary edges
// show final pour premier redraw
sqt
.
show
();
...
...
include/Algo/Render/GL2/mapRender.h
View file @
b6872481
...
...
@@ -61,7 +61,8 @@ enum drawingType
POINTS
=
4
,
EXPLODED
=
8
,
FLAT_TRIANGLES
=
16
,
ERR
=
32
BOUNDARY
=
32
,
ERR
=
64
}
;
enum
bufferIndex
...
...
@@ -70,6 +71,7 @@ enum bufferIndex
LINE_INDICES
=
1
,
TRIANGLE_INDICES
=
2
,
FLAT_BUFFER
=
3
,
BOUNDARY_INDICES
=
4
,
SIZE_BUFFER
}
;
...
...
@@ -204,6 +206,11 @@ public:
template
<
typename
PFP
>
void
initPoints
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
std
::
vector
<
GLuint
>&
tableIndices
,
unsigned
int
thread
=
0
)
;
template
<
typename
PFP
>
void
initBoundaries
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
std
::
vector
<
GLuint
>&
tableIndices
,
unsigned
int
thread
=
0
)
;
/**
* initialization of the VBO indices primitives
* computed by a traversal of the map
...
...
@@ -212,6 +219,8 @@ public:
template
<
typename
PFP
>
void
initPrimitives
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
int
prim
,
bool
optimized
=
true
,
unsigned
int
thread
=
0
)
;
/**
* initialization of the VBO indices primitives
* using the given table
...
...
include/Algo/Render/GL2/mapRender.hpp
View file @
b6872481
...
...
@@ -323,18 +323,6 @@ template<typename PFP>
void
MapRender
::
initTriangles
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
std
::
vector
<
GLuint
>&
tableIndices
,
unsigned
int
thread
)
{
// DartMarker m(map, thread);
// tableIndices.reserve(4 * map.getNbDarts() / 3);
//
// for(Dart dd = map.begin(); dd != map.end(); map.next(dd))
// {
// if(!m.isMarked(dd) && good(dd))
// {
// addTri<PFP>(map, dd, tableIndices);
// m.markOrbit(FACE, dd);
// }
// }
DartMarker
m
(
map
,
thread
);
tableIndices
.
reserve
(
4
*
map
.
getNbDarts
()
/
3
);
TraversorF
<
typename
PFP
::
MAP
>
trav
(
map
);
...
...
@@ -361,7 +349,7 @@ void MapRender::initTrianglesOptimized(typename PFP::MAP& map, const FunctorSele
{
std
::
list
<
Dart
>
bound
;
if
(
good
(
dd
))
if
(
good
(
dd
)
&&
!
map
.
isBoundaryMarked
(
dd
)
)
addTri
<
PFP
>
(
map
,
dd
,
tableIndices
);
m
.
markOrbit
(
FACE
,
dd
);
bound
.
push_back
(
dd
);
...
...
@@ -377,7 +365,7 @@ void MapRender::initTrianglesOptimized(typename PFP::MAP& map, const FunctorSele
{
if
(
!
m
.
isMarked
(
f
))
{
if
(
good
(
f
))
if
(
good
(
f
)
&&
!
map
.
isBoundaryMarked
(
dd
)
)
addTri
<
PFP
>
(
map
,
f
,
tableIndices
);
m
.
markOrbit
(
FACE
,
f
);
bound
.
push_back
(
map
.
phi1
(
f
));
...
...
@@ -404,16 +392,42 @@ void MapRender::initTrianglesOptimized(typename PFP::MAP& map, const FunctorSele
template
<
typename
PFP
>
void
MapRender
::
initLines
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
std
::
vector
<
GLuint
>&
tableIndices
,
unsigned
int
thread
)
{
DartMarker
m
(
map
,
thread
);
//
DartMarker m(map, thread);
tableIndices
.
reserve
(
map
.
getNbDarts
());
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(!m.isMarked(d) && good(d))
// {
// tableIndices.push_back(map.getEmbedding(VERTEX, d));
// tableIndices.push_back(map.getEmbedding(VERTEX, map.phi1(d)));
// m.markOrbit(EDGE, d);
// }
// }
TraversorE
<
typename
PFP
::
MAP
>
trav
(
map
);
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
!
m
.
isMarked
(
d
)
&&
good
(
d
))
if
(
good
(
d
)
&&
map
.
isBoundaryEdge
(
d
))
{
tableIndices
.
push_back
(
map
.
getEmbedding
(
VERTEX
,
d
));
tableIndices
.
push_back
(
map
.
getEmbedding
(
VERTEX
,
map
.
phi1
(
d
)));
}
}
}
template
<
typename
PFP
>
void
MapRender
::
initBoundaries
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
std
::
vector
<
GLuint
>&
tableIndices
,
unsigned
int
thread
)
{
TraversorE
<
typename
PFP
::
MAP
>
trav
(
map
);
tableIndices
.
reserve
(
map
.
getNbDarts
());
//TODO optimisation ?
for
(
Dart
d
=
trav
.
begin
();
d
!=
trav
.
end
();
d
=
trav
.
next
())
{
if
(
good
(
d
)
&&
map
.
isBoundaryEdge
(
d
))
{
tableIndices
.
push_back
(
map
.
getEmbedding
(
VERTEX
,
d
));
tableIndices
.
push_back
(
map
.
getEmbedding
(
VERTEX
,
map
.
phi2
(
d
)));
m
.
markOrbit
(
EDGE
,
d
);
tableIndices
.
push_back
(
map
.
getEmbedding
(
VERTEX
,
map
.
phi1
(
d
)));
}
}
}
...
...
@@ -518,6 +532,11 @@ void MapRender::initPrimitives(typename PFP::MAP& map, const FunctorSelect& good
break
;
case
FLAT_TRIANGLES
:
break
;
case
BOUNDARY
:
initBoundaries
<
PFP
>
(
map
,
good
,
tableIndices
,
thread
)
;
m_nbIndices
[
BOUNDARY_INDICES
]
=
tableIndices
.
size
();
vbo_ind
=
m_indexBuffers
[
BOUNDARY_INDICES
];
break
;
default:
CGoGNerr
<<
"problem initializing VBO indices"
<<
CGoGNendl
;
break
;
...
...
include/Topology/generic/functor.h
View file @
b6872481
...
...
@@ -77,17 +77,41 @@ public:
};
//template <typename MAP>
//class SelectorNoBoundary : public FunctorSelect
//{
//public:
//protected:
// MAP& m_map;
//public:
// SelectorNoBoundary(MAP& m): m_map(m) {}
// bool operator()(Dart d) const { return !m_map.isBoundaryMarked(d); }
//};
template
<
typename
MAP
>
class
Selector
No
Boundary
:
public
FunctorSelect
class
Selector
Edge
Boundary
:
public
FunctorSelect
{
public:
protected:
MAP
&
m_map
;
public:
Selector
No
Boundary
(
MAP
&
m
)
:
m_map
(
m
)
{}
bool
operator
()(
Dart
d
)
const
{
return
!
m_map
.
isBoundary
Marked
(
d
);
}
Selector
Edge
Boundary
(
MAP
&
m
)
:
m_map
(
m
)
{}
bool
operator
()(
Dart
d
)
const
{
return
m_map
.
isBoundary
Edge
(
d
);
}
};
template
<
typename
MAP
>
class
SelectorEdgeNoBoundary
:
public
FunctorSelect
{
public:
protected:
MAP
&
m_map
;
public:
SelectorEdgeNoBoundary
(
MAP
&
m
)
:
m_map
(
m
)
{}
bool
operator
()(
Dart
d
)
const
{
return
!
m_map
.
isBoundaryEdge
(
d
);
}
};
// Counting Functors : increment its value every time it is applied
/********************************************************/
...
...
include/Topology/generic/traversorCell.h
View file @
b6872481
...
...
@@ -45,7 +45,7 @@ public:
Dart
begin
()
{
mark
.
unmarkAll
()
;
mark
.
unmarkAll
()
;
// TODO ajouter test pour ne pas toujours faire le unmark !!
current
=
m
.
begin
()
;
while
(
m
.
isBoundaryMarked
(
current
))
m
.
next
(
current
)
;
...
...
src/Algo/Render/mapRender.cpp
View file @
b6872481
...
...
@@ -40,8 +40,8 @@ namespace GL2
MapRender
::
MapRender
()
{
glGenBuffersARB
(
4
,
m_indexBuffers
)
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
++
i
)
glGenBuffersARB
(
SIZE_BUFFER
,
m_indexBuffers
)
;
for
(
unsigned
int
i
=
0
;
i
<
SIZE_BUFFER
;
++
i
)
m_nbIndices
[
i
]
=
0
;
}
...
...
@@ -68,6 +68,10 @@ void MapRender::initPrimitives(int prim, std::vector<GLuint>& tableIndices)
m_nbIndices
[
TRIANGLE_INDICES
]
=
tableIndices
.
size
();
vbo_ind
=
m_indexBuffers
[
TRIANGLE_INDICES
];
break
;
case
BOUNDARY
:
m_nbIndices
[
BOUNDARY_INDICES
]
=
tableIndices
.
size
();
vbo_ind
=
m_indexBuffers
[
BOUNDARY_INDICES
];
break
;
default:
CGoGNerr
<<
"problem initializing VBO indices"
<<
CGoGNendl
;
break
;
...
...
@@ -97,6 +101,11 @@ void MapRender::draw(Utils::GLSLShader* sh, int prim)
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
m_indexBuffers
[
TRIANGLE_INDICES
]);
glDrawElements
(
GL_TRIANGLES
,
m_nbIndices
[
TRIANGLE_INDICES
],
GL_UNSIGNED_INT
,
0
);
break
;
case
BOUNDARY
:
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
m_indexBuffers
[
BOUNDARY_INDICES
]);
glDrawElements
(
GL_LINES
,
m_nbIndices
[
BOUNDARY_INDICES
],
GL_UNSIGNED_INT
,
0
);
break
;
default:
break
;
}
...
...
src/Topology/map/map2.cpp
View file @
b6872481
...
...
@@ -120,7 +120,6 @@ void Map2::deleteOrientedFace(Dart d)
Dart
Map2
::
newFace
(
unsigned
int
nbEdges
)
{
std
::
cout
<<
"OUCHHH"
<<
std
::
endl
;
Dart
d
=
Map1
::
newFace
(
nbEdges
);
Dart
e
=
Map1
::
newBoundaryFace
(
nbEdges
);
...
...
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