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
David Cazier
CGoGN
Commits
16c584ca
Commit
16c584ca
authored
Dec 20, 2013
by
CGoGN
Browse files
Merge /home/untereiner/CGoGN
parents
193852a3
fd9a5728
Changes
62
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/clipping.cpp
View file @
16c584ca
...
...
@@ -790,36 +790,27 @@ void Clipping::importMesh(std::string& filename)
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
if
(
extension
==
std
::
string
(
".tet"
))
{
if
(
!
Algo
::
Volume
::
Import
::
importTet
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
else
if
(
extension
==
std
::
string
(
".ts"
))
{
if
(
!
Algo
::
Volume
::
Import
::
importTs
<
PFP
>
(
myMap
,
filename
.
c_str
(),
attrNames
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
if
(
extension
==
std
::
string
(
".map"
))
{
if
(
!
myMap
.
loadMapBin
(
filename
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
}
if
(
extension
==
std
::
string
(
".map"
))
{
if
(
!
myMap
.
loadMapBin
(
filename
))
{
CGoGNerr
<<
"could not import "
<<
filename
<<
CGoGNendl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
VEC3
,
VERTEX
>
(
"position"
)
;
}
else
{
if
(
!
Algo
::
Volume
::
Import
::
importMesh
<
PFP
>
(
myMap
,
filename
,
attrNames
))
{
std
::
cerr
<<
"could not import "
<<
filename
<<
std
::
endl
;
return
;
}
else
position
=
myMap
.
getAttribute
<
PFP
::
VEC3
,
VERTEX
>
(
attrNames
[
0
])
;
}
updateVBOprimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
|
Algo
::
Render
::
GL2
::
LINES
|
Algo
::
Render
::
GL2
::
POINTS
)
;
...
...
Apps/Examples/simpleGMap3.cpp
View file @
16c584ca
...
...
@@ -30,87 +30,120 @@
SimpleGMap3
::
SimpleGMap3
()
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
normal
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"normal"
);
volume
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
>
(
"volume"
);
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
volume
=
myMap
.
addAttribute
<
VEC3
,
VOLUME
>
(
"volume"
);
CellMarker
<
EDGE
>
mE
(
myMap
);
//
CellMarker<EDGE> mE(myMap);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
3
,
1
,
1
);
primCat
.
embedHexaGrid
(
2
,
1
,
1
);
myMap
.
check
();
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
1
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
check
();
Geom
::
Plane3D
<
PFP
::
REAL
>
pl
(
VEC3
(
-
1
,
-
0.5
,
-
0.5
),
VEC3
(
-
1
,
-
0.5
,
0.5
),
VEC3
(
1
,
0.5
,
0.5
));
Algo
::
Volume
::
Modelisation
::
sliceConvexVolume
<
PFP
>
(
myMap
,
position
,
d
,
pl
);
Dart
dp
=
Algo
::
Surface
::
Modelisation
::
createQuadrangularPyramid
<
PFP
>
(
myMap
);
myMap
.
check
();
position
[
dp
]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
-
0.5
);
position
[
myMap
.
phi1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
0.5
);
position
[
myMap
.
phi1
(
myMap
.
phi1
(
dp
))]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
0.5
);
position
[
myMap
.
phi_1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
-
0.5
);
position
[
myMap
.
phi_1
(
myMap
.
phi2
(
dp
))]
=
typename
PFP
::
VEC3
(
1.5
f
,
0.0
f
,
0.0
f
);
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
2
,
0
,
0
);
Dart
dtemp
=
myMap
.
beta1
(
myMap
.
beta0
(
myMap
.
beta1
(
myMap
.
beta2
(
myMap
.
beta1
(
myMap
.
beta0
(
myMap
.
beta1
(
myMap
.
beta2
(
d
))))))));
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim
(
myMap
,
position
);
d
=
prim
.
hexaGrid_topo
(
2
,
2
,
1
);
prim
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
sewVolumes
(
dtemp
,
dp
);
Dart
d1
=
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
d
)))));
VEC3
mid0
=
(
position
[
d1
]
+
position
[
myMap
.
phi1
(
d1
)])
/
2.0
f
;
myMap
.
cutEdge
(
d1
);
position
[
myMap
.
phi1
(
d1
)]
=
mid0
;
// Geom::Plane3D<PFP::REAL> pl(VEC3(-1,-0.5,-0.5),VEC3(-1,-0.5,0.5),VEC3(1,0.5,0.5));
// Algo::Volume::Modelisation::sliceConvexVolume<PFP>(myMap, position, d, pl);
VEC3
mid1
=
(
position
[
d
]
+
position
[
myMap
.
phi1
(
d
)])
/
2.0
f
;
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid1
;
// myMap.check();
d
=
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
d
)))));
VEC3
mid
=
(
position
[
d
]
+
position
[
myMap
.
phi1
(
d
)])
/
2.0
f
;
myMap
.
cutEdge
(
d
);
position
[
myMap
.
phi1
(
d
)]
=
mid
;
// for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
// position[i] += VEC3(2,0,0);
myMap
.
splitFace
(
d
,
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi1
(
d
))));
// Algo::Volume::Modelisation::Primitive3D<PFP> prim(myMap, position);
// d = prim.hexaGrid_topo(2,2,1);
// prim.embedHexaGrid(1,1,1);
myMap
.
check
();
// Dart d1 = myMap.phi1(myMap.phi1(myMap.phi2(myMap.phi1(myMap.phi1(d)))));
// VEC3 mid0 = (position[d1] + position[myMap.phi1(d1)]) / 2.0f;
// myMap.cutEdge(d1);
// position[myMap.phi1(d1)] = mid0;
for
(
unsigned
int
i
=
position
.
begin
()
;
i
!=
position
.
end
()
;
position
.
next
(
i
))
position
[
i
]
+=
VEC3
(
0
,
2
,
0
);
// VEC3 mid1 = (position[d] + position[myMap.phi1(d)]) / 2.0f;
// myMap.cutEdge(d);
// position[myMap.phi1(d)] = mid1;
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
prim2
(
myMap
,
position
);
d
=
prim2
.
hexaGrid_topo
(
2
,
1
,
1
);
prim2
.
embedHexaGrid
(
1
,
1
,
1
);
// d = myMap.phi1(myMap.phi1(myMap.phi2(myMap.phi1(myMap.phi1(d)))));
// VEC3 mid = (position[d] + position[myMap.phi1(d)]) / 2.0f;
// myMap.cutEdge(d);
// position[myMap.phi1(d)] = mid;
d
=
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
d
))));
myMap
.
unsewVolumes
(
d
);
// myMap.splitFace(d,myMap.phi1(myMap.phi1(myMap.phi1(d))));
myMap
.
check
();
// myMap.check();
// for(unsigned int i = position.begin() ; i != position.end() ; position.next(i))
// position[i] += VEC3(0,2,0);
// Algo::Volume::Modelisation::Primitive3D<PFP> prim2(myMap,position);
// d = prim2.hexaGrid_topo(2,1,1);
// prim2.embedHexaGrid(1,1,1);
// d = myMap.phi2(myMap.phi1(myMap.phi1(myMap.phi2(d))));
// myMap.unsewVolumes(d);
// myMap.check();
}
void
SimpleGMap3
::
initGUI
()
{
}
void
SimpleGMap3
::
cb_keyPress
(
int
code
)
{
switch
(
code
)
{
case
'e'
:
{
time_t
rawtime
;
struct
tm
*
timeinfo
;
char
buffer
[
80
];
time
(
&
rawtime
);
timeinfo
=
localtime
(
&
rawtime
);
strftime
(
buffer
,
80
,
".%F.%H:%M:%S"
,
timeinfo
);
std
::
string
filename
=
std
::
string
(
"topo_screenshot"
)
+
std
::
string
(
buffer
)
+
std
::
string
(
".svg"
);
m_render_topo
->
svgout2D
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
break
;
}
}
}
void
SimpleGMap3
::
cb_initGL
()
{
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
VEC3
gPosObj
=
bb
.
center
()
;
float
tailleX
=
bb
.
size
(
0
)
;
float
tailleY
=
bb
.
size
(
1
)
;
float
tailleZ
=
bb
.
size
(
2
)
;
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
->
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.
9
f
);
Utils
::
GLSLShader
::
setCurrentOGLVersion
(
2
)
;
Geom
::
BoundingBox
<
PFP
::
VEC3
>
bb
=
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
myMap
,
position
)
;
VEC3
gPosObj
=
bb
.
center
()
;
float
tailleX
=
bb
.
size
(
0
)
;
float
tailleY
=
bb
.
size
(
1
)
;
float
tailleZ
=
bb
.
size
(
2
)
;
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
->
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
);
}
void
SimpleGMap3
::
cb_redraw
()
{
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
m_render_topo
->
drawTopo
();
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
m_render_topo
->
drawTopo
();
}
/**********************************************************************************************
...
...
@@ -119,13 +152,13 @@ void SimpleGMap3::cb_redraw()
int
main
(
int
argc
,
char
**
argv
)
{
QApplication
app
(
argc
,
argv
)
;
QApplication
app
(
argc
,
argv
)
;
SimpleGMap3
sqt
;
sqt
.
setGeometry
(
0
,
0
,
1000
,
800
)
;
sqt
.
show
()
;
SimpleGMap3
sqt
;
sqt
.
setGeometry
(
0
,
0
,
1000
,
800
)
;
sqt
.
show
()
;
sqt
.
initGUI
()
;
sqt
.
initGUI
()
;
return
app
.
exec
()
;
return
app
.
exec
()
;
}
Apps/Examples/simpleGMap3.h
View file @
16c584ca
...
...
@@ -53,7 +53,6 @@ public:
MAP
myMap
;
VertexAttribute
<
VEC3
>
position
;
VertexAttribute
<
VEC3
>
normal
;
VolumeAttribute
<
VEC3
>
volume
;
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
...
...
@@ -64,4 +63,5 @@ public:
void
cb_initGL
()
;
void
cb_redraw
()
;
void
cb_keyPress
(
int
c
);
};
Apps/Examples/simpleMap3.cpp
View file @
16c584ca
...
...
@@ -32,44 +32,62 @@ SimpleMap3::SimpleMap3()
{
position
=
myMap
.
addAttribute
<
VEC3
,
VERTEX
>
(
"position"
);
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
2
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
closeMap
();
Algo
::
Volume
::
Modelisation
::
Primitive3D
<
PFP
>
primCat
(
myMap
,
position
);
Dart
d
=
primCat
.
hexaGrid_topo
(
1
,
1
,
1
);
primCat
.
embedHexaGrid
(
1
,
1
,
1
);
myMap
.
closeMap
();
myMap
.
check
();
unsigned
int
nb
=
0
;
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
nb
++
;
Dart
dp
=
Algo
::
Surface
::
Modelisation
::
createQuadrangularPyramid
<
PFP
>
(
myMap
);
std
::
cout
<<
"Nb vertices (equals 12) : "
<<
nb
<<
std
::
endl
;
assert
(
nb
==
12
);
position
[
dp
]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
-
0.5
);
position
[
myMap
.
phi1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
0.5
,
0.5
);
position
[
myMap
.
phi1
(
myMap
.
phi1
(
dp
))]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
0.5
);
position
[
myMap
.
phi_1
(
dp
)]
=
typename
PFP
::
VEC3
(
0.5
,
-
0.5
,
-
0.5
);
position
[
myMap
.
phi_1
(
myMap
.
phi2
(
dp
))]
=
typename
PFP
::
VEC3
(
1.5
f
,
0.0
f
,
0.0
f
);
Dart
dtemp
=
myMap
.
phi_1
(
myMap
.
phi2
(
myMap
.
phi_1
(
myMap
.
phi_1
(
myMap
.
phi2
(
d
)))));
d
=
myMap
.
phi2
(
myMap
.
phi1
(
myMap
.
phi1
(
myMap
.
phi2
(
d
)))
);
myMap
.
sewVolumes
(
dtemp
,
dp
);
Dart
dd
=
myMap
.
phi3
(
d
);
// Algo::Volume::Modelisation::Primitive3D<PFP> primCat(myMap, position);
// Dart d = primCat.hexaGrid_topo(2,1,1);
// primCat.embedHexaGrid(1,1,1);
// myMap.closeMap();
myMap
.
unsewVolumes
(
d
);
// unsigned int nb=0;
// for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
// nb++;
myMap
.
check
();
// std::cout << "Nb vertices (equals 12) : " << nb << std::endl;
// assert(nb==12);
nb
=
0
;
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
nb
++
;
std
::
cout
<<
"Nb vertices after unsew (equals 16) : "
<<
nb
<<
std
::
endl
;
assert
(
nb
==
16
);
// d = myMap.phi2(myMap.phi1(myMap.phi1(myMap.phi2(d))));
myMap
.
sewVolumes
(
d
,
d
d
);
// Dart dd = myMap.phi3(
d);
myMap
.
check
(
);
//
myMap.
unsewVolumes(d
);
nb
=
0
;
for
(
unsigned
int
i
=
position
.
begin
();
i
!=
position
.
end
();
position
.
next
(
i
))
nb
++
;
// myMap.check();
std
::
cout
<<
"Nb vertices after resew (equals 12) : "
<<
nb
<<
std
::
endl
;
assert
(
nb
==
12
);
// nb=0;
// for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
// nb++;
// std::cout << "Nb vertices after unsew (equals 16) : " << nb << std::endl;
// assert(nb==16);
// myMap.sewVolumes(d,dd);
// myMap.check();
// nb=0;
// for(unsigned int i = position.begin(); i!=position.end(); position.next(i))
// nb++;
// std::cout << "Nb vertices after resew (equals 12) : " << nb << std::endl;
// assert(nb==12);
}
...
...
@@ -92,22 +110,64 @@ void SimpleMap3::cb_initGL()
m_render_topo
=
new
Algo
::
Render
::
GL2
::
Topo3Render
();
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.
9
f
);
m_render_topo
->
updateData
<
PFP
>
(
myMap
,
position
,
0.9
f
,
0.9
f
,
0.
8
f
);
m_render_topo_boundary
=
new
Algo
::
Render
::
GL2
::
TopoRender
();
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_primal
=
new
Algo
::
Render
::
GL2
::
Topo3PrimalRender
();
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
);
}
void
SimpleMap3
::
cb_keyPress
(
int
code
)
{
switch
(
code
)
{
case
'e'
:
{
time_t
rawtime
;
struct
tm
*
timeinfo
;
char
buffer
[
80
];
time
(
&
rawtime
);
timeinfo
=
localtime
(
&
rawtime
);
strftime
(
buffer
,
80
,
".%F.%H:%M:%S"
,
timeinfo
);
std
::
string
filename
=
std
::
string
(
"topo_screenshot"
)
+
std
::
string
(
buffer
)
+
std
::
string
(
".svg"
);
m_render_topo
->
svgout2D
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
break
;
}
case
'E'
:
{
time_t
rawtime
;
struct
tm
*
timeinfo
;
char
buffer
[
80
];
time
(
&
rawtime
);
timeinfo
=
localtime
(
&
rawtime
);
strftime
(
buffer
,
80
,
".%F.%H:%M:%S"
,
timeinfo
);
std
::
string
filename
=
std
::
string
(
"topo_screenshot"
)
+
std
::
string
(
buffer
)
+
std
::
string
(
".svg"
);
m_render_topo_primal
->
svgout2D
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
break
;
}
}
}
void
SimpleMap3
::
cb_redraw
()
{
glDisable
(
GL_LIGHTING
);
glLineWidth
(
1.0
f
);
m_render_topo
->
drawTopo
();
m_render_topo_boundary
->
drawTopo
();
m_render_topo
->
drawTopo
();
//m_render_topo_boundary->drawTopo();
//m_render_topo_primal->drawTopo();
}
/**********************************************************************************************
...
...
Apps/Examples/simpleMap3.h
View file @
16c584ca
...
...
@@ -33,6 +33,7 @@
#include
"Geometry/vector_gen.h"
#include
"Algo/Render/GL2/topo3Render.h"
#include
"Algo/Render/GL2/topo3PrimalRender.h"
#include
"Algo/Render/GL2/topoRender.h"
using
namespace
CGoGN
;
...
...
@@ -58,6 +59,7 @@ public:
Algo
::
Render
::
GL2
::
Topo3Render
*
m_render_topo
;
Algo
::
Render
::
GL2
::
TopoRender
*
m_render_topo_boundary
;
Algo
::
Render
::
GL2
::
Topo3PrimalRender
*
m_render_topo_primal
;
SimpleMap3
()
;
...
...
@@ -65,5 +67,6 @@ public:
void
cb_initGL
()
;
void
cb_redraw
()
;
void
cb_keyPress
(
int
code
);
};
Apps/Examples/volumeExplorer.cpp
View file @
16c584ca
...
...
@@ -136,7 +136,7 @@ void MyQT::slider_released()
void
MyQT
::
cb_Open
()
{
std
::
string
filters
(
"all (*.*)
;; trian (*.trian);; ctm (*.ctm);; off (*.off);; ply (*.ply)
"
)
;
std
::
string
filters
(
"all (*.*)"
)
;
std
::
string
filename
=
selectFile
(
"Open Mesh"
,
""
,
filters
)
;
if
(
filename
.
empty
())
return
;
...
...
@@ -145,8 +145,8 @@ void MyQT::cb_Open()
std
::
vector
<
std
::
string
>
attrNames
;
size_t
pos
=
filename
.
rfind
(
"."
);
// position of "." in filename
std
::
string
extension
=
filename
.
substr
(
pos
);
//
size_t pos = filename.rfind("."); // position of "." in filename
//
std::string extension = filename.substr(pos);
// if(extension == std::string(".off"))
// {
...
...
SCHNApps/Plugins/CMakeLists.txt
View file @
16c584ca
...
...
@@ -10,3 +10,6 @@ ADD_SUBDIRECTORY(surface_subdivision)
ADD_SUBDIRECTORY
(
surface_selection
)
ADD_SUBDIRECTORY
(
surface_deformation
)
ADD_SUBDIRECTORY
(
surface_modelisation
)
ADD_SUBDIRECTORY
(
volume_import
)
ADD_SUBDIRECTORY
(
volume_render
)
SCHNApps/Plugins/volume_import/CMakeLists.txt
View file @
16c584ca
cmake_minimum_required
(
VERSION 2.8
)
SET
(
PLUGIN_NAME
Import
Volume
)
SET
(
PLUGIN_NAME Volume
_Import
)
SET
(
PLUGIN_ROOT_DIR
${
SCHNApps_ROOT_DIR
}
/Plugins/import
Volume
)
SET
(
PLUGIN_ROOT_DIR
${
SCHNApps_ROOT_DIR
}
/Plugins/
volume_
import
)
INCLUDE_DIRECTORIES
(
${
PLUGIN_ROOT_DIR
}
/include
...
...
@@ -25,7 +25,7 @@ file(
SET
(
PLUGIN_QOBJECT_FILES
${
PLUGIN_ROOT_DIR
}
/include/import
Volume
.h
${
PLUGIN_ROOT_DIR
}
/include/
volume_
import.h
)
include
(
${
SCHNApps_ROOT_DIR
}
/Plugins/plugins_cmake.txt
)
SCHNApps/Plugins/volume_import/include/import
Volume
.h
→
SCHNApps/Plugins/volume_import/include/
volume_
import.h
View file @
16c584ca
#ifndef _IMPORTVOLUME_PLUGIN_H_
#define _IMPORTVOLUME_PLUGIN_H_
#include
"plugin.h"
#ifndef _VOLUME_IMPORT_PLUGIN_H_
#define _VOLUME_IMPORT_PLUGIN_H_
#include
"plugin_processing.h"
namespace
CGoGN
{
...
...
@@ -10,32 +9,22 @@ namespace CGoGN
namespace
SCHNApps
{
class
Import
VolumePlugin
:
public
Plugin
class
Volume
_Import_
Plugin
:
public
Plugin
Processing
{
Q_OBJECT
Q_INTERFACES
(
CGoGN
::
SCHNApps
::
Plugin
)
public:
ImportVolumePlugin
()
{
setProvidesRendering
(
false
);
}
Volume_Import_Plugin
()
{}
~
Import
VolumePlugin
()
~
Volume
_Import_
Plugin
()
{}
private:
virtual
bool
enable
();
virtual
void
disable
()
{}
virtual
void
redraw
(
View
*
view
)
{}
virtual
void
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
keyRelease
(
View
*
view
,
QKeyEvent
*
event
)
{}
virtual
void
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
mouseRelease
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
mouseMove
(
View
*
view
,
QMouseEvent
*
event
)
{}
virtual
void
wheelEvent
(
View
*
view
,
QWheelEvent
*
event
)
{}
public
slots
:
MapHandlerGen
*
importFromFile
(
const
QString
&
fileName
);
void
importFromFileDialog
();
...
...
SCHNApps/Plugins/volume_import/src/import
Volume
.cpp
→
SCHNApps/Plugins/volume_import/src/
volume_
import.cpp
View file @
16c584ca
#include
"import
Volume
.h"
#include
"
volume_
import.h"
#include
"schnapps.h"
#include
"mapHandler.h"
#include
"Algo/Import/import.h"
...
...
@@ -13,20 +14,20 @@ namespace CGoGN
namespace
SCHNApps
{
bool
Import
VolumePlugin
::
enable
()
bool
Volume
_Import_
Plugin
::
enable
()
{
importAction
=
new
QAction
(
"import"
,
this
);
addMenuAction
(
"Volume;Import"
,
importAction
);
m_schnapps
->
addMenuAction
(
this
,
"Volume;Import"
,
importAction
);
connect
(
importAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
importFromFileDialog
()));
return
true
;
}
MapHandlerGen
*
Import
VolumePlugin
::
importFromFile
(
const
QString
&
fileName
)
MapHandlerGen
*
Volume
_Import_
Plugin
::
importFromFile
(
const
QString
&
fileName
)
{
QFileInfo
fi
(
fileName
);
if
(
fi
.
exists
())
{
MapHandlerGen
*
mhg
=
m_
window
->
addMap
(
fi
.
baseName
(),
3
);
MapHandlerGen
*
mhg
=
m_
schnapps
->
addMap
(
fi
.
baseName
(),
3
);
if
(
mhg
)
{
MapHandler
<
PFP3
>*
mh
=
static_cast
<
MapHandler
<
PFP3
>*>
(
mhg
);
...
...
@@ -39,9 +40,6 @@ MapHandlerGen* ImportVolumePlugin::importFromFile(const QString& fileName)
VertexAttribute
<
PFP3
::
VEC3
>
position
=
map
->
getAttribute
<
PFP3
::
VEC3
,
VERTEX
>
(
attrNames
[
0
]);
mh
->
registerAttribute
(
position
);
// create position VBO
mh
->
createVBO
(
position
);
// update corresponding VBO & emit attribute update signal
mh
->
notifyAttributeModification
(
position
);
...
...
@@ -54,9 +52,9 @@ MapHandlerGen* ImportVolumePlugin::importFromFile(const QString& fileName)
return
NULL
;
}
void
Import
VolumePlugin
::
importFromFileDialog
()
void
Volume
_Import_
Plugin
::
importFromFileDialog
()
{
QStringList
fileNames
=
QFileDialog
::
getOpenFileNames
(
m_
window
,
"Import volumes"
,
m_
window
->
getAppPath
(),
"Volume mesh Files (*.node *.ts *.off *.tet)"
);
QStringList
fileNames
=
QFileDialog
::
getOpenFileNames
(
m_
schnapps
,
"Import volumes"
,
m_
schnapps
->
getAppPath
(),
"Volume mesh Files (
*.msh *.vtu *.nas *.vbgz *.tetmesh
*.node *.ts *.off *.tet)"
);
QStringList
::
Iterator
it
=
fileNames
.
begin
();
while
(
it
!=
fileNames
.
end
())
{
importFromFile
(
*
it
);
...
...
@@ -65,9 +63,9 @@ void ImportVolumePlugin::importFromFileDialog()