Verified Commit 4570634c authored by Tobias WEBER's avatar Tobias WEBER
Browse files

added zoom keys

parent d70d2e4c
......@@ -47,7 +47,7 @@ if [ $create_appdir -ne 0 ]; then
mkdir -p ${APPDIRNAME}/DEBIAN
# debian package control file
echo -e "Package: ${APPNAME}\nVersion: 1.3.0" > ${APPDIRNAME}/DEBIAN/control
echo -e "Package: ${APPNAME}\nVersion: 1.3.1" > ${APPDIRNAME}/DEBIAN/control
echo -e "Architecture: $(dpkg --print-architecture)" >> ${APPDIRNAME}/DEBIAN/control
echo -e "Section: base\nPriority: optional" >> ${APPDIRNAME}/DEBIAN/control
echo -e "Description: TAS pathfinding software" >> ${APPDIRNAME}/DEBIAN/control
......
......@@ -15,8 +15,8 @@
<key>CFBundleDisplayName</key> <string>TAS-Paths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths</string>
<key>CFBundleExecutable</key> <string>taspaths</string>
<key>CFBundleVersion</key> <string>1.3.0</string>
<key>CFBundleShortVersionString</key> <string>1.3.0</string>
<key>CFBundleVersion</key> <string>1.3.1</string>
<key>CFBundleShortVersionString</key> <string>1.3.1</string>
<key>CFBundleIconFile</key> <string>taspaths.icns</string>
<key>NSPrincipalClass</key> <string>NSApplication</string>
......
......@@ -5,12 +5,12 @@
<plist version="1.0">
<dict>
<key>CFBundleName</key> <string>TASPaths</string>
<key>CFBundleDisplayName</key> <string>TASPaths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths_hull</string>
<key>CFBundleName</key> <string>TAS-Paths</string>
<key>CFBundleDisplayName</key> <string>TAS-Paths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths-hull</string>
<key>CFBundleVersion</key> <string>1.2.0</string>
<key>CFBundleShortVersionString</key> <string>1.2.0</string>
<key>CFBundleVersion</key> <string>1.3.1</string>
<key>CFBundleShortVersionString</key> <string>1.3.1</string>
<key>CFBundleIconFile</key> <string>taspaths.icns</string>
<key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string> </array>
......
......@@ -5,12 +5,12 @@
<plist version="1.0">
<dict>
<key>CFBundleName</key> <string>TASPaths</string>
<key>CFBundleDisplayName</key> <string>TASPaths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths_lines</string>
<key>CFBundleName</key> <string>TAS-Paths</string>
<key>CFBundleDisplayName</key> <string>TAS-Paths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths-lines</string>
<key>CFBundleVersion</key> <string>1.2.0</string>
<key>CFBundleShortVersionString</key> <string>1.2.0</string>
<key>CFBundleVersion</key> <string>1.3.1</string>
<key>CFBundleShortVersionString</key> <string>1.3.1</string>
<key>CFBundleIconFile</key> <string>taspaths.icns</string>
<key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string> </array>
......
......@@ -5,12 +5,12 @@
<plist version="1.0">
<dict>
<key>CFBundleName</key> <string>TASPaths</string>
<key>CFBundleDisplayName</key> <string>TASPaths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths_poly</string>
<key>CFBundleName</key> <string>TAS-Paths</string>
<key>CFBundleDisplayName</key> <string>TAS-Paths</string>
<key>CFBundleIdentifier</key> <string>eu.ill.cs.takin.taspaths-poly</string>
<key>CFBundleVersion</key> <string>1.2.0</string>
<key>CFBundleShortVersionString</key> <string>1.2.0</string>
<key>CFBundleVersion</key> <string>1.3.1</string>
<key>CFBundleShortVersionString</key> <string>1.3.1</string>
<key>CFBundleIconFile</key> <string>taspaths.icns</string>
<key>CFBundleSupportedPlatforms</key> <array> <string>MacOSX</string> </array>
......
......@@ -34,7 +34,7 @@
#define TASPATHS_TITLE "TAS-Paths"
// version number of this software
#define TASPATHS_VERSION "1.3"
#define TASPATHS_VERSION "1.3.1"
/**
......
......@@ -626,6 +626,8 @@ void PathsRenderer::tick()
void PathsRenderer::tick(const std::chrono::milliseconds& ms)
{
bool update = false;
// if a key is pressed, move and update the camera
if(m_arrowDown[0] || m_arrowDown[1] || m_arrowDown[2] || m_arrowDown[3]
|| m_pageDown[0] || m_pageDown[1])
......@@ -647,8 +649,23 @@ void PathsRenderer::tick(const std::chrono::milliseconds& ms)
m_matCamTrans(1,3) += xinc[1] + yinc[1] + zinc[1];
m_matCamTrans(2,3) += xinc[2] + yinc[2] + zinc[2];
UpdateCam();
update = true;
}
// zoom the view
if(m_bracketDown[0] || m_bracketDown[1])
{
t_real zoom_dir = -1;
if(m_bracketDown[1])
zoom_dir = 1;
t_real zoom_scale = t_real_gl(ms.count()) * g_zoom_scale;
ZoomCam(zoom_dir * zoom_scale);
update = true;
}
if(update)
UpdateCam();
}
......@@ -1301,6 +1318,14 @@ void PathsRenderer::keyPressEvent(QKeyEvent *pEvt)
m_pageDown[1] = 1;
pEvt->accept();
break;
case Qt::Key_BracketLeft:
m_bracketDown[0] = 1;
pEvt->accept();
break;
case Qt::Key_BracketRight:
m_bracketDown[1] = 1;
pEvt->accept();
break;
/*case Qt::Key_S:
SaveShadowFramebuffer("shadow.png");
break;*/
......@@ -1341,6 +1366,14 @@ void PathsRenderer::keyReleaseEvent(QKeyEvent *pEvt)
m_pageDown[1] = 0;
pEvt->accept();
break;
case Qt::Key_BracketLeft:
m_bracketDown[0] = 0;
pEvt->accept();
break;
case Qt::Key_BracketRight:
m_bracketDown[1] = 0;
pEvt->accept();
break;
default:
QOpenGLWidget::keyReleaseEvent(pEvt);
break;
......@@ -1482,15 +1515,21 @@ void PathsRenderer::mouseReleaseEvent(QMouseEvent *pEvt)
void PathsRenderer::wheelEvent(QWheelEvent *pEvt)
{
const t_real_gl degrees = pEvt->angleDelta().y() / 8.;
// zoom
m_zoom *= std::pow(2., degrees/64.);
UpdateCam();
ZoomCam(degrees * g_wheel_zoom_scale);
pEvt->accept();
}
void PathsRenderer::ZoomCam(t_real zoom, bool update)
{
m_zoom *= std::pow(2., zoom);
if(update)
UpdateCam();
}
void PathsRenderer::paintEvent(QPaintEvent* pEvt)
{
QOpenGLWidget::paintEvent(pEvt);
......
......@@ -139,6 +139,8 @@ protected:
void UpdateViewport();
void UpdateShadowFramebuffer();
void ZoomCam(t_real zoom, bool update = true);
void DoPaintGL(qgl_funcs *pGL);
void DoPaintQt(QPainter &painter);
......@@ -157,6 +159,7 @@ private:
bool m_perspectiveProjection = true;
bool m_arrowDown[4] = { 0, 0, 0, 0 }; // l, r, u, d
bool m_pageDown[2] = { 0, 0 };
bool m_bracketDown[2] = { 0, 0 };
protected:
......
......@@ -98,6 +98,8 @@ unsigned int g_timer_fps = 30;
// renderer options
tl2::t_real_gl g_move_scale = tl2::t_real_gl(1./75.);
tl2::t_real_gl g_zoom_scale = 0.0025;
tl2::t_real_gl g_wheel_zoom_scale = tl2::t_real_gl(1./64.);
tl2::t_real_gl g_rotation_scale = tl2::t_real_gl(0.02);
int g_light_follows_cursor = 0;
......
......@@ -122,6 +122,10 @@ extern int g_automatic_screenshots;
// camera translation scaling factor
extern tl2::t_real_gl g_move_scale;
// camera zoom scaling factors
extern tl2::t_real_gl g_zoom_scale;
extern tl2::t_real_gl g_wheel_zoom_scale;
// camera rotation scaling factor
extern tl2::t_real_gl g_rotation_scale;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment