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
Hurstel
CGoGN
Commits
5600a6e5
Commit
5600a6e5
authored
Dec 21, 2012
by
Pierre Kraemer
Browse files
SCHNApps: bug fixes
parent
0a2944b2
Changes
9
Hide whitespace changes
Inline
Side-by-side
SCHNApps/Plugins/differentialProperties/forms/computeNormalsDialog.ui
View file @
5600a6e5
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
28
2
</width>
<height>
2
65
</height>
<width>
28
7
</width>
<height>
2
28
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -63,48 +63,63 @@
</widget>
</item>
<item>
<widget
class=
"QDialogButtonBox"
name=
"buttonBox"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"standardButtons"
>
<set>
QDialogButtonBox::Cancel|QDialogButtonBox::Ok
</set>
</property>
</widget>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QPushButton"
name=
"button_cancel"
>
<property
name=
"text"
>
<string>
Cancel
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_apply"
>
<property
name=
"text"
>
<string>
Apply
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_ok"
>
<property
name=
"text"
>
<string>
OK
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>
button
Box
</sender>
<signal>
accept
ed()
</signal>
<sender>
button
_ok
</sender>
<signal>
click
ed()
</signal>
<receiver>
ComputeNormalsDialog
</receiver>
<slot>
accept()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
2
48
</x>
<y>
2
54
</y>
<x>
2
32
</x>
<y>
2
83
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
1
57
</x>
<y>
274
</y>
<x>
1
40
</x>
<y>
156
</y>
</hint>
</hints>
</connection>
<connection>
<sender>
button
Box
</sender>
<signal>
reject
ed()
</signal>
<sender>
button
_cancel
</sender>
<signal>
click
ed()
</signal>
<receiver>
ComputeNormalsDialog
</receiver>
<slot>
reject()
</slot>
<hints>
<hint
type=
"sourcelabel"
>
<x>
316
</x>
<y>
2
60
</y>
<x>
52
</x>
<y>
2
83
</y>
</hint>
<hint
type=
"destinationlabel"
>
<x>
286
</x>
<y>
274
</y>
<x>
140
</x>
<y>
156
</y>
</hint>
</hints>
</connection>
...
...
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
View file @
5600a6e5
...
...
@@ -65,6 +65,7 @@ private:
ComputeNormalsDialog
*
m_computeNormalsDialog
;
QAction
*
computeNormalsAction
;
QAction
*
computeCurvatureAction
;
};
#endif
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
View file @
5600a6e5
...
...
@@ -9,11 +9,17 @@ bool DifferentialPropertiesPlugin::enable()
{
m_computeNormalsDialog
=
new
ComputeNormalsDialog
(
m_window
);
computeNormalsAction
=
new
QAction
(
"import"
,
this
);
addMenuAction
(
"Surface;DifferentialProperties;Compute Normals"
,
computeNormalsAction
);
computeNormalsAction
=
new
QAction
(
"Compute Normals"
,
this
);
computeCurvatureAction
=
new
QAction
(
"Compute Curvature"
,
this
);
addMenuAction
(
"Surface;Differential Properties;Compute Normals"
,
computeNormalsAction
);
addMenuAction
(
"Surface;Differential Properties;Compute Curvature"
,
computeCurvatureAction
);
connect
(
computeNormalsAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openComputeNormalsDialog
()));
connect
(
computeCurvatureAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_openComputeNormalsDialog
()));
connect
(
m_computeNormalsDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
cb_computeNormals
()));
connect
(
m_computeNormalsDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_computeNormals
()));
return
true
;
}
...
...
@@ -32,15 +38,25 @@ void DifferentialPropertiesPlugin::cb_computeNormals()
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP
>*
mh
=
reinterpret_cast
<
MapHandler
<
PFP
>*>
(
m_window
->
getMap
(
mapname
));
MAP
*
map
=
mh
->
getMap
();
std
::
string
positionName
=
m_computeNormalsDialog
->
combo_positionAttribute
->
currentText
().
toUtf8
().
constData
();
std
::
string
normalName
=
m_computeNormalsDialog
->
attributeName
->
text
().
toUtf8
().
constData
();
VertexAttribute
<
VEC3
>
position
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
positionName
);
VertexAttribute
<
VEC3
>
normal
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
normalName
);
if
(
!
normal
.
isValid
())
normal
=
map
->
addAttribute
<
VEC3
,
VERTEX
>
(
normalName
);
Algo
::
Geometry
::
computeNormalVertices
<
PFP
>
(
*
map
,
position
,
normal
);
if
(
m_computeNormalsDialog
->
check_createVBO
->
checkState
()
==
Qt
::
Checked
)
mh
->
createVBO
(
normal
);
QList
<
View
*>
views
=
m_window
->
getViewsList
();
foreach
(
View
*
view
,
views
)
{
if
(
view
->
isLinkedToMap
(
mh
))
view
->
updateGL
();
}
}
}
...
...
SCHNApps/Plugins/render/render.cpp
View file @
5600a6e5
...
...
@@ -139,6 +139,8 @@ void RenderPlugin::viewLinked(View* view)
PerMapParameterSet
p
(
map
);
params
->
perMap
.
insert
(
map
->
getName
(),
p
);
}
if
(
!
maps
.
empty
())
params
->
selectedMap
=
maps
[
0
];
m_dockTab
->
refreshUI
(
params
);
}
...
...
@@ -164,6 +166,8 @@ void RenderPlugin::mapLinked(View* view, MapHandlerGen* m)
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
p
(
m
);
params
->
perMap
.
insert
(
m
->
getName
(),
p
);
if
(
params
->
perMap
.
count
()
==
1
)
params
->
selectedMap
=
m
;
m_dockTab
->
refreshUI
(
params
);
}
...
...
@@ -176,7 +180,10 @@ void RenderPlugin::mapUnlinked(View* view, MapHandlerGen* m)
if
(
params
->
selectedMap
==
m
)
{
params
->
selectedMap
=
NULL
;
if
(
!
params
->
perMap
.
empty
())
params
->
selectedMap
=
m_window
->
getMap
(
params
->
perMap
.
begin
().
key
());
else
params
->
selectedMap
=
NULL
;
m_dockTab
->
refreshUI
(
params
);
}
}
...
...
SCHNApps/Plugins/renderVector/renderVector.cpp
View file @
5600a6e5
...
...
@@ -77,6 +77,8 @@ void RenderVectorPlugin::viewLinked(View* view)
PerMapParameterSet
p
(
map
);
params
->
perMap
.
insert
(
map
->
getName
(),
p
);
}
if
(
!
maps
.
empty
())
params
->
selectedMap
=
maps
[
0
];
m_dockTab
->
refreshUI
(
params
);
}
...
...
@@ -102,6 +104,8 @@ void RenderVectorPlugin::mapLinked(View* view, MapHandlerGen* m)
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
p
(
m
);
params
->
perMap
.
insert
(
m
->
getName
(),
p
);
if
(
params
->
perMap
.
count
()
==
1
)
params
->
selectedMap
=
m
;
m_dockTab
->
refreshUI
(
params
);
}
...
...
@@ -114,7 +118,10 @@ void RenderVectorPlugin::mapUnlinked(View* view, MapHandlerGen* m)
if
(
params
->
selectedMap
==
m
)
{
params
->
selectedMap
=
NULL
;
if
(
!
params
->
perMap
.
empty
())
params
->
selectedMap
=
m_window
->
getMap
(
params
->
perMap
.
begin
().
key
());
else
params
->
selectedMap
=
NULL
;
m_dockTab
->
refreshUI
(
params
);
}
}
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.cpp
View file @
5600a6e5
...
...
@@ -13,7 +13,10 @@ bool SubdivideSurfacePlugin::enable()
connect
(
m_window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
cb_removeMapFromList
(
MapHandlerGen
*
)));
connect
(
m_dockTab
->
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
connect
(
m_dockTab
->
button_trianguleFaces
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_trianguleFaces
()));
connect
(
m_dockTab
->
button_loopSubdivision
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_loopSubdivision
()));
connect
(
m_dockTab
->
button_CCSubdivision
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
cb_CCSubdivision
()));
QList
<
MapHandlerGen
*>
maps
=
m_window
->
getMapsList
();
foreach
(
MapHandlerGen
*
m
,
maps
)
...
...
@@ -68,6 +71,60 @@ void SubdivideSurfacePlugin::cb_selectedMapChanged()
}
}
void
SubdivideSurfacePlugin
::
cb_loopSubdivision
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_dockTab
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP
>*
mh
=
reinterpret_cast
<
MapHandler
<
PFP
>*>
(
m_window
->
getMap
(
mapname
));
MAP
*
map
=
mh
->
getMap
();
std
::
string
positionName
=
m_dockTab
->
combo_positionAttribute
->
currentText
().
toUtf8
().
constData
();
VertexAttribute
<
VEC3
>
position
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
positionName
);
Algo
::
Modelisation
::
LoopSubdivision
<
PFP
>
(
*
map
,
position
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
POINTS
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
mh
->
updateVBO
(
position
);
QList
<
View
*>
views
=
m_window
->
getViewsList
();
foreach
(
View
*
view
,
views
)
{
if
(
view
->
isLinkedToMap
(
mh
))
view
->
updateGL
();
}
}
}
void
SubdivideSurfacePlugin
::
cb_CCSubdivision
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_dockTab
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP
>*
mh
=
reinterpret_cast
<
MapHandler
<
PFP
>*>
(
m_window
->
getMap
(
mapname
));
MAP
*
map
=
mh
->
getMap
();
std
::
string
positionName
=
m_dockTab
->
combo_positionAttribute
->
currentText
().
toUtf8
().
constData
();
VertexAttribute
<
VEC3
>
position
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
positionName
);
Algo
::
Modelisation
::
CatmullClarkSubdivision
<
PFP
>
(
*
map
,
position
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
POINTS
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
mh
->
updateVBO
(
position
);
QList
<
View
*>
views
=
m_window
->
getViewsList
();
foreach
(
View
*
view
,
views
)
{
if
(
view
->
isLinkedToMap
(
mh
))
view
->
updateGL
();
}
}
}
void
SubdivideSurfacePlugin
::
cb_trianguleFaces
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_dockTab
->
mapList
->
selectedItems
();
...
...
@@ -78,11 +135,14 @@ void SubdivideSurfacePlugin::cb_trianguleFaces()
MAP
*
map
=
mh
->
getMap
();
std
::
string
positionName
=
m_dockTab
->
combo_positionAttribute
->
currentText
().
toUtf8
().
constData
();
VertexAttribute
<
VEC3
>
position
=
map
->
getAttribute
<
VEC3
,
VERTEX
>
(
positionName
);
Algo
::
Modelisation
::
trianguleFaces
<
PFP
>
(
*
map
,
position
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
POINTS
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
mh
->
updateVBO
(
position
);
QList
<
View
*>
views
=
m_window
->
getViewsList
();
foreach
(
View
*
view
,
views
)
{
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.h
View file @
5600a6e5
...
...
@@ -70,6 +70,9 @@ public slots:
void
cb_addMapToList
(
MapHandlerGen
*
m
);
void
cb_removeMapFromList
(
MapHandlerGen
*
m
);
void
cb_selectedMapChanged
();
void
cb_loopSubdivision
();
void
cb_CCSubdivision
();
void
cb_trianguleFaces
();
};
...
...
SCHNApps/Plugins/subdivideSurface/subdivideSurface.ui
View file @
5600a6e5
...
...
@@ -38,6 +38,20 @@
</item>
</layout>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_loopSubdivision"
>
<property
name=
"text"
>
<string>
Loop subdivision
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_CCSubdivision"
>
<property
name=
"text"
>
<string>
Catmull-Clark subdivision
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QPushButton"
name=
"button_trianguleFaces"
>
<property
name=
"text"
>
...
...
SCHNApps/forms/mapsDialog.ui
View file @
5600a6e5
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
457
</width>
<height>
374
</height>
<width>
558
</width>
<height>
418
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
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