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
6e1f65e5
Commit
6e1f65e5
authored
Apr 13, 2015
by
Sylvain Thery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix lineWidth & fixed Size of window
parent
dc66829a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
197 additions
and
278 deletions
+197
-278
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
+2
-2
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
+2
-2
SCHNApps/include/schnapps.h
SCHNApps/include/schnapps.h
+1
-1
SCHNApps/src/schnapps.cpp
SCHNApps/src/schnapps.cpp
+1
-0
SCHNApps/src/view.cpp
SCHNApps/src/view.cpp
+191
-273
No files found.
CGoGN/src/Utils/Shaders/shaderBoldColorLines.cpp
View file @
6e1f65e5
...
...
@@ -88,7 +88,7 @@ void ShaderBoldColorLines::setLineWidth(float pix)
{
glm
::
i32vec4
viewport
;
glGetIntegerv
(
GL_VIEWPORT
,
&
(
viewport
[
0
]));
float
lw
=
float
(
(
0.5
*
pix
)
/
double
(
viewport
[
2
]));
float
lw
=
float
(
double
(
pix
)
/
double
(
viewport
[
2
]));
bind
();
glUniform1f
(
*
m_uniform_lineWidth
,
lw
);
...
...
@@ -101,7 +101,7 @@ void ShaderBoldColorLines::updatePixelWidth()
{
glm
::
i32vec4
viewport
;
glGetIntegerv
(
GL_VIEWPORT
,
&
(
viewport
[
0
]));
float
lw
=
float
(
(
0.5
*
m_pixWidth
)
/
double
(
viewport
[
2
]));
float
lw
=
float
(
double
(
m_pixWidth
)
/
double
(
viewport
[
2
]));
bind
();
glUniform1f
(
*
m_uniform_lineWidth
,
lw
);
...
...
CGoGN/src/Utils/Shaders/shaderBoldLines.cpp
View file @
6e1f65e5
...
...
@@ -86,7 +86,7 @@ void ShaderBoldLines::setLineWidth(float pix)
{
glm
::
i32vec4
viewport
;
glGetIntegerv
(
GL_VIEWPORT
,
&
(
viewport
[
0
]));
float
lw
=
float
(
(
0.5
*
pix
)
/
double
(
viewport
[
2
]));
float
lw
=
float
(
double
(
pix
)
/
double
(
viewport
[
2
]));
bind
();
glUniform1f
(
*
m_uniform_lineWidth
,
lw
);
...
...
@@ -99,7 +99,7 @@ void ShaderBoldLines::updatePixelWidth()
{
glm
::
i32vec4
viewport
;
glGetIntegerv
(
GL_VIEWPORT
,
&
(
viewport
[
0
]));
float
lw
=
float
(
(
0.5
*
m_pixWidth
)
/
double
(
viewport
[
2
]));
float
lw
=
float
(
double
(
m_pixWidth
)
/
double
(
viewport
[
2
]));
bind
();
glUniform1f
(
*
m_uniform_lineWidth
,
lw
);
...
...
SCHNApps/include/schnapps.h
View file @
6e1f65e5
...
...
@@ -153,7 +153,7 @@ public slots:
QString
saveFileDialog
(
const
QString
&
title
,
const
QString
&
dir
=
QString
(),
const
QString
&
filter
=
QString
());
void
setWindowSize
(
int
w
,
int
h
)
{
this
->
setFixedS
ize
(
w
,
h
);
}
void
setWindowSize
(
int
w
,
int
h
)
{
this
->
res
ize
(
w
,
h
);
}
private
slots
:
void
loadPythonScriptFromFileDialog
();
...
...
SCHNApps/src/schnapps.cpp
View file @
6e1f65e5
...
...
@@ -118,6 +118,7 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
// create & setup central widget (views)
m_centralLayout
=
new
QVBoxLayout
(
centralwidget
);
m_centralLayout
->
setMargin
(
2
);
m_rootSplitter
=
new
QSplitter
(
centralwidget
);
b_rootSplitterInitialized
=
false
;
...
...
SCHNApps/src/view.cpp
View file @
6e1f65e5
...
...
@@ -13,7 +13,6 @@
#include <QKeyEvent>
#include <QMouseEvent>
#include <QWheelEvent>
#include <QMessageBox>
namespace
CGoGN
{
...
...
@@ -22,15 +21,13 @@ namespace SCHNApps
{
unsigned
int
View
::
viewCount
=
0
;
View
::
View
(
const
QString
&
name
,
SCHNApps
*
s
,
const
QGLWidget
*
shareWidget
)
:
QGLViewer
(
NULL
,
shareWidget
),
View
::
View
(
const
QString
&
name
,
SCHNApps
*
s
,
QGLFormat
&
format
)
:
QGLViewer
(
format
,
NULL
,
NULL
),
b_updatingUI
(
false
),
m_name
(
name
),
m_schnapps
(
s
),
m_currentCamera
(
NULL
),
m_bbMin
(
0.0
,
0.0
,
0.0
),
m_bbMax
(
0.0
,
0.0
,
0.0
),
m_lastSelectedMap
(
NULL
),
m_buttonArea
(
NULL
),
m_closeButton
(
NULL
),
m_VsplitButton
(
NULL
),
...
...
@@ -39,19 +36,12 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) :
m_mapsButton
(
NULL
),
m_pluginsButton
(
NULL
),
m_camerasButton
(
NULL
),
m_dialogMaps
(
NULL
),
m_dialogPlugins
(
NULL
),
m_dialogCameras
(
NULL
),
m_frameDrawer
(
NULL
),
m_textureWallpaper
(
NULL
),
m_shaderWallpaper
(
NULL
),
b_saveSnapshots
(
false
)
m_dialogMaps
(
NULL
)
{
++
viewCount
;
setSnapshotFormat
(
"BMP"
);
setSnapshotFileName
(
m_name
);
setSnapshotQuality
(
100
);
m_currentCamera
=
m_schnapps
->
addCamera
();
m_currentCamera
->
linkView
(
this
);
connect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
...
...
@@ -59,6 +49,8 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) :
m_dialogPlugins
=
new
ListPopUp
(
"Enabled Plugins"
);
m_dialogCameras
=
new
ListPopUp
(
"Cameras"
);
// setCurrentCamera(m_schnapps->addCamera());
connect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
connect
(
m_dialogMaps
->
list
(),
SIGNAL
(
itemChanged
(
QListWidgetItem
*
)),
this
,
SLOT
(
mapCheckStateChanged
(
QListWidgetItem
*
)));
...
...
@@ -80,11 +72,65 @@ View::View(const QString& name, SCHNApps* s, const QGLWidget* shareWidget) :
foreach
(
Camera
*
cam
,
m_schnapps
->
getCameraSet
().
values
())
cameraAdded
(
cam
);
m_dialogCameras
->
check
(
m_currentCamera
->
getName
(),
Qt
::
Checked
);
}
View
::
View
(
const
QString
&
name
,
SCHNApps
*
s
,
QGLFormat
&
format
,
const
QGLWidget
*
shareWidget
)
:
QGLViewer
(
format
,
NULL
,
shareWidget
),
b_updatingUI
(
false
),
m_name
(
name
),
m_schnapps
(
s
),
m_currentCamera
(
NULL
),
m_lastSelectedMap
(
NULL
),
m_buttonArea
(
NULL
),
m_closeButton
(
NULL
),
m_VsplitButton
(
NULL
),
m_HsplitButton
(
NULL
),
m_buttonAreaLeft
(
NULL
),
m_mapsButton
(
NULL
),
m_pluginsButton
(
NULL
),
m_camerasButton
(
NULL
),
m_dialogMaps
(
NULL
)
{
++
viewCount
;
m_currentCamera
=
m_schnapps
->
addCamera
();
m_currentCamera
->
linkView
(
this
);
m_dialogCameras
->
check
(
m_currentCamera
->
getName
(),
Qt
::
Checked
);
connect
(
m_schnapps
,
SIGNAL
(
schnappsClosing
()),
this
,
SLOT
(
closeDialogs
()));
connect
(
m_schnapps
,
SIGNAL
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)),
this
,
SLOT
(
selectedMapChanged
(
MapHandlerGen
*
,
MapHandlerGen
*
)));
m_dialogMaps
=
new
ListPopUp
(
"Linked Maps"
);
m_dialogPlugins
=
new
ListPopUp
(
"Enabled Plugins"
);
m_dialogCameras
=
new
ListPopUp
(
"Cameras"
);
// setCurrentCamera(m_schnapps->addCamera());
connect
(
m_schnapps
,
SIGNAL
(
mapAdded
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapAdded
(
MapHandlerGen
*
)));
connect
(
m_schnapps
,
SIGNAL
(
mapRemoved
(
MapHandlerGen
*
)),
this
,
SLOT
(
mapRemoved
(
MapHandlerGen
*
)));
connect
(
m_dialogMaps
->
list
(),
SIGNAL
(
itemChanged
(
QListWidgetItem
*
)),
this
,
SLOT
(
mapCheckStateChanged
(
QListWidgetItem
*
)));
foreach
(
MapHandlerGen
*
map
,
m_schnapps
->
getMapSet
().
values
())
mapAdded
(
map
);
connect
(
m_schnapps
,
SIGNAL
(
pluginEnabled
(
Plugin
*
)),
this
,
SLOT
(
pluginEnabled
(
Plugin
*
)));
connect
(
m_schnapps
,
SIGNAL
(
pluginDisabled
(
Plugin
*
)),
this
,
SLOT
(
pluginDisabled
(
Plugin
*
)));
connect
(
m_dialogPlugins
->
list
(),
SIGNAL
(
itemChanged
(
QListWidgetItem
*
)),
this
,
SLOT
(
pluginCheckStateChanged
(
QListWidgetItem
*
)));
foreach
(
Plugin
*
plug
,
m_schnapps
->
getPluginSet
().
values
())
pluginEnabled
(
plug
);
connect
(
m_schnapps
,
SIGNAL
(
cameraAdded
(
Camera
*
)),
this
,
SLOT
(
cameraAdded
(
Camera
*
)));
connect
(
m_schnapps
,
SIGNAL
(
cameraRemoved
(
Camera
*
)),
this
,
SLOT
(
cameraRemoved
(
Camera
*
)));
connect
(
m_dialogCameras
->
list
(),
SIGNAL
(
itemChanged
(
QListWidgetItem
*
)),
this
,
SLOT
(
cameraCheckStateChanged
(
QListWidgetItem
*
)));
foreach
(
Camera
*
cam
,
m_schnapps
->
getCameraSet
().
values
())
cameraAdded
(
cam
);
m_dialogCameras
->
check
(
m_currentCamera
->
getName
(),
Qt
::
Checked
);
}
View
::~
View
()
...
...
@@ -93,12 +139,14 @@ View::~View()
this
->
setCamera
(
c
);
m_currentCamera
->
unlinkView
(
this
);
foreach
(
PluginInteraction
*
p
,
l_plugins
)
unlinkPlugin
(
p
);
foreach
(
MapHandlerGen
*
m
,
l_maps
)
unlinkMap
(
m
);
delete
m_buttonArea
;
delete
m_buttonAreaLeft
;
...
...
@@ -107,16 +155,18 @@ View::~View()
delete
m_dialogCameras
;
}
void
View
::
closeDialogs
()
{
m_dialogMaps
->
close
();
m_dialogPlugins
->
close
();
m_dialogCameras
->
close
();
}
void
View
::
setCurrentCamera
(
Camera
*
c
)
{
// DEBUG_SLOT();
if
(
c
!=
m_currentCamera
&&
c
)
if
(
c
!=
m_currentCamera
&&
c
!=
NULL
)
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".setCurrentCamera(
\"
"
<<
c
->
getName
()
<<
"
\"
);"
<<
endl
;
Camera
*
prev
=
m_currentCamera
;
if
(
prev
)
prev
->
unlinkView
(
this
);
...
...
@@ -125,10 +175,10 @@ void View::setCurrentCamera(Camera* c)
this
->
setCamera
(
m_currentCamera
);
m_currentCamera
->
linkView
(
this
);
DEBUG_EMIT
(
"currentCameraChanged"
);
emit
(
currentCameraChanged
(
prev
,
c
));
//
DEBUG_EMIT("currentCameraChanged");
//
emit(currentCameraChanged(prev, c));
if
(
prev
)
if
(
prev
)
{
QListWidgetItem
*
prevItem
=
m_dialogCameras
->
findItem
(
prev
->
getName
());
if
(
prevItem
)
...
...
@@ -138,8 +188,7 @@ void View::setCurrentCamera(Camera* c)
b_updatingUI
=
false
;
}
}
if
(
m_currentCamera
)
if
(
m_currentCamera
)
{
QListWidgetItem
*
curItem
=
m_dialogCameras
->
findItem
(
m_currentCamera
->
getName
());
if
(
curItem
)
...
...
@@ -150,7 +199,12 @@ void View::setCurrentCamera(Camera* c)
}
}
m_currentCamera
->
fitToViewsBoundingBox
();
// b_updatingUI = true;
// m_dialogCameras->check(c->getName(),Qt::Checked);
// b_updatingUI = false;
// updateCurrentCameraBB();
m_currentCamera
->
updateParams
();
updateGL
();
}
}
...
...
@@ -162,32 +216,23 @@ void View::setCurrentCamera(const QString& name)
setCurrentCamera
(
c
);
}
bool
View
::
usesCamera
(
const
QString
&
n
ame
)
const
bool
View
::
usesCamera
(
const
QString
&
cameraN
ame
)
const
{
Camera
*
c
=
m_schnapps
->
getCamera
(
name
);
return
usesCamera
(
c
);
return
m_currentCamera
->
getName
()
==
cameraName
;
}
void
View
::
linkPlugin
(
PluginInteraction
*
plugin
)
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".linkPlugin(
\"
"
<<
plugin
->
getName
()
<<
"
\"
);"
<<
endl
;
DEBUG_SLOT
();
if
(
plugin
&&
!
l_plugins
.
contains
(
plugin
))
{
l_plugins
.
push_back
(
plugin
);
plugin
->
linkView
(
this
);
DEBUG_EMIT
(
"pluginLinked"
);
emit
(
pluginLinked
(
plugin
));
b_updatingUI
=
true
;
m_dialogPlugins
->
check
(
plugin
->
getName
(),
Qt
::
Checked
);
m_dialogPlugins
->
check
(
plugin
->
getName
(),
Qt
::
Checked
);
b_updatingUI
=
false
;
updateGL
();
...
...
@@ -206,19 +251,12 @@ void View::unlinkPlugin(PluginInteraction* plugin)
DEBUG_SLOT
();
if
(
l_plugins
.
removeOne
(
plugin
))
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".unlinkPlugin(
\"
"
<<
plugin
->
getName
()
<<
"
\"
);"
<<
endl
;
plugin
->
unlinkView
(
this
);
DEBUG_EMIT
(
"pluginUnlinked"
);
emit
(
pluginUnlinked
(
plugin
));
b_updatingUI
=
true
;
m_dialogPlugins
->
check
(
plugin
->
getName
(),
Qt
::
Unchecked
);
m_dialogPlugins
->
check
(
plugin
->
getName
(),
Qt
::
Unchecked
);
b_updatingUI
=
false
;
updateGL
();
...
...
@@ -240,30 +278,27 @@ bool View::isLinkedToPlugin(const QString& name) const
void
View
::
linkMap
(
MapHandlerGen
*
map
)
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".linkMap(
\"
"
<<
map
->
getName
()
<<
"
\"
);"
<<
endl
;
DEBUG_SLOT
();
if
(
map
&&
!
l_maps
.
contains
(
map
))
{
l_maps
.
push_back
(
map
);
map
->
linkView
(
this
);
DEBUG_EMIT
(
"mapLinked"
);
emit
(
mapLinked
(
map
));
std
::
cout
<<
"View::linkMap Maps:"
<<
map
->
getName
().
toStdString
()
<<
std
::
endl
;
m_currentCamera
->
updateParams
();
updateGL
();
// connect(map->getFrame(), SIGNAL(modified()), this, SLOT(updateGL()));
// connect(map->getFrame(), SIGNAL(modified()), m_currentCamera, SLOT(BBModified(map)));
connect
(
map
,
SIGNAL
(
selectedCellsChanged
(
CellSelectorGen
*
)),
this
,
SLOT
(
updateGL
()));
connect
(
map
,
SIGNAL
(
boundingBoxModified
()),
this
,
SLOT
(
updateBoundingBox
()));
if
(
map
->
isSelectedMap
())
setManipulatedFrame
(
map
->
getFrame
());
updateBoundingBox
();
b_updatingUI
=
true
;
m_dialogMaps
->
check
(
map
->
getName
(),
Qt
::
Checked
);
m_dialogMaps
->
check
(
map
->
getName
(),
Qt
::
Checked
);
b_updatingUI
=
false
;
}
}
...
...
@@ -280,27 +315,24 @@ void View::unlinkMap(MapHandlerGen* map)
DEBUG_SLOT
();
if
(
l_maps
.
removeOne
(
map
))
{
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".unlinkMap(
\"
"
<<
map
->
getName
()
<<
"
\"
);"
<<
endl
;
map
->
unlinkView
(
this
);
DEBUG_EMIT
(
"mapUnlinked"
);
emit
(
mapUnlinked
(
map
));
// updateCurrentCameraBB();
m_currentCamera
->
updateParams
();
updateGL
();
disconnect
(
map
->
getFrame
(),
SIGNAL
(
modified
()),
this
,
SLOT
(
updateGL
()));
disconnect
(
map
,
SIGNAL
(
selectedCellsChanged
(
CellSelectorGen
*
)),
this
,
SLOT
(
updateGL
()));
disconnect
(
map
,
SIGNAL
(
boundingBoxModified
()),
this
,
SLOT
(
updateBoundingBox
()));
if
(
map
==
m_schnapps
->
getSelectedMap
())
setManipulatedFrame
(
NULL
);
updateBoundingBox
();
b_updatingUI
=
true
;
m_dialogMaps
->
check
(
map
->
getName
(),
Qt
::
Unchecked
);
m_dialogMaps
->
check
(
map
->
getName
(),
Qt
::
Unchecked
);
b_updatingUI
=
false
;
}
}
...
...
@@ -317,20 +349,21 @@ bool View::isLinkedToMap(const QString& name) const
return
l_maps
.
contains
(
m
);
}
void
View
::
init
()
{
glewExperimental
=
GL_TRUE
;
// needed for GL Core Profile 3.3
glewInit
();
std
::
cout
<<
"using "
<<
glGetString
(
GL_VERSION
)
<<
std
::
endl
;
// int major = 0;
// int minor = 0;
// glGetIntegerv(GL_MAJOR_VERSION, &major);
// glGetIntegerv(GL_MINOR_VERSION, &minor);
// std::cout << this->getName().toStdString() << "is using GL "<< major <<"."<< minor << std::endl;
qglviewer
::
Camera
*
c
=
this
->
camera
();
this
->
setCamera
(
m_currentCamera
);
//
delete c;
delete
c
;
this
->
setBackgroundColor
(
QColor
(
0
,
0
,
0
));
glEnable
(
GL_DEPTH_TEST
);
...
...
@@ -354,6 +387,7 @@ void View::init()
m_buttonAreaLeft
=
new
ViewButtonArea
(
this
);
m_buttonAreaLeft
->
setTopLeftPosition
(
0
,
0
);
m_mapsButton
=
new
ViewButton
(
":icons/icons/maps.png"
,
this
);
m_buttonAreaLeft
->
addButton
(
m_mapsButton
);
connect
(
m_mapsButton
,
SIGNAL
(
clicked
(
int
,
int
,
int
,
int
)),
this
,
SLOT
(
ui_mapsListView
(
int
,
int
,
int
,
int
)));
...
...
@@ -366,13 +400,13 @@ void View::init()
m_buttonAreaLeft
->
addButton
(
m_camerasButton
);
connect
(
m_camerasButton
,
SIGNAL
(
clicked
(
int
,
int
,
int
,
int
)),
this
,
SLOT
(
ui_camerasListView
(
int
,
int
,
int
,
int
)));
// FRAME DRAWER
m_frameDrawer
=
new
Utils
::
Drawer
();
glm
::
mat4
mm
(
1.0
);
glm
::
mat4
pm
(
1.0
);
// m_frameDrawer->getShader()->updateMatrices(mm, pm);
m_frameDrawer
->
updateMatrices
(
mm
,
pm
);
m_frameDrawer
->
getShader
()
->
updateMatrices
(
mm
,
pm
);
m_frameDrawer
->
newList
(
GL_COMPILE
);
m_frameDrawer
->
color3f
(
0.0
f
,
1.0
f
,
0.0
f
);
...
...
@@ -385,32 +419,18 @@ void View::init()
m_frameDrawer
->
end
();
m_frameDrawer
->
endList
();
// WALLPAPER
std
::
cout
<<
"end INIT of "
<<
this
->
getName
().
toStdString
()
<<
std
::
endl
;
m_textureWallpaper
=
new
Utils
::
Texture
<
2
,
Geom
::
Vec3uc
>
(
GL_UNSIGNED_BYTE
);
m_textureWallpaper
->
create
(
Geom
::
Vec2ui
(
16
,
16
));
const
float
max
=
m_textureWallpaper
->
size
()[
0
];
for
(
unsigned
int
ki
=
0
;
ki
<
m_textureWallpaper
->
size
()[
0
];
++
ki
)
{
for
(
unsigned
int
kj
=
0
;
kj
<
m_textureWallpaper
->
size
()[
1
];
++
kj
)
{
float
col
=
255
-
(
255
*
((
kj
/
max
)
*
0.6
+
0.2
));
(
*
m_textureWallpaper
)(
ki
,
kj
)
=
Geom
::
Vec3f
(
col
,
col
,
col
);
}
}
m_textureWallpaper
->
update
();
m_textureWallpaper
->
setWrapping
(
GL_CLAMP_TO_EDGE
);
m_shaderWallpaper
=
new
Utils
::
ShaderWallPaper
();
m_shaderWallpaper
->
setTextureUnit
(
GL_TEXTURE0
);
m_shaderWallpaper
->
setTexture
(
m_textureWallpaper
);
// qglviewer::Camera* c = this->camera();
// this->setCamera(m_currentCamera);
// delete c;
this
->
setBackgroundColor
(
QColor
(
0
,
0
,
0
));
}
void
View
::
preDraw
()
{
if
(
Utils
::
GLSLShader
::
CURRENT_OGL_VERSION
>=
3
)
if
(
Utils
::
GLSLShader
::
CURRENT_OGL_VERSION
>=
3
)
makeCurrent
();
m_currentCamera
->
setScreenWidthAndHeight
(
width
(),
height
());
...
...
@@ -419,26 +439,27 @@ void View::preDraw()
void
View
::
draw
()
{
if
(
Utils
::
GLSLShader
::
CURRENT_OGL_VERSION
>=
3
)
if
(
Utils
::
GLSLShader
::
CURRENT_OGL_VERSION
>=
3
)
{
glEnable
(
GL_DEPTH_TEST
);
glDepthFunc
(
GL_LESS
);
glClear
(
GL_DEPTH_BUFFER_BIT
|
GL_COLOR_BUFFER_BIT
);
}
m_shaderWallpaper
->
draw
();
const
CameraSet
&
cams
=
m_schnapps
->
getCameraSet
();
QList
<
Camera
*>
lc
=
cams
.
values
();
foreach
(
Camera
*
camera
,
lc
)
foreach
(
Camera
*
camera
,
lc
)
{
if
(
camera
!=
m_currentCamera
)
if
(
camera
!=
m_currentCamera
)
{
if
(
camera
->
getDraw
())
camera
->
draw
();
if
(
camera
->
getDrawPath
())
camera
->
drawAllPaths
();
if
(
camera
->
getDraw
())
camera
->
draw
();
if
(
camera
->
getDrawPath
())
camera
->
drawAllPaths
();
}
}
// for debugging
// m_currentCamera->drawBBCam();
glm
::
mat4
mm
=
getCurrentModelViewMatrix
();
glm
::
mat4
pm
=
getCurrentProjectionMatrix
();
...
...
@@ -450,9 +471,9 @@ void View::draw()
if
(
map
==
selectedMap
)
{
Utils
::
Drawer
*
bbDr
=
map
->
getBBDraw
er
();
if
(
bb
D
r
)
bb
D
r
->
updateMatrices
(
pm
,
map_mm
);
Utils
::
GLSLShader
*
bbShader
=
map
->
getBBDrawerShad
er
();
if
(
bb
Shade
r
)
bb
Shade
r
->
updateMatrices
(
pm
,
map_mm
);
map
->
drawBB
();
}
...
...
@@ -479,9 +500,8 @@ void View::postDraw()
void
View
::
resizeGL
(
int
width
,
int
height
)
{
QGLViewer
::
resizeGL
(
width
,
height
);
if
(
m_buttonArea
)
m_buttonArea
->
setTopRightPosition
(
width
/
this
->
pixelRatio
()
,
0
);
m_buttonArea
->
setTopRightPosition
(
width
,
0
);
if
(
m_buttonAreaLeft
)
m_buttonAreaLeft
->
setTopLeftPosition
(
0
,
0
);
...
...
@@ -502,51 +522,9 @@ void View::drawFrame()
void
View
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
event
->
key
()
==
Qt
::
Key_S
)
{
b_saveSnapshots
=
!
b_saveSnapshots
;
if
(
b_saveSnapshots
)
{
QMessageBox
msgBox
;
msgBox
.
setText
(
"Snapshot every frame?"
);
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
|
QMessageBox
::
Cancel
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Ok
)
{
m_schnapps
->
statusBarMessage
(
"frame snapshot !!"
,
2000
);
connect
(
this
,
SIGNAL
(
drawFinished
(
bool
)),
this
,
SLOT
(
saveSnapshot
(
bool
)));
}
else
{
m_schnapps
->
statusBarMessage
(
"cancel frame snapshot"
,
2000
);
b_saveSnapshots
=
false
;
}
}
else
{
disconnect
(
this
,
SIGNAL
(
drawFinished
(
bool
)),
this
,
SLOT
(
saveSnapshot
(
bool
)));
m_schnapps
->
statusBarMessage
(
"Stop frame snapshot"
,
2000
);
}
}
else
{
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
plugin
->
keyPress
(
this
,
event
);
if
(
event
->
key
()
==
Qt
::
Key_Escape
)
{
QMessageBox
msgBox
;
msgBox
.
setText
(
"Really quit SCHNApps ?"
);
msgBox
.
setStandardButtons
(
QMessageBox
::
Ok
|
QMessageBox
::
Cancel
);
msgBox
.
setDefaultButton
(
QMessageBox
::
Ok
);
if
(
msgBox
.
exec
()
==
QMessageBox
::
Ok
)
m_schnapps
->
close
();
}
else
QGLViewer
::
keyPressEvent
(
event
);
}
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
plugin
->
keyPress
(
this
,
event
);
QGLViewer
::
keyPressEvent
(
event
);
}
void
View
::
keyReleaseEvent
(
QKeyEvent
*
event
)
...
...
@@ -558,23 +536,17 @@ void View::keyReleaseEvent(QKeyEvent *event)
void
View
::
mousePressEvent
(
QMouseEvent
*
event
)
{
if
(
!
isSelectedView
())
m_schnapps
->
setSelectedView
(
this
);
if
(
m_buttonAreaLeft
->
isClicked
(
event
->
x
(),
event
->
y
()))
if
(
m_buttonArea
->
isClicked
(
event
->
x
(),
event
->
y
()))
m_buttonArea
->
clickButton
(
event
->
x
(),
event
->
y
(),
event
->
globalX
(),
event
->
globalY
());
else
if
(
m_buttonAreaLeft
->
isClicked
(
event
->
x
(),
event
->
y
()))
m_buttonAreaLeft
->
clickButton
(
event
->
x
(),
event
->
y
(),
event
->
globalX
(),
event
->
globalY
());
else
{
hideDialogs
();
if
(
m_buttonArea
->
isClicked
(
event
->
x
(),
event
->
y
()))
m_buttonArea
->
clickButton
(
event
->
x
(),
event
->
y
(),
event
->
globalX
(),
event
->
globalY
());
else
{
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
plugin
->
mousePress
(
this
,
event
);
QGLViewer
::
mousePressEvent
(
event
);
}
if
(
!
isSelectedView
())
m_schnapps
->
setSelectedView
(
this
);
foreach
(
PluginInteraction
*
plugin
,
l_plugins
)
plugin
->
mousePress
(
this
,
event
);
QGLViewer
::
mousePressEvent
(
event
);
}
}
...
...
@@ -639,27 +611,6 @@ glm::mat4 View::getCurrentModelViewProjectionMatrix() const
}
void
View
::
closeDialogs
()
{