summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-07-04 13:21:58 +0200
committerZolnai Tamás <tamas.zolnai@collabora.com>2014-07-04 13:21:58 +0200
commit2946c7c62718cb74feab554b5939ec340e6c4280 (patch)
tree5db02445d24a4e44f15044865a86d582a3c7ee85
parentdfeef9e970a69c5736a54619b96607899c57e9a1 (diff)
glTF: camera movement constraint: use distance from the boundary box
... instead of distance from model center position. Change-Id: I379ab5e32cc5009d0eb751c4808fecf0109d1e5a
-rw-r--r--avmedia/source/opengl/oglwindow.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index 9060145d228e..9f09533d2ce9 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -266,7 +266,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
{
// Limit zooming in orbit mode
m_fCameraDistance += vMoveBy.z;
- if ((m_fCameraDistance < 0.75 * fModelSize && vMoveBy.z < 0.0 ) ||
+ if ((m_fCameraDistance < 0.5 * fModelSize && vMoveBy.z < 0.0 ) ||
(m_fCameraDistance > 2 * fModelSize && vMoveBy.z > 0.0 ))
{
m_fCameraDistance -= vMoveBy.z;
@@ -292,7 +292,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
glm::vec3 vView;
glm::vec3 vUp;
gltf_get_camera_pos(&m_rHandle, &vEye,&vView,&vUp);
- m_fCameraDistance = vEye.z - gltf_get_model_center_pos(&m_rHandle)->z;
+ m_fCameraDistance = vEye.z - gltf_get_model_center_pos(&m_rHandle)->z - (gltf_get_model_size(&m_rHandle)/2.0);
}
}
else if(nCode == KEY_F)