avmedia/source/opengl/oglwindow.cxx | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
New commits: commit 99c6a8eb358003b9a5663988e475509cf77cc583 Author: Zolnai Tamás <tamas.zol...@collabora.com> Date: Thu Jul 17 16:21:02 2014 +0200 glTF: allow to move camera also by keyboard in orbit mode. Change-Id: Ibf16b9651988358c30d649dd937813329d0f64ec (cherry picked from commit 9e8dbd37c4dda5d07c22c66a5a2b08cce4d175f5) Reviewed-on: https://gerrit.libreoffice.org/10368 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx index c748ca1..2650faf 100644 --- a/avmedia/source/opengl/oglwindow.cxx +++ b/avmedia/source/opengl/oglwindow.cxx @@ -268,15 +268,18 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) vMup = glm::normalize(vMup); vMup *= 25.0f; - if(nCode == KEY_W)vMoveBy += vMove*(0.0005f*fModelSize); - if(nCode == KEY_S)vMoveBy -= vMove*(0.0005f*fModelSize); if( !m_bIsOrbitMode ) { + if(nCode == KEY_W)vMoveBy += vMove*(0.0005f*fModelSize); + if(nCode == KEY_S)vMoveBy -= vMove*(0.0005f*fModelSize); if(nCode == KEY_A)vMoveBy -= vStrafe*(0.0005f*fModelSize); if(nCode == KEY_D)vMoveBy += vStrafe*(0.0005f*fModelSize); } else { + if(nCode == KEY_E)vMoveBy += vMove*(0.0005f*fModelSize); + if(nCode == KEY_Q)vMoveBy -= vMove*(0.0005f*fModelSize); + // Limit zooming in orbit mode m_fCameraDistance += vMoveBy.z; if ((m_fCameraDistance < 0.5 * fModelSize && vMoveBy.z < 0.0 ) || @@ -288,6 +291,30 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) } } gltf_renderer_move_camera(&m_rHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0); + + if( m_bIsOrbitMode ) + { + long nDeltaX = 0; + long nDeltaY = 0; + if (nCode == KEY_W) + { + nDeltaY -= 1; + } + if (nCode == KEY_S) + { + nDeltaY += 1; + } + if (nCode == KEY_A) + { + nDeltaX -= 1; + } + if (nCode == KEY_D) + { + nDeltaX += 1; + } + float fSensitivity = 50.0; + gltf_renderer_rotate_model(&m_rHandle, nDeltaX*fSensitivity, nDeltaY*fSensitivity, 0.0); + } } else if(nCode == KEY_M) {
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits