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
KennethVanhoey
CGoGN
Commits
13c0da82
Commit
13c0da82
authored
Mar 05, 2014
by
Pierre Kraemer
Browse files
examples & tutos compiling !
parent
bdb3cd9c
Changes
103
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/Debug/CMakeLists.txt
View file @
13c0da82
...
...
@@ -65,10 +65,10 @@ 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
}
)
QT4_WRAP_UI
(
mcmesh_ui ../mcmesh.ui
)
QT4_WRAP_CPP
(
mcmesh_moc ../mcmesh.h
)
add_executable
(
mcmeshD ../mcmesh.cpp
${
mcmesh_moc
}
${
mcmesh_ui
}
)
target_link_libraries
(
mcmeshD
${
CGoGN_LIBS_D
}
${
CGoGN_EXT_LIBS
}
)
#
QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
#
QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
#
add_executable( mcmeshD ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
#
target_link_libraries( mcmeshD ${CGoGN_LIBS_D} ${CGoGN_EXT_LIBS})
QT4_WRAP_CPP
(
concave_rendering_moc ../concave_rendering.h
)
add_executable
(
concave_renderingD ../concave_rendering.cpp
${
concave_rendering_moc
}
${
concave_rendering_ui
}
)
...
...
Apps/Examples/Release/CMakeLists.txt
View file @
13c0da82
...
...
@@ -31,6 +31,10 @@ QT4_WRAP_CPP( texturesExample_moc ../texturesExample.h )
add_executable
(
texturesExample ../texturesExample.cpp
${
texturesExample_moc
}
)
target_link_libraries
(
texturesExample
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_CPP
(
simpleMap3_moc ../simpleMap3.h
)
add_executable
(
simpleMap3 ../simpleMap3.cpp
${
simpleMap3_moc
}
)
target_link_libraries
(
simpleMap3
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
QT4_WRAP_CPP
(
simpleGMap2_moc ../simpleGMap2.h
)
add_executable
(
simpleGMap2 ../simpleGMap2.cpp
${
simpleGMap2_moc
}
)
target_link_libraries
(
simpleGMap2
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
...
...
@@ -58,10 +62,10 @@ 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
}
)
QT4_WRAP_UI
(
mcmesh_ui ../mcmesh.ui
)
QT4_WRAP_CPP
(
mcmesh_moc ../mcmesh.h
)
add_executable
(
mcmesh ../mcmesh.cpp
${
mcmesh_moc
}
${
mcmesh_ui
}
)
target_link_libraries
(
mcmesh
${
CGoGN_LIBS_R
}
${
CGoGN_EXT_LIBS
}
)
#
QT4_WRAP_UI( mcmesh_ui ../mcmesh.ui )
#
QT4_WRAP_CPP( mcmesh_moc ../mcmesh.h )
#
add_executable( mcmesh ../mcmesh.cpp ${mcmesh_moc} ${mcmesh_ui} )
#
target_link_libraries( mcmesh ${CGoGN_LIBS_R} ${CGoGN_EXT_LIBS} )
QT4_WRAP_CPP
(
concave_rendering_moc ../concave_rendering.h
)
add_executable
(
concave_rendering ../concave_rendering.cpp
${
concave_rendering_moc
}
${
concave_rendering_ui
}
)
...
...
Apps/Examples/simpleMap3.cpp
View file @
13c0da82
...
...
@@ -106,20 +106,20 @@ void SimpleMap3::cb_initGL()
float
gWidthObj
=
std
::
max
<
float
>
(
std
::
max
<
float
>
(
tailleX
,
tailleY
),
tailleZ
)
;
setParamObject
(
gWidthObj
,
gPosObj
.
data
());
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
Map
<
PFP
>
();
m_render_topo
->
setDartWidth
(
2.0
f
);
m_render_topo
->
setInitialDartsColor
(
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.8
f
);
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.8
f
);
m_render_topo_boundary
=
new
Algo
::
Render
::
GL2
::
TopoRender
();
m_render_topo_boundary
=
new
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
();
m_render_topo_boundary
->
setDartWidth
(
2.0
f
);
m_render_topo_boundary
->
setInitialDartsColor
(
0.4
f
,
0.8
f
,
0.4
f
);
m_render_topo_boundary
->
updateDataBoundary
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
bb
.
maxSize
()
/
50.0
f
);
m_render_topo_boundary
->
updateDataBoundary
(
myMap
,
position
,
0.9
f
,
0.9
f
,
bb
.
maxSize
()
/
50.0
f
);
m_render_topo_primal
=
new
Algo
::
Render
::
GL2
::
Topo3PrimalRender
();
m_render_topo_primal
=
new
Algo
::
Render
::
GL2
::
Topo3PrimalRender
<
PFP
>
();
m_render_topo_primal
->
setDartWidth
(
2.0
f
);
m_render_topo_primal
->
setInitialDartsColor
(
1.0
f
,
1.0
f
,
1.0
f
);
m_render_topo_primal
->
updateData
<
PFP
>
(
myMap
,
position
,
0.95
f
,
0.85
f
);
m_render_topo_primal
->
updateData
(
myMap
,
position
,
0.95
f
,
0.85
f
);
}
void
SimpleMap3
::
cb_keyPress
(
int
code
)
...
...
Apps/Examples/simpleMap3.h
View file @
13c0da82
...
...
@@ -45,6 +45,7 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
SimpleMap3
:
public
Utils
::
QT
::
SimpleQT
...
...
@@ -55,11 +56,11 @@ public:
MAP
myMap
;
SelectorTrue
allDarts
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo_boundary
;
Algo
::
Render
::
GL2
::
Topo3PrimalRender
*
m_render_topo_primal
;
Algo
::
Render
::
GL2
::
Topo3Render
Map
<
PFP
>
*
m_render_topo
;
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
*
m_render_topo_boundary
;
Algo
::
Render
::
GL2
::
Topo3PrimalRender
<
PFP
>
*
m_render_topo_primal
;
SimpleMap3
()
;
...
...
@@ -69,4 +70,3 @@ public:
void
cb_redraw
()
;
void
cb_keyPress
(
int
code
);
};
Apps/Examples/viewer.cpp
View file @
13c0da82
...
...
@@ -80,7 +80,7 @@ void Viewer::cb_initGL()
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
()
;
m_topoRender
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
m_topoRender
=
new
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
()
;
m_topoRender
->
setInitialDartsColor
(
0.25
f
,
0.25
f
,
0.25
f
)
;
...
...
@@ -230,7 +230,7 @@ void Viewer::importMesh(std::string& filename)
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
LINES
)
;
m_render
->
initPrimitives
<
PFP
>
(
myMap
,
Algo
::
Render
::
GL2
::
TRIANGLES
)
;
m_topoRender
->
updateData
<
PFP
>
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
m_topoRender
->
updateData
(
myMap
,
position
,
0.85
f
,
0.85
f
,
m_drawBoundaryTopo
)
;
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
normalBaseSize
=
bb
.
diagSize
()
/
100.0
f
;
...
...
@@ -262,7 +262,7 @@ void Viewer::exportMesh(std::string& filename, bool askExportMode)
if
(
askExportMode
)
Utils
::
QT
::
inputValues
(
Utils
::
QT
::
VarCombo
(
"binary mode;ascii mode"
,
ascii
,
"Save in"
))
;
std
::
vector
<
VertexAttribute
<
VEC3
>*>
attributes
;
std
::
vector
<
VertexAttribute
<
VEC3
,
MAP_IMPL
>*>
attributes
;
attributes
.
push_back
(
&
position
)
;
Algo
::
Surface
::
Export
::
exportPLYnew
<
PFP
>
(
myMap
,
attributes
,
filename
.
c_str
(),
!
ascii
)
;
}
...
...
Apps/Examples/viewer.h
View file @
13c0da82
...
...
@@ -64,6 +64,7 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
//class Viewer : public Utils::QT::SimpleQT
...
...
@@ -100,11 +101,11 @@ public:
bool
m_drawTopo
;
bool
m_drawBoundaryTopo
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
normal
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
normal
;
Algo
::
Render
::
GL2
::
MapRender
*
m_render
;
Algo
::
Render
::
GL2
::
TopoRender
*
m_topoRender
;
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
*
m_topoRender
;
Utils
::
VBO
*
m_positionVBO
;
Utils
::
VBO
*
m_normalVBO
;
...
...
Apps/Examples/volumeExplorer.cpp
View file @
13c0da82
...
...
@@ -122,12 +122,11 @@ void MyQT::slider_released()
{
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
//TODO MapBrowser
m_topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.8
f
,
m_explode_factorf
-
0.05
f
,
m_explode_factor
);
m_topo_render
->
updateData
(
myMap
,
position
,
0.8
f
,
m_explode_factorf
-
0.05
f
,
m_explode_factor
);
}
updateGL
();
}
void
MyQT
::
cb_Open
()
{
std
::
string
filters
(
"all (*.*)"
)
;
...
...
@@ -210,7 +209,7 @@ void MyQT::cb_initGL()
m_explode_render
=
new
Algo
::
Render
::
GL2
::
ExplodeVolumeRender
(
true
,
true
,
true
);
// SelectorDartNoBoundary<PFP::MAP> nb(myMap);
m_topo_render
->
updateData
<
PFP
>
(
myMap
,
position
,
0.8
f
,
0.8
f
,
0.8
f
);
m_topo_render
->
updateData
(
myMap
,
position
,
0.8
f
,
0.8
f
,
0.8
f
);
m_explode_render
->
updateData
<
PFP
>
(
myMap
,
position
,
color
);
m_explode_render
->
setExplodeVolumes
(
0.8
f
);
m_explode_render
->
setExplodeFaces
(
0.9
f
);
...
...
Apps/Examples/volumeExplorer.h
View file @
13c0da82
...
...
@@ -95,7 +95,6 @@ class MyQT: public Utils::QT::SimpleQT
Utils
::
ClippingShader
*
m_sh1
;
Utils
::
ClippingShader
*
m_sh2
;
public:
float
m_WidthObj
;
Geom
::
Vec3f
m_PosObj
;
...
...
Apps/SandBox/tilings.cpp
View file @
13c0da82
...
...
@@ -48,11 +48,15 @@ struct PFP: public PFP_STANDARD
typedef
EmbeddedMap2
MAP
;
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
PFP
::
MAP
myMap
;
VertexAttribute
<
PFP
::
VEC3
>
position
;
VertexAttribute
<
PFP
::
VEC3
>
position2
;
VertexAttribute
<
PFP
::
VEC3
>
normal
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position2
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
normal
;
void
MyQT
::
cb_initGL
()
{
...
...
@@ -71,7 +75,6 @@ void MyQT::cb_initGL()
m_shader
->
setAttributePosition
(
m_positionVBO
);
m_shader
->
setColor
(
Geom
::
Vec4f
(
1.
,
1.
,
0.
,
0.
));
m_lines
=
new
Utils
::
ShaderVectorPerVertex
();
m_lines
->
setAttributePosition
(
m_positionVBO
);
m_lines
->
setAttributeVector
(
m_normalVBO
);
...
...
@@ -87,7 +90,6 @@ void MyQT::cb_initGL()
registerShader
(
m_lines
);
m_normalVBO
->
updateData
(
normal
);
}
void
MyQT
::
cb_redraw
()
...
...
@@ -313,7 +315,6 @@ int main(int argc, char **argv)
sqt
.
triangularTiling
(
atoi
(
argv
[
2
]));
}
// bounding box
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
);
float
lWidthObj
=
std
::
max
<
PFP
::
REAL
>
(
std
::
max
<
PFP
::
REAL
>
(
bb
.
size
(
0
),
bb
.
size
(
1
)),
bb
.
size
(
2
));
...
...
@@ -327,7 +328,5 @@ int main(int argc, char **argv)
sqt
.
show
();
return
app
.
exec
();
}
Apps/SandBox/tilings.h
View file @
13c0da82
...
...
@@ -44,7 +44,6 @@
#include
"Algo/Tiling/Surface/square.h"
#include
"Algo/Tiling/Surface/triangular.h"
// forward definitions (minimize includes)
namespace
CGoGN
{
namespace
Algo
{
namespace
Render
{
namespace
GL1
{
class
MapRender
;
}
}
}
}
namespace
CGoGN
{
namespace
Utils
{
class
VBO
;
}
}
...
...
@@ -68,8 +67,6 @@ public:
Utils
::
ShaderSimpleColor
*
m_shader
;
Utils
::
ShaderVectorPerVertex
*
m_lines
;
MyQT
()
:
m_render
(
NULL
),
m_positionVBO
(
NULL
),
...
...
@@ -93,10 +90,6 @@ protected:
void
threadAttrib
();
void
threadStorage
();
};
#endif // TUTO_TILINGS_H
Apps/Tuto/show_traversors.cpp
View file @
13c0da82
...
...
@@ -38,9 +38,9 @@
#include
"Algo/Render/GL2/drawerCells.h"
MAP
myMap
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
Dart
dglobal
;
void
MyQT
::
cb_checkTopo
(
bool
b
)
...
...
@@ -112,16 +112,15 @@ void MyQT::cb_explode(int x)
traverse3
();
}
void
MyQT
::
cb_initGL
()
{
// choose to use GL version 2
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
);
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
Map
<
PFP
>
();
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
m_dm_topo
=
new
DartMarker
(
myMap
);
m_render_topo
->
updateData
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
m_dm_topo
=
new
DartMarker
<
MAP
>
(
myMap
);
}
void
MyQT
::
cb_redraw
()
...
...
@@ -146,7 +145,7 @@ void MyQT::cb_mousePress(int /*button*/, int x, int y)
{
if
(
Shift
())
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
Dart
d
=
m_render_topo
->
picking
(
myMap
,
x
,
y
);
if
(
d
!=
Dart
::
nil
())
{
CGoGNout
<<
"Dart "
<<
d
<<
" clicked"
<<
CGoGNendl
;
...
...
@@ -163,7 +162,6 @@ void MyQT::cb_Save()
std
::
string
filename1
=
filename
+
std
::
string
(
"Drawer"
)
+
std
::
string
(
".svg"
);
std
::
string
filename2
=
filename
+
std
::
string
(
"Topo"
)
+
std
::
string
(
".svg"
);
// std::string filename = selectFileSave("Export SVG file ",".","(*.svg)");
// Utils::SVG::SVGOut svg(filename,modelViewMatrix(),projectionMatrix());
// m_drawer.toSVG(svg);
...
...
@@ -188,12 +186,7 @@ void MyQT::cb_Save()
// anim.add(&svg1);
// anim.add(&svg2);
// anim.write(filename, 2.0f);
}
template
<
unsigned
int
ORBIT
>
...
...
@@ -240,13 +233,11 @@ void MyQT::traverse2()
m_drawer
.
endList
();
// SelectorMarked sm(*m_dm_topo);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
m_render_topo
->
updateData
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
updateGL
();
}
void
MyQT
::
dynamicMarkOrbit
(
unsigned
int
orb
)
{
switch
(
orb
)
...
...
@@ -300,7 +291,7 @@ void MyQT::traverse3()
Algo
::
Render
::
drawerCells
<
PFP
>
(
VERTEX
+
m_first3
,
m_drawer
,
myMap
,
m_affDarts
,
position
,
m_expl
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
//sm
m_render_topo
->
updateData
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
//sm
for
(
std
::
vector
<
Dart
>::
iterator
id
=
m_affDarts
.
begin
();
id
!=
m_affDarts
.
end
();
++
id
)
m_render_topo
->
setDartColor
(
*
id
,
0.7
f
,
0.0
f
,
0.0
f
);
...
...
@@ -321,7 +312,7 @@ void MyQT::traverse3()
Algo
::
Render
::
drawerCells
<
PFP
>
(
VERTEX
+
m_first3
,
m_drawer
,
myMap
,
m_affDarts
,
position
,
m_expl
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
//sm
m_render_topo
->
updateData
(
myMap
,
position
,
0.95
f
,
0.9
f
,
0.8
f
);
//sm
for
(
std
::
vector
<
Dart
>::
iterator
id
=
m_affDarts
.
begin
();
id
!=
m_affDarts
.
end
();
++
id
)
m_render_topo
->
setDartColor
(
*
id
,
0.7
f
,
0.0
f
,
0.0
f
);
m_render_topo
->
setDartColor
(
m_selected
,
0.0
f
,
0.7
f
,
0.0
f
);
...
...
Apps/Tuto/show_traversors.h
View file @
13c0da82
...
...
@@ -24,17 +24,10 @@
#ifndef __SHOW_TRAVERSORS_
#define __SHOW_TRAVERSORS_
#include
<iostream>
//#define WITH_GMAP 1
#include
"Topology/generic/parameters.h"
#ifdef WITH_GMAP
#include
"Topology/gmap/embeddedGMap3.h"
#else
#include
"Topology/map/embeddedMap3.h"
#endif
#include
"Topology/map/embeddedMap3.h"
#include
"Geometry/vector_gen.h"
#include
"Algo/Geometry/boundingbox.h"
...
...
@@ -51,7 +44,6 @@
#include
"Utils/cgognStream.h"
#include
"Utils/drawer.h"
#include
"Utils/Qt/qtSimple.h"
#include
"ui_show_traversors.h"
...
...
@@ -64,17 +56,13 @@ using namespace CGoGN ;
struct
PFP
:
public
PFP_STANDARD
{
// definition de la carte
#ifdef WITH_GMAP
typedef
EmbeddedGMap3
MAP
;
#else
typedef
EmbeddedMap3
MAP
;
#endif
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
/**
* Utilisation de designer-qt4:
* Faire un DockWiget (laisser le nom par defaut
...
...
@@ -86,7 +74,7 @@ class MyQT: public Utils::QT::SimpleQT
{
Q_OBJECT
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Algo
::
Render
::
GL2
::
Topo3Render
Map
<
PFP
>
*
m_render_topo
;
bool
m_showTopo
;
unsigned
int
m_first3
;
...
...
@@ -118,7 +106,7 @@ public:
Utils
::
Drawer
m_drawer
;
DartMarker
*
m_dm_topo
;
DartMarker
<
MAP
>
*
m_dm_topo
;
protected:
void
storeVerticesInfo
();
...
...
Apps/Tuto/tuto1.cpp
View file @
13c0da82
...
...
@@ -93,13 +93,13 @@ void MyQT::createMap()
// render the topo of the map without boundary darts
m_render_topo
->
setInitialBoundaryDartsColor
(
0
,
1
,
0
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
true
);
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
,
true
);
}
// initialization GL callback
void
MyQT
::
cb_initGL
()
{
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
()
;
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
()
;
}
// redraw GL callback (clear and swap already done)
...
...
Apps/Tuto/tuto1.h
View file @
13c0da82
...
...
@@ -32,12 +32,7 @@
#include
"Utils/cgognStream.h"
#include
"Topology/generic/parameters.h"
#ifdef USE_GMAP
#include
"Topology/gmap/embeddedGMap2.h"
#else
#include
"Topology/map/embeddedMap2.h"
#endif
#include
"Topology/map/embeddedMap2.h"
#include
"Algo/Render/GL2/topoRender.h"
...
...
@@ -50,21 +45,18 @@ using namespace CGoGN ;
struct
PFP
:
public
PFP_STANDARD
{
// definition of the type of the map
#ifdef USE_GMAP
typedef
EmbeddedGMap2
MAP
;
#else
typedef
EmbeddedMap2
MAP
;
#endif
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
MyQT
:
public
Utils
::
QT
::
SimpleQGLV
{
Q_OBJECT
public:
MyQT
()
:
m_render_topo
(
NULL
)
{}
MyQT
()
:
m_render_topo
(
NULL
)
{}
void
cb_redraw
();
void
cb_initGL
();
...
...
@@ -75,10 +67,10 @@ protected:
MAP
myMap
;
// attribute for vertices positions
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
;
// render (for the topo)
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo
;
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
*
m_render_topo
;
// just for more compact writing
inline
Dart
PHI1
(
Dart
d
)
{
return
myMap
.
phi1
(
d
);
}
...
...
Apps/Tuto/tuto2.cpp
View file @
13c0da82
...
...
@@ -27,7 +27,6 @@
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
{
// // interface
...
...
@@ -53,7 +52,7 @@ void MyQT::createMap()
Dart
d1
=
myMap
.
newFace
(
3
);
Dart
d2
=
myMap
.
newFace
(
4
);
myMap
.
sewFaces
(
d1
,
d2
);
VertexAttribute
<
VEC3
>
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
VertexAttribute
<
VEC3
,
MAP_IMPL
>
position
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"position"
);
position
[
d1
]
=
PFP
::
VEC3
(
0
,
0
,
0
);
position
[
PHI1
(
d1
)]
=
PFP
::
VEC3
(
2
,
0
,
0
);
position
[
PHI_1
(
d1
)]
=
PFP
::
VEC3
(
1
,
2
,
0
);
...
...
@@ -61,7 +60,7 @@ void MyQT::createMap()
position
[
PHI_1
(
d2
)]
=
PFP
::
VEC3
(
2
,
-
2
,
0
);
// create another attribute on vertices (for faces drawing)
VertexAttribute
<
VEC3
>
colorF
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"colorF"
);
VertexAttribute
<
VEC3
,
MAP_IMPL
>
colorF
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"colorF"
);
colorF
[
d1
]
=
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
);
colorF
[
PHI1
(
d1
)]
=
Geom
::
Vec3f
(
0.0
f
,
1.0
f
,
0.0
f
);
...
...
@@ -70,7 +69,7 @@ void MyQT::createMap()
colorF
[
PHI_1
(
d2
)]
=
Geom
::
Vec3f
(
0.0
f
,
1.0
f
,
1.0
f
);
// create another attribute on vertices (for edges drawing)
VertexAttribute
<
VEC3
>
colorE
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"colorE"
);
VertexAttribute
<
VEC3
,
MAP_IMPL
>
colorE
=
myMap
.
addAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
"colorE"
);
colorE
[
d1
]
=
Geom
::
Vec3f
(
0.0
f
,
0.5
f
,
0.5
f
);
colorE
[
PHI1
(
d1
)]
=
Geom
::
Vec3f
(
0.5
f
,
0.0
f
,
0.5
f
);
...
...
@@ -80,7 +79,7 @@ void MyQT::createMap()
// example of attribute on face
// here for example we store the number of edges of faces at construction
FaceAttribute
<
int
>
side
=
myMap
.
addAttribute
<
int
,
FACE
>
(
"nb_sides"
);
FaceAttribute
<
int
,
MAP_IMPL
>
side
=
myMap
.
addAttribute
<
int
,
FACE
>
(
"nb_sides"
);
side
[
d1
]
=
3
;
side
[
d2
]
=
4
;
...
...
Apps/Tuto/tuto2.h
View file @
13c0da82
...
...
@@ -27,7 +27,6 @@
//#define USE_GMAP
#include
"Utils/Qt/qtSimple.h"
#include
"Utils/cgognStream.h"
#include
"Topology/generic/parameters.h"
...
...
@@ -61,9 +60,9 @@ struct PFP: public PFP_STANDARD
};
typedef
PFP
::
MAP
MAP
;
typedef
PFP
::
MAP
::
IMPL
MAP_IMPL
;
typedef
PFP
::
VEC3
VEC3
;
class
MyQT
:
public
Utils
::
QT
::
SimpleQT
{
Q_OBJECT
...
...
Apps/Tuto/tuto3.cpp
View file @
13c0da82
...
...
@@ -29,7 +29,6 @@
using
namespace
CGoGN
;
int
main
(
int
argc
,
char
**
argv
)
{
// // interface
...
...
@@ -48,8 +47,7 @@ int main(int argc, char **argv)
// final show for redraw
sqt
.
show
();
CGoGNout
<<
"You can pick darts dans see it's id with left mouse button"
<<
CGoGNendl
;
CGoGNout
<<
"You can pick darts and see its id with left mouse button"
<<
CGoGNendl
;
// and wait for the end
return
app
.
exec
();
...
...
@@ -57,12 +55,11 @@ int main(int argc, char **argv)
Dart
xd1
;
void
MyQT
::
traverseMap
()
{
DartMarker
m1
(
myMap
);
DartMarker
m2
(
myMap
);
myMap
.
rdfi
(
myMap
.
begin
(),
m1
,
m2
);
DartMarker
<
MAP
>
m1
(
myMap
);
DartMarker
<
MAP
>
m2
(
myMap
);
//
myMap.rdfi(myMap.begin(),m1,m2);
m1
.
unmarkAll
();
...
...
@@ -70,7 +67,7 @@ void MyQT::traverseMap()
// 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
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
);
// nb
for
(
Dart
d
=
myMap
.
begin
();
d
!=
myMap
.
end
();
myMap
.
next
(
d
))
{
...
...
@@ -201,13 +198,13 @@ void MyQT::createMap()
// 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
m_render_topo
->
updateData
(
myMap
,
position
,
0.9
f
,
0.9
f
);
// nb
}
// initialization GL callback
void
MyQT
::
cb_initGL
()
{
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
();
m_render_topo
=
new
Algo
::
Render
::
GL2
::
TopoRender
Map
<
PFP
>
();
}
// redraw GL callback (clear and swap already done)
...
...
@@ -223,11 +220,10 @@ void MyQT::cb_mouseClick(int button, int x, int y)
{
if
(
button
==
Qt
::
LeftButton
)
{
Dart
d
=
m_render_topo
->
picking
<
PFP
>
(
myMap
,
x
,
y
);
Dart
d
=
m_render_topo
->
picking
(
myMap
,
x
,
y
);
if
(
d
!=
NIL
)
CGoGNout
<<
"Dart "
<<
d
<<
CGoGNendl
;
dart_selected
=
d
;
dart_selected
=
d
;
updateGL
();
}
}
Apps/Tuto/tuto3.h
View file @
13c0da82
...
...
@@ -28,17 +28,10 @@
#include
"Utils/Qt/qtSimple.h"
#include
"Utils/cgognStream.h"