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
02729b30
Commit
02729b30
authored
Apr 22, 2013
by
Sylvain Thery
Browse files
Merge cgogn:~kraemer/CGoGN
parents
4323777e
8a6d72c0
Changes
13
Hide whitespace changes
Inline
Side-by-side
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
View file @
02729b30
...
...
@@ -137,12 +137,15 @@ void DifferentialPropertiesPlugin::computeCurvatureFromDialog()
else
KnormalName
=
m_computeCurvatureDialog
->
KnormalAttributeName
->
text
();
bool
compute_kmean
=
(
m_computeCurvatureDialog
->
check_computeKmean
->
checkState
()
==
Qt
::
Checked
);
bool
compute_kgaussian
=
(
m_computeCurvatureDialog
->
check_computeKgaussian
->
checkState
()
==
Qt
::
Checked
);
bool
autoUpdate
=
(
currentItems
[
0
]
->
checkState
()
==
Qt
::
Checked
);
computeCurvature
(
mapName
,
positionName
,
normalName
,
KmaxName
,
kmaxName
,
KminName
,
kminName
,
KnormalName
,
compute_kmean
,
compute_kgaussian
,
autoUpdate
);
}
...
...
SCHNApps/Plugins/renderScalar/forms/renderScalar.ui
View file @
02729b30
...
...
@@ -6,7 +6,7 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
1
74
</width>
<width>
1
81
</width>
<height>
545
</height>
</rect>
</property>
...
...
@@ -14,29 +14,25 @@
<string>
Form
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"0"
colspan=
"
2
"
>
<item
row=
"0"
column=
"0"
colspan=
"
4
"
>
<widget
class=
"QListWidget"
name=
"mapList"
/>
</item>
<item
row=
"1"
column=
"0"
colspan=
"2"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout"
>
<item>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QComboBox"
name=
"combo_positionVBO"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
<item
row=
"1"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"text"
>
<string>
Position :
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
colspan=
"3"
>
<widget
class=
"QComboBox"
name=
"combo_positionVBO"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Expanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
>
<widget
class=
"QLabel"
name=
"label_3"
>
...
...
@@ -45,21 +41,21 @@
</property>
</widget>
</item>
<item
row=
"3"
column=
"0"
colspan=
"
2
"
>
<item
row=
"3"
column=
"0"
colspan=
"
4
"
>
<widget
class=
"QListWidget"
name=
"list_scalarVBO"
>
<property
name=
"selectionMode"
>
<enum>
QAbstractItemView::MultiSelection
</enum>
</property>
</widget>
</item>
<item
row=
"
4
"
column=
"0"
>
<item
row=
"
5
"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"text"
>
<string>
Expansion :
</string>
</property>
</widget>
</item>
<item
row=
"
4
"
column=
"
1
"
>
<item
row=
"
5
"
column=
"
2"
colspan=
"2
"
>
<widget
class=
"QSlider"
name=
"slider_expansion"
>
<property
name=
"maximum"
>
<number>
10
</number>
...
...
@@ -72,7 +68,7 @@
</property>
</widget>
</item>
<item
row=
"
5
"
column=
"0"
colspan=
"
2
"
>
<item
row=
"
6
"
column=
"0"
colspan=
"
4
"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
...
...
@@ -85,6 +81,37 @@
</property>
</spacer>
</item>
<item
row=
"4"
column=
"0"
colspan=
"2"
>
<widget
class=
"QLabel"
name=
"label_4"
>
<property
name=
"text"
>
<string>
Colormap :
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"2"
colspan=
"2"
>
<widget
class=
"QComboBox"
name=
"combo_colorMap"
>
<item>
<property
name=
"text"
>
<string>
BlueWhiteRed
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
CyanWhiteRed
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
BlueCyanGreenYellowRed
</string>
</property>
</item>
<item>
<property
name=
"text"
>
<string>
BlueGreenRed
</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<resources/>
...
...
SCHNApps/Plugins/renderScalar/include/renderScalar.h
View file @
02729b30
...
...
@@ -12,6 +12,13 @@ namespace CGoGN
namespace
SCHNApps
{
enum
ColorMap
{
BlueWhiteRed
=
0
,
CyanWhiteRed
=
1
,
BlueCyanGreenYellowRed
=
2
,
BlueGreenRed
=
3
};
struct
PerMapParameterSet
{
PerMapParameterSet
()
:
...
...
@@ -23,6 +30,7 @@ struct PerMapParameterSet
Utils
::
VBO
*
positionVBO
;
Utils
::
VBO
*
scalarVBO
;
float
scalarMin
,
scalarMax
;
int
colorMap
;
int
expansion
;
};
...
...
@@ -85,6 +93,7 @@ public slots:
void
changePositionVBO
(
View
*
view
,
MapHandlerGen
*
map
,
Utils
::
VBO
*
vbo
,
bool
fromUI
=
false
);
void
changeScalarVBO
(
View
*
view
,
MapHandlerGen
*
map
,
Utils
::
VBO
*
vbo
,
bool
fromUI
=
false
);
void
changeColorMap
(
View
*
view
,
MapHandlerGen
*
map
,
int
c
,
bool
fromUI
=
false
);
void
changeExpansion
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
=
false
);
void
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
);
...
...
SCHNApps/Plugins/renderScalar/include/renderScalarDockTab.h
View file @
02729b30
...
...
@@ -34,6 +34,7 @@ public slots:
void
positionVBOChanged
(
int
index
);
void
selectedScalarVBOChanged
();
void
colorMapChanged
(
int
index
);
void
expansionChanged
(
int
i
);
void
addVBOToList
(
Utils
::
VBO
*
vbo
);
...
...
SCHNApps/Plugins/renderScalar/src/renderScalar.cpp
View file @
02729b30
...
...
@@ -11,6 +11,7 @@ namespace SCHNApps
PerMapParameterSet
::
PerMapParameterSet
(
MapHandlerGen
*
map
)
:
positionVBO
(
NULL
),
scalarVBO
(
NULL
),
colorMap
(
BlueWhiteRed
),
expansion
(
0
)
{
bool
positionFound
=
false
;
...
...
@@ -37,7 +38,6 @@ bool RenderScalarPlugin::enable()
addTabInDock
(
m_dockTab
,
"RenderScalar"
);
m_scalarShader
=
new
Utils
::
ShaderScalarField
();
registerShader
(
m_scalarShader
);
connect
(
m_window
,
SIGNAL
(
viewAndPluginLinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
viewLinked
(
View
*
,
Plugin
*
)));
...
...
@@ -66,6 +66,7 @@ void RenderScalarPlugin::redraw(View* view)
m_scalarShader
->
setAttributeScalar
(
p
->
scalarVBO
);
m_scalarShader
->
setMinValue
(
p
->
scalarMin
);
m_scalarShader
->
setMaxValue
(
p
->
scalarMax
);
m_scalarShader
->
setColorMap
(
p
->
colorMap
);
m_scalarShader
->
setExpansion
(
p
->
expansion
);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
...
...
@@ -229,6 +230,19 @@ void RenderScalarPlugin::changeScalarVBO(View* view, MapHandlerGen* map, Utils::
}
}
void
RenderScalarPlugin
::
changeColorMap
(
View
*
view
,
MapHandlerGen
*
map
,
int
c
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
params
->
perMap
[
map
->
getName
()]
->
colorMap
=
c
;
if
(
view
->
isCurrentView
())
{
if
(
!
fromUI
)
m_dockTab
->
refreshUI
(
params
);
view
->
updateGL
();
}
}
void
RenderScalarPlugin
::
changeExpansion
(
View
*
view
,
MapHandlerGen
*
map
,
int
i
,
bool
fromUI
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
...
...
SCHNApps/Plugins/renderScalar/src/renderScalarDockTab.cpp
View file @
02729b30
...
...
@@ -20,6 +20,7 @@ RenderScalarDockTab::RenderScalarDockTab(Window* w, RenderScalarPlugin* p) :
connect
(
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedMapChanged
()));
connect
(
combo_positionVBO
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
positionVBOChanged
(
int
)));
connect
(
list_scalarVBO
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
selectedScalarVBOChanged
()));
connect
(
combo_colorMap
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
colorMapChanged
(
int
)));
connect
(
slider_expansion
,
SIGNAL
(
valueChanged
(
int
)),
this
,
SLOT
(
expansionChanged
(
int
)));
}
...
...
@@ -68,6 +69,7 @@ void RenderScalarDockTab::refreshUI(ParameterSet* params)
}
}
combo_colorMap
->
setCurrentIndex
(
p
->
colorMap
);
slider_expansion
->
setSliderPosition
(
p
->
expansion
);
}
++
i
;
...
...
@@ -117,6 +119,16 @@ void RenderScalarDockTab::selectedScalarVBOChanged()
}
}
void
RenderScalarDockTab
::
colorMapChanged
(
int
index
)
{
if
(
!
b_refreshingUI
)
{
View
*
view
=
m_window
->
getCurrentView
();
MapHandlerGen
*
map
=
m_currentParams
->
selectedMap
;
m_plugin
->
changeColorMap
(
view
,
map
,
index
,
true
);
}
}
void
RenderScalarDockTab
::
expansionChanged
(
int
i
)
{
if
(
!
b_refreshingUI
)
...
...
include/Topology/generic/genericmap.h
View file @
02729b30
...
...
@@ -47,7 +47,6 @@ namespace CGoGN
/**
* Class that allows to browse a map
* This is a pure virtual class that can be overloaded in:
* - a map (generic and so on)
* - a MapBrowserSelector
* - a MapBrowserLinked (Attr or Auto)
*/
...
...
@@ -64,7 +63,7 @@ class DartMarkerGen ;
class
CellMarkerGen
;
template
<
unsigned
int
CELL
>
class
CellMarkerBase
;
class
GenericMap
// : public MapBrowser
class
GenericMap
{
template
<
typename
T
,
unsigned
int
ORBIT
>
friend
class
AttributeHandler
;
template
<
typename
T
>
friend
class
DartAutoAttribute
;
...
...
@@ -79,7 +78,7 @@ class GenericMap// : public MapBrowser
protected:
/**
* @brief current MapBrowser use to traverse
* @brief current MapBrowser use
d
to traverse
the map
*/
MapBrowser
*
m_currentBrowser
;
...
...
@@ -191,7 +190,7 @@ public:
/**
* @brief set the current MapBrowser
* @param mb pointer on MapBrowser to use (default is map it
self)
* @param mb pointer on MapBrowser to use (default is map itself)
*/
void
setBrowser
(
MapBrowser
*
mb
)
{
m_currentBrowser
=
mb
;
}
...
...
include/Topology/generic/mapBrowser.h
View file @
02729b30
...
...
@@ -110,6 +110,6 @@ public:
}
// namespace CGoGN
#include
"mapBrowser.hpp"
#include
"
Topology/generic/
mapBrowser.hpp"
#endif
/* MAPBROWSER_H_ */
include/Utils/Shaders/shaderScalarField.frag
View file @
02729b30
// ShaderScalarField::fragmentShaderText
PRECISON
;
uniform
float
minValue
;
uniform
float
maxValue
;
VARYING_FRAG
vec3
color
;
VARYING_FRAG
float
scalar
;
FRAG_OUT_DEF
;
void
main
()
{
// float s = scalar *
2
0.0;
// if( s - floor(s) <= 0.0
1
)
// float s = scalar *
1
0.0;
// if( s - floor(s) <= 0.0
5
)
// gl_FragColor = vec4(0.0);
// else
gl_FragColor
=
vec4
(
color
,
0
.
0
);
...
...
include/Utils/Shaders/shaderScalarField.h
View file @
02729b30
...
...
@@ -44,6 +44,7 @@ protected:
CGoGNGLuint
m_uniform_minValue
;
CGoGNGLuint
m_uniform_maxValue
;
CGoGNGLuint
m_uniform_colorMap
;
CGoGNGLuint
m_uniform_expansion
;
VBO
*
m_vboPos
;
...
...
@@ -51,6 +52,7 @@ protected:
float
m_minValue
;
float
m_maxValue
;
int
m_colorMap
;
int
m_expansion
;
void
getLocations
();
...
...
@@ -70,6 +72,8 @@ public:
void
setMaxValue
(
float
f
);
void
setColorMap
(
int
i
);
void
setExpansion
(
int
i
);
};
...
...
include/Utils/Shaders/shaderScalarField.vert
View file @
02729b30
...
...
@@ -5,6 +5,7 @@ ATTRIBUTE float VertexScalar;
uniform
mat4
ModelViewProjectionMatrix
;
uniform
float
minValue
;
uniform
float
maxValue
;
uniform
int
colorMap
;
uniform
int
expansion
;
VARYING_VERT
vec3
color
;
VARYING_VERT
float
scalar
;
...
...
@@ -58,6 +59,54 @@ vec3 color_map_blue_white_red(float x)
return
c
;
}
vec3
color_map_cyan_white_red
(
float
x
)
{
if
(
x
<
0
.
0
)
return
vec3
(
0
.
0
,
0
.
0
,
1
.
0
)
;
if
(
x
<
0
.
5
)
return
vec3
(
2
.
0
*
x
,
1
.
0
,
1
.
0
);
if
(
x
<
1
.
0
)
return
vec3
(
1
.
0
,
2
.
0
-
2
.
0
*
x
,
2
.
0
-
2
.
0
*
x
);
return
vec3
(
1
.
0
,
0
.
0
,
0
.
0
)
;
}
vec3
color_map_BCGYR
(
float
x
)
{
if
(
x
<
0
.
0
)
return
vec3
(
0
.
0
,
0
.
0
,
1
.
0
)
;
if
(
x
<
0
.
25
)
return
vec3
(
0
.
0
,
4
.
0
*
x
,
1
.
0
);
if
(
x
<
0
.
5
)
return
vec3
(
0
.
0
,
1
.
0
,
2
.
0
-
4
.
0
*
x
);
if
(
x
<
0
.
75
)
return
vec3
(
4
.
0
*
x
-
2
.
0
,
1
.
0
,
0
.
0
);
if
(
x
<
1
.
0
)
return
vec3
(
1
.
0
,
4
.
0
-
4
.
0
*
x
,
0
.
0
);
return
vec3
(
1
.
0
,
0
.
0
,
0
.
0
)
;
}
vec3
color_map_blue_green_red
(
float
x
)
{
if
(
x
<
0
.
0
)
return
vec3
(
0
.
0
,
0
.
0
,
1
.
0
)
;
if
(
x
<
0
.
5
)
return
vec3
(
0
.
0
,
2
.
0
*
x
,
1
.
0
-
2
.
0
*
x
);
if
(
x
<
1
.
0
)
return
vec3
(
2
.
0
*
x
-
1
.
0
,
2
.
0
-
2
.
0
*
x
,
0
.
0
);
return
vec3
(
1
.
0
,
0
.
0
,
0
.
0
)
;
}
void
main
()
{
gl_Position
=
ModelViewProjectionMatrix
*
vec4
(
VertexPosition
,
1
.
0
);
...
...
@@ -70,6 +119,14 @@ void main ()
),
expansion
);
color
=
color_map_blue_white_red
(
value
);
switch
(
colorMap
)
{
case
0
:
color
=
color_map_blue_white_red
(
value
);
break
;
case
1
:
color
=
color_map_cyan_white_red
(
value
);
break
;
case
2
:
color
=
color_map_BCGYR
(
value
);
break
;
case
3
:
color
=
color_map_blue_green_red
(
value
);
break
;
}
scalar
=
value
;
}
include/Utils/colorMaps.hpp
View file @
02729b30
...
...
@@ -47,10 +47,10 @@ inline Geom::Vec3f color_map_blue_green_red(float x)
if
(
x
<
0.5
f
)
return
Geom
::
Vec3f
(
0.0
f
,
2.0
f
*
x
,
1.0
f
-
2.0
f
*
x
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
2.0
f
*
x
-
1.0
f
,
2.0
f
-
2.0
f
*
x
,
0.0
f
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
2.0
f
*
x
-
1.0
f
,
2.0
f
-
2.0
f
*
x
,
0.0
f
);
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
}
inline
Geom
::
Vec3f
color_map_BCGYR
(
float
x
)
...
...
@@ -67,10 +67,10 @@ inline Geom::Vec3f color_map_BCGYR(float x)
if
(
x
<
0.75
f
)
return
Geom
::
Vec3f
(
4.0
f
*
x
-
2.0
f
,
1.0
f
,
0.0
f
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
1.0
f
,
4.0
f
-
4.0
f
*
x
,
0.0
f
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
1.0
f
,
4.0
f
-
4.0
f
*
x
,
0.0
f
);
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
}
inline
Geom
::
Vec3f
color_map_blue_white_red
(
float
x
)
...
...
@@ -81,10 +81,10 @@ inline Geom::Vec3f color_map_blue_white_red(float x)
if
(
x
<
0.5
f
)
return
Geom
::
Vec3f
(
2.0
f
*
x
,
2.0
f
*
x
,
1.0
f
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
1.0
f
,
2.0
f
-
2.0
f
*
x
,
2.0
f
-
2.0
f
*
x
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
1.0
f
,
2.0
f
-
2.0
f
*
x
,
2.0
f
-
2.0
f
*
x
);
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
}
inline
Geom
::
Vec3f
color_map_cyan_white_red
(
float
x
)
...
...
@@ -95,10 +95,10 @@ inline Geom::Vec3f color_map_cyan_white_red(float x)
if
(
x
<
0.5
f
)
return
Geom
::
Vec3f
(
2.0
f
*
x
,
1.0
f
,
1.0
f
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
1.0
f
,
2.0
f
-
2.0
f
*
x
,
2.0
f
-
2.0
f
*
x
);
if
(
x
<
1.0
f
)
return
Geom
::
Vec3f
(
1.0
f
,
2.0
f
-
2.0
f
*
x
,
2.0
f
-
2.0
f
*
x
);
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
return
Geom
::
Vec3f
(
1.0
f
,
0.0
f
,
0.0
f
)
;
}
...
...
src/Utils/Shaders/shaderScalarField.cpp
View file @
02729b30
...
...
@@ -56,6 +56,7 @@ void ShaderScalarField::getLocations()
bind
();
*
m_uniform_minValue
=
glGetUniformLocation
(
this
->
program_handler
(),
"minValue"
);
*
m_uniform_maxValue
=
glGetUniformLocation
(
this
->
program_handler
(),
"maxValue"
);
*
m_uniform_colorMap
=
glGetUniformLocation
(
this
->
program_handler
(),
"colorMap"
);
*
m_uniform_expansion
=
glGetUniformLocation
(
this
->
program_handler
(),
"expansion"
);
unbind
();
}
...
...
@@ -65,6 +66,7 @@ void ShaderScalarField::sendParams()
bind
();
glUniform1f
(
*
m_uniform_minValue
,
m_minValue
);
glUniform1f
(
*
m_uniform_maxValue
,
m_maxValue
);
glUniform1i
(
*
m_uniform_colorMap
,
m_colorMap
);
glUniform1i
(
*
m_uniform_expansion
,
m_expansion
);
unbind
();
}
...
...
@@ -103,11 +105,19 @@ void ShaderScalarField::setMaxValue(float f)
unbind
();
}
void
ShaderScalarField
::
set
Expansion
(
int
f
)
void
ShaderScalarField
::
set
ColorMap
(
int
i
)
{
m_
expansion
=
f
;
m_
colorMap
=
i
;
bind
();
glUniform1i
(
*
m_uniform_expansion
,
f
);
glUniform1i
(
*
m_uniform_colorMap
,
i
);
unbind
();
}
void
ShaderScalarField
::
setExpansion
(
int
i
)
{
m_expansion
=
i
;
bind
();
glUniform1i
(
*
m_uniform_expansion
,
i
);
unbind
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment