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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Etienne Schmitt
CGoGN
Commits
7bb2d103
Commit
7bb2d103
authored
Feb 14, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: first version of attributes auto update
parent
9da47178
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
204 additions
and
72 deletions
+204
-72
SCHNApps/Plugins/differentialProperties/include/computeNormalDialog.h
...gins/differentialProperties/include/computeNormalDialog.h
+0
-2
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
...s/differentialProperties/include/differentialProperties.h
+19
-6
SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp
...lugins/differentialProperties/src/computeNormalDialog.cpp
+0
-9
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
...ins/differentialProperties/src/differentialProperties.cpp
+46
-13
SCHNApps/Plugins/importSurface/include/importSurface.h
SCHNApps/Plugins/importSurface/include/importSurface.h
+8
-2
SCHNApps/Plugins/importSurface/src/importSurface.cpp
SCHNApps/Plugins/importSurface/src/importSurface.cpp
+15
-2
SCHNApps/Plugins/importVolume/include/importVolume.h
SCHNApps/Plugins/importVolume/include/importVolume.h
+8
-2
SCHNApps/Plugins/importVolume/src/importVolume.cpp
SCHNApps/Plugins/importVolume/src/importVolume.cpp
+15
-2
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
+18
-5
SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp
SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp
+65
-25
SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
...pps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
+0
-2
SCHNApps/bin/init.py
SCHNApps/bin/init.py
+1
-1
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+9
-1
No files found.
SCHNApps/Plugins/differentialProperties/include/computeNormalDialog.h
View file @
7bb2d103
...
...
@@ -28,8 +28,6 @@ public slots:
void
addMapToList
(
MapHandlerGen
*
m
);
void
removeMapFromList
(
MapHandlerGen
*
m
);
void
addAttributeToList
(
unsigned
int
orbit
,
const
QString
&
nameAttr
);
void
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
);
};
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/differentialProperties/include/differentialProperties.h
View file @
7bb2d103
...
...
@@ -38,18 +38,22 @@ public:
virtual
void
wheelEvent
(
View
*
view
,
QWheelEvent
*
event
)
{}
public
slots
:
void
mapAdded
(
MapHandlerGen
*
map
);
void
mapRemoved
(
MapHandlerGen
*
map
);
void
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
);
void
openComputeNormalDialog
();
void
openComputeCurvatureDialog
();
void
computeNormalFromDialog
();
void
computeCurvatureFromDialog
();
void
computeNormal
(
const
QString
&
mapName
,
void
computeNormal
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
,
const
QString
&
normalAttributeName
=
"normal"
,
bool
createNormalVBO
=
true
);
bool
createNormalVBO
=
true
,
bool
autoUpdateNormal
=
true
);
void
computeCurvature
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
,
...
...
@@ -63,7 +67,12 @@ public slots:
bool
createkmaxVBO
=
true
,
bool
createKminVBO
=
true
,
bool
createkminVBO
=
true
,
bool
createKnormalVBO
=
true
bool
createKnormalVBO
=
true
,
bool
autoUpdateKmax
=
true
,
bool
autoUpdatekmax
=
true
,
bool
autoUpdateKmin
=
true
,
bool
autoUpdatekmin
=
true
,
bool
autoUpdateKnormal
=
true
);
private:
...
...
@@ -76,9 +85,13 @@ private:
struct
ComputeNormalParameters
{
ComputeNormalParameters
()
{}
ComputeNormalParameters
(
QString
p
,
QString
n
)
:
positionName
(
p
),
normalName
(
n
)
{}
ComputeNormalParameters
(
QString
p
,
QString
n
,
bool
vbo
,
bool
update
)
:
positionName
(
p
),
normalName
(
n
),
createVBO
(
vbo
),
autoUpdate
(
update
)
{}
QString
positionName
;
QString
normalName
;
bool
createVBO
;
bool
autoUpdate
;
};
QHash
<
QString
,
ComputeNormalParameters
>
computeNormalLastParameters
;
};
...
...
SCHNApps/Plugins/differentialProperties/src/computeNormalDialog.cpp
View file @
7bb2d103
...
...
@@ -105,15 +105,6 @@ void ComputeNormalDialog::addAttributeToList(unsigned int orbit, const QString&
}
}
void
ComputeNormalDialog
::
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
)
{
MapHandlerGen
*
map
=
static_cast
<
MapHandlerGen
*>
(
QObject
::
sender
());
// if(orbit == VERTEX && nameAttr == )
// {
// }
}
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/Plugins/differentialProperties/src/differentialProperties.cpp
View file @
7bb2d103
...
...
@@ -25,9 +25,36 @@ bool DifferentialPropertiesPlugin::enable()
connect
(
m_computeCurvatureDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
computeCurvatureFromDialog
()));
connect
(
m_computeCurvatureDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
computeCurvatureFromDialog
()));
connect
(
m_window
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_window
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
return
true
;
}
void
DifferentialPropertiesPlugin
::
mapAdded
(
MapHandlerGen
*
map
)
{
connect
(
map
,
SIGNAL
(
attributeModified
(
unsigned
int
,
QString
)),
this
,
SLOT
(
attributeModified
(
unsigned
int
,
QString
)));
}
void
DifferentialPropertiesPlugin
::
mapRemoved
(
MapHandlerGen
*
map
)
{
disconnect
(
map
,
SIGNAL
(
attributeModified
(
unsigned
int
,
QString
)),
this
,
SLOT
(
attributeModified
(
unsigned
int
,
QString
)));
}
void
DifferentialPropertiesPlugin
::
attributeModified
(
unsigned
int
orbit
,
QString
nameAttr
)
{
if
(
orbit
==
VERTEX
)
{
MapHandlerGen
*
map
=
static_cast
<
MapHandlerGen
*>
(
QObject
::
sender
());
if
(
computeNormalLastParameters
.
contains
(
map
->
getName
()))
{
ComputeNormalParameters
&
params
=
computeNormalLastParameters
[
map
->
getName
()];
if
(
params
.
positionName
==
nameAttr
&&
params
.
autoUpdate
)
computeNormal
(
map
->
getName
(),
params
.
positionName
,
params
.
normalName
,
params
.
createVBO
);
}
}
}
void
DifferentialPropertiesPlugin
::
openComputeNormalDialog
()
{
m_computeNormalDialog
->
show
();
...
...
@@ -46,6 +73,7 @@ void DifferentialPropertiesPlugin::computeNormalFromDialog()
const
QString
&
mapName
=
currentItems
[
0
]
->
text
();
QString
positionName
=
m_computeNormalDialog
->
combo_positionAttribute
->
currentText
();
QString
normalName
;
if
(
m_computeNormalDialog
->
normalAttributeName
->
text
().
isEmpty
())
normalName
=
m_computeNormalDialog
->
combo_normalAttribute
->
currentText
();
...
...
@@ -54,7 +82,9 @@ void DifferentialPropertiesPlugin::computeNormalFromDialog()
bool
createVBO
=
(
m_computeNormalDialog
->
check_createVBO
->
checkState
()
==
Qt
::
Checked
);
computeNormal
(
mapName
,
positionName
,
normalName
,
createVBO
);
bool
autoUpdate
=
(
currentItems
[
0
]
->
checkState
()
==
Qt
::
Checked
);
computeNormal
(
mapName
,
positionName
,
normalName
,
createVBO
,
autoUpdate
);
}
}
...
...
@@ -73,39 +103,34 @@ void DifferentialPropertiesPlugin::computeCurvatureFromDialog()
KmaxName
=
m_computeCurvatureDialog
->
combo_KmaxAttribute
->
currentText
();
else
KmaxName
=
m_computeCurvatureDialog
->
KmaxAttributeName
->
text
();
bool
KmaxVBO
=
(
m_computeCurvatureDialog
->
check_KmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
);
QString
kmaxName
;
if
(
m_computeCurvatureDialog
->
kmaxAttributeName
->
text
().
isEmpty
())
kmaxName
=
m_computeCurvatureDialog
->
combo_kmaxAttribute
->
currentText
();
else
kmaxName
=
m_computeCurvatureDialog
->
kmaxAttributeName
->
text
();
bool
kmaxVBO
=
(
m_computeCurvatureDialog
->
check_kmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
);
QString
KminName
;
if
(
m_computeCurvatureDialog
->
KminAttributeName
->
text
().
isEmpty
())
KminName
=
m_computeCurvatureDialog
->
combo_KminAttribute
->
currentText
();
else
KminName
=
m_computeCurvatureDialog
->
KminAttributeName
->
text
();
bool
KminVBO
=
(
m_computeCurvatureDialog
->
check_KminCreateVBO
->
checkState
()
==
Qt
::
Checked
);
QString
kminName
;
if
(
m_computeCurvatureDialog
->
kminAttributeName
->
text
().
isEmpty
())
kminName
=
m_computeCurvatureDialog
->
combo_kminAttribute
->
currentText
();
else
kminName
=
m_computeCurvatureDialog
->
kminAttributeName
->
text
();
bool
kminVBO
=
(
m_computeCurvatureDialog
->
check_kminCreateVBO
->
checkState
()
==
Qt
::
Checked
);
QString
KnormalName
;
if
(
m_computeCurvatureDialog
->
KnormalAttributeName
->
text
().
isEmpty
())
KnormalName
=
m_computeCurvatureDialog
->
combo_KnormalAttribute
->
currentText
();
else
KnormalName
=
m_computeCurvatureDialog
->
KnormalAttributeName
->
text
();
bool
KmaxVBO
=
(
m_computeCurvatureDialog
->
check_KmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
);
bool
kmaxVBO
=
(
m_computeCurvatureDialog
->
check_kmaxCreateVBO
->
checkState
()
==
Qt
::
Checked
);
bool
KminVBO
=
(
m_computeCurvatureDialog
->
check_KminCreateVBO
->
checkState
()
==
Qt
::
Checked
);
bool
kminVBO
=
(
m_computeCurvatureDialog
->
check_kminCreateVBO
->
checkState
()
==
Qt
::
Checked
);
bool
KnormalVBO
=
(
m_computeCurvatureDialog
->
check_KnormalCreateVBO
->
checkState
()
==
Qt
::
Checked
);
computeCurvature
(
...
...
@@ -119,7 +144,8 @@ void DifferentialPropertiesPlugin::computeNormal(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
,
const
QString
&
normalAttributeName
,
bool
createNormalVBO
)
bool
createNormalVBO
,
bool
autoUpdateNormal
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
...
...
@@ -140,7 +166,9 @@ void DifferentialPropertiesPlugin::computeNormal(
mh
->
createVBO
(
normal
);
computeNormalLastParameters
[
mapName
]
=
ComputeNormalParameters
(
positionAttributeName
,
normalAttributeName
)
;
ComputeNormalParameters
(
positionAttributeName
,
normalAttributeName
,
createNormalVBO
,
autoUpdateNormal
)
;
mh
->
notifyAttributeModification
(
normal
);
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
...
...
@@ -160,7 +188,12 @@ void DifferentialPropertiesPlugin::computeCurvature(
bool
createkmaxVBO
,
bool
createKminVBO
,
bool
createkminVBO
,
bool
createKnormalVBO
)
bool
createKnormalVBO
,
bool
autoUpdateKmax
,
bool
autoUpdatekmax
,
bool
autoUpdateKmin
,
bool
autoUpdatekmin
,
bool
autoUpdateKnormal
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
...
...
SCHNApps/Plugins/importSurface/include/importSurface.h
View file @
7bb2d103
...
...
@@ -4,9 +4,11 @@
#include "plugin.h"
using
namespace
CGoGN
;
using
namespace
SCHNApps
;
namespace
CGoGN
{
namespace
SCHNApps
{
class
ImportSurfacePlugin
:
public
Plugin
{
...
...
@@ -42,4 +44,8 @@ private:
QAction
*
importAction
;
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/Plugins/importSurface/src/importSurface.cpp
View file @
7bb2d103
...
...
@@ -7,6 +7,12 @@
#include <QFileDialog>
#include <QFileInfo>
namespace
CGoGN
{
namespace
SCHNApps
{
bool
ImportSurfacePlugin
::
enable
()
{
importAction
=
new
QAction
(
"import"
,
this
);
...
...
@@ -30,12 +36,15 @@ MapHandlerGen* ImportSurfacePlugin::importFromFile(const QString& fileName)
Algo
::
Surface
::
Import
::
importMesh
<
PFP2
>
(
*
map
,
fileName
.
toStdString
(),
attrNames
);
// get vertex position attribute
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
CGoGN
::
VERTEX
>
(
attrNames
[
0
]);
mh
->
registerAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
position
);
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
attrNames
[
0
]);
mh
->
registerAttribute
(
position
);
// create VBO for vertex position attribute
mh
->
createVBO
(
position
);
// update corresponding VBO & emit attribute update signal
mh
->
notifyAttributeModification
(
position
);
// compute map bounding box
mh
->
updateBB
(
position
);
}
...
...
@@ -56,3 +65,7 @@ Q_EXPORT_PLUGIN2(ImportSurfacePlugin, ImportSurfacePlugin)
#else
Q_EXPORT_PLUGIN2
(
ImportSurfacePluginD
,
ImportSurfacePlugin
)
#endif
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/Plugins/importVolume/include/importVolume.h
View file @
7bb2d103
...
...
@@ -4,9 +4,11 @@
#include "plugin.h"
using
namespace
CGoGN
;
using
namespace
SCHNApps
;
namespace
CGoGN
{
namespace
SCHNApps
{
class
ImportVolumePlugin
:
public
Plugin
{
...
...
@@ -42,4 +44,8 @@ private:
QAction
*
importAction
;
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/Plugins/importVolume/src/importVolume.cpp
View file @
7bb2d103
...
...
@@ -7,6 +7,12 @@
#include <QFileDialog>
#include <QFileInfo>
namespace
CGoGN
{
namespace
SCHNApps
{
bool
ImportVolumePlugin
::
enable
()
{
importAction
=
new
QAction
(
"import"
,
this
);
...
...
@@ -30,12 +36,15 @@ MapHandlerGen* ImportVolumePlugin::importFromFile(const QString& fileName)
Algo
::
Volume
::
Import
::
importMesh
<
PFP3
>
(
*
map
,
fileName
.
toStdString
(),
attrNames
);
// get vertex position attribute
VertexAttribute
<
PFP3
::
VEC3
>
position
=
map
->
getAttribute
<
PFP3
::
VEC3
,
CGoGN
::
VERTEX
>
(
attrNames
[
0
]);
mh
->
registerAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
position
);
VertexAttribute
<
PFP3
::
VEC3
>
position
=
map
->
getAttribute
<
PFP3
::
VEC3
,
VERTEX
>
(
attrNames
[
0
]);
mh
->
registerAttribute
(
position
);
// create VBO for vertex position attribute
mh
->
createVBO
(
position
);
// update corresponding VBO & emit attribute update signal
mh
->
notifyAttributeModification
(
position
);
// compute map bounding box
mh
->
updateBB
(
position
);
}
...
...
@@ -56,3 +65,7 @@ Q_EXPORT_PLUGIN2(ImportVolumePlugin, ImportVolumePlugin)
#else
Q_EXPORT_PLUGIN2
(
ImportVolumePluginD
,
ImportVolumePlugin
)
#endif
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/Plugins/subdivideSurface/include/subdivideSurface.h
View file @
7bb2d103
...
...
@@ -38,11 +38,24 @@ public:
public
slots
:
void
openSubdivideSurfaceDialog
();
void
subdivideSurface
();
void
loopSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
);
void
CCSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
);
void
trianguleFaces
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
);
void
subdivideSurfaceFromDialog
();
void
loopSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
void
CCSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
void
trianguleFaces
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
);
// void loopSubdivision(PFP2::MAP* map, VertexAttribute<PFP2::VEC3>& position);
// void CCSubdivision(PFP2::MAP* map, VertexAttribute<PFP2::VEC3>& position);
// void trianguleFaces(PFP2::MAP* map, VertexAttribute<PFP2::VEC3>& position);
private:
SubdivideSurfaceDialog
*
m_subdivideSurfaceDialog
;
...
...
SCHNApps/Plugins/subdivideSurface/src/subdivideSurface.cpp
View file @
7bb2d103
...
...
@@ -20,8 +20,8 @@ bool SubdivideSurfacePlugin::enable()
connect
(
m_subdivideSurfaceAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
openSubdivideSurfaceDialog
()));
connect
(
m_subdivideSurfaceDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
subdivideSurface
()));
connect
(
m_subdivideSurfaceDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
subdivideSurface
()));
connect
(
m_subdivideSurfaceDialog
,
SIGNAL
(
accepted
()),
this
,
SLOT
(
subdivideSurface
FromDialog
()));
connect
(
m_subdivideSurfaceDialog
->
button_apply
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
subdivideSurface
FromDialog
()));
return
true
;
}
...
...
@@ -31,50 +31,90 @@ void SubdivideSurfacePlugin::openSubdivideSurfaceDialog()
m_subdivideSurfaceDialog
->
show
();
}
void
SubdivideSurfacePlugin
::
subdivideSurface
()
void
SubdivideSurfacePlugin
::
subdivideSurface
FromDialog
()
{
QList
<
QListWidgetItem
*>
currentItems
=
m_subdivideSurfaceDialog
->
mapList
->
selectedItems
();
if
(
!
currentItems
.
empty
())
{
const
QString
&
mapname
=
currentItems
[
0
]
->
text
();
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapname
));
PFP2
::
MAP
*
map
=
mh
->
getMap
();
std
::
string
positionName
=
m_subdivideSurfaceDialog
->
combo_positionAttribute
->
currentText
().
toStdString
();
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionName
);
const
QString
&
mapName
=
currentItems
[
0
]
->
text
();
const
QString
&
positionName
=
m_subdivideSurfaceDialog
->
combo_positionAttribute
->
currentText
();
if
(
m_subdivideSurfaceDialog
->
radio_Loop
->
isChecked
())
loopSubdivision
(
map
,
position
);
loopSubdivision
(
map
Name
,
positionName
);
else
if
(
m_subdivideSurfaceDialog
->
radio_CC
->
isChecked
())
CCSubdivision
(
map
,
position
);
CCSubdivision
(
map
Name
,
positionName
);
else
if
(
m_subdivideSurfaceDialog
->
radio_trianguleFaces
->
isChecked
())
trianguleFaces
(
map
,
position
);
mh
->
setPrimitiveDirty
(
Algo
::
Render
::
GL2
::
POINTS
);
mh
->
setPrimitiveDirty
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
setPrimitiveDirty
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
mh
->
updateVBO
(
position
);
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
trianguleFaces
(
mapName
,
positionName
);
}
}
void
SubdivideSurfacePlugin
::
loopSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
)
void
SubdivideSurfacePlugin
::
loopSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Modelisation
::
LoopSubdivision
<
PFP2
>
(
*
map
,
position
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
void
SubdivideSurfacePlugin
::
CCSubdivision
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
)
void
SubdivideSurfacePlugin
::
CCSubdivision
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Modelisation
::
CatmullClarkSubdivision
<
PFP2
>
(
*
map
,
position
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
void
SubdivideSurfacePlugin
::
trianguleFaces
(
PFP2
::
MAP
*
map
,
VertexAttribute
<
PFP2
::
VEC3
>&
position
)
void
SubdivideSurfacePlugin
::
trianguleFaces
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
m_window
->
getMap
(
mapName
));
if
(
mh
==
NULL
)
return
;
VertexAttribute
<
PFP2
::
VEC3
>
position
=
mh
->
getAttribute
<
PFP2
::
VEC3
,
VERTEX
>
(
positionAttributeName
);
if
(
!
position
.
isValid
())
return
;
PFP2
::
MAP
*
map
=
mh
->
getMap
();
Algo
::
Surface
::
Modelisation
::
trianguleFaces
<
PFP2
>
(
*
map
,
position
);
mh
->
notifyAttributeModification
(
position
);
mh
->
notifyConnectivityModification
();
QList
<
View
*>
views
=
mh
->
getLinkedViews
();
foreach
(
View
*
view
,
views
)
view
->
updateGL
();
}
#ifndef DEBUG
...
...
SCHNApps/Plugins/surfaceDeformation/src/surfaceDeformation.cpp
View file @
7bb2d103
...
...
@@ -193,7 +193,6 @@ void SurfaceDeformationPlugin::keyPress(View* view, QKeyEvent* event)
{
asRigidAsPossible
(
view
,
map
);
PerMapParameterSet
*
perMap
=
params
->
perMap
[
map
->
getName
()];
params
->
selectedMap
->
updateVBO
(
perMap
->
positionAttribute
);
params
->
selectedMap
->
notifyAttributeModification
(
perMap
->
positionAttribute
);
view
->
updateGL
();
}
...
...
@@ -319,7 +318,6 @@ void SurfaceDeformationPlugin::mouseMove(View* view, QMouseEvent* event)
// matchDiffCoord(view, map);
asRigidAsPossible
(
view
,
params
->
selectedMap
);
params
->
selectedMap
->
updateVBO
(
perMap
->
positionAttribute
);
params
->
selectedMap
->
notifyAttributeModification
(
perMap
->
positionAttribute
);
view
->
updateGL
();
...
...
SCHNApps/bin/init.py
View file @
7bb2d103
importPlugin
=
schnapps
.
loadPlugin
(
"ImportSurface"
);
renderPlugin
=
schnapps
.
loadPlugin
(
"Render"
);
renderVectorPlugin
=
schnapps
.
loadPlugin
(
"RenderVector"
);
renderVectorPlugin
=
schnapps
.
loadPlugin
(
"RenderVector
D
"
);
differentialPropertiesPlugin
=
schnapps
.
loadPlugin
(
"DifferentialProperties"
);
subdivisionPlugin
=
schnapps
.
loadPlugin
(
"SubdivideSurface"
);
surfaceDeformationPlugin
=
schnapps
.
loadPlugin
(
"SurfaceDeformation"
);
...
...
SCHNApps/include/mapHandler.h
View file @
7bb2d103
...
...
@@ -71,11 +71,19 @@ public:
template
<
typename
T
,
unsigned
int
ORBIT
>
inline
void
notifyAttributeModification
(
const
AttributeHandler
<
T
,
ORBIT
>&
attr
)
{
emit
(
attributeModified
(
ORBIT
,
QString
::
fromStdString
(
attr
.
name
())));
QString
nameAttr
=
QString
::
fromStdString
(
attr
.
name
());
if
(
h_vbo
.
contains
(
nameAttr
))
h_vbo
[
nameAttr
]
->
updateData
(
attr
);
emit
(
attributeModified
(
ORBIT
,
nameAttr
));
}
inline
void
notifyConnectivityModification
()
{
m_render
->
setPrimitiveDirty
(
Algo
::
Render
::
GL2
::
POINTS
);
m_render
->
setPrimitiveDirty
(
Algo
::
Render
::
GL2
::
LINES
);
m_render
->
setPrimitiveDirty
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
emit
(
connectivityModified
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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