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
af2b3121
Commit
af2b3121
authored
Feb 07, 2013
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Plain Diff
Merge cgogn:~cgogn/CGoGN
parents
17d2ebb7
1d0228be
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
564 additions
and
66 deletions
+564
-66
SCHNApps/Plugins/CMakeLists.txt
SCHNApps/Plugins/CMakeLists.txt
+1
-1
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
...s/differentialProperties/include/differentialProperties.h
+6
-6
SCHNApps/Plugins/importSurface/include/importSurface.h
SCHNApps/Plugins/importSurface/include/importSurface.h
+6
-6
SCHNApps/Plugins/importVolume/include/importVolume.h
SCHNApps/Plugins/importVolume/include/importVolume.h
+6
-6
SCHNApps/Plugins/render/include/render.h
SCHNApps/Plugins/render/include/render.h
+6
-6
SCHNApps/Plugins/renderExplod/include/renderExplod.h
SCHNApps/Plugins/renderExplod/include/renderExplod.h
+6
-6
SCHNApps/Plugins/renderVector/forms/renderVector.ui
SCHNApps/Plugins/renderVector/forms/renderVector.ui
+6
-0
SCHNApps/Plugins/renderVector/include/renderVector.h
SCHNApps/Plugins/renderVector/include/renderVector.h
+6
-6
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
+6
-6
SCHNApps/Plugins/surfaceDeformation/forms/surfaceDeformation.ui
...ps/Plugins/surfaceDeformation/forms/surfaceDeformation.ui
+88
-0
SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformation.h
...s/Plugins/surfaceDeformation/include/surfaceDeformation.h
+77
-9
SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
...pps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
+337
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+1
-2
SCHNApps/include/plugin.h
SCHNApps/include/plugin.h
+6
-6
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+6
-6
No files found.
SCHNApps/Plugins/CMakeLists.txt
View file @
af2b3121
...
...
@@ -7,4 +7,4 @@ ADD_SUBDIRECTORY(render)
ADD_SUBDIRECTORY
(
renderVector
)
ADD_SUBDIRECTORY
(
renderExplod
)
ADD_SUBDIRECTORY
(
subdivideSurface
)
ADD_SUBDIRECTORY
(
surfaceDeformation
)
#
ADD_SUBDIRECTORY(surfaceDeformation)
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
View file @
af2b3121
...
...
@@ -30,12 +30,12 @@ public:
virtual
void
redraw
(
View
*
view
)
{}
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
:
void
openComputeNormalDialog
();
...
...
SCHNApps/Plugins/importSurface/include/importSurface.h
View file @
af2b3121
...
...
@@ -27,12 +27,12 @@ public:
virtual
void
redraw
(
View
*
view
)
{}
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
);
...
...
SCHNApps/Plugins/importVolume/include/importVolume.h
View file @
af2b3121
...
...
@@ -27,12 +27,12 @@ public:
virtual
void
redraw
(
View
*
view
)
{}
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
);
...
...
SCHNApps/Plugins/render/include/render.h
View file @
af2b3121
...
...
@@ -89,12 +89,12 @@ public:
virtual
void
redraw
(
View
*
view
);
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
)
{}
void
setRefreshingUI
(
bool
b
)
{
b_refreshingUI
=
b
;
}
...
...
SCHNApps/Plugins/renderExplod/include/renderExplod.h
View file @
af2b3121
...
...
@@ -77,12 +77,12 @@ public:
virtual
void
redraw
(
View
*
view
);
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
)
{}
void
setRefreshingUI
(
bool
b
)
{
b_refreshingUI
=
b
;
}
...
...
SCHNApps/Plugins/renderVector/forms/renderVector.ui
View file @
af2b3121
...
...
@@ -83,6 +83,12 @@
</spacer>
</item>
</layout>
<zorder>
mapList
</zorder>
<zorder>
label_3
</zorder>
<zorder>
list_vectorVBO
</zorder>
<zorder>
label
</zorder>
<zorder>
slider_vectorsScaleFactor
</zorder>
<zorder>
label_2
</zorder>
</widget>
<resources/>
<connections/>
...
...
SCHNApps/Plugins/renderVector/include/renderVector.h
View file @
af2b3121
...
...
@@ -71,12 +71,12 @@ public:
virtual
void
redraw
(
View
*
view
);
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
)
{}
void
setRefreshingUI
(
bool
b
)
{
b_refreshingUI
=
b
;
}
...
...
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
View file @
af2b3121
...
...
@@ -29,12 +29,12 @@ public:
virtual
void
redraw
(
View
*
view
)
{}
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
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
:
void
openSubdivideSurfaceDialog
();
...
...
SCHNApps/Plugins/surfaceDeformation/forms/surfaceDeformation.ui
0 → 100644
View file @
af2b3121
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
SurfaceDeformationWidget
</class>
<widget
class=
"QWidget"
name=
"SurfaceDeformationWidget"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
189
</width>
<height>
545
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<widget
class=
"QListWidget"
name=
"mapList"
/>
</item>
<item>
<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>
<item>
<widget
class=
"QGroupBox"
name=
"groupBox"
>
<property
name=
"title"
>
<string>
Select Vertices
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_7"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QRadioButton"
name=
"radio_locked"
>
<property
name=
"text"
>
<string>
locked
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QRadioButton"
name=
"radio_handle"
>
<property
name=
"text"
>
<string>
handle
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
156
</width>
<height>
161
</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>
mapList
</zorder>
<zorder>
label_2
</zorder>
<zorder>
groupBox
</zorder>
</widget>
<resources/>
<connections/>
</ui>
SCHNApps/Plugins/surfaceDeformation/include/surfaceDeformation.h
View file @
af2b3121
...
...
@@ -8,15 +8,66 @@ using namespace CGoGN;
using
namespace
SCHNApps
;
struct
PerMapParameterSet
{
PerMapParameterSet
()
{}
PerMapParameterSet
(
MapHandlerGen
*
mh
);
VertexAttribute
<
PFP2
::
VEC3
>
positionAttribute
;
CellMarker
<
VERTEX
>
lockingMarker
;
bool
setLockedVertices
;
bool
selecting
;
PFP2
::
VEC3
selectionCenter
;
PFP2
::
REAL
selectionRadius
;
bool
dragging
;
PFP2
::
REAL
dragZ
;
qglviewer
::
Vec
dragPrevious
;
std
::
vector
<
unsigned
int
>
locked_vertices
;
std
::
vector
<
unsigned
int
>
handle_vertices
;
};
struct
ParameterSet
{
ParameterSet
()
:
selectedMap
(
NULL
)
{}
PerMapParameterSet
&
getCurrentMapParameterSet
()
{
return
perMap
[
selectedMap
->
getName
()];
}
QHash
<
QString
,
PerMapParameterSet
>
perMap
;
MapHandlerGen
*
selectedMap
;
};
class
SurfaceDeformationPlugin
;
class
SurfaceDeformationDockTab
:
public
QWidget
,
public
Ui
::
SurfaceDeformationWidget
{
public:
SurfaceDeformationDockTab
(
SurfaceDeformationPlugin
*
p
)
:
plugin
(
p
)
{
setupUi
(
this
);
}
void
refreshUI
(
ParameterSet
*
params
);
private:
SurfaceDeformationPlugin
*
plugin
;
};
class
SurfaceDeformationPlugin
:
public
Plugin
{
Q_OBJECT
Q_INTERFACES
(
CGoGN
::
SCHNApps
::
Plugin
)
public:
SurfaceDeformationPlugin
()
SurfaceDeformationPlugin
()
:
b_refreshingUI
(
false
)
{
setProvidesRendering
(
fals
e
);
setProvidesRendering
(
tru
e
);
}
~
SurfaceDeformationPlugin
()
...
...
@@ -25,19 +76,36 @@ public:
virtual
bool
enable
();
virtual
void
disable
()
{}
virtual
void
redraw
(
View
*
view
)
{}
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
);
virtual
void
keyPress
(
View
*
view
,
int
key
)
{}
virtual
void
keyRelease
(
View
*
view
,
int
key
)
{}
virtual
void
mousePress
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseRelease
(
View
*
view
,
int
button
,
int
x
,
int
y
)
{}
virtual
void
mouseMove
(
View
*
view
,
int
buttons
,
int
x
,
int
y
)
{}
virtual
void
wheelEvent
(
View
*
view
,
int
delta
,
int
x
,
int
y
)
{}
void
setRefreshingUI
(
bool
b
)
{
b_refreshingUI
=
b
;
}
public
slots
:
void
viewLinked
(
View
*
view
,
Plugin
*
plugin
);
void
viewUnlinked
(
View
*
view
,
Plugin
*
plugin
);
void
currentViewChanged
(
View
*
view
);
void
mapLinked
(
MapHandlerGen
*
m
);
void
mapUnlinked
(
MapHandlerGen
*
m
);
void
changeSelectedMap
(
View
*
view
,
MapHandlerGen
*
map
);
void
changePositionAttribute
(
View
*
view
,
MapHandlerGen
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>
attribute
);
void
cb_selectedMapChanged
();
void
cb_positionAttributeChanged
(
int
index
);
private:
RenderVectorDockTab
*
m_dockTab
;
QHash
<
View
*
,
ParameterSet
*>
h_viewParams
;
bool
b_refreshingUI
;
};
#endif
SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
View file @
af2b3121
#include "surfaceDeformation.h"
#include "Algo/Selection/raySelector.h"
#include "Algo/Selection/collector.h"
PerMapParameterSet
::
PerMapParameterSet
(
MapHandlerGen
*
mh
)
:
setLockedVertices
(
true
),
selecting
(
false
),
selectionRadius
(
0.1
f
),
dragging
(
false
)
{
GenericMap
*
map
=
mh
->
getGenericMap
();
AttributeContainer
&
cont
=
map
->
getAttributeContainer
<
VERTEX
>
();
std
::
vector
<
std
::
string
>
names
;
std
::
vector
<
std
::
string
>
types
;
cont
.
getAttributesNames
(
names
);
cont
.
getAttributesTypes
(
types
);
std
::
string
vec3TypeName
=
nameOfType
(
PFP2
::
VEC3
());
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
();
++
i
)
{
if
(
types
[
i
]
==
vec3TypeName
)
{
if
(
names
[
i
]
==
"position"
)
// try to select a position attribute named "position"
positionAttribute
=
mh
->
getAttribute
<
PFP2
::
VEC3
>
(
names
[
i
]);
}
}
if
(
!
positionAttribute
.
isValid
())
{
for
(
unsigned
int
i
=
0
;
i
<
names
.
size
();
++
i
)
{
if
(
types
[
i
]
==
vec3TypeName
)
{
positionAttribute
=
mh
->
getAttribute
<
PFP2
::
VEC3
>
(
names
[
i
]);
break
;
}
}
}
}
bool
SurfaceDeformationPlugin
::
enable
()
{
m_dockTab
=
new
SurfaceDeformationDockTab
(
this
);
addTabInDock
(
m_dockTab
,
"Surface Deformation"
);
connect
(
m_dockTab
->
mapList
,
SIGNAL
(
itemSelectionChanged
()),
this
,
SLOT
(
cb_selectedMapChanged
()));
connect
(
m_dockTab
->
combo_positionAttribute
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
cb_positionAttributeChanged
(
int
)));
connect
(
m_window
,
SIGNAL
(
viewAndPluginLinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
viewLinked
(
View
*
,
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
viewAndPluginUnlinked
(
View
*
,
Plugin
*
)),
this
,
SLOT
(
viewUnlinked
(
View
*
,
Plugin
*
)));
connect
(
m_window
,
SIGNAL
(
currentViewChanged
(
View
*
)),
this
,
SLOT
(
currentViewChanged
(
View
*
)));
return
true
;
}
void
SurfaceDeformationPlugin
::
keyPress
(
View
*
view
,
QKeyEvent
*
event
)
{
if
(
event
->
key
()
==
Qt
::
Key_Shift
)
{
view
->
setMouseTracking
(
true
);
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
&
perMap
=
params
->
getCurrentMapParameterSet
();
perMap
.
selecting
=
true
;
view
->
updateGL
();
}
}
void
SurfaceDeformationPlugin
::
keyRelease
(
View
*
view
,
QKeyEvent
*
event
)
{
if
(
event
->
key
()
==
Qt
::
Key_Shift
)
{
view
->
setMouseTracking
(
false
);
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
&
perMap
=
params
->
getCurrentMapParameterSet
();
perMap
.
selecting
=
false
;
view
->
updateGL
();
}
}
void
SurfaceDeformationPlugin
::
mousePress
(
View
*
view
,
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
RightButton
&&
event
->
modifiers
()
&
Qt
::
ShiftModifier
)
{
view
->
setMouseTracking
(
false
)
;
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
&
perMap
=
params
->
getCurrentMapParameterSet
();
perMap
.
selecting
=
false
;
perMap
.
dragging
=
true
;
perMap
.
dragZ
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
perMap
.
handle_vertices
.
size
();
++
i
)
{
PFP
::
VEC3
&
p
=
perMap
.
positionAttribute
[
handle_vertices
[
i
]]
;
qglviewer
::
Vec
q
=
view
->
projectedCoordinatesOf
(
qglviewer
::
Vec
(
p
[
0
],
p
[
1
],
p
[
2
]));
dragZ
+=
q
.
z
;
}
dragZ
/=
handle_vertices
.
size
()
;
qglviewer
::
Vec
p
(
event
->
x
(),
event
->
y
(),
dragZ
);
perMap
.
dragPrevious
=
view
->
unprojectedCoordinatesOf
(
p
);
}
if
(
button
==
Qt
::
LeftButton
&&
event
->
modifiers
()
&
Qt
::
ShiftModifier
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
&
perMap
=
params
->
getCurrentMapParameterSet
();
QPoint
pixel
(
event
->
x
(),
event
->
y
());
qglviewer
::
Vec
orig
;
qglviewer
::
Vec
dir
;
view
->
convertClickToLine
(
pixel
,
orig
,
dir
);
PFP
::
VEC3
rayA
(
orig
.
x
,
orig
.
y
,
orig
.
z
);
PFP
::
VEC3
AB
(
dir
.
x
,
dir
.
y
,
dir
.
z
);
Dart
d
;
PFP2
::
MAP
map
=
static_cast
<
MapHandler
<
PFP2
>*>
(
params
->
selectedMap
)
->
getMap
();
Algo
::
Selection
::
vertexRaySelection
<
PFP
>
(
*
map
,
position
,
rayA
,
AB
,
d
)
;
if
(
d
!=
NIL
)
{
Algo
::
Surface
::
Selection
::
Collector_WithinSphere
<
PFP
>
neigh
(
*
map
,
perMap
.
positionAttribute
,
perMap
.
selectionRadius
)
;
neigh
.
collectAll
(
d
)
;
const
std
::
vector
<
Dart
>&
insideV
=
neigh
.
getInsideVertices
()
;
if
(
perMap
.
setLockedVertices
)
{
for
(
unsigned
int
i
=
0
;
i
<
insideV
.
size
();
++
i
)
{
unsigned
int
v
=
map
->
getEmbedding
<
VERTEX
>
(
insideV
[
i
])
;
if
(
!
lockingMarker
.
isMarked
(
v
))
{
locked_vertices
.
push_back
(
v
)
;
lockingMarker
.
mark
(
v
);
}
}
LinearSolving
::
resetSolver
(
solver
,
false
)
;
}
else
{
for
(
unsigned
int
i
=
0
;
i
<
insideV
.
size
();
++
i
)
{
unsigned
int
v
=
myMap
.
getEmbedding
<
VERTEX
>
(
insideV
[
i
])
;
if
(
!
handleMarker
.
isMarked
(
v
))
{
handle_vertices
.
push_back
(
v
)
;
handleMarker
.
mark
(
v
);
}
if
(
!
lockingMarker
.
isMarked
(
v
))
{
locked_vertices
.
push_back
(
v
)
;
lockingMarker
.
mark
(
v
)
;
}
}
LinearSolving
::
resetSolver
(
solver
,
false
)
;
}
view
->
updateGL
()
;
}
}
}
void
SurfaceDeformationPlugin
::
mouseRelease
(
View
*
view
,
QMouseEvent
*
event
)
{
if
(
event
->
button
()
==
Qt
::
RightButton
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
&
perMap
=
params
->
getCurrentMapParameterSet
();
perMap
.
dragging
=
false
;
}
}
void
SurfaceDeformationPlugin
::
mouseMove
(
View
*
view
,
QMouseEvent
*
event
)
{
ParameterSet
*
params
=
h_viewParams
[
view
];
PerMapParameterSet
&
perMap
=
params
->
getCurrentMapParameterSet
();
if
(
perMap
.
dragging
)
{
qglviewer
::
Vec
p
(
event
->
x
(),
event
->
y
(),
perMap
.
dragZ
);
qglviewer
::
Vec
q
=
view
->
unprojectedCoordinatesOf
(
p
);
qglviewer
::
Vec
vec
=
q
-
perMap
.
dragPrevious
;
PFP
::
VEC3
t
(
vec
.
x
,
vec
.
y
,
vec
.
z
);
for
(
unsigned
int
i
=
0
;
i
<
handle_vertices
.
size
();
++
i
)
perMap
.
positionAttribute
[
handle_vertices
[
i
]]
+=
t
;
perMap
.
dragPrevious
=
q
;
// matchDiffCoord() ;
// for(unsigned int i = 0; i < 2; ++i)
// asRigidAsPossible();
m_positionVBO
->
updateData
(
position
);
view
->
updateGL
();
}
else
if
(
selecting
)
{
QPoint
pixel
(
event
->
x
(),
event
->
y
());
qglviewer
::
Vec
orig
;
qglviewer
::
Vec
dir
;