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
Sauvage
CGoGN
Commits
c3df6df0
Commit
c3df6df0
authored
Feb 18, 2013
by
untereiner
Browse files
Merge cgogn:~thery/CGoGN
parents
44d02608
432667ae
Changes
11
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/mcmesh.cpp
View file @
c3df6df0
...
...
@@ -154,7 +154,7 @@ void MCMesh::MC()
void
MCMesh
::
updateRender
()
{
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
//
SelectorDartNoBoundary<PFP::MAP> nb(myMap);
//TODO add Browser for no border
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
...
...
Apps/Tuto/show_traversors.cpp
View file @
c3df6df0
...
...
@@ -118,7 +118,6 @@ void MyQT::cb_initGL()
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
m_dm_topo
=
new
DartMarker
(
myMap
);
}
...
...
@@ -145,7 +144,6 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if
(
Shift
())
{
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
if
(
d
!=
Dart
::
nil
())
{
...
...
@@ -199,7 +197,6 @@ void MyQT::traverse2()
return
;
m_last
=
2
;
// int code = (m_ajd_or_inci2)*100+m_first2*10+m_second2;
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_drawer
.
newList
(
GL_COMPILE
);
m_drawer
.
lineWidth
(
7.0
f
);
...
...
@@ -266,8 +263,6 @@ void MyQT::traverse3()
m_last
=
3
;
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_affDarts
.
clear
();
m_drawer
.
newList
(
GL_COMPILE
);
...
...
Apps/Tuto/tuto1.cpp
View file @
c3df6df0
...
...
@@ -77,7 +77,8 @@ void MyQT::createMap()
show
();
// render the topo of the map without boundary darts
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
true
);
m_render_topo
->
setInitialBoundaryDartsColor
(
0
,
1
,
0
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
true
);
}
// initialization GL callback
...
...
Apps/Tuto/tuto_oper2.cpp
View file @
c3df6df0
...
...
@@ -191,9 +191,10 @@ void MyQT::createMap(int n)
dm
.
markAll
();
m_render_topo
->
setDartWidth
(
5
.0
f
);
m_render_topo
->
setDartWidth
(
4
.0
f
);
m_render_topo
->
setInitialDartsColor
(
0.0
f
,
0.0
f
,
0.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
);
// nb
m_render_topo
->
setInitialBoundaryDartsColor
(
0.0
f
,
0.0
f
,
0.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
true
);
// nb
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
...
...
@@ -211,7 +212,8 @@ void MyQT::createMap(int n)
void
MyQT
::
updateMap
()
{
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
);
// nb
m_render_topo
->
setInitialBoundaryDartsColor
(
0.0
f
,
0.0
f
,
0.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
true
);
// nb
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
dm
.
isMarked
(
d
)
&&
(
!
myMap
.
isBoundaryMarked2
(
d
)))
...
...
@@ -227,7 +229,7 @@ void MyQT::updateMap()
void
MyQT
::
cb_initGL
()
{
glClearColor
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
(
0.01
f
)
;
}
// redraw GL callback (clear and swap already done)
...
...
Apps/Tuto/tuto_oper2.h
View file @
c3df6df0
...
...
@@ -69,7 +69,7 @@ class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
public:
MyQT
()
:
nb
(
myMap
),
m_render_topo
(
NULL
),
m_selected
(
NIL
),
m_selected2
(
NIL
),
dm
(
myMap
),
m_shift
(
0.01
f
)
{}
MyQT
()
:
m_render_topo
(
NULL
),
m_selected
(
NIL
),
m_selected2
(
NIL
),
dm
(
myMap
),
m_shift
(
0.01
f
)
{}
void
cb_redraw
();
void
cb_initGL
();
...
...
@@ -87,8 +87,6 @@ protected:
VertexAttribute
<
VEC3
>
position
;
DartAttribute
<
VEC3
>
colorDarts
;
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
;
// render (for the topo)
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo
;
Dart
m_selected
;
...
...
Apps/Tuto/tuto_orbits.cpp
View file @
c3df6df0
...
...
@@ -142,8 +142,7 @@ void MyQT::cb_initGL()
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.8
f
,
0.8
f
/*, nb*/
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.8
f
,
0.8
f
);
m_strings
=
new
Utils
::
Strings3D
(
true
,
Geom
::
Vec3f
(
0.1
f
,
0.0
f
,
0.3
f
));
registerShader
(
m_strings
);
...
...
@@ -167,8 +166,7 @@ void MyQT::cb_mousePress(int button, int x, int y)
{
if
(
Shift
())
{
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_clicked
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
/*, nb*/
);
m_clicked
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
if
(
m_clicked
!=
Dart
::
nil
())
{
unsigned
int
orbs
[
9
]
=
{
VERTEX
,
EDGE
,
FACE
,
VOLUME
,
PFP
::
MAP
::
VERTEX_OF_PARENT
,
PFP
::
MAP
::
EDGE_OF_PARENT
,
PFP
::
MAP
::
FACE_OF_PARENT
,
PFP
::
MAP
::
VERTEX_OF_PARENT2
,
PFP
::
MAP
::
EDGE_OF_PARENT2
};
...
...
include/Algo/Render/GL2/topo3Render.hpp
View file @
c3df6df0
...
...
@@ -75,6 +75,7 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const VertexAttribute<
m_nbDarts
=
0
;
for
(
Dart
d
=
mapx
.
begin
();
d
!=
mapx
.
end
();
mapx
.
next
(
d
))
{
if
(
!
mapx
.
isBoundaryMarked3
(
d
))
// in the following code Traversor do not traverse boundary
m_nbDarts
++
;
}
...
...
@@ -237,25 +238,27 @@ void Topo3Render::setDartsIdColor(typename PFP::MAP& map)
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
nb
<
m_nbDarts
)
if
(
!
map
.
isBoundaryMarked3
(
d
))
// topo3 Render do not traverse boundary
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
}
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
...
...
@@ -270,15 +273,18 @@ void Topo3Render::updateColors(typename PFP::MAP& map, const VertexAttribute<typ
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
nb
<
m_nbDarts
)
if
(
!
map
.
isBoundaryMarked3
(
d
))
// topo3 Render do not traverse boundary
{
colorBuffer
[
m_attIndex
[
d
]]
=
colors
[
d
];
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
if
(
nb
<
m_nbDarts
)
{
colorBuffer
[
m_attIndex
[
d
]]
=
colors
[
d
];
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the selector parameter ?)"
<<
CGoGNendl
;
break
;
}
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
...
...
@@ -313,6 +319,7 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const VertexAttribute
m_nbDarts
=
0
;
for
(
Dart
d
=
mapx
.
begin
();
d
!=
mapx
.
end
();
mapx
.
next
(
d
))
{
if
(
!
map
.
isBoundaryMarked3
(
d
))
// in the following code Traversor do not traverse boundary
m_nbDarts
++
;
}
...
...
include/Algo/Render/GL2/topoRender.h
View file @
c3df6df0
...
...
@@ -94,11 +94,21 @@ protected:
*/
float
m_topo_relation_width
;
/// shifting along normals for 3-map boundary drawing
float
m_normalShift
;
float
m_boundShift
;
/**
* initial darts color (set in update)
*/
Geom
::
Vec3f
m_dartsColor
;
/**
* initial darts color (set in update)
*/
Geom
::
Vec3f
m_dartsBoundaryColor
;
float
*
m_color_save
;
/**
...
...
@@ -130,7 +140,7 @@ protected:
* affect a color to each dart
*/
template
<
typename
PFP
>
void
setDartsIdColor
(
typename
PFP
::
MAP
&
map
);
void
setDartsIdColor
(
typename
PFP
::
MAP
&
map
,
bool
withBoundary
);
/**
* save colors before picking
...
...
@@ -146,8 +156,7 @@ public:
/**
* Constructor
*/
TopoRender
();
TopoRender
(
float
bs
=
0.01
f
);
/**
* Destructor
...
...
@@ -185,6 +194,7 @@ public:
* draw all topo
*/
void
drawTopo
();
/**
* change dart drawing color
* @param d the dart
...
...
@@ -205,6 +215,8 @@ public:
void
setInitialDartsColor
(
float
r
,
float
g
,
float
b
);
void
setInitialBoundaryDartsColor
(
float
r
,
float
g
,
float
b
);
/**
* redraw one dart with specific width and color (not efficient use only for debug with small amount of call)
* @param d the dart
...
...
@@ -225,7 +237,7 @@ public:
* @return the dart or NIL
*/
template
<
typename
PFP
>
Dart
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
);
Dart
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
,
bool
withBoundary
=
false
);
template
<
typename
PFP
>
...
...
@@ -245,6 +257,13 @@ public:
template
<
typename
PFP
>
void
updateDataGMap
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
ke
,
float
kf
,
bool
withBoundary
=
false
);
/**
* Special update function used to draw boundary of map3
*/
template
<
typename
PFP
>
void
updateDataBoundary
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
ke
,
float
kf
,
float
ns
);
/**
* render to svg struct
*/
...
...
@@ -254,6 +273,18 @@ public:
* render svg into svg file
*/
void
svgout2D
(
const
std
::
string
&
filename
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
/**
* @brief set normal shift for boundary of dim 3 drawing
* @param ns distance shift along normals (use BB.diagSize()/100 is good approximation)
*/
void
setNormalShift
(
float
ns
);
/**
* @brief set boundary shift for boundary of dim 2 drawing
* @param ns distance shift
*/
void
setBoundaryShift
(
float
bs
);
};
// just for compatibility with old code
...
...
include/Algo/Render/GL2/topoRender.hpp
View file @
c3df6df0
...
...
@@ -30,9 +30,12 @@
#include
"Topology/map/embeddedMap2.h"
#include
"Topology/gmap/embeddedGMap2.h"
#include
"Algo/Geometry/basic.h"
#include
"Geometry/distances.h"
#include
"Algo/Geometry/centroid.h"
#include
"Algo/Geometry/normal.h"
#include
"Topology/generic/mapBrowser.h"
namespace
CGoGN
{
...
...
@@ -46,6 +49,22 @@ namespace Render
namespace
GL2
{
template
<
typename
PFP
>
void
TopoRender
::
updateDataBoundary
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
ke
,
float
kf
,
float
ns
)
{
m_normalShift
=
ns
;
SelectorDartBoundary
<
typename
PFP
::
MAP
>
sdb
(
map
);
MapBrowserSelector
mbs
(
map
,
sdb
);
map
.
setBrowser
(
&
mbs
);
updateData
<
PFP
>
(
map
,
positions
,
ke
,
kf
,
true
);
map
.
setBrowser
(
NULL
);
m_normalShift
=
0.0
f
;
}
template
<
typename
PFP
>
void
TopoRender
::
updateData
(
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
positions
,
float
ke
,
float
kf
,
bool
withBoundary
)
{
...
...
@@ -83,6 +102,7 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute<ty
{
if
(
withBoundary
||
!
map
.
isBoundaryMarked2
(
d
))
vecDarts
.
push_back
(
d
);
}
m_nbDarts
=
vecDarts
.
size
();
...
...
@@ -120,41 +140,96 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute<ty
if
(
!
mf
.
isMarked
(
d
))
{
vecPos
.
clear
();
VEC3
center
=
Algo
::
Surface
::
Geometry
::
faceCentroidELW
<
PFP
>
(
mapx
,
d
,
positions
);
float
k
=
1.0
f
-
kf
;
Dart
dd
=
d
;
do
if
(
!
map
.
isBoundaryMarked2
(
d
))
{
vecPos
.
push_back
(
center
*
k
+
positions
[
dd
]
*
kf
);
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
unsigned
int
nb
=
vecPos
.
size
();
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
k
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
VEC3
center
=
Algo
::
Surface
::
Geometry
::
faceCentroidELW
<
PFP
>
(
mapx
,
d
,
positions
);
float
k
=
1.0
f
-
kf
;
Dart
dd
=
d
;
do
{
vecPos
.
push_back
(
center
*
k
+
positions
[
dd
]
*
kf
);
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
if
(
m_normalShift
>
0.0
f
)
{
VEC3
normal
=
Algo
::
Surface
::
Geometry
::
newellNormal
<
PFP
>
(
mapx
,
d
,
positions
);
for
(
typename
std
::
vector
<
VEC3
>::
iterator
pit
=
vecPos
.
begin
();
pit
!=
vecPos
.
end
();
++
pit
)
{
*
pit
-=
normal
*
m_normalShift
;
}
}
unsigned
int
nb
=
vecPos
.
size
();
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
k
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
k
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
k
;
m_attIndex
[
d
]
=
indexDC
;
indexDC
+=
2
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
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
;
d
=
map
.
phi1
(
d
);
}
mf
.
markOrbit
<
FACE
>
(
d
);
}
else
if
(
withBoundary
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
k
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
k
;
m_attIndex
[
d
]
=
indexDC
;
indexDC
+=
2
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
m_dartsColor
;
*
colorDartBuf
++
=
m_dartsColor
;
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
;
d
=
map
.
phi1
(
d
);
Dart
dd
=
d
;
do
{
Dart
ee
=
mapx
.
phi2
(
dd
);
VEC3
normal
=
Algo
::
Surface
::
Geometry
::
newellNormal
<
PFP
>
(
mapx
,
ee
,
positions
);
VEC3
vd
=
Algo
::
Surface
::
Geometry
::
vectorOutOfDart
<
PFP
>
(
mapx
,
ee
,
positions
);
VEC3
v
=
vd
^
normal
;
v
.
normalize
();
VEC3
P
=
positions
[
map
.
phi1
(
ee
)]
+
v
*
m_boundShift
;
vecPos
.
push_back
(
P
);
dd
=
map
.
phi1
(
dd
);
ee
=
mapx
.
phi2
(
dd
);
P
=
positions
[
map
.
phi1
(
ee
)]
+
v
*
m_boundShift
;
vecPos
.
push_back
(
P
);
}
while
(
dd
!=
d
);
unsigned
int
nb
=
vecPos
.
size
()
/
2
;
float
k
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
2
*
i
]
*
ke
+
vecPos
[
2
*
i
+
1
]
*
k
;
VEC3
Q
=
vecPos
[
2
*
i
+
1
]
*
ke
+
vecPos
[
2
*
i
]
*
k
;
m_attIndex
[
d
]
=
indexDC
;
indexDC
+=
2
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
m_dartsBoundaryColor
;
*
colorDartBuf
++
=
m_dartsBoundaryColor
;
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
;
d
=
map
.
phi1
(
d
);
}
mf
.
markOrbit
<
FACE
>
(
d
);
}
mf
.
markOrbit
<
FACE
>
(
d
);
}
}
...
...
@@ -184,7 +259,7 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute<ty
Dart
e
=
map
.
phi2
(
d
);
// if (good(e) && (e.index > d.index))
if
(
(
withBoundary
||
!
map
.
isBoundaryMarked2
(
e
))
&&
(
d
<
e
))
if
(
(
withBoundary
||
!
map
.
isBoundaryMarked2
(
e
))
&&
(
e
.
index
>
d
.
index
))
{
*
positionF2
++
=
fv2
[
d
];
*
positionF2
++
=
fv2
[
e
];
...
...
@@ -269,9 +344,19 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const VertexAttribute<t
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
if
(
m_normalShift
>
0.0
f
)
{
VEC3
normal
=
Algo
::
Surface
::
Geometry
::
newellNormal
<
PFP
>
(
mapx
,
d
,
positions
);
for
(
typename
std
::
vector
<
VEC3
>::
iterator
pit
=
vecPos
.
begin
();
pit
!=
vecPos
.
end
();
++
pit
)
{
*
pit
-=
normal
*
m_normalShift
;
}
}
unsigned
int
nb
=
vecPos
.
size
();
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
k
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
...
...
@@ -355,7 +440,7 @@ void TopoRender::updateDataGMap(typename PFP::MAP& mapx, const VertexAttribute<t
}
template
<
typename
PFP
>
void
TopoRender
::
setDartsIdColor
(
typename
PFP
::
MAP
&
map
)
void
TopoRender
::
setDartsIdColor
(
typename
PFP
::
MAP
&
map
,
bool
withBoundary
)
{
m_vbo3
->
bind
();
float
*
colorBuffer
=
reinterpret_cast
<
float
*>
(
glMapBuffer
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
));
...
...
@@ -370,33 +455,38 @@ void TopoRender::setDartsIdColor(typename PFP::MAP& map)
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
nb
++
;
}
else
if
(
withBoundary
||
!
map
.
isBoundaryMarked2
(
d
))
{
CGoGNerr
<<
"Error buffer too small for color picking (change the good parameter ?)"
<<
CGoGNendl
;
break
;
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
*
local
++
=
r
;
*
local
++
=
g
;
*
local
++
=
b
;
nb
++
;
}
else
{
CGoGNerr
<<
"Error buffer too small for color picking (change the good parameter ?)"
<<
CGoGNendl
;
CGoGNerr
<<
"NB = "
<<
nb
<<
" NBDARTs = "
<<
m_nbDarts
<<
CGoGNendl
;
break
;
}
}
}
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
}
template
<
typename
PFP
>
Dart
TopoRender
::
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
)
Dart
TopoRender
::
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
,
bool
withBoundary
)
{
pushColors
();
setDartsIdColor
<
PFP
>
(
map
);
setDartsIdColor
<
PFP
>
(
map
,
withBoundary
);
Dart
d
=
pickColor
(
x
,
y
);
popColors
();
return
d
;
...
...
include/Topology/generic/mapBrowser.hpp
View file @
c3df6df0
...
...
@@ -32,7 +32,11 @@ inline MapBrowserSelector::MapBrowserSelector(AttribMap& m, const FunctorSelect&
inline
Dart
MapBrowserSelector
::
begin
()
const
{
return
m_map
.
realBegin
()
;
Dart
d
=
m_map
.
realBegin
()
;
while
(
(
d
!=
m_map
.
realEnd
())
&&
!
m_selector
(
d
)
)
m_map
.
realNext
(
d
);
return
d
;
}
inline
Dart
MapBrowserSelector
::
end
()
const
...
...
src/Algo/Render/topoRender.cpp
View file @
c3df6df0
...
...
@@ -38,12 +38,15 @@ namespace Render
namespace
GL2
{
TopoRender
::
TopoRender
()
:
TopoRender
::
TopoRender
(
float
bs
)
:
m_nbDarts
(
0
),
m_nbRel2
(
0
),
m_topo_dart_width
(
2.0
f
),
m_topo_relation_width
(
3.0
f
),
m_normalShift
(
0.0
f
),
m_boundShift
(
bs
),
m_dartsColor
(
1.0
f
,
1.0
f
,
1.0
f
),
m_dartsBoundaryColor
(
0.7
f
,
1.0
f
,
0.7
f
),
m_bufferDartPosition
(
NULL
)
{
m_vbo0
=
new
Utils
::
VBO
();
...