diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-15 20:50:30 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-05-15 20:51:48 +0200 |
commit | 684b0a11040a4f46d9a4971583c21350b6395d18 (patch) | |
tree | d1ab962bc1bf935b802b75ae25eeacb4280658b7 /avmedia | |
parent | 1811336b058d1a26c7f6d836a5c478413c20f287 (diff) |
OGLWindow: improve camera movement, make it faster
By now there is no a timer which rerender the
scene all the time so we need to move camera
without setting time.
Change-Id: Iba1bfd9b9dc87309cf83d5dcd6832f0e4cb2cd92
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/opengl/oglwindow.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx index ca2ffbf41a1f..90e32edb187f 100644 --- a/avmedia/source/opengl/oglwindow.cxx +++ b/avmedia/source/opengl/oglwindow.cxx @@ -270,14 +270,14 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) vMup = glm::normalize(vMup); vMup *= 25.0f; - if(nCode == KEY_Q)vMoveBy += vMove*(0.1f*fModelSize); - if(nCode == KEY_E)vMoveBy -= vMove*(0.1f*fModelSize); - if(nCode == KEY_A)vMoveBy -= vStrafe*(0.1f*fModelSize); - if(nCode == KEY_D)vMoveBy += vStrafe*(0.1f*fModelSize); - if(nCode == KEY_W)vMoveBy -= vMup*(0.1f*fModelSize); - if(nCode == KEY_S)vMoveBy += vMup*(0.1f*fModelSize); + if(nCode == KEY_Q)vMoveBy += vMove*(0.001f*fModelSize); + if(nCode == KEY_E)vMoveBy -= vMove*(0.001f*fModelSize); + if(nCode == KEY_A)vMoveBy -= vStrafe*(0.001f*fModelSize); + if(nCode == KEY_D)vMoveBy += vStrafe*(0.001f*fModelSize); + if(nCode == KEY_W)vMoveBy -= vMup*(0.001f*fModelSize); + if(nCode == KEY_S)vMoveBy += vMup*(0.001f*fModelSize); } - gltf_renderer_move_camera(vMoveBy.x,vMoveBy.y,vMoveBy.z,10.0); + gltf_renderer_move_camera(vMoveBy.x,vMoveBy.y,vMoveBy.z,0.0); update(); } } @@ -290,7 +290,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) m_aLastMousePos = pMouseEvt->GetPosPixel(); } } - else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEBUTTONUP ) + else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE ) { MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData(); if(pMouseEvt && pMouseEvt->IsLeft()) @@ -299,9 +299,9 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) long nDeltaX = m_aLastMousePos.X()-aCurPos.X(); long nDeltaY = aCurPos.Y()-m_aLastMousePos.Y(); - static const float fSensitivity = 4.0; + static const float fSensitivity = 1.0; // TODO: It seems this method just moves the camera but not rotate it. - gltf_renderer_rotate_camera((float)nDeltaX*fSensitivity,(float)nDeltaY*fSensitivity,0.0,10.0); + gltf_renderer_rotate_camera((float)nDeltaX*fSensitivity,(float)nDeltaY*fSensitivity,0.0,0.0); update(); } } |