summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-07-17 16:21:02 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-07-17 16:21:02 +0200
commit9e8dbd37c4dda5d07c22c66a5a2b08cce4d175f5 (patch)
tree0140150f48bdbcb61004bc980a4078bbb2b17d70 /avmedia
parent472e34d22f845734b886142bfcaadc69d6749e39 (diff)
glTF: allow to move camera also by keyboard in orbit mode.
Change-Id: Ibf16b9651988358c30d649dd937813329d0f64ec
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/opengl/oglwindow.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index d082aa9d24f4..ce8f46242da0 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -260,15 +260,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 ) ||
@@ -280,6 +283,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)
{