Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
KennethVanhoey
CGoGN
Commits
3cae3e11
Commit
3cae3e11
authored
Nov 04, 2014
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schnapps interface modifs
parent
c12a2401
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
979 additions
and
422 deletions
+979
-422
SCHNApps/CMakeLists.txt
SCHNApps/CMakeLists.txt
+1
-0
SCHNApps/Plugins/surface_differentialProperties/include/surface_differentialProperties.h
...entialProperties/include/surface_differentialProperties.h
+2
-0
SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp
...erentialProperties/src/surface_differentialProperties.cpp
+13
-0
SCHNApps/Plugins/surface_render/include/surface_render.h
SCHNApps/Plugins/surface_render/include/surface_render.h
+4
-0
SCHNApps/Plugins/surface_render/src/surface_render.cpp
SCHNApps/Plugins/surface_render/src/surface_render.cpp
+8
-0
SCHNApps/Plugins/surface_subdivision/include/surface_subdivision.h
...Plugins/surface_subdivision/include/surface_subdivision.h
+1
-0
SCHNApps/Plugins/surface_subdivision/src/surface_subdivision.cpp
...s/Plugins/surface_subdivision/src/surface_subdivision.cpp
+6
-0
SCHNApps/include/camera.h
SCHNApps/include/camera.h
+16
-0
SCHNApps/include/controlDock_cameraTab.h
SCHNApps/include/controlDock_cameraTab.h
+8
-5
SCHNApps/include/controlDock_mapTab.h
SCHNApps/include/controlDock_mapTab.h
+4
-4
SCHNApps/include/controlDock_pluginTab.h
SCHNApps/include/controlDock_pluginTab.h
+4
-4
SCHNApps/include/dialogList.h
SCHNApps/include/dialogList.h
+53
-0
SCHNApps/include/mapHandler.h
SCHNApps/include/mapHandler.h
+10
-2
SCHNApps/include/mapHandler.hpp
SCHNApps/include/mapHandler.hpp
+56
-12
SCHNApps/include/schnapps.h
SCHNApps/include/schnapps.h
+6
-0
SCHNApps/include/view.h
SCHNApps/include/view.h
+35
-2
SCHNApps/include/viewButtonArea.h
SCHNApps/include/viewButtonArea.h
+2
-0
SCHNApps/src/camera.cpp
SCHNApps/src/camera.cpp
+134
-0
SCHNApps/src/controlDock_cameraTab.cpp
SCHNApps/src/controlDock_cameraTab.cpp
+23
-129
SCHNApps/src/controlDock_mapTab.cpp
SCHNApps/src/controlDock_mapTab.cpp
+97
-121
SCHNApps/src/controlDock_pluginTab.cpp
SCHNApps/src/controlDock_pluginTab.cpp
+81
-81
SCHNApps/src/dialogList.cpp
SCHNApps/src/dialogList.cpp
+88
-0
SCHNApps/src/main.cpp
SCHNApps/src/main.cpp
+7
-5
SCHNApps/src/mapHandler.cpp
SCHNApps/src/mapHandler.cpp
+2
-0
SCHNApps/src/schnapps.cpp
SCHNApps/src/schnapps.cpp
+25
-4
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+274
-37
SCHNApps/src/viewButtonArea.cpp
SCHNApps/src/viewButtonArea.cpp
+5
-0
src/Topology/generic/genericmap.cpp
src/Topology/generic/genericmap.cpp
+14
-16
No files found.
SCHNApps/CMakeLists.txt
View file @
3cae3e11
...
...
@@ -150,6 +150,7 @@ SET(SCHNApps_QOBJECT_FILES
${
SCHNApps_ROOT_DIR
}
/include/controlDock_pluginTab.h
${
SCHNApps_ROOT_DIR
}
/include/controlDock_mapTab.h
${
SCHNApps_ROOT_DIR
}
/include/colorComboBox.h
${
SCHNApps_ROOT_DIR
}
/include/dialogList.h
)
...
...
SCHNApps/Plugins/surface_differentialProperties/include/surface_differentialProperties.h
View file @
3cae3e11
...
...
@@ -38,6 +38,8 @@ private slots:
void
computeNormalFromDialog
();
void
computeCurvatureFromDialog
();
void
appsFinished
();
public
slots
:
void
computeNormal
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
=
"position"
,
...
...
SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp
View file @
3cae3e11
...
...
@@ -37,6 +37,9 @@ bool Surface_DifferentialProperties_Plugin::enable()
connect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
appsFinished
()),
this
,
SLOT
(
appsFinished
()));
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
mapAdded
(
map
);
...
...
@@ -56,6 +59,8 @@ void Surface_DifferentialProperties_Plugin::disable()
disconnect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
appsFinished
()),
this
,
SLOT
(
appsFinished
()));
}
void
Surface_DifferentialProperties_Plugin
::
mapAdded
(
MapHandlerGen
*
map
)
...
...
@@ -213,6 +218,7 @@ void Surface_DifferentialProperties_Plugin::computeNormal(
mh
->
notifyAttributeModification
(
normal
);
}
void
Surface_DifferentialProperties_Plugin
::
computeCurvature
(
const
QString
&
mapName
,
const
QString
&
positionAttributeName
,
...
...
@@ -303,6 +309,13 @@ void Surface_DifferentialProperties_Plugin::computeCurvature(
}
}
void
Surface_DifferentialProperties_Plugin
::
appsFinished
()
{
m_computeNormalDialog
->
close
();
m_computeCurvatureDialog
->
close
();
}
Q_EXPORT_PLUGIN2
(
Surface_DifferentialProperties_Plugin
,
Surface_DifferentialProperties_Plugin
)
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/surface_render/include/surface_render.h
View file @
3cae3e11
...
...
@@ -67,6 +67,8 @@ public:
~
Surface_Render_Plugin
()
{}
private:
virtual
bool
enable
();
virtual
void
disable
();
...
...
@@ -95,6 +97,8 @@ private slots:
void
vboAdded
(
Utils
::
VBO
*
vbo
);
void
vboRemoved
(
Utils
::
VBO
*
vbo
);
void
appsFinished
();
public
slots
:
// slots for Python calls
...
...
SCHNApps/Plugins/surface_render/src/surface_render.cpp
View file @
3cae3e11
...
...
@@ -41,6 +41,7 @@ bool Surface_Render_Plugin::enable()
connect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
appsFinished
()),
this
,
SLOT
(
appsFinished
()));
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
mapAdded
(
map
);
...
...
@@ -61,6 +62,7 @@ void Surface_Render_Plugin::disable()
disconnect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
disconnect
(
m_schnapps
,
SIGNAL
(
appsFinished
()),
this
,
SLOT
(
appsFinished
()));
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
mapRemoved
(
map
);
...
...
@@ -397,6 +399,12 @@ void Surface_Render_Plugin::changeVertexColor(const QString& view, const QString
}
void
Surface_Render_Plugin
::
appsFinished
()
{
m_dockTab
->
m_colorDial
->
close
();
}
Q_EXPORT_PLUGIN2
(
Surface_Render_Plugin
,
Surface_Render_Plugin
)
}
// namespace SCHNApps
...
...
SCHNApps/Plugins/surface_subdivision/include/surface_subdivision.h
View file @
3cae3e11
...
...
@@ -29,6 +29,7 @@ public:
private
slots
:
void
openSubdivisionDialog
();
void
subdivideFromDialog
();
void
appsFinished
();
public
slots
:
void
loopSubdivision
(
...
...
SCHNApps/Plugins/surface_subdivision/src/surface_subdivision.cpp
View file @
3cae3e11
...
...
@@ -125,6 +125,12 @@ void Surface_Subdivision_Plugin::trianguleFaces(
view
->
updateGL
();
}
void
Surface_Subdivision_Plugin
::
appsFinished
()
{
m_subdivisionDialog
->
close
();
}
Q_EXPORT_PLUGIN2
(
Surface_Subdivision_Plugin
,
Surface_Subdivision_Plugin
)
}
// namespace SCHNApps
...
...
SCHNApps/include/camera.h
View file @
3cae3e11
...
...
@@ -26,6 +26,12 @@ public:
~
Camera
();
const
QString
&
getName
()
const
{
return
m_name
;
}
void
updateParams
();
void
drawBBCam
();
bool
m_drawBB
;
public
slots
:
QString
getName
()
{
return
m_name
;
}
SCHNApps
*
getSCHNApps
()
const
{
return
m_schnapps
;
}
...
...
@@ -40,24 +46,34 @@ public slots:
const
QList
<
View
*>&
getLinkedViews
()
const
{
return
l_views
;
}
bool
isLinkedToView
(
View
*
view
)
const
{
return
l_views
.
contains
(
view
);
}
bool
isLinkedToMap
(
MapHandlerGen
*
mhg
)
const
;
private:
void
linkView
(
View
*
view
);
void
unlinkView
(
View
*
view
);
private
slots
:
void
frameModified
();
void
mapAdded
(
MapHandlerGen
*
mhg
);
void
mapRemoved
(
MapHandlerGen
*
mhg
);
void
BBModified
();
public
slots
:
void
setProjectionType
(
int
t
);
void
setDraw
(
bool
b
);
void
setDrawPath
(
bool
b
);
signals:
void
projectionTypeChanged
(
int
);
void
drawChanged
(
bool
);
void
drawPathChanged
(
bool
);
protected:
qglviewer
::
Vec
m_bbMin
;
qglviewer
::
Vec
m_bbMax
;
QString
m_name
;
SCHNApps
*
m_schnapps
;
...
...
SCHNApps/include/controlDock_cameraTab.h
View file @
3cae3e11
...
...
@@ -28,22 +28,25 @@ private slots:
void
cameraProjectionChanged
(
QAbstractButton
*
b
);
void
cameraDrawClicked
(
bool
b
);
void
cameraDrawPathClicked
(
bool
b
);
void
cameraSelectionChanged
();
// slots called from SCHNApps signals
void
cameraAdded
(
Camera
*
c
);
void
cameraRemoved
(
Camera
*
c
);
void
selectedViewChanged
(
View
*
prev
,
View
*
cur
);
// void selectedViewChanged(View* prev, View* cur);
// slots called from selected View signals
void
selectedViewCurrentCameraChanged
(
Camera
*
prev
,
Camera
*
cur
);
//
void selectedViewCurrentCameraChanged(Camera* prev, Camera* cur);
// slots called from current Camera signals
void
currentCameraProjectionTypeChanged
(
int
t
);
void
currentCameraDrawChanged
(
bool
b
);
void
currentCameraDrawPathChanged
(
bool
b
);
//
void currentCameraProjectionTypeChanged(int t);
//
void currentCameraDrawChanged(bool b);
//
void currentCameraDrawPathChanged(bool b);
private:
void
updateCurrentCameraInfo
();
Camera
*
currentCam
();
SCHNApps
*
m_schnapps
;
bool
b_updatingUI
;
...
...
SCHNApps/include/controlDock_mapTab.h
View file @
3cae3e11
...
...
@@ -36,7 +36,7 @@ public:
private
slots
:
// slots called from UI actions
void
selectedMapChanged
();
void
mapCheckStateChanged
(
QListWidgetItem
*
item
);
//
void mapCheckStateChanged(QListWidgetItem* item);
void
vertexAttributeCheckStateChanged
(
QListWidgetItem
*
item
);
void
selectedSelectorChanged
();
...
...
@@ -47,11 +47,11 @@ private slots:
// slots called from SCHNApps signals
void
mapAdded
(
MapHandlerGen
*
m
);
void
mapRemoved
(
MapHandlerGen
*
m
);
void
selectedViewChanged
(
View
*
prev
,
View
*
cur
);
//
void selectedViewChanged(View* prev, View* cur);
// slots called from selected View signals
void
selectedViewMapLinked
(
MapHandlerGen
*
plugin
);
void
selectedViewMapUnlinked
(
MapHandlerGen
*
plugin
);
//
void selectedViewMapLinked(MapHandlerGen* plugin);
//
void selectedViewMapUnlinked(MapHandlerGen* plugin);
// slots called from selected MapHandler signals
void
selectedMapAttributeAdded
(
unsigned
int
orbit
,
const
QString
&
name
);
...
...
SCHNApps/include/controlDock_pluginTab.h
View file @
3cae3e11
...
...
@@ -27,17 +27,17 @@ private slots:
void
addPluginDirectoryClicked
();
void
enableSelectedPluginsClicked
();
void
disableSelectedPluginsClicked
();
void
pluginCheckStateChanged
(
QListWidgetItem
*
item
);
//
void pluginCheckStateChanged(QListWidgetItem* item);
// slots called from SCHNApps signals
void
pluginAvailableAdded
(
QString
name
);
void
pluginEnabled
(
Plugin
*
plugin
);
void
pluginDisabled
(
Plugin
*
plugin
);
void
selectedViewChanged
(
View
*
prev
,
View
*
cur
);
//
void selectedViewChanged(View* prev, View* cur);
// slots called from selected View signals
void
selectedViewPluginLinked
(
PluginInteraction
*
plugin
);
void
selectedViewPluginUnlinked
(
PluginInteraction
*
plugin
);
//
void selectedViewPluginLinked(PluginInteraction* plugin);
//
void selectedViewPluginUnlinked(PluginInteraction* plugin);
private:
SCHNApps
*
m_schnapps
;
...
...
SCHNApps/include/dialogList.h
0 → 100644
View file @
3cae3e11
#ifndef _DIALOG_LIST_H_
#define _DIALOG_LIST_H_
#include <QDialog>
#include <QVBoxLayout>
#include <QListWidget>
#include <QListWidgetItem>
namespace
CGoGN
{
namespace
SCHNApps
{
class
ListPopUp
:
public
QDialog
{
Q_OBJECT
QVBoxLayout
*
m_layout
;
QListWidget
*
m_list_items
;
public:
ListPopUp
(
const
QString
&
name
,
QWidget
*
parent
=
NULL
);
virtual
~
ListPopUp
();
QListWidget
*
list
();
QListWidgetItem
*
addItem
(
const
QString
&
str
,
Qt
::
CheckState
checked
=
Qt
::
Unchecked
);
QListWidgetItem
*
getItem
(
unsigned
int
row
);
unsigned
int
nbItems
();
QListWidgetItem
*
findItem
(
const
QString
&
str
);
bool
removeItem
(
const
QString
&
str
);
void
check
(
const
QString
&
str
,
Qt
::
CheckState
ck
);
bool
isChecked
(
const
QString
&
str
);
};
}
// namespace SCHNApps
}
// namespace CGoGN
#endif
SCHNApps/include/mapHandler.h
View file @
3cae3e11
...
...
@@ -51,8 +51,8 @@ public slots:
const
QList
<
View
*>&
getLinkedViews
()
const
{
return
l_views
;
}
bool
isLinkedToView
(
View
*
view
)
const
{
return
l_views
.
contains
(
view
);
}
const
qglviewer
::
Vec
&
getBBmin
()
const
{
return
m_bbMin
;
}
const
qglviewer
::
Vec
&
getBBmax
()
const
{
return
m_bbMax
;
}
//
const qglviewer::Vec& getBBmin() const { return m_bbMin; }
//
const qglviewer::Vec& getBBmax() const { return m_bbMax; }
float
getBBdiagSize
()
const
{
return
m_bbDiagSize
;
}
Utils
::
GLSLShader
*
getBBDrawerShader
()
const
...
...
@@ -77,9 +77,12 @@ public slots:
return
matrix
;
}
void
frameModified
()
{
DEBUG_EMIT
(
"frameModified"
);
emit
(
BBisModified
());}
public:
virtual
void
draw
(
Utils
::
GLSLShader
*
shader
,
int
primitive
)
=
0
;
virtual
void
drawBB
()
=
0
;
virtual
void
transformedBB
(
qglviewer
::
Vec
&
bbMin
,
qglviewer
::
Vec
&
bbMax
)
=
0
;
void
setPrimitiveDirty
(
int
primitive
)
{
m_render
->
setPrimitiveDirty
(
primitive
);
}
...
...
@@ -181,6 +184,8 @@ signals:
void
cellSelectorRemoved
(
unsigned
int
orbit
,
const
QString
&
name
);
void
selectedCellsChanged
(
CellSelectorGen
*
cs
);
void
BBisModified
();
protected:
QString
m_name
;
SCHNApps
*
m_schnapps
;
...
...
@@ -253,6 +258,9 @@ public:
void
updateBB
(
const
VertexAttribute
<
VEC3
,
MAP
>&
position
);
void
updateBBDrawer
();
void
transformedBB
(
qglviewer
::
Vec
&
bbMin
,
qglviewer
::
Vec
&
bbMax
);
/*********************************************************
* MANAGE TOPO DRAWING
*********************************************************/
...
...
SCHNApps/include/mapHandler.hpp
View file @
3cae3e11
#include "Utils/Shaders/shaderColorPerVertex.h"
#include "Utils/Shaders/shaderSimpleColor.h"
#include "Geometry/bounding_box.h"
namespace
CGoGN
{
...
...
@@ -73,10 +75,8 @@ void MapHandler<PFP>::draw(Utils::GLSLShader* shader, int primitive)
if
(
!
m_render
->
isPrimitiveUpToDate
(
primitive
))
m_render
->
initPrimitives
<
PFP
>
(
*
(
static_cast
<
MAP
*>
(
m_map
)),
primitive
)
;
glPushMatrix
();
glMultMatrixd
(
m_frame
->
matrix
());
m_render
->
draw
(
shader
,
primitive
);
glPopMatrix
();
}
template
<
typename
PFP
>
...
...
@@ -88,32 +88,30 @@ void MapHandler<PFP>::drawBB()
updateBBDrawer
();
}
glPushMatrix
();
glMultMatrixd
(
m_frame
->
matrix
());
// QGLViewer::drawAxis();
m_bbDrawer
->
callList
();
glPopMatrix
();
}
template
<
typename
PFP
>
void
MapHandler
<
PFP
>::
updateBB
(
const
VertexAttribute
<
VEC3
,
MAP
>&
position
)
{
m_bb
=
CGoGN
::
Algo
::
Geometry
::
computeBoundingBox
<
PFP
>
(
*
(
static_cast
<
MAP
*>
(
m_map
)),
position
);
m_bbMin
=
qglviewer
::
Vec
(
m_bb
.
min
()[
0
],
m_bb
.
min
()[
1
],
m_bb
.
min
()[
2
]);
m_bbMax
=
qglviewer
::
Vec
(
m_bb
.
max
()[
0
],
m_bb
.
max
()[
1
],
m_bb
.
max
()[
2
]);
m_bbDiagSize
=
(
m_bbMax
-
m_bbMin
).
norm
();
m_bbDiagSize
=
m_bb
.
diagSize
();
updateBBDrawer
();
}
template
<
typename
PFP
>
void
MapHandler
<
PFP
>::
updateBBDrawer
()
{
if
(
!
m_bbDrawer
)
m_bbDrawer
=
new
Utils
::
Drawer
();
const
Geom
::
Vec3f
&
bbmin
=
m_bb
.
min
();
const
Geom
::
Vec3f
&
bbmax
=
m_bb
.
max
();
Geom
::
Vec3f
bbmin
=
m_bb
.
min
();
Geom
::
Vec3f
bbmax
=
m_bb
.
max
();
float
shift
=
0.005
f
*
(
bbmax
-
bbmin
).
norm
();
bbmin
-=
Geom
::
Vec3f
(
shift
,
shift
,
shift
);
bbmax
+=
Geom
::
Vec3f
(
shift
,
shift
,
shift
);
m_bbDrawer
->
newList
(
GL_COMPILE
);
m_bbDrawer
->
color3f
(
0.0
f
,
1.0
f
,
0.0
f
);
...
...
@@ -229,6 +227,52 @@ void MapHandler<PFP>::drawTopoRender(int code)
template
<
typename
PFP
>
void
MapHandler
<
PFP
>::
transformedBB
(
qglviewer
::
Vec
&
bbMin
,
qglviewer
::
Vec
&
bbMax
)
{
const
Geom
::
Vec3f
&
BBmin
=
m_bb
.
min
();
const
Geom
::
Vec3f
&
BBMax
=
m_bb
.
max
();
CGoGN
::
Geom
::
BoundingBox
<
typename
PFP
::
VEC3
>
bb
;
qglviewer
::
Vec
v
=
qglviewer
::
Vec
(
BBmin
[
0
],
BBmin
[
1
],
BBmin
[
2
]);
qglviewer
::
Vec
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBMax
[
0
],
BBmin
[
1
],
BBmin
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBmin
[
0
],
BBMax
[
1
],
BBmin
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBmin
[
0
],
BBmin
[
1
],
BBMax
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBMax
[
0
],
BBMax
[
1
],
BBmin
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBMax
[
0
],
BBmin
[
1
],
BBMax
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBmin
[
0
],
BBMax
[
1
],
BBMax
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
v
=
qglviewer
::
Vec
(
BBMax
[
0
],
BBMax
[
1
],
BBMax
[
2
]);
vt
=
m_frame
->
inverseCoordinatesOf
(
v
);
bb
.
addPoint
(
Geom
::
Vec3f
(
vt
[
0
],
vt
[
1
],
vt
[
2
]));
bbMin
=
qglviewer
::
Vec
(
bb
.
min
()[
0
],
bb
.
min
()[
1
],
bb
.
min
()[
2
]);
bbMax
=
qglviewer
::
Vec
(
bb
.
max
()[
0
],
bb
.
max
()[
1
],
bb
.
max
()[
2
]);
}
}
// namespace SCHNApps
...
...
SCHNApps/include/schnapps.h
View file @
3cae3e11
...
...
@@ -47,6 +47,8 @@ public slots:
/*********************************************************
* MANAGE VIEWS
*********************************************************/
public:
void
redrawAllViews
();
public
slots
:
View
*
addView
(
const
QString
&
name
);
...
...
@@ -151,6 +153,8 @@ signals:
void
pluginEnabled
(
Plugin
*
plugin
);
void
pluginDisabled
(
Plugin
*
plugin
);
void
appsFinished
();
protected:
QString
m_appPath
;
PythonQtObjectPtr
&
m_pythonContext
;
...
...
@@ -186,6 +190,8 @@ protected:
TextureSet
m_textures
;
StaticPointers
m_sp
;
void
closeEvent
(
QCloseEvent
*
event
);
};
}
// namespace SCHNApps
...
...
SCHNApps/include/view.h
View file @
3cae3e11
...
...
@@ -5,6 +5,8 @@
#include <QGLViewer/qglviewer.h>
#include <QGLViewer/manipulatedFrame.h>
#include "dialogList.h"
#include "schnapps.h"
#include "Utils/gl_matrices.h"
...
...
@@ -19,6 +21,7 @@ class ViewButtonArea;
class
ViewButton
;
class
PluginInteraction
;
class
View
:
public
QGLViewer
{
Q_OBJECT
...
...
@@ -34,7 +37,9 @@ public:
const
QString
&
getName
()
const
{
return
m_name
;
}
MapHandlerGen
*
lastSelectedMap
()
{
return
m_lastSelectedMap
;}
void
setLastSelectedMap
(
MapHandlerGen
*
m
)
{
m_lastSelectedMap
=
m
;
}
// void setLastSelectedMap(MapHandlerGen* m) { m_lastSelectedMap=m; }
void
closeDialogs
();
public
slots
:
QString
getName
()
{
return
m_name
;
}
...
...
@@ -67,6 +72,8 @@ public slots:
bool
isLinkedToMap
(
const
QString
&
name
)
const
;
private:
bool
b_updatingUI
;
virtual
void
init
();
virtual
void
preDraw
();
virtual
void
draw
();
...
...
@@ -87,7 +94,7 @@ private:
glm
::
mat4
getCurrentProjectionMatrix
()
const
;
glm
::
mat4
getCurrentModelViewProjectionMatrix
()
const
;
void
updateCurrentCameraBB
();
//
void updateCurrentCameraBB();
private
slots
:
void
selectedMapChanged
(
MapHandlerGen
*
prev
,
MapHandlerGen
*
cur
);
...
...
@@ -96,6 +103,22 @@ private slots:
void
ui_horizontalSplitView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
ui_closeView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
ui_mapsListView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
ui_pluginsListView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
ui_camerasListView
(
int
x
,
int
y
,
int
globalX
,
int
globalY
);
void
mapAdded
(
MapHandlerGen
*
map
);
void
mapRemoved
(
MapHandlerGen
*
map
);
void
pluginEnabled
(
Plugin
*
plugin
);
void
pluginDisabled
(
Plugin
*
plugin
);
void
cameraAdded
(
Camera
*
camera
);
void
cameraRemoved
(
Camera
*
camera
);
void
mapCheckStateChanged
(
QListWidgetItem
*
item
);
void
pluginCheckStateChanged
(
QListWidgetItem
*
item
);
void
cameraCheckStateChanged
(
QListWidgetItem
*
item
);
signals:
void
currentCameraChanged
(
Camera
*
,
Camera
*
);
...
...
@@ -120,7 +143,17 @@ protected:
ViewButton
*
m_VsplitButton
;
ViewButton
*
m_HsplitButton
;
ViewButtonArea
*
m_buttonAreaLeft
;
ViewButton
*
m_mapsButton
;
ViewButton
*
m_pluginsButton
;
ViewButton
*
m_camerasButton
;
QString
m_textInfo
;
ListPopUp
*
m_dialogMaps
;
ListPopUp
*
m_dialogPlugins
;
ListPopUp
*
m_dialogCameras
;
};
}
// namespace SCHNApps
...
...
SCHNApps/include/viewButtonArea.h
View file @
3cae3e11
...
...
@@ -69,6 +69,8 @@ public:
void
setTopRightPosition
(
int
x
,
int
y
);
void
setTopLeftPosition
(
int
x
,
int
y
);
void
draw
();
protected:
...
...
SCHNApps/src/camera.cpp
View file @
3cae3e11
#include "camera.h"
#include "mapHandler.h"
namespace
CGoGN
{
...
...
@@ -9,6 +10,7 @@ namespace SCHNApps
unsigned
int
Camera
::
cameraCount
=
0
;
Camera
::
Camera
(
const
QString
&
name
,
SCHNApps
*
s
)
:
m_drawBB
(
false
),
m_name
(
name
),
m_schnapps
(
s
),
m_draw
(
false
),
...
...
@@ -16,6 +18,22 @@ Camera::Camera(const QString& name, SCHNApps* s) :
{
++
cameraCount
;
connect
(
this
->
frame
(),
SIGNAL
(
modified
()),
this
,
SLOT
(
frameModified
()));
connect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
{
// do the code of BBModified for each linked map
if
(
isLinkedToMap
(
map
))
updateParams
();
foreach
(
View
*
v
,
l_views
)
{
v
->
updateGL
();
}
// and do the connection for map added
mapAdded
(
map
);
}
}
Camera
::~
Camera
()
...
...
@@ -73,6 +91,122 @@ void Camera::frameModified()
}
}
void
Camera
::
updateParams
()
{
// get all maps viewed by camera
QSet
<
MapHandlerGen
*>
q_maps
;
foreach
(
View
*
view
,
l_views
)
{
QList
<
MapHandlerGen
*>
l_maps
=
view
->
getLinkedMaps
();
foreach
(
MapHandlerGen
*
mhg
,
l_maps
)
q_maps
.
insert
(
mhg
);
}
if
(
!
q_maps
.
empty
())
{
// to help debug I store bb min/max in camera for camera bb drawing
// qglviewer::Vec m_bbMin;
// qglviewer::Vec m_bbMax;
(
*
q_maps
.
begin
())
->
transformedBB
(
m_bbMin
,
m_bbMax
);
foreach
(
MapHandlerGen
*
mhg
,
q_maps
)
{
qglviewer
::
Vec
minbb
;
qglviewer
::
Vec
maxbb
;
mhg
->
transformedBB
(
minbb
,
maxbb
);
for
(
unsigned
int
dim
=
0
;
dim
<
3
;
++
dim
)
{
if
(
minbb
[
dim
]
<
m_bbMin
[
dim
])
m_bbMin
[
dim
]
=
minbb
[
dim
];
if
(
maxbb
[
dim
]
>
m_bbMax
[
dim
])
m_bbMax
[
dim
]
=
maxbb
[
dim
];
}
}
this
->
setSceneBoundingBox
(
m_bbMin
,
m_bbMax
);
this
->
showEntireScene
();
}
}
bool
Camera
::
isLinkedToMap
(
MapHandlerGen
*
mhg
)
const
{
const
QString
&
mapName
=
mhg
->
getName
();
foreach
(
View
*
v
,
l_views
)
{
if
(
v
->
isLinkedToMap
(
mapName
))
return
true
;
}
return
false
;
}
void
Camera
::
mapAdded
(
MapHandlerGen
*
mhg
)
{
// all maps signals to camera its existence
// selection if done by BBModified
connect
(
mhg
,
SIGNAL
(
BBisModified
()),
this
,
SLOT
(
BBModified
()));
}
void
Camera
::
mapRemoved
(
MapHandlerGen
*
mhg
)
{
disconnect
(
mhg
,
SIGNAL
(
BBisModified
()),
this
,
SLOT
(
BBModified
()));
}
void
Camera
::
BBModified
()
{
DEBUG_SLOT
();
MapHandlerGen
*
mhg
=
static_cast
<
MapHandlerGen
*>
(
QObject
::
sender
());
if
(
isLinkedToMap
(
mhg
))
updateParams
();
foreach
(
View
*
v
,
l_views
)
{
v
->
updateGL
();
}
}
void
Camera
::
drawBBCam
()
{
if
(
!
m_drawBB
)
return
;
float
shift
=
0.01
f
*
(
m_bbMax
-
m_bbMin
).
norm
();
glDisable
(
GL_LIGHTING
);
glColor3f
(
0.5
f
,
1.0
f
,
0.0
f
);
glLineWidth
(
1.0
f
);
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
m_bbMin
[
0
]
-
shift
,
m_bbMin
[
1
]
-
shift
,
m_bbMin
[
2
]
-
shift
);
glVertex3f
(
m_bbMin
[
0
]
-
shift
,
m_bbMax
[
1
]
+
shift
,
m_bbMin
[
2
]
-
shift
);
glVertex3f
(
m_bbMax
[
0
]
+
shift
,
m_bbMax
[
1
]
+
shift
,
m_bbMin
[
2
]
-
shift
);
glVertex3f
(
m_bbMax
[
0
]
+
shift
,
m_bbMin
[
1
]
-
shift
,
m_bbMin
[
2
]
-
shift
);
glVertex3f
(
m_bbMin
[
0
]
-
shift
,
m_bbMin
[
1
]
-
shift
,
m_bbMin
[
2
]
-
shift
);
glEnd
();
glBegin
(
GL_LINE_LOOP
);
glVertex3f
(
m_bbMax
[
0
]
+
shift
,
m_bbMax
[
1
]
+
shift
,
m_bbMax
[
2
]
+
shift
);
glVertex3f
(
m_bbMax
[
0
]
+
shift
,
m_bbMin
[
1
]
-
shift
,
m_bbMax
[
2
]
+
shift
);