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
David Cazier
CGoGN
Commits
f1fbd43f
Commit
f1fbd43f
authored
Feb 25, 2013
by
untereiner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- svg output supports groups / inkscape:layers
- renderTopoSurface with colorComboBox to choose darts/phi1/phi2 colors
parent
b72caf85
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
622 additions
and
272 deletions
+622
-272
Apps/Tuto/show_traversors.cpp
Apps/Tuto/show_traversors.cpp
+6
-6
Apps/Tuto/tuto5.cpp
Apps/Tuto/tuto5.cpp
+5
-5
Apps/Tuto/tuto_oper3.cpp
Apps/Tuto/tuto_oper3.cpp
+10
-0
Apps/Tuto/tuto_oper3.ui
Apps/Tuto/tuto_oper3.ui
+5
-0
SCHNApps/CMakeLists.txt
SCHNApps/CMakeLists.txt
+1
-0
SCHNApps/Plugins/renderTopoSurface/forms/renderTopoSurface.ui
...Apps/Plugins/renderTopoSurface/forms/renderTopoSurface.ui
+85
-4
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp
+18
-3
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurfaceDockTab.cpp
...lugins/renderTopoSurface/src/renderTopoSurfaceDockTab.cpp
+2
-2
SCHNApps/bin/init.py
SCHNApps/bin/init.py
+2
-0
SCHNApps/include/colorComboBox.h
SCHNApps/include/colorComboBox.h
+28
-0
SCHNApps/src/colorComboBox.cpp
SCHNApps/src/colorComboBox.cpp
+43
-0
include/Algo/Render/SVG/mapSVGRender.hpp
include/Algo/Render/SVG/mapSVGRender.hpp
+20
-12
include/Utils/svg.h
include/Utils/svg.h
+56
-17
src/Algo/Render/topo3Render.cpp
src/Algo/Render/topo3Render.cpp
+33
-22
src/Algo/Render/topoRender.cpp
src/Algo/Render/topoRender.cpp
+69
-20
src/Utils/drawer.cpp
src/Utils/drawer.cpp
+32
-22
src/Utils/svg.cpp
src/Utils/svg.cpp
+201
-156
src/Utils/text3d.cpp
src/Utils/text3d.cpp
+6
-3
No files found.
Apps/Tuto/show_traversors.cpp
View file @
f1fbd43f
...
...
@@ -163,15 +163,15 @@ void MyQT::cb_Save()
Utils
::
SVG
::
SVGOut
svg1
(
modelViewMatrix
(),
projectionMatrix
());
m_drawer
.
toSVG
(
svg1
);
svg1
.
addOpacityAnimation
(
1.0
f
);
svg1
.
addOpacityAnimation
(
1.0
f
);
svg1
.
addOpacityAnimation
(
0.0
f
);
//
svg1.addOpacityAnimation(1.0f);
//
svg1.addOpacityAnimation(1.0f);
//
svg1.addOpacityAnimation(0.0f);
Utils
::
SVG
::
SVGOut
svg2
(
modelViewMatrix
(),
projectionMatrix
());
m_render_topo
->
toSVG
(
svg2
);
svg2
.
addOpacityAnimation
(
1.0
f
);
svg2
.
addOpacityAnimation
(
0.0
f
);
svg2
.
addOpacityAnimation
(
1.0
f
);
//
svg2.addOpacityAnimation(1.0f);
//
svg2.addOpacityAnimation(0.0f);
//
svg2.addOpacityAnimation(1.0f);
Utils
::
SVG
::
AnimatedSVGOut
anim
;
...
...
Apps/Tuto/tuto5.cpp
View file @
f1fbd43f
...
...
@@ -237,13 +237,13 @@ void MyQT::cb_keyPress(int code)
{
std
::
string
filename
=
selectFileSave
(
"Export SVG file "
,
"."
,
"(*.svg)"
);
Utils
::
SVG
::
SVGOut
svg
(
filename
,
modelViewMatrix
(),
projectionMatrix
());
svg
.
setWidth
(
1.0
f
);
svg
.
setColor
(
Geom
::
Vec3f
(
0.0
f
,
0.0
f
,
0.5
f
));
//
svg.setWidth(1.0f);
//
svg.setColor(Geom::Vec3f(0.0f,0.0f,0.5f));
Algo
::
Render
::
SVG
::
renderEdges
<
PFP
>
(
svg
,
myMap
,
position
);
svg
.
setColor
(
Geom
::
Vec3f
(
0.0
f
,
0.8
f
,
0.0
f
));
svg
.
setWidth
(
5.0
f
);
//
svg.setColor(Geom::Vec3f(0.0f,0.8f,0.0f));
//
svg.setWidth(5.0f);
Algo
::
Render
::
SVG
::
renderVertices
<
PFP
>
(
svg
,
myMap
,
position
);
svg
.
setColor
(
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
));
//
svg.setColor(Geom::Vec3f(1.0f,0.0f,0.0f));
m_strings
->
toSVG
(
svg
);
//svg destruction close the file
}
...
...
Apps/Tuto/tuto_oper3.cpp
View file @
f1fbd43f
...
...
@@ -235,6 +235,16 @@ void MyQT::operation(int x)
std
::
cout
<<
"nb darts after = "
<<
myMap
.
getNbDarts
()
<<
std
::
endl
;
}
break
;
case
11
:
CGoGNout
<<
"unsew volumes"
<<
CGoGNendl
;
if
(
m_selected
!=
NIL
)
{
myMap
.
unsewVolumes
(
m_selected
);
dm
.
markAll
();
m_selected
=
NIL
;
updateMap
();
}
break
;
default:
break
;
}
...
...
Apps/Tuto/tuto_oper3.ui
View file @
f1fbd43f
...
...
@@ -145,6 +145,11 @@
<string>
splitVertex
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
unsewVolumes
</string>
</property>
</item>
</widget>
</item>
<item
row=
"6"
column=
"0"
>
...
...
SCHNApps/CMakeLists.txt
View file @
f1fbd43f
...
...
@@ -134,6 +134,7 @@ SET(SCHNApps_QOBJECT_FILES
${
SCHNApps_ROOT_DIR
}
/include/dialogs/cameraViewDialog.h
${
SCHNApps_ROOT_DIR
}
/include/dialogs/pluginsViewDialog.h
${
SCHNApps_ROOT_DIR
}
/include/dialogs/mapsViewDialog.h
${
SCHNApps_ROOT_DIR
}
/include/colorComboBox.h
)
...
...
SCHNApps/Plugins/renderTopoSurface/forms/renderTopoSurface.ui
View file @
f1fbd43f
...
...
@@ -6,14 +6,14 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
20
4
</width>
<width>
20
6
</width>
<height>
547
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout_
3
"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_
4
"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QListWidget"
name=
"mapList"
/>
</item>
...
...
@@ -55,8 +55,14 @@
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider_edgesScaleFactor"
>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"value"
>
<number>
50
</number>
<number>
100
</number>
</property>
<property
name=
"sliderPosition"
>
<number>
100
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -72,9 +78,15 @@
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider_facesScaleFactor"
>
<property
name=
"
value
"
>
<property
name=
"
minimum
"
>
<number>
50
</number>
</property>
<property
name=
"maximum"
>
<number>
100
</number>
</property>
<property
name=
"value"
>
<number>
100
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
...
...
@@ -83,6 +95,68 @@
</layout>
</item>
<item
row=
"4"
column=
"0"
>
<widget
class=
"Line"
name=
"line_2"
/>
</item>
<item
row=
"5"
column=
"0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_3"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"checkBox_3"
>
<property
name=
"text"
>
<string>
draw darts
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
<property
name=
"tristate"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"ColorComboBox"
name=
"comboBox_3"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"checkBox"
>
<property
name=
"text"
>
<string>
draw phi1
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
<property
name=
"tristate"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"ColorComboBox"
name=
"comboBox"
/>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QCheckBox"
name=
"checkBox_2"
>
<property
name=
"text"
>
<string>
draw phi2
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
<property
name=
"tristate"
>
<bool>
false
</bool>
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"ColorComboBox"
name=
"comboBox_2"
/>
</item>
</layout>
</item>
<item
row=
"6"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -97,6 +171,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>
ColorComboBox
</class>
<extends>
QComboBox
</extends>
<header
location=
"global"
>
colorComboBox.h
</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp
View file @
f1fbd43f
...
...
@@ -215,7 +215,8 @@ void RenderTopoSurfacePlugin::changeEdgesScaleFactor(View* view, MapHandlerGen*
{
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
*
perMap
=
params
->
perMap
[
map
->
getName
()];
perMap
->
edgesScaleFactor
=
i
/
50.0
;
perMap
->
edgesScaleFactor
=
i
/
100.0
;
std
::
cout
<<
"i = "
<<
perMap
->
edgesScaleFactor
<<
std
::
endl
;
perMap
->
updateRender
();
if
(
view
->
isCurrentView
())
...
...
@@ -230,7 +231,7 @@ void RenderTopoSurfacePlugin::changeFacesScaleFactor(View* view, MapHandlerGen*
{
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
*
perMap
=
params
->
perMap
[
map
->
getName
()];
perMap
->
facesScaleFactor
=
i
/
5
0.0
;
perMap
->
facesScaleFactor
=
i
/
10
0.0
;
perMap
->
updateRender
();
if
(
view
->
isCurrentView
())
...
...
@@ -243,7 +244,21 @@ void RenderTopoSurfacePlugin::changeFacesScaleFactor(View* view, MapHandlerGen*
void
RenderTopoSurfacePlugin
::
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
)
{
// if(orbit == VERTEX)
// {
// MapHandlerGen* map = static_cast<MapHandlerGen*>(QObject::sender());
// if(h_viewParams.contains(map->getName()))
// {
// ParameterSet* params = h_viewParams[view];
//
// if(params->perMap.contains(map->getName()))
// PerMapParameterSet* perMap = params->perMap[map->getName()];
// perMap->updateRender();
//
// //if(params.positionName == nameAttr && params.autoUpdate)
// // computeNormal(map->getName(), params.positionName, params.normalName);
// }
// }
}
void
RenderTopoSurfacePlugin
::
connectivityModified
()
...
...
SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurfaceDockTab.cpp
View file @
f1fbd43f
...
...
@@ -63,8 +63,8 @@ void RenderTopoSurfaceDockTab::refreshUI(ParameterSet* params)
}
}
slider_edgesScaleFactor
->
setSliderPosition
(
p
->
edgesScaleFactor
*
5
0.0
);
slider_facesScaleFactor
->
setSliderPosition
(
p
->
facesScaleFactor
*
5
0.0
);
slider_edgesScaleFactor
->
setSliderPosition
(
p
->
edgesScaleFactor
*
10
0.0
);
slider_facesScaleFactor
->
setSliderPosition
(
p
->
facesScaleFactor
*
10
0.0
);
}
++
i
;
}
...
...
SCHNApps/bin/init.py
View file @
f1fbd43f
...
...
@@ -4,6 +4,7 @@ renderVectorPlugin = schnapps.loadPlugin("RenderVectorD");
differentialPropertiesPlugin
=
schnapps
.
loadPlugin
(
"DifferentialProperties"
);
subdivisionPlugin
=
schnapps
.
loadPlugin
(
"SubdivideSurface"
);
surfaceDeformationPlugin
=
schnapps
.
loadPlugin
(
"SurfaceDeformation"
);
renderTopoSurface
=
schnapps
.
loadPlugin
(
"RenderTopoSurface"
);
obj
=
importPlugin
.
importFromFile
(
"/home/kraemer/Media/Data/surface/lowRes/iphi_good_9k.off"
);
...
...
@@ -12,6 +13,7 @@ v = schnapps.getView("view_0");
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderPlugin
.
getName
());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderVectorPlugin
.
getName
());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
surfaceDeformationPlugin
.
getName
());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderTopoSurface
.
getName
());
schnapps
.
linkViewAndMap
(
v
.
getName
(),
obj
.
getName
());
...
...
SCHNApps/include/colorComboBox.h
0 → 100644
View file @
f1fbd43f
#ifndef COLORCOMBOBOX_H
#define COLORCOMBOBOX_H
#include <QComboBox>
class
QColor
;
class
QWidget
;
class
ColorComboBox
:
public
QComboBox
{
Q_OBJECT
Q_PROPERTY
(
QColor
color
READ
color
WRITE
setColor
USER
true
)
public:
QColor
color
()
const
;
void
setColor
(
QColor
c
);
public:
ColorComboBox
(
QWidget
*
widget
=
0
);
private:
void
populateList
();
public
slots
:
void
slotHighlight
(
int
index
);
};
#endif
SCHNApps/src/colorComboBox.cpp
0 → 100644
View file @
f1fbd43f
#include <QtGui>
#include "colorComboBox.h"
ColorComboBox
::
ColorComboBox
(
QWidget
*
widget
)
:
QComboBox
(
widget
)
{
//connect( this, SIGNAL(highlighted(int)), this, SLOT(slotHighlight(int)) );
populateList
();
}
QColor
ColorComboBox
::
color
()
const
{
return
qvariant_cast
<
QColor
>
(
itemData
(
currentIndex
(),
Qt
::
DecorationRole
));
}
void
ColorComboBox
::
setColor
(
QColor
color
)
{
setCurrentIndex
(
findData
(
color
,
int
(
Qt
::
DecorationRole
)));
}
void
ColorComboBox
::
populateList
()
{
//QStringList colorNames = QColor::colorNames();
QStringList
colorNames
;
colorNames
<<
"darkGreen"
<<
"green"
<<
"gray"
<<
"red"
<<
"white"
<<
"blue"
<<
"cyan"
<<
"darkMagenta"
<<
"yellow"
<<
"darkRed"
<<
"black"
<<
"magenta"
;
for
(
int
i
=
0
;
i
<
colorNames
.
size
();
++
i
)
{
QColor
color
(
colorNames
[
i
]);
insertItem
(
i
,
colorNames
[
i
]);
setItemData
(
i
,
color
,
Qt
::
DecorationRole
);
}
}
void
ColorComboBox
::
slotHighlight
(
int
index
)
{
const
QStringList
colorNames
=
QColor
::
colorNames
();
QColor
color
(
colorNames
.
at
(
index
));
QPalette
palette
=
this
->
palette
();
palette
.
setColor
(
QPalette
::
Highlight
,
color
);
setPalette
(
palette
);
}
include/Algo/Render/SVG/mapSVGRender.hpp
View file @
f1fbd43f
...
...
@@ -37,41 +37,49 @@ namespace SVG
template
<
typename
PFP
>
void
renderVertices
(
Utils
::
SVG
::
SVGOut
&
svg
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
thread
)
{
Utils
::
SVG
::
SvgGroup
*
svg1
=
new
Utils
::
SVG
::
SvgGroup
(
"vertices"
,
svg
.
m_model
,
svg
.
m_proj
);
TraversorV
<
typename
PFP
::
MAP
>
trac
(
map
);
svg
.
beginPoints
();
svg
1
->
beginPoints
();
for
(
Dart
d
=
trac
.
begin
();
d
!=
trac
.
end
();
d
=
trac
.
next
())
svg
.
addPoint
(
position
[
d
]);
svg
.
endPoints
();
svg1
->
addPoint
(
position
[
d
]);
svg1
->
endPoints
();
svg
.
addGroup
(
svg1
);
}
template
<
typename
PFP
>
void
renderVertices
(
Utils
::
SVG
::
SVGOut
&
svg
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
color
,
unsigned
int
thread
)
{
Utils
::
SVG
::
SvgGroup
*
svg1
=
new
Utils
::
SVG
::
SvgGroup
(
"vertices"
,
svg
.
m_model
,
svg
.
m_proj
);
TraversorV
<
typename
PFP
::
MAP
>
trac
(
map
);
svg
.
beginPoints
();
svg
1
->
beginPoints
();
for
(
Dart
d
=
trac
.
begin
();
d
!=
trac
.
end
();
d
=
trac
.
next
())
svg
.
addPoint
(
position
[
d
],
color
[
d
]);
svg
.
endPoints
();
svg1
->
addPoint
(
position
[
d
],
color
[
d
]);
svg1
->
endPoints
();
svg
.
addGroup
(
svg1
);
}
template
<
typename
PFP
>
void
renderEdges
(
Utils
::
SVG
::
SVGOut
&
svg
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
unsigned
int
thread
)
{
Utils
::
SVG
::
SvgGroup
*
svg1
=
new
Utils
::
SVG
::
SvgGroup
(
"edges"
,
svg
.
m_model
,
svg
.
m_proj
);
TraversorE
<
typename
PFP
::
MAP
>
trac
(
map
);
svg
.
beginLines
();
svg
1
->
beginLines
();
for
(
Dart
d
=
trac
.
begin
();
d
!=
trac
.
end
();
d
=
trac
.
next
())
svg
.
addLine
(
position
[
d
],
position
[
map
.
phi1
(
d
)]);
svg
.
endLines
();
svg1
->
addLine
(
position
[
d
],
position
[
map
.
phi1
(
d
)]);
svg1
->
endLines
();
svg
.
addGroup
(
svg1
);
}
template
<
typename
PFP
>
void
renderEdges
(
Utils
::
SVG
::
SVGOut
&
svg
,
typename
PFP
::
MAP
&
map
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
position
,
const
VertexAttribute
<
typename
PFP
::
VEC3
>&
color
,
unsigned
int
thread
)
{
Utils
::
SVG
::
SvgGroup
*
svg1
=
new
Utils
::
SVG
::
SvgGroup
(
"edges"
,
svg
.
m_model
,
svg
.
m_proj
);
TraversorE
<
typename
PFP
::
MAP
>
trac
(
map
);
svg
.
beginLines
();
svg
1
->
beginLines
();
for
(
Dart
d
=
trac
.
begin
();
d
!=
trac
.
end
();
d
=
trac
.
next
())
svg
.
addLine
(
position
[
d
],
position
[
map
.
phi1
(
d
)],
color
[
d
]);
svg
.
endLines
();
svg1
->
addLine
(
position
[
d
],
position
[
map
.
phi1
(
d
)],
color
[
d
]);
svg1
->
endLines
();
svg
.
addGroup
(
svg1
);
}
}
// namespace SVG
...
...
include/Utils/svg.h
View file @
f1fbd43f
...
...
@@ -157,13 +157,11 @@ public:
class
AnimatedSVGOut
;
class
S
VGOut
class
S
vgGroup
{
friend
class
AnimatedSVGOut
;
protected:
std
::
ofstream
*
m_out
;
public:
std
::
string
m_name
;
const
glm
::
mat4
&
m_model
;
const
glm
::
mat4
&
m_proj
;
glm
::
i32vec4
m_viewport
;
...
...
@@ -176,15 +174,9 @@ protected:
std
::
vector
<
float
>
m_opacities_animations
;
unsigned
int
m_bbX0
;
unsigned
int
m_bbY0
;
unsigned
int
m_bbX1
;
unsigned
int
m_bbY1
;
bool
m_isLayer
;
protected:
void
computeBB
(
unsigned
int
&
a
,
unsigned
int
&
b
,
unsigned
int
&
c
,
unsigned
&
d
);
public:
...
...
@@ -194,7 +186,7 @@ public:
* @param model the modelview matrix
* @param proj the projection matrix
*/
S
VGOut
(
const
std
::
string
&
file
name
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
S
vgGroup
(
const
std
::
string
&
name
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
/**
* Object that allow the rendering/exporting in svg file
...
...
@@ -202,19 +194,18 @@ public:
* @param model the modelview matrix
* @param proj the projection matrix
*/
SVGOut
(
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
//SvgGroup
(const glm::mat4& model, const glm::mat4& proj);
/**
* destructor
* flush and close the file
*/
~
S
VGOut
();
~
S
vgGroup
();
void
setColor
(
const
Geom
::
Vec3f
&
col
);
void
setWidth
(
float
w
);
void
closeFile
();
void
beginPoints
();
void
endPoints
();
...
...
@@ -234,15 +225,63 @@ public:
void
addString
(
const
Geom
::
Vec3f
&
P
,
const
Geom
::
Vec3f
&
Q
,
const
std
::
string
&
str
);
void
addString
(
const
Geom
::
Vec3f
&
P
,
const
std
::
string
&
str
,
const
Geom
::
Vec3f
&
C
);
void
sortSimpleDepth
(
std
::
vector
<
DepthSort
>&
vds
);
void
addOpacityAnimation
(
float
val
)
{
m_opacities_animations
.
push_back
(
val
);}
void
clearpacityAnimation
()
{
m_opacities_animations
.
clear
();}
static
void
animateSVG
(
const
std
::
string
&
filename
,
const
std
::
vector
<
SVGOut
*>&
outs
,
float
timestep
);
void
setToLayer
()
{
m_isLayer
=
true
;
}
//static void animateSVG(const std::string& filename, const std::vector<SVGOut*>& outs, float timestep);
};
class
SVGOut
{
public:
std
::
ofstream
*
m_out
;
const
glm
::
mat4
&
m_model
;
const
glm
::
mat4
&
m_proj
;
glm
::
i32vec4
m_viewport
;
std
::
vector
<
SvgGroup
*>
m_groups
;
unsigned
int
m_bbX0
;
unsigned
int
m_bbY0
;
unsigned
int
m_bbX1
;
unsigned
int
m_bbY1
;
protected:
void
computeBB
(
unsigned
int
&
a
,
unsigned
int
&
b
,
unsigned
int
&
c
,
unsigned
&
d
);
public:
/**
* Object that allow the rendering/exporting in svg file
* @param filename file name ended by .svg
* @param model the modelview matrix
* @param proj the projection matrix
*/
SVGOut
(
const
std
::
string
&
filename
,
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
/**
* Object that allow the rendering/exporting in svg file
* no file parameter for use in animateSVG
* @param model the modelview matrix
* @param proj the projection matrix
*/
SVGOut
(
const
glm
::
mat4
&
model
,
const
glm
::
mat4
&
proj
);
~
SVGOut
();
void
addGroup
(
SvgGroup
*
group
)
{
m_groups
.
push_back
(
group
);
}
void
write
();
};
class
AnimatedSVGOut
{
protected:
...
...
src/Algo/Render/topo3Render.cpp
View file @
f1fbd43f
...
...
@@ -384,71 +384,82 @@ void Topo3Render::svgout2D(const std::string& filename, const glm::mat4& model,
void
Topo3Render
::
toSVG
(
Utils
::
SVG
::
SVGOut
&
svg
)
{
svg
.
setWidth
(
m_topo_relation_width
);
// PHI3 / beta3
Utils
::
SVG
::
SvgGroup
*
svg1
=
new
Utils
::
SVG
::
SvgGroup
(
"phi3"
,
svg
.
m_model
,
svg
.
m_proj
);
const
Geom
::
Vec3f
*
ptr
=
reinterpret_cast
<
Geom
::
Vec3f
*>
(
m_vbo3
->
lockPtr
());
svg
.
beginLines
();
svg1
->
setWidth
(
m_topo_relation_width
);
svg
1
->
beginLines
();
for
(
unsigned
int
i
=
0
;
i
<
m_nbRel3
;
++
i
)
{
Geom
::
Vec3f
P
=
(
ptr
[
4
*
i
]
+
ptr
[
4
*
i
+
3
])
/
2.0
f
;
Geom
::
Vec3f
Q
=
(
ptr
[
4
*
i
+
1
]
+
ptr
[
4
*
i
+
2
])
/
2.0
f
;
svg
.
addLine
(
P
,
Q
,
Geom
::
Vec3f
(
0.8
f
,
0.8
f
,
0.0
f
));
svg
1
->
addLine
(
P
,
Q
,
Geom
::
Vec3f
(
0.8
f
,
0.8
f
,
0.0
f
));
}
svg
.
endLines
();
svg
1
->
endLines
();
m_vbo3
->
releasePtr
();
svg
.
addGroup
(
svg1
);
// PHI2 / beta2
Utils
::
SVG
::
SvgGroup
*
svg2
=
new
Utils
::
SVG
::
SvgGroup
(
"phi2"
,
svg
.
m_model
,
svg
.
m_proj
);
ptr
=
reinterpret_cast
<
Geom
::
Vec3f
*>
(
m_vbo2
->
lockPtr
());
svg
.
beginLines
();
svg2
->
setWidth
(
m_topo_relation_width
);
svg
2
->
beginLines
();
for
(
unsigned
int
i
=
0
;
i
<
m_nbRel2
;
++
i
)
{
Geom
::
Vec3f
P
=
(
ptr
[
4
*
i
]
+
ptr
[
4
*
i
+
3
])
/
2.0
f
;
Geom
::
Vec3f
Q
=
(
ptr
[
4
*
i
+
1
]
+
ptr
[
4
*
i
+
2
])
/
2.0
f
;
svg
.
addLine
(
P
,
Q
,
Geom
::
Vec3f
(
0.8
f
,
0.0
f
,
0.0
f
));
svg
2
->
addLine
(
P
,
Q
,
Geom
::
Vec3f
(
0.8
f
,
0.0
f
,
0.0
f
));
}
svg
.
endLines
();
svg
2
->
endLines
();
m_vbo2
->
releasePtr
();
svg
.
addGroup
(
svg2
);
//PHI1 /beta1
Utils
::
SVG
::
SvgGroup
*
svg3
=
new
Utils
::
SVG
::
SvgGroup
(
"phi1"
,
svg
.
m_model
,
svg
.
m_proj
);
ptr
=
reinterpret_cast
<
Geom
::
Vec3f
*>
(
m_vbo1
->
lockPtr
());
svg
.
beginLines
();