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

Zolnai Tamás tamas.zolnai at collabora.com
Thu Jul 3 07:30:16 PDT 2014


 avmedia/source/framework/modeltools.cxx |    1 -
 avmedia/source/opengl/oglwindow.cxx     |   17 +++++++++++++++++
 avmedia/source/opengl/oglwindow.hxx     |    2 ++
 3 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 9a670eb493f3760eb398c3f9d2296d979b608f95
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Thu Jul 3 16:26:44 2014 +0200

    glTF: constraine camera move in orbit mode
    
    Not to get too close to / too far from the model.
    Too close means move into the model.
    
    Change-Id: Ie25d87c88093d4baaf98f13ab8239263b5e1bf66

diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index f45468e..b3b1777 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -21,6 +21,7 @@ OGLWindow::OGLWindow( glTFHandle& rHandle, OpenGLContext& rContext, Window& rEve
     , m_bVisible ( false )
     , m_aLastMousePos(Point())
     , m_bIsOrbitMode( false )
+    , m_fCameraDistance(0.0)
 {
 }
 
@@ -261,6 +262,16 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
                         if(nCode == KEY_A)vMoveBy -= vStrafe*(0.0005f*fModelSize);
                         if(nCode == KEY_D)vMoveBy += vStrafe*(0.0005f*fModelSize);
                     }
+                    else
+                    {
+                        // Limit zooming in orbit mode
+                        m_fCameraDistance += vMoveBy.z;
+                        if (m_fCameraDistance < 0.75 * fModelSize || m_fCameraDistance > 2 * fModelSize)
+                        {
+                            m_fCameraDistance -= vMoveBy.z;
+                            vMoveBy = glm::vec3(0.0);
+                        }
+                    }
                 }
                 gltf_renderer_move_camera(&m_rHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0);
             }
@@ -275,6 +286,12 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
                 {
                     gltf_orbit_mode_start(&m_rHandle);
                     m_bIsOrbitMode = true;
+                    // Set default camera distance
+                    glm::vec3 vEye;
+                    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;
                 }
             }
             else if(nCode == KEY_F)
diff --git a/avmedia/source/opengl/oglwindow.hxx b/avmedia/source/opengl/oglwindow.hxx
index b4b1390..68b1ed8 100644
--- a/avmedia/source/opengl/oglwindow.hxx
+++ b/avmedia/source/opengl/oglwindow.hxx
@@ -68,9 +68,11 @@ private:
     glTFHandle& m_rHandle;
     OpenGLContext& m_rContext;
     Window& m_rEventHandler;
+
     bool m_bVisible;
     Point m_aLastMousePos;
     bool m_bIsOrbitMode;
+    double m_fCameraDistance;
 };
 
 } // namespace ogl
commit 0b3a918860944878b5fc4cf87883889bc467a052
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date:   Tue Jul 1 12:29:45 2014 +0200

    Remove obsolete comment
    
    Change-Id: I0cc592b245871187dd41e85be8c86e6e7878181b

diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index 6119cb7..87c7519 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -87,7 +87,6 @@ bool KmzDae2Gltf(const OUString& rSourceURL, OUString& o_rOutput)
     asset->setBundleOutputPath(OUStringToOString( sOutput, RTL_TEXTENCODING_UTF8 ).getStr());
 
     // If *.dae file is not in the local file system, then copy it to a temp folder for the conversion
-    // KMZ covnerter need a temp folder in all case, because it creates temp files next to the source file
     OUString sInput = rSourceURL;
     const INetURLObject aSourceURLObj(rSourceURL);
     if( aSourceURLObj.GetProtocol() != INET_PROT_FILE )


More information about the Libreoffice-commits mailing list