Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 518664 | Differences between
and this patch

Collapse All | Expand All

(-)a/avmedia/source/opengl/oglframegrabber.hxx (-4 lines)
Lines 14-24 Link Here
14
#include <com/sun/star/lang/XServiceInfo.hpp>
14
#include <com/sun/star/lang/XServiceInfo.hpp>
15
#include <com/sun/star/media/XFrameGrabber.hpp>
15
#include <com/sun/star/media/XFrameGrabber.hpp>
16
16
17
#ifdef SYSTEM_LIBGLTF
18
#include <libgltf/libgltf.h>
19
#else
20
#include <libgltf.h>
17
#include <libgltf.h>
21
#endif
22
18
23
namespace avmedia { namespace ogl {
19
namespace avmedia { namespace ogl {
24
20
(-)a/avmedia/source/opengl/oglplayer.cxx (-2 / +14 lines)
Lines 269-274 uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c Link Here
269
        return uno::Reference< media::XPlayerWindow >();
269
        return uno::Reference< media::XPlayerWindow >();
270
    }
270
    }
271
271
272
    if( !m_aContext.supportMultiSampling() )
273
    {
274
        SAL_WARN("avmedia.opengl", "Context does not support multisampling!");
275
        return uno::Reference< media::XPlayerWindow >();
276
    }
277
272
    if( !lcl_CheckOpenGLRequirements() )
278
    if( !lcl_CheckOpenGLRequirements() )
273
    {
279
    {
274
        SAL_WARN("avmedia.opengl", "Your platform does not have the minimal OpenGL requiremenets!");
280
        SAL_WARN("avmedia.opengl", "Your platform does not have the minimal OpenGL requiremenets!");
Lines 287-293 uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c Link Here
287
    releaseInputFiles();
293
    releaseInputFiles();
288
    if( nRet != 0 )
294
    if( nRet != 0 )
289
    {
295
    {
290
        SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
296
        SAL_WARN("avmedia.opengl", "Error occured while setting up the scene! Error code: " << nRet);
291
        return uno::Reference< media::XPlayerWindow >();
297
        return uno::Reference< media::XPlayerWindow >();
292
    }
298
    }
293
    // The background color is white by default, but we need to separate the
299
    // The background color is white by default, but we need to separate the
Lines 309-314 uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber() Link Here
309
        return uno::Reference< media::XFrameGrabber >();
315
        return uno::Reference< media::XFrameGrabber >();
310
    }
316
    }
311
317
318
    if( !m_aContext.supportMultiSampling() )
319
    {
320
        SAL_WARN("avmedia.opengl", "Context does not support multisampling!");
321
        return uno::Reference< media::XFrameGrabber >();
322
    }
323
312
    if( !lcl_CheckOpenGLRequirements() )
324
    if( !lcl_CheckOpenGLRequirements() )
313
    {
325
    {
314
        SAL_WARN("avmedia.opengl", "Your platform does not have the minimal OpenGL requiremenets!");
326
        SAL_WARN("avmedia.opengl", "Your platform does not have the minimal OpenGL requiremenets!");
Lines 324-330 uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber() Link Here
324
    releaseInputFiles();
336
    releaseInputFiles();
325
    if( nRet != 0 )
337
    if( nRet != 0 )
326
    {
338
    {
327
        SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
339
        SAL_WARN("avmedia.opengl", "Error occured while setting up the scene! Error code: " << nRet);
328
        return uno::Reference< media::XFrameGrabber >();
340
        return uno::Reference< media::XFrameGrabber >();
329
    }
341
    }
330
    glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
342
    glClearColor(0.5f, 0.5f, 0.5f, 0.5f);
(-)a/avmedia/source/opengl/oglplayer.hxx (-4 / +2 lines)
Lines 14-24 Link Here
14
#include <cppuhelper/basemutex.hxx>
14
#include <cppuhelper/basemutex.hxx>
15
#include <com/sun/star/lang/XServiceInfo.hpp>
15
#include <com/sun/star/lang/XServiceInfo.hpp>
16
#include <com/sun/star/media/XPlayer.hpp>
16
#include <com/sun/star/media/XPlayer.hpp>
17
#ifdef SYSTEM_LIBGLTF
17
18
#include <libgltf/libgltf.h>
19
#else
20
#include <libgltf.h>
18
#include <libgltf.h>
21
#endif
19
22
#include <vcl/opengl/OpenGLContext.hxx>
20
#include <vcl/opengl/OpenGLContext.hxx>
23
#include <vcl/timer.hxx>
21
#include <vcl/timer.hxx>
24
22
(-)a/avmedia/source/opengl/oglwindow.cxx (-17 / +19 lines)
Lines 23-29 OGLWindow::OGLWindow( glTFHandle& rHandle, OpenGLContext& rContext, Window& rEve Link Here
23
    , meZoomLevel( media::ZoomLevel_ORIGINAL )
23
    , meZoomLevel( media::ZoomLevel_ORIGINAL )
24
    , m_aLastMousePos(Point(0,0))
24
    , m_aLastMousePos(Point(0,0))
25
    , m_bIsOrbitMode( false )
25
    , m_bIsOrbitMode( false )
26
    , m_fCameraDistance(0.0)
27
{
26
{
28
}
27
}
29
28
Lines 267-281 IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) Link Here
267
                    glm::vec3 vMove = vView-vEye;
266
                    glm::vec3 vMove = vView-vEye;
268
                    vMove = glm::normalize(vMove);
267
                    vMove = glm::normalize(vMove);
269
                    vMove *= 25.0f;
268
                    vMove *= 25.0f;
270
                    glm::vec3 vStrafe = glm::cross(vView-vEye, vUp);
269
                    glm::vec3 vStrafe = glm::cross(vMove, vUp);
271
                    vStrafe = glm::normalize(vStrafe);
270
                    vStrafe = glm::normalize(vStrafe);
272
                    vStrafe *= 25.0f;
271
                    vStrafe *= 25.0f;
273
                    glm::vec3 vMup = glm::cross(vView-vEye,glm::vec3(1.0f,0.0f,0.0f) );
272
                    glm::vec3 vMup = vUp * 25.0f;
274
                    vMup = glm::normalize(vMup);
275
                    vMup *= 25.0f;
276
273
277
                    if( !m_bIsOrbitMode )
274
                    if( !m_bIsOrbitMode )
278
                    {
275
                    {
276
                        if(nCode == KEY_E)vMoveBy += vMup*(0.0005f*fModelSize);
277
                        if(nCode == KEY_Q)vMoveBy -= vMup*(0.0005f*fModelSize);
279
                        if(nCode == KEY_W)vMoveBy += vMove*(0.0005f*fModelSize);
278
                        if(nCode == KEY_W)vMoveBy += vMove*(0.0005f*fModelSize);
280
                        if(nCode == KEY_S)vMoveBy -= vMove*(0.0005f*fModelSize);
279
                        if(nCode == KEY_S)vMoveBy -= vMove*(0.0005f*fModelSize);
281
                        if(nCode == KEY_A)vMoveBy -= vStrafe*(0.0005f*fModelSize);
280
                        if(nCode == KEY_A)vMoveBy -= vStrafe*(0.0005f*fModelSize);
Lines 283-297 IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) Link Here
283
                    }
282
                    }
284
                    else
283
                    else
285
                    {
284
                    {
286
                        if(nCode == KEY_E)vMoveBy += vMove*(0.0005f*fModelSize);
285
                        bool bZoomIn = false;
287
                        if(nCode == KEY_Q)vMoveBy -= vMove*(0.0005f*fModelSize);
286
                        bool bZoomOut = false;
287
                        if(nCode == KEY_E)
288
                        {
289
                            vMoveBy += vMove*(0.0005f*fModelSize);
290
                            bZoomIn = true;
291
                        }
292
                        if(nCode == KEY_Q)
293
                        {
294
                            vMoveBy -= vMove*(0.0005f*fModelSize);
295
                            bZoomOut = true;
296
                        }
288
297
289
                        // Limit zooming in orbit mode
298
                        // Limit zooming in orbit mode
290
                        m_fCameraDistance += vMoveBy.z;
299
                        float fCameraDistFromModelGlobe = glm::length(vEye + vMoveBy - vView) - fModelSize / 2.0f;
291
                        if ((m_fCameraDistance < 0.5 * fModelSize && vMoveBy.z < 0.0 ) ||
300
                        if ((fCameraDistFromModelGlobe < 0.5 * fModelSize && bZoomIn ) ||
292
                            (m_fCameraDistance > 2 * fModelSize && vMoveBy.z > 0.0 ))
301
                            (fCameraDistFromModelGlobe > 2 * fModelSize && bZoomOut ))
293
                        {
302
                        {
294
                            m_fCameraDistance -= vMoveBy.z;
295
                            vMoveBy = glm::vec3(0.0);
303
                            vMoveBy = glm::vec3(0.0);
296
                        }
304
                        }
297
                    }
305
                    }
Lines 333-344 IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent) Link Here
333
                {
341
                {
334
                    gltf_orbit_mode_start(&m_rHandle);
342
                    gltf_orbit_mode_start(&m_rHandle);
335
                    m_bIsOrbitMode = true;
343
                    m_bIsOrbitMode = true;
336
                    // Set default camera distance
337
                    glm::vec3 vEye;
338
                    glm::vec3 vView;
339
                    glm::vec3 vUp;
340
                    gltf_get_camera_pos(&m_rHandle, &vEye,&vView,&vUp);
341
                    m_fCameraDistance = vEye.z - gltf_get_model_center_pos(&m_rHandle)->z - (gltf_get_model_size(&m_rHandle)/2.0);
342
                }
344
                }
343
            }
345
            }
344
            else if(nCode == KEY_F)
346
            else if(nCode == KEY_F)
(-)a/avmedia/source/opengl/oglwindow.hxx (-5 / +1 lines)
Lines 17-27 Link Here
17
#include <com/sun/star/media/XPlayerWindow.hpp>
17
#include <com/sun/star/media/XPlayerWindow.hpp>
18
#include <com/sun/star/media/ZoomLevel.hpp>
18
#include <com/sun/star/media/ZoomLevel.hpp>
19
19
20
#ifdef SYSTEM_LIBGLTF
21
#include <libgltf/libgltf.h>
22
#else
23
#include <libgltf.h>
20
#include <libgltf.h>
24
#endif
21
25
#include <vcl/opengl/OpenGLContext.hxx>
22
#include <vcl/opengl/OpenGLContext.hxx>
26
#include <vcl/syschild.hxx>
23
#include <vcl/syschild.hxx>
27
24
Lines 77-83 private: Link Here
77
    com::sun::star::media::ZoomLevel meZoomLevel;
74
    com::sun::star::media::ZoomLevel meZoomLevel;
78
    Point m_aLastMousePos;
75
    Point m_aLastMousePos;
79
    bool m_bIsOrbitMode;
76
    bool m_bIsOrbitMode;
80
    double m_fCameraDistance;
81
};
77
};
82
78
83
} // namespace ogl
79
} // namespace ogl
(-)a/configure.ac (-1 / +1 lines)
Lines 10572-10578 if test "x$enable_gltf" != "xno" -a $_os != Darwin -a $_os != iOS -a $_os != And Link Here
10572
    AC_DEFINE(HAVE_FEATURE_GLTF,1)
10572
    AC_DEFINE(HAVE_FEATURE_GLTF,1)
10573
    if test "$with_system_libgltf" = "yes"; then
10573
    if test "$with_system_libgltf" = "yes"; then
10574
	SYSTEM_LIBGLTF=TRUE
10574
	SYSTEM_LIBGLTF=TRUE
10575
	PKG_CHECK_MODULES( LIBGLTF, libgltf-0.0 )
10575
	PKG_CHECK_MODULES( LIBGLTF, [libgltf-0.0 >= 0.0.1] )
10576
    else
10576
    else
10577
    	BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10577
    	BUILD_TYPE="$BUILD_TYPE LIBGLTF"
10578
    fi
10578
    fi
(-)a/include/vcl/opengl/OpenGLContext.hxx (+2 lines)
Lines 166-171 public: Link Here
166
        return mbInitialized;
166
        return mbInitialized;
167
    }
167
    }
168
168
169
    bool supportMultiSampling() const;
170
169
    static SystemWindowData generateWinData(Window* pParent);
171
    static SystemWindowData generateWinData(Window* pParent);
170
private:
172
private:
171
    SAL_DLLPRIVATE bool initWindow();
173
    SAL_DLLPRIVATE bool initWindow();
(-)a/vcl/source/opengl/OpenGLContext.cxx (-1 / +5 lines)
Lines 833-836 void OpenGLContext::show() Link Here
833
        m_pWindow->Show();
833
        m_pWindow->Show();
834
}
834
}
835
835
836
bool OpenGLContext::supportMultiSampling() const
837
{
838
    return m_aGLWin.bMultiSampleSupported;
839
}
840
836
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
841
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
837
- 

Return to bug 518664