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
Thomas Pitiot
CGoGN
Commits
4830f7f3
Commit
4830f7f3
authored
Jan 25, 2012
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forgottent commited files for MR & new orbits
parent
10aeeaff
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
520 additions
and
439 deletions
+520
-439
Apps/Examples/Debug/CMakeLists.txt
Apps/Examples/Debug/CMakeLists.txt
+6
-0
Apps/Examples/Release/CMakeLists.txt
Apps/Examples/Release/CMakeLists.txt
+7
-0
Apps/Examples/simpleGMap3.cpp
Apps/Examples/simpleGMap3.cpp
+6
-3
Apps/Tuto/CMakeLists.txt
Apps/Tuto/CMakeLists.txt
+6
-0
Apps/Tuto/tuto3.cpp
Apps/Tuto/tuto3.cpp
+110
-56
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+206
-185
Apps/Tuto/tuto5.h
Apps/Tuto/tuto5.h
+43
-56
Apps/Tuto/tuto5.ui
Apps/Tuto/tuto5.ui
+22
-92
include/Algo/Modelisation/subdivision.hpp
include/Algo/Modelisation/subdivision.hpp
+5
-2
include/Algo/Modelisation/subdivision3.hpp
include/Algo/Modelisation/subdivision3.hpp
+2
-1
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+22
-7
src/Topology/gmap/gmap2.cpp
src/Topology/gmap/gmap2.cpp
+1
-1
src/Topology/map/embeddedMap2.cpp
src/Topology/map/embeddedMap2.cpp
+11
-11
src/Topology/map/embeddedMap3.cpp
src/Topology/map/embeddedMap3.cpp
+17
-14
src/Topology/map/map1.cpp
src/Topology/map/map1.cpp
+5
-3
src/Topology/map/map2.cpp
src/Topology/map/map2.cpp
+41
-2
src/Topology/map/map3.cpp
src/Topology/map/map3.cpp
+10
-6
No files found.
Apps/Examples/Debug/CMakeLists.txt
View file @
4830f7f3
...
...
@@ -72,3 +72,9 @@ QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable
(
clippingD ../clipping.cpp
${
clipping_ui
}
${
clipping_moc
}
)
target_link_libraries
(
clippingD
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_UI
(
volumeExplorer_ui ../volumeExplorer.ui
)
QT4_WRAP_CPP
(
volumeExplorer_moc ../volumeExplorer.h
)
add_executable
(
volumeExplorerD ../volumeExplorer.cpp
${
volumeExplorer_ui
}
${
volumeExplorer_moc
}
)
target_link_libraries
(
volumeExplorerD
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
\ No newline at end of file
Apps/Examples/Release/CMakeLists.txt
View file @
4830f7f3
...
...
@@ -64,3 +64,10 @@ QT4_WRAP_CPP( clipping_moc ../clipping.h )
add_executable
(
clipping ../clipping.cpp
${
clipping_ui
}
${
clipping_moc
}
)
target_link_libraries
(
clipping
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_UI
(
volumeExplorer_ui ../volumeExplorer.ui
)
QT4_WRAP_CPP
(
volumeExplorer_moc ../volumeExplorer.h
)
add_executable
(
volumeExplorer ../volumeExplorer.cpp
${
volumeExplorer_ui
}
${
volumeExplorer_moc
}
)
target_link_libraries
(
volumeExplorer
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
\ No newline at end of file
Apps/Examples/simpleGMap3.cpp
View file @
4830f7f3
...
...
@@ -37,9 +37,9 @@ SimpleGMap3::SimpleGMap3()
Algo
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
primCat
.
embedHexaGrid
(
2
,
1
,
1
);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
myMap
.
check
();
std
::
cout
<<
"AAA"
<<
std
::
endl
;
DartMarker
markOrient
(
myMap
);
std
::
vector
<
Dart
>
orient
;
FunctorStore
fs
(
orient
);
...
...
@@ -47,11 +47,13 @@ SimpleGMap3::SimpleGMap3()
d
=
49
;
myMap
.
foreach_dart_of_oriented_volume
(
d
,
fs
);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
for
(
std
::
vector
<
Dart
>::
iterator
it
=
orient
.
begin
()
;
it
!=
orient
.
end
()
;
++
it
)
markOrient
.
mark
(
*
it
);
SelectorMarked
sm
(
markOrient
);
std
::
cout
<<
"AAA"
<<
std
::
endl
;
Algo
::
Modelisation
::
catmullClarkVol
<
PFP
,
PFP
::
TVEC3
,
PFP
::
VEC3
>
(
myMap
,
position
,
sm
);
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
...
...
@@ -86,6 +88,7 @@ SimpleGMap3::SimpleGMap3()
myMap
.
unsewVolumes
(
d
);
myMap
.
check
();
}
void
SimpleGMap3
::
initGUI
()
...
...
Apps/Tuto/CMakeLists.txt
View file @
4830f7f3
...
...
@@ -53,6 +53,12 @@ add_executable( tuto5 tuto5.cpp ${tuto5_ui} ${tuto5_moc})
target_link_libraries
(
tuto5
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_UI
(
tuto_orbits_ui tuto_orbits.ui
)
QT4_WRAP_CPP
(
tuto_orbits_moc tuto_orbits.h
)
add_executable
(
tuto_orbits tuto_orbits.cpp
${
tuto_orbits_ui
}
${
tuto_orbits_moc
}
)
target_link_libraries
(
tuto_orbits
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
#add_executable( tuto_subdivision tuto_subdivision.cpp)
#target_link_libraries( tuto_subdivision
...
...
Apps/Tuto/tuto3.cpp
View file @
4830f7f3
...
...
@@ -55,67 +55,94 @@ int main(int argc, char **argv)
return
app
.
exec
();
}
Dart
xd1
;
void
MyQT
::
traverseMap
()
{
DartMarker
m1
(
myMap
);
DartMarker
m2
(
myMap
);
myMap
.
rdfi
(
myMap
.
begin
(),
m1
,
m2
);
//traverse cells of map using topological markers on darts
CGoGNout
<<
"Traverse with DartMarkers:"
<<
CGoGNendl
;
DartMarker
dmV
(
myMap
);
DartMarker
dmE
(
myMap
);
DartMarker
dmF
(
myMap
);
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
!
dmV
.
isMarked
(
d
))
{
CGoGNout
<<
"Vertex of dart "
<<
d
<<
CGoGNendl
;
dmV
.
markOrbit
(
VERTEX
,
d
);
}
if
(
!
dmE
.
isMarked
(
d
))
{
CGoGNout
<<
"Edgee of dart "
<<
d
<<
CGoGNendl
;
dmE
.
markOrbit
(
EDGE
,
d
);
}
if
(
!
dmF
.
isMarked
(
d
))
{
CGoGNout
<<
"Face of dart "
<<
d
<<
CGoGNendl
;
dmF
.
markOrbit
(
FACE
,
d
);
}
}
m1
.
unmarkAll
();
m1
.
markOrbit
(
VOLUME
,
xd1
);
//
traverses cells of map with markers on embedded cells.
// More efficients but more memory costly if cells are not already embedded.
// Avoid using construction of objects not ell embedded
//
render the topo of the map without boundary darts
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
nb
);
CGoGNout
<<
"========================="
<<
CGoGNendl
;
CGoGNout
<<
"Traverse with CellMarkers:"
<<
CGoGNendl
;
CellMarker
cmV
(
myMap
,
VERTEX
);
CellMarker
cmE
(
myMap
,
EDGE
);
CellMarker
cmF
(
myMap
,
FACE
);
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
if
(
!
cmV
.
isMarked
(
d
))
{
CGoGNout
<<
"Vertex of dart "
<<
d
<<
CGoGNendl
;
cmV
.
mark
(
d
);
}
if
(
!
cmE
.
isMarked
(
d
))
if
(
m2
.
isMarked
(
d
))
{
CGoGNout
<<
"Edgee of dart "
<<
d
<<
CGoGNendl
;
cmE
.
mark
(
d
);
m_render_topo
->
setDartColor
(
d
,
1.0
f
,
0.0
f
,
0.0
f
);
}
if
(
!
cmF
.
isMarked
(
d
))
if
(
m1
.
isMarked
(
d
))
{
CGoGNout
<<
"Face of dart "
<<
d
<<
CGoGNendl
;
cmF
.
mark
(
d
);
m_render_topo
->
setDartColor
(
d
,
0.0
f
,
1.0
f
,
0.0
f
);
}
}
// markers are cleaned and released at destruction of DartMarkers & CellMarkers
// DartMarkerStore should be used if few darts are traversed
// DartMarkerNoUnmark can be use if you want to manage unmarking yourself
//
//
// //traverse cells of map using topological markers on darts
//
// CGoGNout << "Traverse with DartMarkers:"<< CGoGNendl;
// DartMarker dmV(myMap);
// DartMarker dmE(myMap);
// DartMarker dmF(myMap);
// for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if (!dmV.isMarked(d))
// {
// CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
// dmV.markOrbit(VERTEX,d);
// }
// if (!dmE.isMarked(d))
// {
// CGoGNout << "Edgee of dart "<<d<<CGoGNendl;
// dmE.markOrbit(EDGE,d);
// }
// if (!dmF.isMarked(d))
// {
// CGoGNout << "Face of dart "<<d<<CGoGNendl;
// dmF.markOrbit(FACE,d);
// }
// }
//
//
// // traverses cells of map with markers on embedded cells.
// // More efficients but more memory costly if cells are not already embedded.
// // Avoid using construction of objects not ell embedded
//
// CGoGNout << "========================="<< CGoGNendl;
// CGoGNout << "Traverse with CellMarkers:"<< CGoGNendl;
// CellMarker cmV(myMap,VERTEX);
// CellMarker cmE(myMap,EDGE);
// CellMarker cmF(myMap,FACE);
// for (Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if (!cmV.isMarked(d))
// {
// CGoGNout << "Vertex of dart "<<d<<CGoGNendl;
// cmV.mark(d);
// }
// if (!cmE.isMarked(d))
// {
// CGoGNout << "Edgee of dart "<<d<<CGoGNendl;
// cmE.mark(d);
// }
// if (!cmF.isMarked(d))
// {
// CGoGNout << "Face of dart "<<d<<CGoGNendl;
// cmF.mark(d);
// }
// }
//
// // markers are cleaned and released at destruction of DartMarkers & CellMarkers
// // DartMarkerStore should be used if few darts are traversed
// // DartMarkerNoUnmark can be use if you want to manage unmarking yourself
}
...
...
@@ -123,19 +150,46 @@ void MyQT::traverseMap()
void
MyQT
::
createMap
()
{
Dart
d1
=
Algo
::
Modelisation
::
Polyhedron
<
PFP
>::
createTetra
(
myMap
);
Dart
d2
=
d1
;
// Dart d1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
>
(
VERTEX
,
"position"
);
position
[
d2
]
=
PFP
::
VEC3
(
1
,
0
,
0
);
d2
=
PHI1
(
d2
);
position
[
d2
]
=
PFP
::
VEC3
(
-
1
,
0
,
0
);
d2
=
PHI1
(
d2
);
position
[
d2
]
=
PFP
::
VEC3
(
0
,
2
,
0
);
d2
=
PHI
<
211
>
(
d2
);
position
[
d2
]
=
PFP
::
VEC3
(
0
,
1
,
2
);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim1
(
myMap
,
position
);
prim1
.
cylinder_topo
(
256
,
256
,
true
,
true
);
// topo of sphere is a closed cylinder
prim1
.
embedSphere
(
2.0
f
);
// Dart d2 = d1;
// position[d2] = PFP::VEC3(1, 0, 0);
// d2 = PHI1(d2);
// position[d2] = PFP::VEC3(-1, 0, 0);
// d2 = PHI1(d2);
// position[d2] = PFP::VEC3(0, 2, 0);
// d2 = PHI<211>(d2);
// position[d2] = PFP::VEC3(0, 1, 2);
Algo
::
Modelisation
::
Polyhedron
<
PFP
>
prim2
(
myMap
,
position
);
prim2
.
cylinder_topo
(
256
,
256
,
true
,
true
);
// topo of sphere is a closed cylinder
prim2
.
embedSphere
(
2.0
f
);
Geom
::
Matrix44f
trf
;
trf
.
identity
();
Geom
::
translate
<
float
>
(
5.0
f
,
0.0
,
0.0
,
trf
);
prim2
.
transform
(
trf
);
xd1
=
prim2
.
getDart
();
// xd1 = Algo::Modelisation::Polyhedron<PFP>::createTetra(myMap);
// Dart xd2 = xd1;
//
// position[xd2] = PFP::VEC3(5, 0, 0);
// xd2 = PHI1(xd2);
// position[xd2] = PFP::VEC3(3, 0, 0);
// xd2 = PHI1(xd2);
// position[xd2] = PFP::VEC3(4, 2, 0);
// xd2 = PHI<211>(xd2);
// position[xd2] = PFP::VEC3(4, 1, 2);
// bounding box of scene
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
...
...
Apps/Tuto/tuto5.cpp
View file @
4830f7f3
...
...
@@ -26,256 +26,298 @@
#include "tuto5.h"
#include <iostream>
#include "Algo/Modelisation/primitives3d.h"
#include "Algo/Modelisation/polyhedron.h"
#include "Algo/Modelisation/subdivision.h"
#include "Algo/Render/GL2/topo3Render.h"
#include "Algo/Render/SVG/mapSVGRender.h"
#include "Algo/Import/import.h"
PFP
::
MAP
myMap
;
PFP
::
TVEC3
position
;
Dart
dglobal
;
void
MyQT
::
balls_onoff
(
bool
x
)
{
render_balls
=
!
render_balls
;
updateGL
();
CGoGNerr
<<
" balls_onoff "
<<
CGoGNendl
;
}
void
MyQT
::
v
ector
s_onoff
(
bool
x
)
void
MyQT
::
v
olume
s_onoff
(
bool
x
)
{
render_v
ector
s
=
!
render_v
ector
s
;
render_v
olume
s
=
!
render_v
olume
s
;
updateGL
();
CGoGNerr
<<
" vectors_onoff "
<<
CGoGNflush
;
}
void
MyQT
::
text
_onoff
(
bool
x
)
void
MyQT
::
edges
_onoff
(
bool
x
)
{
render_
text
=
!
render_
text
;
render_
edges
=
!
render_
edges
;
updateGL
();
CGoGNerr
<<
" text_onoff "
<<
CGoGNflush
;
}
void
MyQT
::
topo_onoff
(
bool
x
)
{
render_topo
=
!
render_topo
;
if
(
render_topo
)
{
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.8
f
,
0.8
f
,
m_explode_factor
,
nb
);
}
updateGL
();
CGoGNerr
<<
" topo_onoff "
<<
CGoGNflush
;
}
void
MyQT
::
s
li
der_balls
(
int
x
)
void
MyQT
::
c
li
pping_onoff
(
bool
x
)
{
m_sprite
->
setSize
(
0.05
f
*
x
);
clip_volume
=
!
clip_volume
;
if
(
clip_volume
)
{
Geom
::
Vec3f
pos
=
m_PlanePick
->
getPosition
();
float
pipo
;
Geom
::
Vec3f
normal
=
m_PlanePick
->
getAxisScale
(
2
,
pipo
);
// 2 = Z axis = plane normal
float
d
=
-
(
pos
*
normal
);
m_explode_render
->
setClippingPlane
(
Geom
::
Vec4f
(
normal
[
0
],
normal
[
1
],
normal
[
2
],
d
));
m_topo_render
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
normal
,
pos
);
m_topo_render
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
normal
,
pos
);
}
else
{
m_explode_render
->
setNoClippingPlane
();
m_topo_render
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_topo_render
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
Geom
::
Vec3f
(
0
,
0
,
999999.9
f
));
m_topo_render
->
shader1
()
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
m_topo_render
->
shader2
()
->
setClipColorAttenuationFactorRelative
(
0.0
f
,
0.0
f
);
}
updateGL
();
}
void
MyQT
::
sl
ide
r_vectors
(
int
x
)
void
MyQT
::
h
ide
_onoff
(
bool
x
)
{
m_lines
->
setScale
(
0.02
*
x
)
;
hide_clipping
=
!
hide_clipping
;
updateGL
();
}
void
MyQT
::
slider_text
(
int
x
)
void
MyQT
::
slider_explode
(
int
x
)
{
m_strings
->
setScale
(
0.02
f
*
x
);
m_explode_factor
=
0.01
f
*
x
;
m_explode_render
->
setExplodeVolumes
(
m_explode_factor
);
updateGL
();
}
void
MyQT
::
animate
()
void
MyQT
::
slider_pressed
()
{
// transfoMatrix() = glm::rotate(transfoMatrix(), 0.5f, glm::vec3(0.5773f,0.5773f,0.5773f))
;
transfoRotate
(
0.5
f
,
0.5773
f
,
0.5773
f
,
0.5773
f
)
;
updateGL
Matrices
();
render_topoTemp
=
render_topo
;
render_topo
=
false
;
updateGL
();
}
void
MyQT
::
s
toreVerticesInfo
()
void
MyQT
::
s
lider_released
()
{
CellMarker
mv
(
myMap
,
VERTEX
)
;
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
)
)
render_topo
=
render_topoTemp
;
if
(
render_topo
)
{
if
(
!
mv
.
isMarked
(
d
))
{
mv
.
mark
(
d
);
std
::
stringstream
ss
;
ss
<<
d
<<
" : "
<<
position
[
d
];
m_strings
->
addString
(
ss
.
str
(),
position
[
d
]);
}
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.8
f
,
0.8
f
,
m_explode_factor
,
nb
);
}
updateGL
();
}
void
MyQT
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
// create VBO for position
m_positionVBO
=
new
Utils
::
VBO
();
m_positionVBO
->
updateData
(
position
);
// create the renders
m_topo_render
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_explode_render
=
new
Algo
::
Render
::
GL2
::
ExplodeVolumeRender
();
// using simple shader with color
m_shader
=
new
Utils
::
ShaderSimpleColor
();
m_shader
->
setAttributePosition
(
m_positionVBO
);
m_shader
->
setColor
(
Geom
::
Vec4f
(
0.
,
1.
,
0.
,
0.
));
m_sprite
=
new
Utils
::
PointSprite
();
m_sprite
->
setAttributePosition
(
m_positionVBO
);
m_strings
=
new
Utils
::
Strings3D
(
true
,
Geom
::
Vec3f
(
0.1
f
,
0.0
f
,
0.3
f
));
storeVerticesInfo
();
m_strings
->
sendToVBO
();
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.8
f
,
0.8
f
,
0.8
f
,
nb
);
m_explode_render
->
updateData
<
PFP
>
(
myMap
,
position
);
m_explode_render
->
setExplodeVolumes
(
0.8
f
);
m_explode_render
->
setColorLine
(
Geom
::
Vec4f
(
0.3
f
,
0.3
f
,
0.3
f
,
1.0
f
));
// copy de contenu de VBO a la creation
m_dataVBO
=
new
Utils
::
VBO
(
*
m_positionVBO
);
registerShader
(
m_explode_render
->
shaderFaces
());
registerShader
(
m_explode_render
->
shaderLines
()
);
m_lines
=
new
Utils
::
ShaderVectorPerVertex
();
m_lines
->
setAttributePosition
(
m_positionVBO
);
m_lines
->
setAttributeVector
(
m_dataVBO
);
m_lines
->
setScale
(
0.2
f
);
m_lines
->
setColor
(
Geom
::
Vec4f
(
0.0
f
,
1.0
f
,
0.2
f
,
0.0
f
));
m_PlanePick
=
new
Utils
::
Pickable
(
Utils
::
Pickable
::
GRID
,
1
);
m_frame
=
new
Utils
::
FrameManipulator
();
m_frame
->
setSize
(
m_WidthObj
/
2.0
f
);
// accede au buffer du VBO pour modification
PFP
::
VEC3
*
data
=
static_cast
<
PFP
::
VEC3
*>
(
m_dataVBO
->
lockPtr
());
for
(
unsigned
int
i
=
0
;
i
<
m_dataVBO
->
nbElts
();
++
i
)
{
data
[
i
].
normalize
();
}
m_dataVBO
->
releasePtr
();
registerShader
(
m_shader
);
registerShader
(
m_strings
);
registerShader
(
m_sprite
);
registerShader
(
m_lines
);
m_topo_render
->
shader1
()
->
insertClippingCode
();
m_topo_render
->
shader2
()
->
insertClippingCode
();
SelectorTrue
allDarts
;
clip_id1
=
m_topo_render
->
shader1
()
->
addClipPlane
();
clip_id2
=
m_topo_render
->
shader2
()
->
addClipPlane
();
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
TRIANGLES
);
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
LINES
);
m_
render
->
initPrimitives
<
PFP
>
(
myMap
,
allDarts
,
Algo
::
Render
::
GL2
::
POINTS
);
m_
topo_
render
->
shader1
()
->
setClipPlaneParamsAll
(
clip_id1
,
Geom
::
Vec3f
(
0
,
0
,
1
),
m_PosObj
);
m_
topo_
render
->
shader2
()
->
setClipPlaneParamsAll
(
clip_id2
,
Geom
::
Vec3f
(
0
,
0
,
1
),
m_PosObj
);
m_
explode_render
->
setClippingPlane
(
Geom
::
Vec4f
(
0
,
0
,
1
,
m_PosObj
*
Geom
::
Vec3f
(
0
,
0
,
-
1
))
);
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.9
f
,
nb
);
}
// timer example for animation
m_timer
=
new
QTimer
(
this
);
connect
(
m_timer
,
SIGNAL
(
timeout
()),
SLOT
(
animate
())
);
}
void
MyQT
::
cb_redraw
()
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glEnable
(
GL_LIGHTING
);
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
POINTS
);
glLineWidth
(
2.0
f
);
m_shader
->
setColor
(
Geom
::
Vec4f
(
1.
,
1.
,
0.
,
0.
));
m_render
->
draw
(
m_shader
,
Algo
::
Render
::
GL2
::
LINES
);
glEnable
(
GL_POLYGON_OFFSET_FILL
);
glPolygonOffset
(
1.0
f
,
1.0
f
);
if
(
render_topo
)
m_render
_topo
->
drawTopo
();
m_
topo_
render
->
drawTopo
();
/* Dart d = myMap.phi2(myMap.begin());
m_render_topo->overdrawDart(d, 5, 1.0f, 0.0f, 1.0f);
d = myMap.phi1(myMap.begin());
m_render_topo->overdrawDart(d, 5, 1.0f, 0.0f, 1.0f);
*/
m_render_topo
->
overdrawDart
(
m_selected
,
5
,
1.0
f
,
0.0
f
,
1.0
f
);
if
(
render_edges
)
{
glLineWidth
(
1.0
f
);
m_explode_render
->
drawEdges
();
}
glDisable
(
GL_POLYGON_OFFSET_FILL
);
if
(
render_text
)
m_strings
->
drawAll
(
Geom
::
Vec3f
(
0.0
f
,
1.0
f
,
1.0
f
));
if
(
render_balls
)
if
(
render_volumes
)
{
m_sprite
->
predraw
(
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
));
m_render
->
draw
(
m_sprite
,
Algo
::
Render
::
GL2
::
POINTS
);
m_sprite
->
postdraw
();
m_explode_render
->
drawFaces
();
}
if
(
render_vectors
)
if
(
clip_volume
&&
!
hide_clipping
)
{
glLineWidth
(
1.0
f
);
m_
render
->
draw
(
m_lines
,
Algo
::
Render
::
GL2
::
POINTS
);
m_frame
->
draw
(
);
m_
PlanePick
->
draw
(
);
}
}
void
MyQT
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
void
MyQT
::
cb_mousePress
(
int
button
,
int
x
,
int
y
)
{
if
(
Shift
())
if
(
!
Shift
())
return
;
if
(
hide_clipping
||
!
clip_volume
)
return
;
m_begX
=
x
;
m_begY
=
y
;
// get ray of selection
Geom
::
Vec3f
rayA
,
rayB
;
float
dist
=
getOrthoScreenRay
(
x
,
y
,
rayA
,
rayB
);
Geom
::
Vec3f
AB
=
rayB
-
rayA
;
unsigned
int
fr_picked
=
0
;
// picking the frame -> axis
fr_picked
=
m_frame
->
pick
(
rayA
,
AB
,
dist
);
if
(
fr_picked
!=
0
)
{
SelectorDartNoBoundary
<
PFP
::
MAP
>
nb
(
myMap
);
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
,
nb
);
if
(
d
!=
Dart
::
nil
())
{
CGoGNout
<<
"Dart "
<<
d
<<
" clicked"
<<
CGoGNendl
;
m_selected
=
d
;
}
else
{
statusMsg
(
""
);
}
m_pickedAxis
=
fr_picked
;
std
::
cout
<<
"PICKED:"
<<
m_pickedAxis
<<
std
::
endl
;
m_frame
->
highlight
(
m_pickedAxis
);
m_frame
->
storeProjection
(
m_pickedAxis
);
updateGL
();
}
}
void
MyQT
::
cb_
keyPress
(
int
code
)
void
MyQT
::
cb_
mouseRelease
(
int
button
,
int
x
,
int
y
)
{
if
(
code
==
's'
)
if
(
hide_clipping
||
!
clip_volume
)
return
;
m_pickedAxis
=
0
;
m_frame
->
highlight
(
m_pickedAxis
);
updateGL
();
}
void
MyQT
::
cb_mouseMove
(
int
buttons
,
int
x
,
int
y
)
{
<