[Libreoffice-commits] core.git: 2 commits - avmedia/source external/libgltf

Zolnai Tamás tamas.zolnai at collabora.com
Wed May 28 06:44:14 PDT 2014


 avmedia/source/opengl/oglwindow.cxx             |   27 ++++++++++++++++++------
 external/libgltf/UnpackedTarball_libgltf.mk     |    1 
 external/libgltf/patches/deallocation_fix.patch |   12 ++++++++++
 3 files changed, 34 insertions(+), 6 deletions(-)

New commits:
commit 00e7b772b418049b117c57f8a3d85567701b47a6
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed May 28 15:40:06 2014 +0200

    Patching libgltf: fix wrong deallocation method
    
    Change-Id: I05c5650c1e43cf9ac4156e8d74073bf92ac0c4df
    (cherry picked from commit 3ce0f83cec6d2ee1467523209df633c5a2487f71)

diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index ce5ad79..3237707 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -20,6 +20,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
 	external/libgltf/patches/include_path_freetype.patch \
 	external/libgltf/patches/openmp-disable.patch \
 	external/libgltf/patches/rgba_textures.patch \
+	external/libgltf/patches/deallocation_fix.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/deallocation_fix.patch b/external/libgltf/patches/deallocation_fix.patch
new file mode 100644
index 0000000..4049e2f
--- /dev/null
+++ b/external/libgltf/patches/deallocation_fix.patch
@@ -0,0 +1,12 @@
+diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp
+--- libgltf.org/src/LoadScene.cpp	2014-05-28 15:35:48.232375923 +0200
++++ libgltf/src/LoadScene.cpp	2014-05-28 15:36:02.600375314 +0200
+@@ -144,7 +144,7 @@
+         free(gHandle->files);
+         gHandle->files = NULL;
+     }
+-    delete gHandle;
++    free(gHandle);
+     return true;
+ }
+ 
commit 677302934793f1874b739b858a659220f247adac
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Wed May 28 15:33:39 2014 +0200

    glTF rendering: workaround for camera movements
    
    If the glTF contains camera movement in it moving camera
    by keyboard didn't work very well.
    
    Change-Id: I9300a257858d4f35c2d622654a0c2fd85eedc5ed
    (cherry picked from commit 968b7f807561339d0083fe0aa6e893983ca60456)

diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index 6f39b0e..160ef6f 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -270,18 +270,33 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
                     vMup = glm::normalize(vMup);
                     vMup *= 25.0f;
 
-                    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);
+                    if(nCode == KEY_Q)vMoveBy += vMove*(0.0005f*fModelSize);
+                    if(nCode == KEY_E)vMoveBy -= vMove*(0.0005f*fModelSize);
+                    if(nCode == KEY_A)vMoveBy -= vStrafe*(0.0005f*fModelSize);
+                    if(nCode == KEY_D)vMoveBy += vStrafe*(0.0005f*fModelSize);
+                    if(nCode == KEY_W)vMoveBy -= vMup*(0.0005f*fModelSize);
+                    if(nCode == KEY_S)vMoveBy += vMup*(0.0005f*fModelSize);
                 }
                 gltf_renderer_move_camera(m_pHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0);
                 update();
             }
         }
     }
+    // TODO: Clean this mess up after libgltf gets a working camera handling
+     else if( pEvent->GetId() == VCLEVENT_WINDOW_KEYUP )
+    {
+        KeyEvent* pKeyEvt = (KeyEvent*)pEvent->GetData();
+        if(pKeyEvt)
+        {
+            const sal_uInt16 nCode = pKeyEvt->GetKeyCode().GetCode();
+            if (nCode == KEY_Q || nCode == KEY_E ||
+                nCode == KEY_A || nCode == KEY_D ||
+                nCode == KEY_W || nCode == KEY_S )
+            {
+                gltf_renderer_move_camera(m_pHandle, 0.0, 0.0, 0.0, 0.0);
+            }
+        }
+    }
     else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEBUTTONDOWN )
     {
         MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();


More information about the Libreoffice-commits mailing list