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
CGoGN
CGoGN
Commits
b6f05612
Commit
b6f05612
authored
Jan 25, 2012
by
Sylvain Thery
Browse files
update toporender for right exploding
add middle dart position computing
parent
703b9d14
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/Algo/Render/GL2/topo3Render.h
View file @
b6f05612
...
...
@@ -39,6 +39,7 @@
// forward
namespace
CGoGN
{
namespace
Utils
{
class
ShaderSimpleColor
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ShaderColorPerVertex
;
}
}
namespace
CGoGN
{
namespace
Utils
{
class
ClippingShader
;
}
}
namespace
CGoGN
{
...
...
@@ -106,31 +107,6 @@ protected:
AttributeHandler
<
unsigned
int
>
m_attIndex
;
/**
* update all drawing buffers
* @param map the map
* @param good selector
* @param positions attribute of position vertices
* @param ke exploding coef for edge
* @param kf exploding coef for face
* @param kv exploding coef for volume
*/
template
<
typename
PFP
>
void
updateMapD3
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
);
/**
* update all drawing buffers
* @param map the map
* @param good selector
* @param positions attribute of position vertices
* @param ke exploding coef for edge
* @param kf exploding coef for face
* @param kv exploding coef for volume
*/
template
<
typename
PFP
>
void
updateGMap3
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
);
/**
* save colors
...
...
@@ -153,10 +129,6 @@ protected:
public:
Dart
colToDart
(
float
*
color
);
void
dartToCol
(
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
/**
* Constructor
* @param map the map to draw
...
...
@@ -170,6 +142,10 @@ public:
*/
~
Topo3Render
();
Utils
::
ClippingShader
*
shader1
()
{
return
reinterpret_cast
<
Utils
::
ClippingShader
*>
(
m_shader1
);}
Utils
::
ClippingShader
*
shader2
()
{
return
reinterpret_cast
<
Utils
::
ClippingShader
*>
(
m_shader2
);}
/**
* set the with of line use to draw darts (default val is 2)
* @param dw width
...
...
@@ -258,6 +234,16 @@ public:
template
<
typename
PFP
>
Dart
picking
(
typename
PFP
::
MAP
&
map
,
int
x
,
int
y
,
const
FunctorSelect
&
good
=
allDarts
);
Dart
colToDart
(
float
*
color
);
template
<
typename
PFP
>
void
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
);
/**
* update all drawing buffers to render a dual map
* @param map the map
...
...
@@ -270,6 +256,16 @@ public:
template
<
typename
PFP
>
void
updateData
(
typename
PFP
::
MAP
&
map
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
=
allDarts
);
/**
* Get back middle position of drawed darts
* @param map the map
* @param posExpl the output positions
* @param good the selector
*/
template
<
typename
PFP
>
void
computeDartMiddlePositions
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
posExpl
,
const
FunctorSelect
&
good
=
allDarts
);
protected:
/**
* update all drawing buffers to render a dual map
...
...
include/Algo/Render/GL2/topo3Render.hpp
View file @
b6f05612
...
...
@@ -30,6 +30,10 @@
#include
"Topology/map/map3.h"
#include
"Topology/gmap/gmap3.h"
#include
"Topology/generic/traversorCell.h"
#include
"Algo/Geometry/centroid.h"
#include
<sys/time.h>
namespace
CGoGN
{
...
...
@@ -61,6 +65,9 @@ void Topo3Render::updateData(typename PFP::MAP& map, const typename PFP::TVEC3&
template
<
typename
PFP
>
void
Topo3Render
::
updateDataMap3
(
typename
PFP
::
MAP
&
mapx
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
Map3
&
map
=
reinterpret_cast
<
Map3
&>
(
mapx
);
typedef
typename
PFP
::
VEC3
VEC3
;
...
...
@@ -75,61 +82,20 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
}
m_nbDarts
=
0
;
// table of center of volume
std
::
vector
<
VEC3
>
vecCenters
;
vecCenters
.
reserve
(
1000
);
// table of nbfaces per volume
std
::
vector
<
unsigned
int
>
vecNbFaces
;
vecNbFaces
.
reserve
(
1000
);
// table of face (one dart of each)
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
unsigned
int
posDBI
=
0
;
DartMarker
mark
(
map
);
// marker for darts
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
good
(
d
))
{
CellMarkerStore
markVert
(
map
,
VERTEX
);
//marker for vertices
VEC3
center
(
0
,
0
,
0
);
unsigned
int
nbv
=
0
;
unsigned
int
nbf
=
0
;
std
::
list
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
push_back
(
d
);
// Start with the face of d
// For every face added to the list
for
(
std
::
list
<
Dart
>::
iterator
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
{
if
(
!
mark
.
isMarked
(
*
face
))
// Face has not been visited yet
{
// store a dart of face
vecDartFaces
.
push_back
(
*
face
);
nbf
++
;
Dart
dNext
=
*
face
;
do
{
if
(
!
markVert
.
isMarked
(
dNext
))
{
markVert
.
mark
(
dNext
);
center
+=
positions
[
dNext
];
nbv
++
;
}
mark
.
mark
(
dNext
);
// Mark
m_nbDarts
++
;
Dart
adj
=
map
.
phi2
(
dNext
);
// Get adjacent face
if
(
adj
!=
dNext
&&
!
mark
.
isMarked
(
adj
))
visitedFaces
.
push_back
(
adj
);
// Add it
dNext
=
map
.
phi1
(
dNext
);
}
while
(
dNext
!=
*
face
);
}
}
center
/=
typename
PFP
::
REAL
(
nbv
);
vecCenters
.
push_back
(
center
);
vecNbFaces
.
push_back
(
nbf
);
}
m_nbDarts
++
;
}
// compute center of each volumes
CellMarker
cmv
(
map
,
VOLUME
);
AutoAttributeHandler
<
VEC3
>
centerVolumes
(
map
,
VOLUME
,
"centerVolumes"
);
TraversorW
<
Map3
>
traVol
(
map
,
good
);
for
(
Dart
d
=
traVol
.
begin
();
d
!=
traVol
.
end
();
d
=
traVol
.
next
())
{
centerVolumes
[
d
]
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
mapx
,
d
,
positions
);
}
// debut phi1
...
...
@@ -152,70 +118,77 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
VEC3
*
positionDartBuf
=
reinterpret_cast
<
VEC3
*>
(
PositionDartsBuffer
);
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
unsigned
int
posDBI
=
0
;
std
::
vector
<
Dart
>::
iterator
face
=
vecDartFaces
.
begin
();
for
(
unsigned
int
iVol
=
0
;
iVol
<
vecNbFaces
.
size
();
++
iVol
)
// traverse each face of each volume
TraversorCell
<
Map3
>
traFace
(
map
,
PFP
::
MAP
::
ORBIT_IN_PARENT
(
FACE
),
good
);
for
(
Dart
d
=
traFace
.
begin
();
d
!=
traFace
.
end
();
d
=
traFace
.
next
())
{
for
(
unsigned
int
iFace
=
0
;
iFace
<
vecNbFaces
[
iVol
];
++
iFace
)
vecDartFaces
.
push_back
(
d
);
std
::
vector
<
VEC3
>
vecPos
;
vecPos
.
reserve
(
16
);
// store the face & center
float
okv
=
1.0
f
-
kv
;
VEC3
vc
=
centerVolumes
[
d
];
VEC3
centerFace
(
0
,
0
,
0
);
Dart
dd
=
d
;
do
{
Dart
d
=
*
face
++
;
VEC3
P
=
positions
[
dd
];
P
=
vc
*
okv
+
P
*
kv
;
vecPos
.
push_back
(
P
);
centerFace
+=
P
;
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
centerFace
/=
REAL
(
vecPos
.
size
());
std
::
vector
<
VEC3
>
vecPos
;
vecPos
.
reserve
(
16
);
//shrink the face
unsigned
int
nb
=
vecPos
.
size
(
);
// store the face & center
VEC3
center
(
0
,
0
,
0
);
Dart
dd
=
d
;
do
{
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
P
);
center
+=
P
;
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
center
/=
REAL
(
vecPos
.
size
());
//shrink the face
unsigned
int
nb
=
vecPos
.
size
();
float
okf
=
1.0
f
-
kf
;
float
okv
=
1.0
f
-
kv
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
vecPos
[
i
]
=
vecCenters
[
iVol
]
*
okv
+
vecPos
[
i
]
*
kv
;
vecPos
[
i
]
=
center
*
okf
+
vecPos
[
i
]
*
kf
;
}
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
float
okf
=
1.0
f
-
kf
;
// compute position of points to use for drawing topo
float
oke
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
oke
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
oke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
vecPos
[
i
]
=
centerFace
*
okf
+
vecPos
[
i
]
*
kf
;
}
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
// compute position of points to use for drawing topo
float
oke
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
oke
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
oke
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.0
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.0
);
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
fv1
[
d
]
=
P
*
0.1
f
+
Q
*
0.9
f
;
fv11
[
d
]
=
P
*
0.9
f
+
Q
*
0.1
f
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
Q
;
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.0
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.0
);
fv
2
[
d
]
=
P
*
0.
52
f
+
Q
*
0.
48
f
;
fv
2x
[
d
]
=
P
*
0.
48
f
+
Q
*
0.
52
f
;
fv
1
[
d
]
=
P
*
0.
1
f
+
Q
*
0.
9
f
;
fv
11
[
d
]
=
P
*
0.
9
f
+
Q
*
0.
1
f
;
d
=
map
.
phi1
(
d
)
;
}
fv2
[
d
]
=
P
*
0.52
f
+
Q
*
0.48
f
;
fv2x
[
d
]
=
P
*
0.48
f
+
Q
*
0.52
f
;
d
=
map
.
phi1
(
d
);
}
}
m_vbo0
->
bind
();
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
m_vbo4
->
bind
();
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
// phi1
m_vbo1
->
bind
();
glBufferData
(
GL_ARRAY_BUFFER
,
2
*
m_nbDarts
*
sizeof
(
typename
PFP
::
VEC3
),
0
,
GL_STREAM_DRAW
);
...
...
@@ -282,6 +255,20 @@ void Topo3Render::updateDataMap3(typename PFP::MAP& mapx, const typename PFP::TV
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
}
template
<
typename
PFP
>
void
Topo3Render
::
dartToCol
(
typename
PFP
::
MAP
&
map
,
Dart
d
,
float
&
r
,
float
&
g
,
float
&
b
)
{
unsigned
int
lab
=
d
.
index
+
1
;
// add one to avoid picking the black of screen
r
=
float
(
lab
%
255
)
/
255.0
f
;
lab
=
lab
/
255
;
g
=
float
(
lab
%
255
)
/
255.0
f
;
lab
=
lab
/
255
;
b
=
float
(
lab
%
255
)
/
255.0
f
;
lab
=
lab
/
255
;
if
(
lab
!=
0
)
CGoGNerr
<<
"Error picking color, too many darts"
<<
CGoGNendl
;
}
template
<
typename
PFP
>
void
Topo3Render
::
setDartsIdColor
(
typename
PFP
::
MAP
&
map
,
const
FunctorSelect
&
good
)
{
...
...
@@ -296,7 +283,7 @@ void Topo3Render::setDartsIdColor(typename PFP::MAP& map, const FunctorSelect& g
if
(
nb
<
m_nbDarts
)
{
float
r
,
g
,
b
;
dartToCol
(
d
,
r
,
g
,
b
);
dartToCol
<
PFP
>
(
map
,
d
,
r
,
g
,
b
);
float
*
local
=
colorBuffer
+
3
*
m_attIndex
[
d
];
// get the right position in VBO
*
local
++
=
r
;
...
...
@@ -330,9 +317,14 @@ Dart Topo3Render::picking(typename PFP::MAP& map, int x, int y, const FunctorSel
return
d
;
}
template
<
typename
PFP
>
void
Topo3Render
::
updateDataGMap3
(
typename
PFP
::
MAP
&
mapx
,
const
typename
PFP
::
TVEC3
&
positions
,
float
ke
,
float
kf
,
float
kv
,
const
FunctorSelect
&
good
)
{
typedef
typename
PFP
::
VEC3
VEC3
;
typedef
typename
PFP
::
REAL
REAL
;
GMap3
&
map
=
reinterpret_cast
<
GMap3
&>
(
mapx
);
typedef
typename
PFP
::
VEC3
VEC3
;
...
...
@@ -347,64 +339,20 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
}
m_nbDarts
=
0
;
// table of center of volume
std
::
vector
<
VEC3
>
vecCenters
;
vecCenters
.
reserve
(
1000
);
// table of nbfaces per volume
std
::
vector
<
unsigned
int
>
vecNbFaces
;
vecNbFaces
.
reserve
(
1000
);
// table of face (one dart of each)
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
unsigned
int
posDBI
=
0
;
DartMarker
mark
(
map
);
// marker for darts
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
good
(
d
))
{
CellMarkerStore
markVert
(
map
,
VERTEX
);
//marker for vertices
VEC3
center
(
0
,
0
,
0
);
unsigned
int
nbv
=
0
;
unsigned
int
nbf
=
0
;
std
::
list
<
Dart
>
visitedFaces
;
// Faces that are traversed
visitedFaces
.
push_back
(
d
);
// Start with the face of d
// For every face added to the list
for
(
std
::
list
<
Dart
>::
iterator
face
=
visitedFaces
.
begin
();
face
!=
visitedFaces
.
end
();
++
face
)
{
if
(
!
mark
.
isMarked
(
*
face
))
// Face has not been visited yet
{
// store a dart of face
vecDartFaces
.
push_back
(
*
face
);
nbf
++
;
Dart
dNext
=
*
face
;
do
{
if
(
!
markVert
.
isMarked
(
dNext
))
{
markVert
.
mark
(
dNext
);
center
+=
positions
[
dNext
];
nbv
++
;
}
mark
.
mark
(
dNext
);
// Mark
mark
.
mark
(
map
.
beta0
(
dNext
));
m_nbDarts
++
;
Dart
adj
=
map
.
phi2
(
dNext
);
// Get adjacent face
if
(
adj
!=
dNext
&&
!
mark
.
isMarked
(
adj
))
visitedFaces
.
push_back
(
adj
);
// Add it
dNext
=
map
.
phi1
(
dNext
);
}
while
(
dNext
!=
*
face
);
}
}
center
/=
typename
PFP
::
REAL
(
nbv
);
vecCenters
.
push_back
(
center
);
vecNbFaces
.
push_back
(
nbf
);
}
m_nbDarts
++
;
}
// compute center of each volumes
AutoAttributeHandler
<
VEC3
>
centerVolumes
(
map
,
VOLUME
,
"centerVolumes"
);
TraversorW
<
GMap3
>
traVol
(
map
,
good
);
for
(
Dart
d
=
traVol
.
begin
();
d
!=
traVol
.
end
();
d
=
traVol
.
next
())
{
centerVolumes
[
d
]
=
Algo
::
Geometry
::
volumeCentroid
<
PFP
>
(
mapx
,
d
,
positions
);
}
m_nbDarts
*=
2
;
// beta1
AutoAttributeHandler
<
VEC3
>
fv1
(
map
,
DART
);
...
...
@@ -422,88 +370,96 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
GLvoid
*
PositionDartsBuffer
=
glMapBuffer
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
);
VEC3
*
positionDartBuf
=
reinterpret_cast
<
VEC3
*>
(
PositionDartsBuffer
);
std
::
vector
<
Dart
>::
iterator
face
=
vecDartFaces
.
begin
();
for
(
unsigned
int
iVol
=
0
;
iVol
<
vecNbFaces
.
size
();
++
iVol
)
std
::
vector
<
Dart
>
vecDartFaces
;
vecDartFaces
.
reserve
(
map
.
getNbDarts
()
/
4
);
unsigned
int
posDBI
=
0
;
//traverse each face of each volume
TraversorCell
<
GMap3
>
traFace
(
map
,
PFP
::
MAP
::
ORBIT_IN_PARENT
(
FACE
),
good
);
for
(
Dart
d
=
traFace
.
begin
();
d
!=
traFace
.
end
();
d
=
traFace
.
next
())
{
for
(
unsigned
int
iFace
=
0
;
iFace
<
vecNbFaces
[
iVol
];
++
iFace
)
vecDartFaces
.
push_back
(
d
);
std
::
vector
<
VEC3
>
vecPos
;
vecPos
.
reserve
(
16
);
// store the face & center
float
okv
=
1.0
f
-
kv
;
VEC3
vc
=
centerVolumes
[
d
];
VEC3
centerFace
(
0
,
0
,
0
);
Dart
dd
=
d
;
do
{
Dart
d
=
*
face
++
;
VEC3
P
=
positions
[
dd
];
P
=
vc
*
okv
+
P
*
kv
;
vecPos
.
push_back
(
P
);
centerFace
+=
P
;
dd
=
map
.
phi1
(
dd
);
}
while
(
dd
!=
d
);
centerFace
/=
REAL
(
vecPos
.
size
());
std
::
vector
<
VEC3
>
vecPos
;
vecPos
.
reserve
(
16
);
//shrink the face
unsigned
int
nb
=
vecPos
.
size
(
);
// store the face & center
VEC3
center
(
0
,
0
,
0
);
Dart
dd
=
d
;
do
{
const
VEC3
&
P
=
positions
[
d
];
vecPos
.
push_back
(
P
);
center
+=
P
;
d
=
map
.
phi1
(
d
);
}
while
(
d
!=
dd
);
center
/=
REAL
(
vecPos
.
size
());
//shrink the face
unsigned
int
nb
=
vecPos
.
size
();
float
okf
=
1.0
f
-
kf
;
float
okv
=
1.0
f
-
kv
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
vecPos
[
i
]
=
vecCenters
[
iVol
]
*
okv
+
vecPos
[
i
]
*
kv
;
vecPos
[
i
]
=
center
*
okf
+
vecPos
[
i
]
*
kf
;
}
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
float
okf
=
1.0
f
-
kf
;
// compute position of points to use for drawing topo
float
oke
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
oke
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
oke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
vecPos
[
i
]
=
centerFace
*
okf
+
vecPos
[
i
]
*
kf
;
}
vecPos
.
push_back
(
vecPos
.
front
());
// copy the first for easy computation on next loop
VEC3
PP
=
0.52
f
*
P
+
0.48
f
*
Q
;
VEC3
QQ
=
0.52
f
*
Q
+
0.48
f
*
P
;
// compute position of points to use for drawing topo
float
oke
=
1.0
f
-
ke
;
for
(
unsigned
int
i
=
0
;
i
<
nb
;
++
i
)
{
VEC3
P
=
vecPos
[
i
]
*
ke
+
vecPos
[
i
+
1
]
*
oke
;
VEC3
Q
=
vecPos
[
i
+
1
]
*
ke
+
vecPos
[
i
]
*
oke
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
PP
;
*
positionDartBuf
++
=
Q
;
*
positionDartBuf
++
=
QQ
;
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
VEC3
PP
=
0.52
f
*
P
+
0.48
f
*
Q
;
VEC3
QQ
=
0.52
f
*
Q
+
0.48
f
*
P
;
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
*
positionDartBuf
++
=
P
;
*
positionDartBuf
++
=
PP
;
*
positionDartBuf
++
=
Q
;
*
positionDartBuf
++
=
QQ
;
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
*
colorDartBuf
++
=
VEC3
(
1.
,
1.
,
1.
);
m_attIndex
[
d
]
=
posDBI
;
posDBI
+=
2
;
fv1
[
d
]
=
P
*
0.9
f
+
PP
*
0.1
f
;
fv2x
[
d
]
=
P
*
0.52
f
+
PP
*
0.48
f
;
fv2
[
d
]
=
P
*
0.48
f
+
PP
*
0.52
f
;
Dart
dx
=
map
.
beta0
(
d
);
fv1
[
dx
]
=
Q
*
0.9
f
+
QQ
*
0.1
f
;
fv2
[
dx
]
=
Q
*
0.52
f
+
QQ
*
0.48
f
;
fv2x
[
dx
]
=
Q
*
0.48
f
+
QQ
*
0.52
f
;
m_attIndex
[
dx
]
=
posDBI
;
posDBI
+=
2
;
fv1
[
d
]
=
P
*
0.9
f
+
PP
*
0.1
f
;
fv2x
[
d
]
=
P
*
0.52
f
+
PP
*
0.48
f
;
fv2
[
d
]
=
P
*
0.48
f
+
PP
*
0.52
f
;
Dart
dx
=
map
.
beta0
(
d
);
fv1
[
dx
]
=
Q
*
0.9
f
+
QQ
*
0.1
f
;
fv2
[
dx
]
=
Q
*
0.52
f
+
QQ
*
0.48
f
;
fv2x
[
dx
]
=
Q
*
0.48
f
+
QQ
*
0.52
f
;
d
=
map
.
phi1
(
d
)
;
}
m_attIndex
[
dx
]
=
posDBI
;
posDBI
+=
2
;
}
d
=
map
.
phi1
(
d
);
}
}
m_vbo0
->
bind
();
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
// beta1
m_vbo4
->
bind
();
glUnmapBuffer
(
GL_ARRAY_BUFFER
);
// beta3
m_vbo1
->
bind
();
glBufferData
(
GL_ARRAY_BUFFER
,
m_nbDarts
*
sizeof
(
typename
PFP
::
VEC3
),
0
,
GL_STREAM_DRAW
);
glBufferData
(
GL_ARRAY_BUFFER
,
2
*
m_nbDarts
*
sizeof
(
typename
PFP
::
VEC3
),
0
,
GL_STREAM_DRAW
);
GLvoid
*
PositionBuffer1
=
glMapBufferARB
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
);
// beta
2
// beta
3
m_vbo2
->
bind
();
glBufferData
(
GL_ARRAY_BUFFER
,
2
*
m_nbDarts
*
sizeof
(
typename
PFP
::
VEC3
),
0
,
GL_STREAM_DRAW
);
GLvoid
*
PositionBuffer2
=
glMapBufferARB
(
GL_ARRAY_BUFFER
,
GL_READ_WRITE
);
...
...
@@ -582,6 +538,27 @@ void Topo3Render::updateDataGMap3(typename PFP::MAP& mapx, const typename PFP::T
}
template
<
typename
PFP
>
void
Topo3Render
::
computeDartMiddlePositions
(
typename
PFP
::
MAP
&
map
,
typename
PFP
::
TVEC3
&
posExpl
,
const
FunctorSelect
&
good
)
{
m_vbo0
->
bind
();
typename
PFP
::
VEC3
*
positionsPtr
=
reinterpret_cast
<
typename
PFP
::
VEC3
*>
(
glMapBuffer
(
GL_ARRAY_BUFFER