Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
David Cazier
CGoGN
Commits
ada7c5ba
Commit
ada7c5ba
authored
Apr 01, 2015
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: bug fix in render vector plugin
parent
9c85376f
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
133 additions
and
189 deletions
+133
-189
CGoGN/src/Utils/Shaders/shaderPhong.cpp
CGoGN/src/Utils/Shaders/shaderPhong.cpp
+24
-11
SCHNApps/Plugins/surface_radiance/src/surface_radiance.cpp
SCHNApps/Plugins/surface_radiance/src/surface_radiance.cpp
+32
-39
SCHNApps/Plugins/surface_render/src/surface_render_dockTab.cpp
...pps/Plugins/surface_render/src/surface_render_dockTab.cpp
+6
-6
SCHNApps/Plugins/surface_renderVector/forms/surface_renderVector.ui
...lugins/surface_renderVector/forms/surface_renderVector.ui
+24
-44
SCHNApps/Plugins/surface_renderVector/include/surface_renderVector.h
...ugins/surface_renderVector/include/surface_renderVector.h
+0
-18
SCHNApps/Plugins/surface_renderVector/include/surface_renderVector_dockTab.h
...rface_renderVector/include/surface_renderVector_dockTab.h
+0
-2
SCHNApps/Plugins/surface_renderVector/src/surface_renderVector.cpp
...Plugins/surface_renderVector/src/surface_renderVector.cpp
+0
-13
SCHNApps/Plugins/surface_renderVector/src/surface_renderVector_dockTab.cpp
...surface_renderVector/src/surface_renderVector_dockTab.cpp
+46
-56
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+1
-0
No files found.
CGoGN/src/Utils/Shaders/shaderPhong.cpp
View file @
ada7c5ba
...
...
@@ -54,17 +54,30 @@ ShaderPhong::ShaderPhong(bool withClipping, bool doubleSided, bool withEyePositi
std
::
string
glxvert
(
GLSLShader
::
defines_gl
());
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
());
// get choose GL defines (2 or 3)
// ans compile shaders
std
::
string
glxvert
(
GLSLShader
::
defines_gl
());
if
(
withClipping
)
{
m_nameVS
=
"ShaderPhongClip_vs"
;
m_nameFS
=
"ShaderPhongClip_fs"
;
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderClipText
);
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderClipText
);
}
else
{
m_nameVS
=
"ShaderPhong_vs"
;
m_nameFS
=
"ShaderPhong_fs"
;
if
(
m_with_eyepos
)
glxvert
.
append
(
"#define WITH_EYEPOSITION"
);
glxvert
.
append
(
vertexShaderText
);
std
::
string
glxfrag
(
GLSLShader
::
defines_gl
());
// Use double sided lighting if set
if
(
doubleSided
)
glxfrag
.
append
(
"#define DOUBLE_SIDED
\n
"
);
glxfrag
.
append
(
fragmentShaderText
);
}
loadShadersFromMemory
(
glxvert
.
c_str
(),
glxfrag
.
c_str
());
...
...
SCHNApps/Plugins/surface_radiance/src/surface_radiance.cpp
View file @
ada7c5ba
...
...
@@ -335,50 +335,43 @@ void Surface_Radiance_Plugin::decimate(const QString& mapName, const QString& po
mapParams
.
positionApproximator
=
new
Algo
::
Surface
::
Decimation
::
Approximator_QEM
<
PFP2
>
(
*
map
,
position
);
}
//
if (mapParams.normalApproximator == NULL)
//
{
//
mapParams.normalApproximator =
//
new Algo::Surface::Decimation::Approximator_InterpolateAlongEdge<PFP2, PFP2::VEC3>(
//
*map,
//
normal,
//
position,
//
((Algo::Surface::Decimation::Approximator<PFP2, PFP2::VEC3, EDGE>*)(mapParams.positionApproximator))->getApproximationResultAttribute()
//
);
//
}
//
if (mapParams.radianceApproximator == NULL)
//
{
//
mapParams.radianceApproximator =
//
new Algo::Surface::Decimation::Approximator_InterpolateAlongEdge<PFP2, Utils::SphericalHarmonics<PFP2::REAL, PFP2::VEC3> >(
//
*map,
//
mapParams.radiance,
//
position,
//
((Algo::Surface::Decimation::Approximator<PFP2, PFP2::VEC3, EDGE>*)(mapParams.positionApproximator))->getApproximationResultAttribute()
//
);
//
}
if
(
mapParams
.
normalApproximator
==
NULL
)
{
mapParams
.
normalApproximator
=
new
Algo
::
Surface
::
Decimation
::
Approximator_InterpolateAlongEdge
<
PFP2
,
PFP2
::
VEC3
>
(
*
map
,
normal
,
position
,
((
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP2
,
PFP2
::
VEC3
,
EDGE
>*
)(
mapParams
.
positionApproximator
))
->
getApproximationResultAttribute
()
);
}
if
(
mapParams
.
radianceApproximator
==
NULL
)
{
mapParams
.
radianceApproximator
=
new
Algo
::
Surface
::
Decimation
::
Approximator_InterpolateAlongEdge
<
PFP2
,
Utils
::
SphericalHarmonics
<
PFP2
::
REAL
,
PFP2
::
VEC3
>
>
(
*
map
,
mapParams
.
radiance
,
position
,
((
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP2
,
PFP2
::
VEC3
,
EDGE
>*
)(
mapParams
.
positionApproximator
))
->
getApproximationResultAttribute
()
);
}
if
(
mapParams
.
selector
==
NULL
)
{
// mapParams.selector =
// new EdgeSelector_Radiance<PFP2>(
// *map,
// position,
// normal,
// mapParams.radiance,
// *(Algo::Surface::Decimation::Approximator<PFP2, PFP2::VEC3, EDGE>*)(mapParams.positionApproximator),
// *(Algo::Surface::Decimation::Approximator<PFP2, PFP2::VEC3, EDGE>*)(mapParams.normalApproximator),
// *(Algo::Surface::Decimation::Approximator<PFP2, Utils::SphericalHarmonics<PFP2::REAL, PFP2::VEC3>, EDGE>*)(mapParams.radianceApproximator)
// );
// mapParams.selector =
// new Algo::Surface::Decimation::EdgeSelector_QEM<PFP2>(
// *map,
// position,
// *(Algo::Surface::Decimation::Approximator<PFP2, PFP2::VEC3, EDGE>*)(mapParams.positionApproximator)
// );
mapParams
.
selector
=
new
EdgeSelector_Radiance
<
PFP2
>
(
*
map
,
position
,
normal
,
mapParams
.
radiance
,
*
(
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP2
,
PFP2
::
VEC3
,
EDGE
>*
)(
mapParams
.
positionApproximator
),
*
(
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP2
,
PFP2
::
VEC3
,
EDGE
>*
)(
mapParams
.
normalApproximator
),
*
(
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP2
,
Utils
::
SphericalHarmonics
<
PFP2
::
REAL
,
PFP2
::
VEC3
>
,
EDGE
>*
)(
mapParams
.
radianceApproximator
)
);
mapParams
.
selector
=
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_
ColorNaive
<
PFP2
>
(
new
Algo
::
Surface
::
Decimation
::
EdgeSelector_
QEM
<
PFP2
>
(
*
map
,
position
,
*
(
Algo
::
Surface
::
Decimation
::
Approximator
<
PFP2
,
PFP2
::
VEC3
,
EDGE
>*
)(
mapParams
.
positionApproximator
)
...
...
SCHNApps/Plugins/surface_render/src/surface_render_dockTab.cpp
View file @
ada7c5ba
...
...
@@ -50,7 +50,7 @@ void Surface_Render_DockTab::positionVBOChanged(int index)
{
m_plugin
->
h_viewParameterSet
[
view
][
map
].
positionVBO
=
map
->
getVBO
(
combo_positionVBO
->
currentText
());
view
->
updateGL
();
m_plugin
->
pythonRecording
(
"change
VertexColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
rgbCol
[
0
],
rgbCol
[
1
],
rgbCol
[
2
]
);
m_plugin
->
pythonRecording
(
"change
PositionVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_positionVBO
->
currentText
()
);
}
}
}
...
...
@@ -65,7 +65,7 @@ void Surface_Render_DockTab::normalVBOChanged(int index)
{
m_plugin
->
h_viewParameterSet
[
view
][
map
].
normalVBO
=
map
->
getVBO
(
combo_normalVBO
->
currentText
());
view
->
updateGL
();
m_plugin
->
pythonRecording
(
"change
PositionVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_position
VBO
->
currentText
());
m_plugin
->
pythonRecording
(
"change
NormalVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_normal
VBO
->
currentText
());
}
}
}
...
...
@@ -80,7 +80,7 @@ void Surface_Render_DockTab::colorVBOChanged(int index)
{
m_plugin
->
h_viewParameterSet
[
view
][
map
].
colorVBO
=
map
->
getVBO
(
combo_colorVBO
->
currentText
());
view
->
updateGL
();
m_plugin
->
pythonRecording
(
"change
NormalVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_normal
VBO
->
currentText
());
m_plugin
->
pythonRecording
(
"change
ColorVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_color
VBO
->
currentText
());
}
}
}
...
...
@@ -208,7 +208,6 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
{
if
(
m_currentColorDial
==
1
)
{
m_diffuseColor
=
col
;
dcolorButton
->
setStyleSheet
(
"QPushButton { background-color:"
+
col
.
name
()
+
"}"
);
...
...
@@ -220,12 +219,12 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
{
m_plugin
->
h_viewParameterSet
[
view
][
map
].
diffuseColor
=
rgbCol
;
view
->
updateGL
();
m_plugin
->
pythonRecording
(
"changeFaceColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
rgbCol
[
0
],
rgbCol
[
1
],
rgbCol
[
2
]);
}
}
if
(
m_currentColorDial
==
2
)
{
m_simpleColor
=
col
;
scolorButton
->
setStyleSheet
(
"QPushButton { background-color:"
+
col
.
name
()
+
"}"
);
...
...
@@ -237,12 +236,12 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
{
m_plugin
->
h_viewParameterSet
[
view
][
map
].
simpleColor
=
rgbCol
;
view
->
updateGL
();
m_plugin
->
pythonRecording
(
"changeEdgeColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
rgbCol
[
0
],
rgbCol
[
1
],
rgbCol
[
2
]);
}
}
if
(
m_currentColorDial
==
3
)
{
m_vertexColor
=
col
;
vcolorButton
->
setStyleSheet
(
"QPushButton { background-color:"
+
col
.
name
()
+
"}"
);
...
...
@@ -254,6 +253,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
{
m_plugin
->
h_viewParameterSet
[
view
][
map
].
vertexColor
=
rgbCol
;
view
->
updateGL
();
m_plugin
->
pythonRecording
(
"changeVertexColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
rgbCol
[
0
],
rgbCol
[
1
],
rgbCol
[
2
]);
}
}
}
...
...
SCHNApps/Plugins/surface_renderVector/forms/surface_renderVector.ui
View file @
ada7c5ba
...
...
@@ -14,23 +14,6 @@
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"5"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLineEdit"
name=
"selectedName"
>
<property
name=
"readOnly"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"10"
column=
"0"
colspan=
"2"
>
<widget
class=
"ColorComboBox"
name=
"combo_color"
/>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"combo_positionVBO"
>
<property
name=
"sizePolicy"
>
...
...
@@ -46,13 +29,23 @@
</item>
</widget>
</item>
<item
row=
"
1"
column=
"0
"
>
<widget
class=
"QLabel"
name=
"label
_3
"
>
<item
row=
"
4"
column=
"0"
colspan=
"2
"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Vectors :
</string>
<string>
Selected vector size :
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item
row=
"8"
column=
"0"
colspan=
"2"
>
<widget
class=
"ColorComboBox"
name=
"combo_color"
/>
</item>
<item
row=
"2"
column=
"0"
colspan=
"2"
>
<widget
class=
"QListWidget"
name=
"list_vectorVBO"
>
<property
name=
"selectionMode"
>
...
...
@@ -60,7 +53,14 @@
</property>
</widget>
</item>
<item
row=
"11"
column=
"0"
colspan=
"2"
>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
<property
name=
"text"
>
<string>
Vectors :
</string>
</property>
</widget>
</item>
<item
row=
"9"
column=
"0"
colspan=
"2"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -73,7 +73,7 @@
</property>
</spacer>
</item>
<item
row=
"
8
"
column=
"0"
colspan=
"2"
>
<item
row=
"
6
"
column=
"0"
colspan=
"2"
>
<widget
class=
"QSlider"
name=
"slider_vectorsScaleFactor"
>
<property
name=
"value"
>
<number>
50
</number>
...
...
@@ -83,30 +83,10 @@
</property>
</widget>
</item>
<item
row=
"6"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Vectors Size :
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"0"
>
<spacer
name=
"verticalSpacer_2"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"9"
column=
"0"
>
<item
row=
"7"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<string>
Color
:
</string>
<string>
Selected vector color
:
</string>
</property>
</widget>
</item>
...
...
SCHNApps/Plugins/surface_renderVector/include/surface_renderVector.h
View file @
ada7c5ba
...
...
@@ -12,22 +12,8 @@ namespace CGoGN
namespace
SCHNApps
{
//struct SVectorInfo
//{
// Utils::VBO* vbo;
// QColor color;
// float scaleFactor;
// SVectorInfo() :
// vbo(NULL), color(QColor("red")), scaleFactor(1.0f)
// {}
// SVectorInfo(Utils::VBO* ptr) :
// vbo(ptr), color(QColor("red")), scaleFactor(1.0f)
// {}
//};
struct
MapParameters
{
MapParameters
()
:
positionVBO
(
NULL
)
{}
...
...
@@ -36,10 +22,6 @@ struct MapParameters
QList
<
Utils
::
VBO
*>
vectorVBOs
;
QList
<
QColor
>
colors
;
QList
<
float
>
scaleFactors
;
//float vectorsScaleFactor;
};
class
Surface_RenderVector_Plugin
:
public
PluginInteraction
...
...
SCHNApps/Plugins/surface_renderVector/include/surface_renderVector_dockTab.h
View file @
ada7c5ba
...
...
@@ -26,8 +26,6 @@ private:
SCHNApps
*
m_schnapps
;
Surface_RenderVector_Plugin
*
m_plugin
;
bool
b_updatingUI
;
int
m_current_vbo
;
QString
m_currentVBOName
;
private
slots
:
void
positionVBOChanged
(
int
index
);
...
...
SCHNApps/Plugins/surface_renderVector/src/surface_renderVector.cpp
View file @
ada7c5ba
...
...
@@ -51,19 +51,6 @@ void Surface_RenderVector_Plugin::drawMap(View* view, MapHandlerGen* map)
{
const
MapParameters
&
p
=
h_viewParameterSet
[
view
][
map
];
//m_vectorShader->setScale(map->getBBdiagSize() / 100.0f * p.vectorsScaleFactor) ;
//if(p.positionVBO)
//{
// m_vectorShader->setAttributePosition(p.positionVBO);
// for(QList<Utils::VBO*>::const_iterator it = p.vectorVBOs.begin(); it != p.vectorVBOs.end(); ++it)
// {
// m_vectorShader->setAttributeVector(*it);
// glLineWidth(1.0f);
// map->draw(m_vectorShader, Algo::Render::GL2::POINTS);
// }
//}
if
(
p
.
positionVBO
)
{
m_vectorShader
->
setAttributePosition
(
p
.
positionVBO
);
...
...
SCHNApps/Plugins/surface_renderVector/src/surface_renderVector_dockTab.cpp
View file @
ada7c5ba
...
...
@@ -15,8 +15,7 @@ namespace SCHNApps
Surface_RenderVector_DockTab
::
Surface_RenderVector_DockTab
(
SCHNApps
*
s
,
Surface_RenderVector_Plugin
*
p
)
:
m_schnapps
(
s
),
m_plugin
(
p
),
b_updatingUI
(
false
),
m_current_vbo
(
-
1
)
b_updatingUI
(
false
)
{
setupUi
(
this
);
...
...
@@ -24,11 +23,6 @@ Surface_RenderVector_DockTab::Surface_RenderVector_DockTab(SCHNApps* s, Surface_
slider_vectorsScaleFactor
->
setDisabled
(
true
);
combo_color
->
setDisabled
(
true
);
QFont
font
=
selectedName
->
font
();
font
.
setBold
(
true
);
selectedName
->
setFont
(
font
);
selectedName
->
setText
(
"not selected"
);
connect
(
combo_positionVBO
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
positionVBOChanged
(
int
)));
connect
(
slider_vectorsScaleFactor
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
vectorsScaleFactorChanged
(
int
)));
connect
(
list_vectorVBO
,
SIGNAL
(
itemChanged
(
QListWidgetItem
*
)),
this
,
SLOT
(
vectorsVBOChecked
(
QListWidgetItem
*
)));
...
...
@@ -37,10 +31,9 @@ Surface_RenderVector_DockTab::Surface_RenderVector_DockTab(SCHNApps* s, Surface_
connect
(
combo_color
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
colorChanged
(
int
)));
}
void
Surface_RenderVector_DockTab
::
positionVBOChanged
(
int
index
)
{
if
(
!
b_updatingUI
)
if
(
!
b_updatingUI
)
{
View
*
view
=
m_schnapps
->
getSelectedView
();
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
...
...
@@ -55,38 +48,31 @@ void Surface_RenderVector_DockTab::positionVBOChanged(int index)
void
Surface_RenderVector_DockTab
::
selectedVectorVBOChanged
(
QListWidgetItem
*
item
,
QListWidgetItem
*
old
)
{
if
(
!
b_updatingUI
)
{
if
((
item
->
checkState
()
==
Qt
::
Checked
))
if
(
!
b_updatingUI
)
{
selectedName
->
setText
(
item
->
text
());
slider_vectorsScaleFactor
->
setEnabled
(
true
);
combo_color
->
setEnabled
(
true
);
View
*
view
=
m_schnapps
->
getSelectedView
();
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
view
&&
map
)
{
if
((
item
->
checkState
()
==
Qt
::
Checked
))
{
const
MapParameters
&
p
=
m_plugin
->
h_viewParameterSet
[
view
][
map
];
Utils
::
VBO
*
v
=
map
->
getVBO
(
item
->
text
());
m_current_vbo
=
p
.
vectorVBOs
.
indexOf
(
v
);
if
(
m_current_vbo
>=
0
)
{
slider_vectorsScaleFactor
->
setSliderPosition
(
p
.
scaleFactors
[
m_current_vbo
]
*
50.0
f
);
std
::
cout
<<
item
->
text
().
toStdString
()
<<
" : "
<<
p
.
scaleFactors
[
m_current_vbo
]
<<
" / "
<<
slider_vectorsScaleFactor
->
value
()
<<
std
::
endl
;
combo_color
->
setColor
(
p
.
colors
[
m_current_vbo
]);
}
}
int
idx
=
p
.
vectorVBOs
.
indexOf
(
v
);
slider_vectorsScaleFactor
->
setEnabled
(
true
);
slider_vectorsScaleFactor
->
setSliderPosition
(
p
.
scaleFactors
[
idx
]
*
50.0
f
);
combo_color
->
setEnabled
(
true
);
combo_color
->
setColor
(
p
.
colors
[
idx
]);
}
else
{
selectedName
->
setText
(
"not selected"
);
slider_vectorsScaleFactor
->
setDisabled
(
true
);
combo_color
->
setDisabled
(
true
);
}
}
}
}
void
Surface_RenderVector_DockTab
::
vectorsVBOChecked
(
QListWidgetItem
*
item
)
{
if
(
!
b_updatingUI
)
...
...
@@ -97,6 +83,7 @@ void Surface_RenderVector_DockTab::vectorsVBOChecked(QListWidgetItem* item)
{
MapParameters
&
p
=
m_plugin
->
h_viewParameterSet
[
view
][
map
];
Utils
::
VBO
*
vbo
=
map
->
getVBO
(
item
->
text
());
if
(
item
->
checkState
()
==
Qt
::
Checked
)
{
p
.
vectorVBOs
.
append
(
vbo
);
...
...
@@ -114,11 +101,10 @@ void Surface_RenderVector_DockTab::vectorsVBOChecked(QListWidgetItem* item)
p
.
vectorVBOs
.
removeAt
(
idx
);
p
.
scaleFactors
.
removeAt
(
idx
);
p
.
colors
.
removeAt
(
idx
);
list_vectorVBO
->
setCurrentItem
(
item
);
list_vectorVBO
->
clearSelection
();
//
list_vectorVBO->setCurrentItem(item);
//
list_vectorVBO->clearSelection();
slider_vectorsScaleFactor
->
setDisabled
(
true
);
combo_color
->
setDisabled
(
true
);
m_current_vbo
=
-
1
;
m_plugin
->
pythonRecording
(
"removeVectorVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
QString
(
item
->
text
()));
}
view
->
updateGL
();
...
...
@@ -126,45 +112,49 @@ void Surface_RenderVector_DockTab::vectorsVBOChecked(QListWidgetItem* item)
}
}
void
Surface_RenderVector_DockTab
::
vectorsScaleFactorChanged
(
int
i
)
{
if
(
!
b_updatingUI
)
{
View
*
view
=
m_schnapps
->
getSelectedView
();
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
view
&&
map
&&
(
m_current_vbo
>=
0
))
QListWidgetItem
*
item
=
list_vectorVBO
->
currentItem
();
if
(
view
&&
map
&&
item
)
{
float
&
scale
=
m_plugin
->
h_viewParameterSet
[
view
][
map
].
scaleFactors
[
m_current_vbo
];
MapParameters
&
p
=
m_plugin
->
h_viewParameterSet
[
view
][
map
];
Utils
::
VBO
*
vbo
=
map
->
getVBO
(
item
->
text
());
int
idx
=
p
.
vectorVBOs
.
indexOf
(
vbo
);
float
&
scale
=
p
.
scaleFactors
[
idx
];
float
newScale
=
float
(
i
)
/
50.0
f
;
std
::
cout
<<
"vectorsScaleFactorChanged "
<<
i
<<
" -> "
<<
newScale
<<
" / old:"
<<
scale
<<
std
::
endl
;
if
(
fabs
(
scale
-
newScale
)
>
0.01
f
)
{
scale
=
newScale
;
m_plugin
->
pythonRecording
(
"changeVectorScaleFactor"
,
""
,
view
->
getName
(),
map
->
getName
(),
selectedName
->
text
(),
newScale
);
item
->
text
(),
newScale
);
view
->
updateGL
();
}
}
}
}
void
Surface_RenderVector_DockTab
::
colorChanged
(
int
i
)
{
if
(
!
b_updatingUI
)
{
View
*
view
=
m_schnapps
->
getSelectedView
();
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
if
(
view
&&
map
&&
(
m_current_vbo
>=
0
))
QListWidgetItem
*
item
=
list_vectorVBO
->
currentItem
();
if
(
view
&&
map
&&
item
)
{
QColor
&
col
=
m_plugin
->
h_viewParameterSet
[
view
][
map
].
colors
[
m_current_vbo
];
MapParameters
&
p
=
m_plugin
->
h_viewParameterSet
[
view
][
map
];
Utils
::
VBO
*
vbo
=
map
->
getVBO
(
item
->
text
());
int
idx
=
p
.
vectorVBOs
.
indexOf
(
vbo
);
QColor
&
col
=
p
.
colors
[
idx
];
if
(
col
!=
combo_color
->
color
())
{
col
=
combo_color
->
color
();
m_plugin
->
pythonRecording
(
"changeVectorColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
selectedName
->
text
(),
combo_color
->
color
().
name
());
item
->
text
(),
combo_color
->
color
().
name
());
view
->
updateGL
();
}
}
...
...
@@ -172,6 +162,9 @@ void Surface_RenderVector_DockTab::colorChanged(int i)
}
void
Surface_RenderVector_DockTab
::
addPositionVBO
(
QString
name
)
{
b_updatingUI
=
true
;
...
...
@@ -211,14 +204,13 @@ void Surface_RenderVector_DockTab::removeVectorVBO(QString name)
void
Surface_RenderVector_DockTab
::
updateMapParameters
()
{
std
::
cout
<<
"Surface_RenderVector_DockTab::updateMapParameters"
<<
std
::
endl
;
b_updatingUI
=
true
;
combo_positionVBO
->
clear
();
combo_positionVBO
->
addItem
(
"- select VBO -"
);
list_vectorVBO
->
clear
();
list_vectorVBO
->
clearSelection
();
View
*
view
=
m_schnapps
->
getSelectedView
();
MapHandlerGen
*
map
=
m_schnapps
->
getSelectedMap
();
...
...
@@ -226,31 +218,29 @@ void Surface_RenderVector_DockTab::updateMapParameters()
{
const
MapParameters
&
p
=
m_plugin
->
h_viewParameterSet
[
view
][
map
];
unsigned
int
i
=
0
;
unsigned
int
i
=
1
;
foreach
(
Utils
::
VBO
*
vbo
,
map
->
getVBOSet
().
values
())
{
if
(
vbo
->
dataSize
()
==
3
)
{
combo_positionVBO
->
addItem
(
QString
::
fromStdString
(
vbo
->
name
()));
if
(
vbo
==
p
.
positionVBO
)
combo_positionVBO
->
setCurrentIndex
(
i
+
1
);
// +1 for "- select VBO -"
combo_positionVBO
->
setCurrentIndex
(
i
);
list_vectorVBO
->
addItem
(
QString
::
fromStdString
(
vbo
->
name
()));
QListWidgetItem
*
item
=
list_vectorVBO
->
item
(
list_vectorVBO
->
count
()
-
1
);
item
->
setFlags
(
item
->
flags
()
|
Qt
::
ItemIsEditable
);
item
->
setCheckState
(
Qt
::
Unchecked
);
if
(
p
.
vectorVBOs
.
contains
(
vbo
))
list_vectorVBO
->
item
(
i
)
->
setCheckState
(
Qt
::
Checked
);
list_vectorVBO
->
item
(
i
-
1
)
->
setCheckState
(
Qt
::
Checked
);
++
i
;
}
}
if
(
m_current_vbo
>=
0
)
{
slider_vectorsScaleFactor
->
setSliderPosition
(
p
.
scaleFactors
[
m_current_vbo
]
*
50.0
f
);
combo_color
->
setColor
(
p
.
colors
[
m_current_vbo
]);
}
// set color
}
slider_vectorsScaleFactor
->
setDisabled
(
true
);
combo_color
->
setDisabled
(
true
);
b_updatingUI
=
false
;
}
...
...
SCHNApps/src/view.cpp
View file @
ada7c5ba
...
...
@@ -13,6 +13,7 @@
#include <QKeyEvent>
#include <QMouseEvent>