[Libreoffice-commits] core.git: Branch 'libreoffice-4-3' - 25 commits - avmedia/source download.lst external/collada2gltf external/libgltf external/opencollada slideshow/source
Zolnai Tamás
tamas.zolnai at collabora.com
Wed Jun 11 10:34:26 PDT 2014
avmedia/source/framework/modeltools.cxx | 55
avmedia/source/opengl/oglframegrabber.cxx | 11
avmedia/source/opengl/oglframegrabber.hxx | 4
avmedia/source/opengl/oglplayer.cxx | 95
avmedia/source/opengl/oglplayer.hxx | 2
avmedia/source/opengl/oglwindow.cxx | 111
avmedia/source/opengl/oglwindow.hxx | 8
download.lst | 5
external/collada2gltf/GitSHA1.cpp | 2
external/collada2gltf/UnpackedTarball_collada2gltf.mk | 13
external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 | 8522 ----------
external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3 | 8522 ++++++++++
external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0 | 128
external/collada2gltf/patches/wrong_uri_usage.patch.1 | 78
external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 | 128
external/libgltf/UnpackedTarball_libgltf.mk | 4
external/libgltf/patches/deallocation_fix.patch | 12
external/libgltf/patches/disable_fps_and_timer.patch | 124
external/libgltf/patches/openmp-disable.patch | 12
external/libgltf/patches/rgba_textures.patch | 12
external/opencollada/UnpackedTarball_opencollada.mk | 6
external/opencollada/opencollada.clang.patch.0 | 22
external/opencollada/opencollada.libxml.patch.0 | 12
external/opencollada/patches/0001-Revert-fix-for-malformed-FBX-COLLADA-id.patch.1 | 51
external/opencollada/patches/0002-Expose-sid-for-textures-in-extras.patch.1 | 66
external/opencollada/patches/opencollada.clang.patch.0 | 22
external/opencollada/patches/opencollada.libxml.patch.0 | 12
slideshow/source/engine/shapes/viewmediashape.cxx | 6
28 files changed, 9133 insertions(+), 8912 deletions(-)
New commits:
commit 99d3e778d8896d72a5733ded8d1f3c304bae8d9c
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 15:00:20 2014 +0200
OGLFrameGrabber: use reference instead of pointer
Change-Id: Id21138ce2a5d8e764407f42afa2b21464da70e45
(cherry picked from commit 1f1c3b2966c36149ca8b8a2e411d562c154f6c6b)
diff --git a/avmedia/source/opengl/oglframegrabber.cxx b/avmedia/source/opengl/oglframegrabber.cxx
index e92cd86..cca8cc0 100644
--- a/avmedia/source/opengl/oglframegrabber.cxx
+++ b/avmedia/source/opengl/oglframegrabber.cxx
@@ -23,9 +23,9 @@ using namespace com::sun::star;
namespace avmedia { namespace ogl {
-OGLFrameGrabber::OGLFrameGrabber( glTFHandle* pHandle )
+OGLFrameGrabber::OGLFrameGrabber( glTFHandle& rHandle )
: FrameGrabber_BASE()
- , m_pHandle( pHandle )
+ , m_rHandle( rHandle )
{
}
@@ -36,9 +36,10 @@ OGLFrameGrabber::~OGLFrameGrabber()
uno::Reference< css::graphic::XGraphic > SAL_CALL OGLFrameGrabber::grabFrame( double /*fMediaTime*/ )
throw ( uno::RuntimeException, std::exception )
{
- boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[m_pHandle->viewport.width * m_pHandle->viewport.height * 4]);
- gltf_renderer_get_bitmap(&m_pHandle, 1, (char*)pBuffer.get(), GL_BGRA);
- BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_pHandle->viewport.width, m_pHandle->viewport.height);
+ boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[m_rHandle.viewport.width * m_rHandle.viewport.height * 4]);
+ glTFHandle* pHandle = &m_rHandle;
+ gltf_renderer_get_bitmap(&pHandle, 1, (char*)pBuffer.get(), GL_BGRA);
+ BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_rHandle.viewport.width, m_rHandle.viewport.height);
return Graphic( aBitmap ).GetXGraphic();
}
diff --git a/avmedia/source/opengl/oglframegrabber.hxx b/avmedia/source/opengl/oglframegrabber.hxx
index 5be6371..b6cc0e8 100644
--- a/avmedia/source/opengl/oglframegrabber.hxx
+++ b/avmedia/source/opengl/oglframegrabber.hxx
@@ -25,7 +25,7 @@ class OGLFrameGrabber : public FrameGrabber_BASE
{
public:
- OGLFrameGrabber( glTFHandle* pHandle );
+ OGLFrameGrabber( glTFHandle& rHandle );
virtual ~OGLFrameGrabber();
// XFrameGrabber
@@ -37,7 +37,7 @@ public:
virtual com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
private:
- glTFHandle* m_pHandle;
+ glTFHandle& m_rHandle;
};
} // namespace ogl
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 525dc95..b5420e4 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -297,7 +297,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
return uno::Reference< media::XFrameGrabber >();
}
- OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
+ OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( *m_pHandle );
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
}
commit d878999eb2b1d4833f86485a557030ce69a2e711
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 14:54:59 2014 +0200
OGLWindow: no need to call update after changes, timer takes care of it
Change-Id: Ifc5ecf4ec3e385293889c82a3b678a8dbcd3edbb
(cherry picked from commit c90a742ed507b493fc20a5dbe68f8601217f7e4c)
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index 545895d..f7f9a23 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -109,10 +109,6 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt
m_rHandle.viewport.y = nY;
m_rHandle.viewport.width = nWidth;
m_rHandle.viewport.height = nHeight;
- if( m_bVisible )
- {
- update();
- }
}
}
@@ -129,7 +125,6 @@ void SAL_CALL OGLWindow::setVisible( sal_Bool bSet )
assert(m_rEventHandler.GetParent());
if( bSet && !m_bVisible )
{
- update();
m_rEventHandler.GetParent()->AddEventListener( LINK(this, OGLWindow, FocusGrabber));
m_rEventHandler.AddEventListener( LINK(this, OGLWindow, CameraHandler));
m_rEventHandler.GrabFocus();
@@ -279,7 +274,6 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
if(nCode == KEY_S)vMoveBy += vMup*(0.0005f*fModelSize);
}
gltf_renderer_move_camera(&m_rHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0);
- update();
}
}
}
@@ -326,7 +320,6 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
long nDeltaY = aCurPos.Y()-m_aLastMousePos.Y();
// TODO: It seems this method just moves the camera but not rotate it.
gltf_renderer_rotate_camera(&m_rHandle, (float)nDeltaX*fSensitivity, (float)nDeltaY*fSensitivity, 0.0, 0.0);
- update();
m_aLastMousePos = aCurPos;
}
commit 0604b16639db4cfa8f79ef0afd3ece7b8789c352
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Wed Jun 11 19:23:57 2014 +0200
OGLWindow: use reference instead of pointer
(cherry picked from commit 0bff18c4ec19462d325ea0ca6a24c3a15c1f8cfb)
Change-Id: I72ef9570ac9e7b4cb4afc2319725743098722d31
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index c4741d4..525dc95 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -148,7 +148,6 @@ void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
assert(m_pHandle);
- gltf_animation_stop(m_pHandle);
m_aTimer.Stop();
gltf_animation_stop(m_pHandle);
}
@@ -248,6 +247,7 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
SAL_WARN("avmedia.opengl", "Failed to get the SystemChildWindow for rendering!");
return uno::Reference< media::XPlayerWindow >();
}
+ assert(pChildWindow->GetParent());
if( !m_aContext.init(pChildWindow) )
{
@@ -270,7 +270,7 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
return uno::Reference< media::XPlayerWindow >();
}
- m_pOGLWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
+ m_pOGLWindow = new OGLWindow(*m_pHandle, m_aContext, *pChildWindow->GetParent());
return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
}
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index 160ef6f..545895d 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -14,10 +14,10 @@ using namespace com::sun::star;
namespace avmedia { namespace ogl {
-OGLWindow::OGLWindow( glTFHandle* pHandle, OpenGLContext* pContext, SystemChildWindow* pChildWindow )
- : m_pHandle( pHandle )
- , m_pContext( pContext )
- , m_pEventHandler( pChildWindow->GetParent() )
+OGLWindow::OGLWindow( glTFHandle& rHandle, OpenGLContext& rContext, Window& rEventHandlerParent )
+ : m_rHandle( rHandle )
+ , m_rContext( rContext )
+ , m_rEventHandler( rEventHandlerParent )
, m_bVisible ( false )
, meZoomLevel( media::ZoomLevel_ORIGINAL )
, m_aLastMousePos(Point())
@@ -31,11 +31,11 @@ OGLWindow::~OGLWindow()
void SAL_CALL OGLWindow::update() throw (css::uno::RuntimeException, std::exception)
{
- m_pContext->makeCurrent();
- gltf_prepare_renderer(m_pHandle);
- gltf_renderer(m_pHandle);
- gltf_complete_renderer(m_pHandle);
- m_pContext->swapBuffers();
+ m_rContext.makeCurrent();
+ gltf_prepare_renderer(&m_rHandle);
+ gltf_renderer(&m_rHandle);
+ gltf_complete_renderer(&m_rHandle);
+ m_rContext.swapBuffers();
}
sal_Bool SAL_CALL OGLWindow::setZoomLevel( css::media::ZoomLevel eZoomLevel ) throw (css::uno::RuntimeException, std::exception)
@@ -83,8 +83,9 @@ uno::Sequence< OUString > SAL_CALL OGLWindow::getSupportedServiceNames() throw (
void SAL_CALL OGLWindow::dispose() throw (uno::RuntimeException, std::exception)
{
- m_pEventHandler->GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
- m_pEventHandler->RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
+ assert(m_rEventHandler.GetParent());
+ m_rEventHandler.GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
+ m_rEventHandler.RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
}
void SAL_CALL OGLWindow::addEventListener( const uno::Reference< lang::XEventListener >& )
@@ -100,14 +101,14 @@ void SAL_CALL OGLWindow::removeEventListener( const uno::Reference< lang::XEvent
void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int16 /*nFlags*/ )
throw (uno::RuntimeException, std::exception)
{
- if( m_pHandle->viewport.x != nX || m_pHandle->viewport.x != nY ||
- m_pHandle->viewport.width != nWidth || m_pHandle->viewport.height != nHeight )
+ if( m_rHandle.viewport.x != nX || m_rHandle.viewport.x != nY ||
+ m_rHandle.viewport.width != nWidth || m_rHandle.viewport.height != nHeight )
{
- m_pContext->setWinSize(Size(nWidth,nHeight));
- m_pHandle->viewport.x = nX;
- m_pHandle->viewport.y = nY;
- m_pHandle->viewport.width = nWidth;
- m_pHandle->viewport.height = nHeight;
+ m_rContext.setWinSize(Size(nWidth,nHeight));
+ m_rHandle.viewport.x = nX;
+ m_rHandle.viewport.y = nY;
+ m_rHandle.viewport.width = nWidth;
+ m_rHandle.viewport.height = nHeight;
if( m_bVisible )
{
update();
@@ -118,24 +119,25 @@ void SAL_CALL OGLWindow::setPosSize( sal_Int32 nX, sal_Int32 nY, sal_Int32 nWidt
awt::Rectangle SAL_CALL OGLWindow::getPosSize()
throw (uno::RuntimeException, std::exception)
{
- return awt::Rectangle(m_pHandle->viewport.x, m_pHandle->viewport.y,
- m_pHandle->viewport.width, m_pHandle->viewport.height);
+ return awt::Rectangle(m_rHandle.viewport.x, m_rHandle.viewport.y,
+ m_rHandle.viewport.width, m_rHandle.viewport.height);
}
void SAL_CALL OGLWindow::setVisible( sal_Bool bSet )
throw (uno::RuntimeException, std::exception)
{
+ assert(m_rEventHandler.GetParent());
if( bSet && !m_bVisible )
{
update();
- m_pEventHandler->GetParent()->AddEventListener( LINK(this, OGLWindow, FocusGrabber));
- m_pEventHandler->AddEventListener( LINK(this, OGLWindow, CameraHandler));
- m_pEventHandler->GrabFocus();
+ m_rEventHandler.GetParent()->AddEventListener( LINK(this, OGLWindow, FocusGrabber));
+ m_rEventHandler.AddEventListener( LINK(this, OGLWindow, CameraHandler));
+ m_rEventHandler.GrabFocus();
}
else if( !bSet )
{
- m_pEventHandler->GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
- m_pEventHandler->RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
+ m_rEventHandler.GetParent()->RemoveEventListener( LINK(this, OGLWindow, FocusGrabber));
+ m_rEventHandler.RemoveEventListener( LINK(this, OGLWindow, CameraHandler));
}
m_bVisible = bSet;
}
@@ -212,26 +214,25 @@ void SAL_CALL OGLWindow::removePaintListener( const uno::Reference< awt::XPaintL
IMPL_LINK(OGLWindow, FocusGrabber, VclWindowEvent*, pEvent)
{
- assert(m_pEventHandler);
if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
{
MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
if(pMouseEvt)
{
const Point& rMousePos = pMouseEvt->GetPosPixel();
- const Rectangle aWinRect(m_pEventHandler->GetPosPixel(),m_pEventHandler->GetSizePixel());
+ const Rectangle aWinRect(m_rEventHandler.GetPosPixel(),m_rEventHandler.GetSizePixel());
// Grab focus to the OpenGL window when mouse pointer is over it
if( aWinRect.IsInside(rMousePos) )
{
- if ( !m_pEventHandler->HasFocus() )
+ if ( !m_rEventHandler.HasFocus() )
{
- m_pEventHandler->GrabFocus();
+ m_rEventHandler.GrabFocus();
}
}
// Move focus to the document when mouse is not over the OpenGL window
- else if ( m_pEventHandler->HasFocus() )
+ else if ( m_rEventHandler.HasFocus() )
{
- m_pEventHandler->GrabFocusToDocument();
+ m_rEventHandler.GrabFocusToDocument();
}
}
}
@@ -257,8 +258,8 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
glm::vec3 vEye;
glm::vec3 vView;
glm::vec3 vUp;
- gltf_get_camera_pos(m_pHandle, &vEye,&vView,&vUp);
- float fModelSize =(float)gltf_get_model_size(m_pHandle);
+ gltf_get_camera_pos(&m_rHandle, &vEye,&vView,&vUp);
+ float fModelSize =(float)gltf_get_model_size(&m_rHandle);
glm::vec3 vMove = vView-vEye;
vMove = glm::normalize(vMove);
@@ -277,7 +278,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
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);
+ gltf_renderer_move_camera(&m_rHandle, vMoveBy.x, vMoveBy.y, vMoveBy.z, 0.0);
update();
}
}
@@ -293,7 +294,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
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);
+ gltf_renderer_move_camera(&m_rHandle, 0.0, 0.0, 0.0, 0.0);
}
}
}
@@ -307,15 +308,15 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
}
else if( pEvent->GetId() == VCLEVENT_WINDOW_MOUSEMOVE )
{
- if ( !m_pEventHandler->HasFocus() )
+ if ( !m_rEventHandler.HasFocus() )
{
- m_pEventHandler->GrabFocus();
+ m_rEventHandler.GrabFocus();
}
MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
if(pMouseEvt && pMouseEvt->IsLeft())
{
const Point& aCurPos = pMouseEvt->GetPosPixel();
- float fSensitivity = std::min(m_pHandle->viewport.width, m_pHandle->viewport.height);
+ float fSensitivity = std::min(m_rHandle.viewport.width, m_rHandle.viewport.height);
if (fSensitivity == 0.0)
fSensitivity = 1.0;
else
@@ -324,7 +325,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
long nDeltaX = m_aLastMousePos.X()-aCurPos.X();
long nDeltaY = aCurPos.Y()-m_aLastMousePos.Y();
// TODO: It seems this method just moves the camera but not rotate it.
- gltf_renderer_rotate_camera(m_pHandle, (float)nDeltaX*fSensitivity, (float)nDeltaY*fSensitivity, 0.0, 0.0);
+ gltf_renderer_rotate_camera(&m_rHandle, (float)nDeltaX*fSensitivity, (float)nDeltaY*fSensitivity, 0.0, 0.0);
update();
m_aLastMousePos = aCurPos;
diff --git a/avmedia/source/opengl/oglwindow.hxx b/avmedia/source/opengl/oglwindow.hxx
index 2b1c943..db2d867 100644
--- a/avmedia/source/opengl/oglwindow.hxx
+++ b/avmedia/source/opengl/oglwindow.hxx
@@ -27,7 +27,7 @@ class OGLWindow : public ::cppu::WeakImplHelper2 < com::sun::star::media::XPlaye
com::sun::star::lang::XServiceInfo >
{
public:
- OGLWindow( glTFHandle* pHandle, OpenGLContext* pContext, SystemChildWindow* pChildWindow );
+ OGLWindow( glTFHandle& rHandle, OpenGLContext& rContext, Window& rEventHandlerParent );
virtual ~OGLWindow();
virtual void SAL_CALL update() throw (com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
@@ -65,9 +65,9 @@ private:
DECL_LINK( FocusGrabber, VclWindowEvent* );
DECL_LINK( CameraHandler, VclWindowEvent* );
- glTFHandle* m_pHandle;
- OpenGLContext* m_pContext;
- Window* m_pEventHandler;
+ glTFHandle& m_rHandle;
+ OpenGLContext& m_rContext;
+ Window& m_rEventHandler;
bool m_bVisible;
com::sun::star::media::ZoomLevel meZoomLevel;
Point m_aLastMousePos;
commit cc9faa492d96cc1be308697ba56cc77a37a52191
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 13:24:34 2014 +0200
OGLPlayer: use more assertions
Change-Id: I0a224a90a3e99d12809d40612b1e66d7c023aebc
(cherry picked from commit c1e1576dc081876b39e6f70d13571521a61eeb64)
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 5aa87bd..c4741d4 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -18,6 +18,8 @@
#include <tools/urlobj.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <cassert>
+
using namespace com::sun::star;
namespace avmedia { namespace ogl {
@@ -137,6 +139,7 @@ bool OGLPlayer::create( const OUString& rURL )
void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
gltf_animation_start(m_pHandle);
m_aTimer.Start();
}
@@ -144,6 +147,8 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
+ gltf_animation_stop(m_pHandle);
m_aTimer.Stop();
gltf_animation_stop(m_pHandle);
}
@@ -151,12 +156,14 @@ void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
return (sal_Bool)gltf_animation_is_playing(m_pHandle);
}
double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
return gltf_animation_get_duration(m_pHandle);
}
@@ -164,6 +171,7 @@ void SAL_CALL OGLPlayer::setMediaTime( double fTime ) throw ( uno::RuntimeExcept
{
// TODO: doesn't work, but cause problem in playing
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
(void) fTime;
//gltf_animation_set_time(m_pHandle, fTime);
}
@@ -171,6 +179,7 @@ void SAL_CALL OGLPlayer::setMediaTime( double fTime ) throw ( uno::RuntimeExcept
double SAL_CALL OGLPlayer::getMediaTime() throw ( ::com::sun::star::uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
return 0.0; //gltf_animation_get_time(m_pHandle);
}
@@ -184,12 +193,14 @@ double SAL_CALL OGLPlayer::getRate() throw ( uno::RuntimeException, std::excepti
void SAL_CALL OGLPlayer::setPlaybackLoop( sal_Bool bSet ) throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
gltf_animation_set_looping(m_pHandle, (int)bSet);
}
sal_Bool SAL_CALL OGLPlayer::isPlaybackLoop() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
return (sal_Bool)gltf_animation_get_looping(m_pHandle);
}
@@ -226,11 +237,18 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
osl::MutexGuard aGuard( m_aMutex );
assert( rArguments.getLength() >= 3 );
+ assert(m_pHandle);
sal_IntPtr pIntPtr = 0;
rArguments[ 2 ] >>= pIntPtr;
SystemChildWindow *pChildWindow = reinterpret_cast< SystemChildWindow* >( pIntPtr );
+ if( !pChildWindow )
+ {
+ SAL_WARN("avmedia.opengl", "Failed to get the SystemChildWindow for rendering!");
+ return uno::Reference< media::XPlayerWindow >();
+ }
+
if( !m_aContext.init(pChildWindow) )
{
SAL_WARN("avmedia.opengl", "Context initialization failed");
@@ -260,6 +278,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pHandle);
if( !m_aContext.init() )
{
@@ -307,6 +326,7 @@ IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer)
if (pTimer == &m_aTimer)
{
osl::MutexGuard aGuard(m_aMutex);
+ assert(m_pOGLWindow);
m_pOGLWindow->update();
}
commit 48513910e7abd2ebe1e7c5f5489fcb8e2daa28dc
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 05:48:54 2014 +0200
OGLPlayer: handle json parsing error
Change-Id: I86aea12318d4e21ccadd97ad2820e31bd4580c99
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 3bb4a16..5aa87bd 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -243,7 +243,15 @@ uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( c
m_pHandle->viewport.y = 0;
m_pHandle->viewport.width = aSize.Width();
m_pHandle->viewport.height = aSize.Height();
- gltf_renderer_set_content(m_pHandle);
+
+ // TODO: In libgltf different return values are defined (for different errors)
+ // but these error codes are not part of the library interface
+ int nRet = gltf_renderer_set_content(m_pHandle);
+ if( nRet != 0 )
+ {
+ SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
+ return uno::Reference< media::XPlayerWindow >();
+ }
m_pOGLWindow = new OGLWindow(m_pHandle, &m_aContext, pChildWindow);
return uno::Reference< media::XPlayerWindow >( m_pOGLWindow );
}
@@ -263,7 +271,13 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
m_pHandle->viewport.y = 0;
m_pHandle->viewport.width = getPreferredPlayerWindowSize().Width;
m_pHandle->viewport.height = getPreferredPlayerWindowSize().Height;
- gltf_renderer_set_content(m_pHandle);
+
+ int nRet = gltf_renderer_set_content(m_pHandle);
+ if( nRet != 0 )
+ {
+ SAL_WARN("avmedia.opengl", "Error occured while parsing *.json file! Error code: " << nRet);
+ return uno::Reference< media::XFrameGrabber >();
+ }
OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
}
commit a4f1efc434d6c5952ba0cfcf94e6c39356ce0f85
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 29 05:27:46 2014 +0200
OGLPlayer: check before dereference
(cherry picked from commit 228c5099962b7b7574326e3c328db4165796e8a8)
Conflicts:
avmedia/source/opengl/oglplayer.cxx
Change-Id: I4bbaf97fe8c5def441ca106c26ad312281ed352f
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 3a69a84..3bb4a16 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -31,14 +31,17 @@ OGLPlayer::OGLPlayer()
OGLPlayer::~OGLPlayer()
{
osl::MutexGuard aGuard(m_aMutex);
- for (size_t i = 0; i < m_pHandle->size; ++i)
+ if( m_pHandle )
{
- if (m_pHandle->files[i].type != GLTF_JSON)
+ for (size_t i = 0; i < m_pHandle->size; ++i)
{
- delete [] m_pHandle->files[i].buffer;
+ if (m_pHandle->files[i].type != GLTF_JSON)
+ {
+ delete [] m_pHandle->files[i].buffer;
+ }
}
+ gltf_renderer_release(m_pHandle);
}
- gltf_renderer_release(m_pHandle);
}
static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL)
commit 8dcc15538ec0a60b181ff8ecf386abe678eee03c
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)
(cherry picked from commit 00e7b772b418049b117c57f8a3d85567701b47a6)
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 630574d66a67b08ebae808fc6fbe346c14e2493f
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)
(cherry picked from commit 677302934793f1874b739b858a659220f247adac)
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();
commit d54680911a9a0c1a094a327fa4984fa478da6cdf
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Wed May 28 13:07:38 2014 +0200
libgltf: solve this memory leak problem on a better way 2
Handle those cases when file loading failes.
Release *.json file on a different way since it is allocated
by libgltf (inside the glTFHandle).
(cherry picked from commit fafc1e29c1f060c1a44361a0445300f9786ad6f4)
(cherry picked from commit 32f60d78b15b5f2c677e8687720665f6814fef62)
Conflicts:
avmedia/source/opengl/oglplayer.cxx
Change-Id: Idf6c6971a8ac1b342d89dc4f61a62624183e01d0
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 8ed8ddb..3a69a84 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -31,6 +31,13 @@ OGLPlayer::OGLPlayer()
OGLPlayer::~OGLPlayer()
{
osl::MutexGuard aGuard(m_aMutex);
+ for (size_t i = 0; i < m_pHandle->size; ++i)
+ {
+ if (m_pHandle->files[i].type != GLTF_JSON)
+ {
+ delete [] m_pHandle->files[i].buffer;
+ }
+ }
gltf_renderer_release(m_pHandle);
}
@@ -70,6 +77,8 @@ bool OGLPlayer::create( const OUString& rURL )
m_pHandle = gltf_renderer_init(&aJsonFile);
+ delete [] aJsonFile.buffer;
+
if( !m_pHandle || !m_pHandle->files )
{
SAL_WARN("avmedia.opengl", "gltf_renderer_init returned an invalid glTFHandle");
@@ -89,7 +98,14 @@ bool OGLPlayer::create( const OUString& rURL )
// Load images as bitmaps
GraphicFilter aFilter;
Graphic aGraphic;
- aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL));
+ if( aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL)) != GRFILTER_OK )
+ {
+ rFile.buffer = 0;
+ rFile.imagewidth = 0;
+ rFile.imageheight = 0;
+ SAL_WARN("avmedia.opengl", "Can't load texture file: " + sFilesURL);
+ return false;
+ }
BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
aBitmapEx.Mirror(BMP_MIRROR_VERT);
rFile.buffer = (char*)OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx);
@@ -100,6 +116,8 @@ bool OGLPlayer::create( const OUString& rURL )
{
if( !lcl_LoadFile(&rFile, sFilesURL) )
{
+ rFile.buffer = 0;
+ rFile.size = 0;
SAL_WARN("avmedia.opengl", "Can't load glTF file: " + sFilesURL);
return false;
}
commit 4962ea97f1446fa5c9021130c9c938d1a9f7e03f
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Tue May 27 20:12:59 2014 +0200
glTF rendering: fix texture problems
It seems we need mirroring.
Change-Id: Id9ad7041eb09ec773e4174cb68d34a65a2c473fe
(cherry picked from commit 7c0dc577a4bae2cd398894a68e2edfe966c9ae26)
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 79d8d18..8ed8ddb 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -90,7 +90,8 @@ bool OGLPlayer::create( const OUString& rURL )
GraphicFilter aFilter;
Graphic aGraphic;
aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL));
- const BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
+ BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
+ aBitmapEx.Mirror(BMP_MIRROR_VERT);
rFile.buffer = (char*)OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx);
rFile.imagewidth = aBitmapEx.GetSizePixel().Width();
rFile.imageheight = aBitmapEx.GetSizePixel().Height();
commit 093c80e1a67d2d387729ddaa9e72bea162e52993
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Tue May 27 16:48:30 2014 +0200
Patching libgltf: the passed texture bitmaps are RGBA buffers
(cherry picked from commit 9c830b09a033a4716bbc54bfe59f46e22cafe677)
Conflicts:
external/libgltf/UnpackedTarball_libgltf.mk
Change-Id: I53f6a97820da12e89d567e1bc10226fa27cafd84
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index 33889fb..ce5ad79 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
external/libgltf/patches/include_path_glew.patch \
external/libgltf/patches/include_path_freetype.patch \
external/libgltf/patches/openmp-disable.patch \
+ external/libgltf/patches/rgba_textures.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/rgba_textures.patch b/external/libgltf/patches/rgba_textures.patch
new file mode 100644
index 0000000..b220894
--- /dev/null
+++ b/external/libgltf/patches/rgba_textures.patch
@@ -0,0 +1,12 @@
+diff -ur libgltf.org/src/Texture.cpp libgltf/src/Texture.cpp
+--- libgltf.org/src/Texture.cpp 2014-05-27 16:40:18.625920865 +0200
++++ libgltf/src/Texture.cpp 2014-05-27 16:41:45.601917179 +0200
+@@ -60,7 +60,7 @@
+ bool Texture::loadTexture2DFromBuffer(unsigned char* buffer, int width,
+ int height)
+ {
+- GLenum format = GL_BGRA;
++ GLenum format = GL_RGBA;
+
+ createFromData(buffer, width, height, format, false);
+
commit 7e50c6ab24f0cadffe43073c3410cd121d578fec
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed May 28 16:43:08 2014 +0200
First stop the timer, then the animation.
Change-Id: Icd5f9f4b8e1c48176fdb73c954e1c4b7d0811516
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index b626bf2..79d8d18 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -122,8 +122,8 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
- gltf_animation_stop(m_pHandle);
m_aTimer.Stop();
+ gltf_animation_stop(m_pHandle);
}
sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
commit 034a4c50b2aaac22caeea9a70d20d5e007b1d0cc
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed May 28 16:40:12 2014 +0200
slideshow: Don't assume anything about the duration.
Let the player decide what to do when the duration is zero, and start()/stop() was called.
Change-Id: I17027349e8d61f7b114e193a769402c04a64f3f3
diff --git a/slideshow/source/engine/shapes/viewmediashape.cxx b/slideshow/source/engine/shapes/viewmediashape.cxx
index f91be0b..344062d 100644
--- a/slideshow/source/engine/shapes/viewmediashape.cxx
+++ b/slideshow/source/engine/shapes/viewmediashape.cxx
@@ -128,7 +128,7 @@ namespace slideshow
if( !mxPlayer.is() )
implInitialize( maBounds );
- if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+ if (mxPlayer.is())
mxPlayer->start();
return true;
@@ -170,7 +170,7 @@ namespace slideshow
void ViewMediaShape::pauseMedia()
{
- if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+ if (mxPlayer.is())
mxPlayer->stop();
}
@@ -178,7 +178,7 @@ namespace slideshow
void ViewMediaShape::setMediaTime(double fTime)
{
- if( mxPlayer.is() && ( mxPlayer->getDuration() > 0.0 ) )
+ if (mxPlayer.is())
mxPlayer->setMediaTime(fTime);
}
commit 5d0ede279d68bbb1dee2a5bfe9651e605f2a62cc
Author: Jan Holesovsky <kendy at collabora.com>
Date: Wed May 28 15:38:22 2014 +0200
Use AutoTimer instead of Timer, and add some more locking.
(cherry picked from commit 91fb0866cad2518e5f2cbc48af0e952282fee19d)
Conflicts:
avmedia/source/opengl/oglplayer.cxx
Change-Id: I83a99e333a6c62bf7779e3fbbcc3e5af38bb2ca5
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index f2e80d2..b626bf2 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -30,6 +30,7 @@ OGLPlayer::OGLPlayer()
OGLPlayer::~OGLPlayer()
{
+ osl::MutexGuard aGuard(m_aMutex);
gltf_renderer_release(m_pHandle);
}
@@ -52,6 +53,8 @@ static bool lcl_LoadFile( glTFFile* io_pFile, const OUString& rURL)
bool OGLPlayer::create( const OUString& rURL )
{
+ osl::MutexGuard aGuard(m_aMutex);
+
m_sURL = rURL;
// Load *.json file and init renderer
@@ -267,8 +270,8 @@ IMPL_LINK(OGLPlayer,TimerHandler,Timer*,pTimer)
{
if (pTimer == &m_aTimer)
{
+ osl::MutexGuard aGuard(m_aMutex);
m_pOGLWindow->update();
- m_aTimer.Start();
}
return 0;
diff --git a/avmedia/source/opengl/oglplayer.hxx b/avmedia/source/opengl/oglplayer.hxx
index 69f010b..e7da91e 100644
--- a/avmedia/source/opengl/oglplayer.hxx
+++ b/avmedia/source/opengl/oglplayer.hxx
@@ -63,7 +63,7 @@ private:
OUString m_sURL;
glTFHandle* m_pHandle;
OpenGLContext m_aContext;
- Timer m_aTimer;
+ AutoTimer m_aTimer;
OGLWindow* m_pOGLWindow;
};
commit efc5aaf1ff68f93cdeb4e69ce2c6c374c19de67e
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon May 26 16:38:53 2014 +0200
libgltf: Update openmp-related patch to newer libgltf.
Change-Id: I6f7e8d974030169bb00fbd81a0e2190640702729
(cherry picked from commit 318ffa88240f55adef906df673614123d19f35a3)
diff --git a/external/libgltf/patches/openmp-disable.patch b/external/libgltf/patches/openmp-disable.patch
index c084183..ef8bc2e 100644
--- a/external/libgltf/patches/openmp-disable.patch
+++ b/external/libgltf/patches/openmp-disable.patch
@@ -1,8 +1,8 @@
--- libgltf/src/RenderScene.h
+++ libgltf/src/RenderScene.h
@@ -16,7 +16,8 @@
- #include "FPSCounter.h"
- #include "Timer.h"
+ #define TRACE_TIME
+ #endif
-#define OPENMPENABLE 1
+// Needs a configure / etc. detection to see if omp.h is on the system ...
commit 2a54bc7f941bb9e664614b78ee697e8f92ae1c93
Author: Jan Holesovsky <kendy at collabora.com>
Date: Mon May 26 15:42:43 2014 +0200
libgltf: Update to newer version.
Change-Id: I95e9356039c6f8bae44b007dce17ab2becbd1259
(cherry picked from commit 6259d1af797e6566f2c1420f84874962cb8ae4e9)
diff --git a/download.lst b/download.lst
index 799900d..1ac844c 100644
--- a/download.lst
+++ b/download.lst
@@ -87,7 +87,7 @@ export LIBATOMIC_OPS_TARBALL := libatomic_ops-7_2d.zip
export LIBEOT_MD5SUM := aa24f5dd2a2992f4a116aa72af817548
export LIBEOT_TARBALL := libeot-0.01.tar.bz2
export LIBEXTTEXTCAT_TARBALL := ae330b9493bd4503ac390106ff6060d7-libexttextcat-3.4.3.tar.bz2
-export LIBGLTF_TARBALL := 1ce9a9714caff757bab489257eda955d-libgltf.tar.bz2
+export LIBGLTF_TARBALL := 3c62598ccbecb65998bf7602bb09a791-libgltf.tar.bz2
export LIBLANGTAG_TARBALL := 36271d3fa0d9dec1632029b6d7aac925-liblangtag-0.5.1.tar.bz2
export LIBXMLSEC_TARBALL := 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz
export LIBXML_TARBALL := 9c0cfef285d5c4a5c80d00904ddab380-libxml2-2.9.1.tar.gz
commit 7eb492219a6170202050a333ad0f770593fd0a48
Author: Michael Meeks <michael.meeks at collabora.com>
Date: Sat May 24 20:33:19 2014 +0100
libgltf: turn off openMP usage without any detection code.
Change-Id: Ic823109b812a3d99d8462cf67cd9aa87094bba06
(cherry picked from commit 42f2f473305372050f012aa952ef21b5596fd1cc)
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index d8434b6..33889fb 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libgltf,1))
$(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
external/libgltf/patches/include_path_glew.patch \
external/libgltf/patches/include_path_freetype.patch \
+ external/libgltf/patches/openmp-disable.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/openmp-disable.patch b/external/libgltf/patches/openmp-disable.patch
new file mode 100644
index 0000000..c084183
--- /dev/null
+++ b/external/libgltf/patches/openmp-disable.patch
@@ -0,0 +1,12 @@
+--- libgltf/src/RenderScene.h
++++ libgltf/src/RenderScene.h
+@@ -16,7 +16,8 @@
+ #include "FPSCounter.h"
+ #include "Timer.h"
+
+-#define OPENMPENABLE 1
++// Needs a configure / etc. detection to see if omp.h is on the system ...
++#define OPENMPENABLE 0
+ #if OPENMPENABLE
+ #include <omp.h>
+ #define WAVESIZE 4
commit 17009369673582f579f38e8848e1e1408832c12a
Author: Jan Holesovsky <kendy at collabora.com>
Date: Sun May 25 14:14:05 2014 +0200
Update OpenCollada and collada2gltf to the newest versions.
(cherry picked from commit a850d96fade014f11bc076fb916fae8c7c5eaecb)
Conflicts:
external/opencollada/patches/generatedsaxparser_utils_touri_fix.patch.1
Change-Id: Iee0b9f08843220e8ece00739ca01aa438b93965a
diff --git a/download.lst b/download.lst
index 589321f..799900d 100644
--- a/download.lst
+++ b/download.lst
@@ -23,8 +23,7 @@ export CLUCENE_TARBALL := 48d647fbd8ef8889e5a7f422c1bfda94-clucene-core-2.3.3.4.
export CMIS_TARBALL := 22f8a85daf4a012180322e1f52a7563b-libcmis-0.4.1.tar.gz
export COINMP_MD5SUM := 1cce53bf4b40ae29790d2c5c9f8b1129
export COINMP_TARBALL := CoinMP-1.7.6.tgz
-export COLLADA2GLTF_MD5SUM := c8a8be5829ceffacfe1d68d078f5c442
-export COLLADA2GLTF_TARBALL := collada2gltf-master-6258611a6a.tar.bz2
+export COLLADA2GLTF_TARBALL := 4b87018f7fff1d054939d19920b751a0-collada2gltf-master-cb1d97788a.tar.bz2
export CPPUNIT_TARBALL := ac4781e01619be13461bb2d562b94a7b-cppunit-1.13.1.tar.gz
export CT2N_TARBALL := 451ccf439a36a568653b024534669971-ConvertTextToNumber-1.3.2.oxt
export CURL_MD5SUM := e6d1f9d1b59da5062109ffe14e0569a4
diff --git a/external/collada2gltf/GitSHA1.cpp b/external/collada2gltf/GitSHA1.cpp
index bd2cffe..af42860 100644
--- a/external/collada2gltf/GitSHA1.cpp
+++ b/external/collada2gltf/GitSHA1.cpp
@@ -1,2 +1,2 @@
-#define GIT_SHA1 "6258611a6a4b4b94b963db5f1fe41c5290be1f87"
+#define GIT_SHA1 "cb1d97788a38d2928afb4622f6a25d012f0f8a54"
char g_GIT_SHA1[] = GIT_SHA1;
diff --git a/external/collada2gltf/patches/wrong_uri_usage.patch.1 b/external/collada2gltf/patches/wrong_uri_usage.patch.1
index f42f435..7c688ad 100644
--- a/external/collada2gltf/patches/wrong_uri_usage.patch.1
+++ b/external/collada2gltf/patches/wrong_uri_usage.patch.1
@@ -45,11 +45,10 @@ diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
std::ofstream f2(outputPath.c_str(), std::fstream::binary);
if (this->_converterConfig->boolForKeyPath("verboseLogging")) {
-@@ -397,8 +394,8 @@
+@@ -397,7 +394,8 @@
this->_root = shared_ptr <GLTF::JSONObject> (new GLTF::JSONObject());
- this->_root->setString(kProfile, profile->id());
this->_root->createObjectIfNeeded(kNodes);
--
+
- this->_writer.initWithPath(this->getOutputFilePath().c_str());
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+ this->_writer.initWithPath(outputURI.toNativePath().c_str());
diff --git a/external/opencollada/UnpackedTarball_opencollada.mk b/external/opencollada/UnpackedTarball_opencollada.mk
index 93e5480..a183792 100644
--- a/external/opencollada/UnpackedTarball_opencollada.mk
+++ b/external/opencollada/UnpackedTarball_opencollada.mk
@@ -12,6 +12,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,opencollada))
$(eval $(call gb_UnpackedTarball_set_tarball,opencollada,$(OPENCOLLADA_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,opencollada,\
+ external/opencollada/patches/0001-Revert-fix-for-malformed-FBX-COLLADA-id.patch.1 \
+ external/opencollada/patches/0002-Expose-sid-for-textures-in-extras.patch.1 \
external/opencollada/patches/opencollada.clang.patch.0 \
external/opencollada/patches/opencollada.libxml.patch.0 \
))
diff --git a/external/opencollada/patches/0001-Revert-fix-for-malformed-FBX-COLLADA-id.patch.1 b/external/opencollada/patches/0001-Revert-fix-for-malformed-FBX-COLLADA-id.patch.1
new file mode 100644
index 0000000..968b57c
--- /dev/null
+++ b/external/opencollada/patches/0001-Revert-fix-for-malformed-FBX-COLLADA-id.patch.1
@@ -0,0 +1,51 @@
+From a54360e9d2a67350f27eec8dfbe1103778b2711c Mon Sep 17 00:00:00 2001
+From: Fabrice Robinet <fabricerobinet at me.com>
+Date: Tue, 13 May 2014 16:31:40 -0700
+Subject: [PATCH 1/2] Revert fix for malformed FBX-COLLADA id
+
+---
+ GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+index 404306a..1f9a3ee 100644
+--- a/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
++++ b/GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp
+@@ -868,11 +868,13 @@ namespace GeneratedSaxParser
+ failed = false;
+ return COLLADABU::URI(0);
+ }
++ const ParserString& string = toStringListItem(buffer, bufferEnd, failed);
++ return COLLADABU::URI(string.str, string.length);
++
++ //FIXME: Testing fails on windows but pass on OSX with this fix.
+ //Just get the string as it is for ids, so that we are able to read FBX-COLLADA
+ //Otherwise, calling toStringItem would result in a truncated string when an id contains spaces
+- //const ParserString& string = toStringListItem(buffer, bufferEnd, failed);
+- //return COLLADABU::URI(string.str, string.length);
+- return COLLADABU::URI((const char*)*buffer, bufferEnd - *buffer);
++ //return COLLADABU::URI((const char*)*buffer, bufferEnd - *buffer);
+ }
+
+ //--------------------------------------------------------------------
+@@ -883,11 +885,14 @@ namespace GeneratedSaxParser
+ failed = false;
+ return COLLADABU::URI(0);
+ }
++
++ const ParserString& string = toStringListItem(buffer, failed);
++ return COLLADABU::URI(string.str, string.length);
++
++ //FIXME: Testing fails on windows but pass on OSX with this fix.
+ //Just get the string as it is for ids, so that we are able to read FBX-COLLADA
+ //Otherwise, calling toStringItem would result in a truncated string when an id contains spaces
+- //const ParserString& string = toStringListItem(buffer, failed);
+- //return COLLADABU::URI(string.str, string.length);
+- return COLLADABU::URI((const char*)*buffer);
++ //return COLLADABU::URI((const char*)*buffer);
+ }
+
+
+--
+1.8.1.4
+
diff --git a/external/opencollada/patches/0002-Expose-sid-for-textures-in-extras.patch.1 b/external/opencollada/patches/0002-Expose-sid-for-textures-in-extras.patch.1
new file mode 100644
index 0000000..067b277
--- /dev/null
+++ b/external/opencollada/patches/0002-Expose-sid-for-textures-in-extras.patch.1
@@ -0,0 +1,66 @@
+From 3f68b25b9085c577c2cc2db81d9a9f743de077b7 Mon Sep 17 00:00:00 2001
+From: Fabrice Robinet <fabricerobinet at me.com>
+Date: Thu, 22 May 2014 15:15:40 -0700
+Subject: [PATCH 2/2] Expose sid for textures in extras.
+
+---
+ COLLADAFramework/include/COLLADAFWSampler.h | 8 +++++++-
+ .../src/COLLADASaxFWLLibraryEffectsLoader.cpp | 4 +++-
+ 2 files changed, 10 insertions(+), 2 deletions(-)
+
+diff --git a/COLLADAFramework/include/COLLADAFWSampler.h b/COLLADAFramework/include/COLLADAFWSampler.h
+index 44936a8..562e47a 100644
+--- a/COLLADAFramework/include/COLLADAFWSampler.h
++++ b/COLLADAFramework/include/COLLADAFWSampler.h
+@@ -129,6 +129,9 @@ namespace COLLADAFW
+ that is used by the sampler to evaluate the MIPmap chain. */
+ float mMipmapBias;
+
++ /* sampler Sid, required to be able to retrieve a sampler from extras */
++ std::string mSid;
++
+ public:
+
+ /** Constructor. */
+@@ -203,8 +206,11 @@ namespace COLLADAFW
+ /** Returns the mipmap Bias.*/
+ void setMipmapBias ( float mipmapBias ) { mMipmapBias = mipmapBias; }
+
+- Sampler* clone() { return FW_NEW Sampler(*this); }
++ void setSid( const std::string &sid) { mSid = sid; }
++
++ const std::string& getSid() { return mSid; }
+
++ Sampler* clone() { return FW_NEW Sampler(*this); }
+ };
+
+ /**
+diff --git a/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp b/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp
+index 36f9c58..5ac99a4 100644
+--- a/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp
++++ b/COLLADASaxFrameworkLoader/src/COLLADASaxFWLLibraryEffectsLoader.cpp
+@@ -1003,18 +1003,20 @@ namespace COLLADASaxFWL
+
+ bool validSampler = false;
+ SidSamplerInfoMap::iterator samplerIt = mEffectProfileSidSamplerInfoMap.find ( samplerSid );
++
+ if ( samplerIt == mEffectProfileSidSamplerInfoMap.end () )
+ {
+ samplerIt = mEffectSidSamplerInfoMap.find ( samplerSid );
+ if ( samplerIt != mEffectSidSamplerInfoMap.end () ) validSampler = true;
+ }
+ else validSampler = true;
+-
++
+ if ( validSampler )
+ {
+ SamplerInfo& samplerInfo = samplerIt->second;
+ samplerInfo.id = samplerArray.getCount();
+ COLLADAFW::Sampler* sampler = samplerInfo.sampler;
++ sampler->setSid(samplerSid);
+ if ( !sampler->getSourceImage().isValid() )
+ {
+ bool validSurface = false;
+--
+1.8.1.4
+
commit 1b732135404bf66e3aa3639c58084eee7d115998
Author: Jan Holesovsky <kendy at collabora.com>
Date: Sat May 24 17:49:38 2014 +0200
libgltf: Another new version.
Change-Id: I784579717674f1caf68ad489d1a931936f6f9651
(cherry picked from commit a0ef37c55febac05f19a2cece0552e68384e56aa)
diff --git a/avmedia/source/opengl/oglplayer.cxx b/avmedia/source/opengl/oglplayer.cxx
index 323242a..f2e80d2 100644
--- a/avmedia/source/opengl/oglplayer.cxx
+++ b/avmedia/source/opengl/oglplayer.cxx
@@ -76,25 +76,25 @@ bool OGLPlayer::create( const OUString& rURL )
// Load external resources
for( size_t i = 0; i < m_pHandle->size; ++i )
{
- glTFFile* pFile = m_pHandle->files[i];
- if( pFile && pFile->filename )
+ glTFFile& rFile = m_pHandle->files[i];
+ if( rFile.filename )
{
const OUString sFilesURL =
- INetURLObject::GetAbsURL(m_sURL,OStringToOUString(OString(pFile->filename),RTL_TEXTENCODING_UTF8));
- if( pFile->type == GLTF_IMAGE )
+ INetURLObject::GetAbsURL(m_sURL,OStringToOUString(OString(rFile.filename),RTL_TEXTENCODING_UTF8));
+ if( rFile.type == GLTF_IMAGE )
{
// Load images as bitmaps
GraphicFilter aFilter;
Graphic aGraphic;
aFilter.ImportGraphic(aGraphic, INetURLObject(sFilesURL));
const BitmapEx aBitmapEx = aGraphic.GetBitmapEx();
- pFile->buffer = (char*)OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx);
- pFile->imagewidth = aBitmapEx.GetSizePixel().Width();
- pFile->imageheight = aBitmapEx.GetSizePixel().Height();
+ rFile.buffer = (char*)OpenGLHelper::ConvertBitmapExToRGBABuffer(aBitmapEx);
+ rFile.imagewidth = aBitmapEx.GetSizePixel().Width();
+ rFile.imageheight = aBitmapEx.GetSizePixel().Height();
}
- else if( pFile->type == GLTF_BINARY || pFile->type == GLTF_GLSL )
+ else if( rFile.type == GLTF_BINARY || rFile.type == GLTF_GLSL )
{
- if( !lcl_LoadFile(pFile, sFilesURL) )
+ if( !lcl_LoadFile(&rFile, sFilesURL) )
{
SAL_WARN("avmedia.opengl", "Can't load glTF file: " + sFilesURL);
return false;
diff --git a/download.lst b/download.lst
index c4adb8e..589321f 100644
--- a/download.lst
+++ b/download.lst
@@ -88,7 +88,7 @@ export LIBATOMIC_OPS_TARBALL := libatomic_ops-7_2d.zip
export LIBEOT_MD5SUM := aa24f5dd2a2992f4a116aa72af817548
export LIBEOT_TARBALL := libeot-0.01.tar.bz2
export LIBEXTTEXTCAT_TARBALL := ae330b9493bd4503ac390106ff6060d7-libexttextcat-3.4.3.tar.bz2
-export LIBGLTF_TARBALL := 510c3f8504bfb8cc8c8fc5d0fac74055-libgltf.tar.bz2
+export LIBGLTF_TARBALL := 1ce9a9714caff757bab489257eda955d-libgltf.tar.bz2
export LIBLANGTAG_TARBALL := 36271d3fa0d9dec1632029b6d7aac925-liblangtag-0.5.1.tar.bz2
export LIBXMLSEC_TARBALL := 1f24ab1d39f4a51faf22244c94a6203f-xmlsec1-1.2.14.tar.gz
export LIBXML_TARBALL := 9c0cfef285d5c4a5c80d00904ddab380-libxml2-2.9.1.tar.gz
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index e919c71..d8434b6 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -18,7 +18,6 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,libgltf,1))
$(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
external/libgltf/patches/include_path_glew.patch \
external/libgltf/patches/include_path_freetype.patch \
- external/libgltf/patches/disable_fps_and_timer.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/patches/disable_fps_and_timer.patch b/external/libgltf/patches/disable_fps_and_timer.patch
deleted file mode 100644
index c5d5eb2..0000000
--- a/external/libgltf/patches/disable_fps_and_timer.patch
+++ /dev/null
@@ -1,124 +0,0 @@
-diff --git libgltf/src/RenderScene.cpp libgltf/src/RenderScene.cpp
-index 88c5c9a..6639572 100644
---- libgltf/src/RenderScene.cpp
-+++ libgltf/src/RenderScene.cpp
-@@ -383,7 +383,9 @@ void RenderWithFBO::releaseFbo()
-
-
- CPhysicalCamera* RenderScene::sCamera = NULL;
-+#if ENABLE_FPS
- FPSCounter* RenderScene::pFPSCounter = NULL;
-+#endif
- ShaderProgram RenderScene::mShaderProgram = ShaderProgram();
-
- RenderScene::RenderScene()
-@@ -400,10 +402,12 @@ RenderScene::RenderScene()
-
- RenderScene::~RenderScene()
- {
-+#if ENABLE_FPS
- if (pFPSCounter != NULL)
- {
- delete pFPSCounter;
- }
-+#endif
- #if ENABLE_TIMER
- if(pTimer != NULL)
- {
-@@ -815,8 +819,10 @@ int RenderScene::initRender(glTFHandle* handle)
-
- void RenderScene::initFPS(unsigned char* fontBuf,unsigned int bufSize)
- {
-+#if ENABLE_FPS
- pFPSCounter = new FPSCounter(fontBuf,bufSize);
- pFPSCounter->loadFPSShader(&mShaderProgram);
-+#endif
- }
-
- void RenderScene::renderPrimitive(RenderPrimitive* pPrimitive,
-@@ -1132,10 +1138,12 @@ void RenderScene::drawTriangle(RenderPrimitive* pPrimitive)
-
- void RenderScene::prepareRender(void* lpParam)
- {
-+#if ENABLE_FPS
- if (pFPSCounter != NULL)
- {
- pFPSCounter->timeStamp();
- }
-+#endif
- viewport = *((glTFViewport*)lpParam);
- fbo.createAndBindFbo(viewport.width * SSAA, viewport.height * SSAA);
- glBindFramebuffer(GL_FRAMEBUFFER, fbo.mFboId);
-@@ -1229,10 +1237,12 @@ void RenderScene::renderShader(Technique* pTechnique)
-
- void RenderScene::completeRender()
- {
-+#if ENABLE_FPS
- if (pFPSCounter != NULL)
- {
- pFPSCounter->printFPS(&viewport);
- }
-+#endif
- glViewport(viewport.x, viewport.y, viewport.width, viewport.height);
- glBindFramebuffer(GL_FRAMEBUFFER, 0);
- fbo.renderFboTexture();
-@@ -1356,4 +1366,4 @@ double RenderScene::getAnimDuration()
- int RenderScene::isAnimPlay()
- {
- return this->mAnimationPlay ? 1 : 0;
--}
-\ No newline at end of file
-+}
-diff --git libgltf/src/RenderScene.h libgltf/src/RenderScene.h
-index cc0b3e5..065a689 100644
---- libgltf/src/RenderScene.h
-+++ libgltf/src/RenderScene.h
-@@ -8,12 +8,22 @@
- #ifndef RENDERSCENE_H
- #define RENDERSCENE_H
-
-+#ifndef ENABLE_FPS
-+#define ENABLE_FPS 0
-+#endif
-+
-+#ifndef ENABLE_TIMER
-+#define ENABLE_TIMER 0
-+#endif
-+
- #include "Shaders.h"
- #include "Common.h"
- #include "Texture.h"
- #include "Camera.h"
- #include "LoadScene.h"
-+#if ENABLE_FPS
- #include "FPSCounter.h"
-+#endif
- #include "Timer.h"
-
- using namespace glTF;
-@@ -246,7 +256,9 @@ private:
- bool loadFPSShader();
- int getFPS();
- void printFPS(glTFViewport* pViewpoit);
-+#if ENABLE_FPS
- static FPSCounter* pFPSCounter;
-+#endif
- RenderWithFBO fbo;
- #if ENABLE_TIMER
- Timer* pTimer;
-diff --git libgltf/src/Timer.h libgltf/src/Timer.h
-index e4d778b..9ab2d74 100644
---- libgltf/src/Timer.h
-+++ libgltf/src/Timer.h
-@@ -10,7 +10,10 @@
- #include "time.h"
- #include "Common.h"
-
--#define ENABLE_TIMER 1
-+#ifndef ENABLE_TIMER
-+#define ENABLE_TIMER 0
-+#endif
-+
- #define DETAILED_INFO 1
-
- #if ENABLE_TIMER
commit 91427791d0e5903245da9df4a4528844264f1fe5
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Sat May 24 23:28:53 2014 +0200
kmz3collada: Workaround for missing textures
The write-only-.dae-file-which-we-need.patch makes the converter
extract only the *.dae file but textures are stored in seperate
image files we need to extract too.
On the other hand this patch makes the converter buildable on all
platforms, since this only works on Windows originally. So for now
disable this patch on Windows so here we won't loose textures
but enable it on other platforms for buildability.
Later we need to solve kmz conversion properly.
Change-Id: Iede9e3bdd5a68a9002f5fa38da8a6459dda8d805
(cherry picked from commit 2d8941eea664031567f4d70f8347dc15befe8880)
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index a3ba218..f37f274 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -15,8 +15,16 @@ $(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/G
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3 \
- external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0 \
external/collada2gltf/patches/wrong_uri_usage.patch.1 \
))
+ifneq ($(OS),WNT)
+$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
+ external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0 \
+))
+
+endif
+
+
+
# vim: set noet sw=4 ts=4:
commit 950415aa3f7a3e21a179bfd6f0cc4d7cbc6f6dc5
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Fri May 23 19:25:37 2014 +0200
collada2gltf: one more URL usage fix
This one caused empty images and so textures were
missing.
Change-Id: Ia1e93270b7f5ec560b39a41d207e84171bb2434a
(cherry picked from commit 3191d7d1302dbde2445b9f300b3eb853120ede65)
diff --git a/external/collada2gltf/patches/wrong_uri_usage.patch.1 b/external/collada2gltf/patches/wrong_uri_usage.patch.1
index 050fdaa..f42f435 100644
--- a/external/collada2gltf/patches/wrong_uri_usage.patch.1
+++ b/external/collada2gltf/patches/wrong_uri_usage.patch.1
@@ -1,6 +1,6 @@
diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
---- collada2gltf.org/GLTF/GLTFAsset.cpp 2014-05-22 11:12:21.823216900 +0200
-+++ collada2gltf/GLTF/GLTFAsset.cpp 2014-05-22 14:59:04.963439700 +0200
+--- collada2gltf.org/GLTF/GLTFAsset.cpp 2014-05-23 19:19:39.505246750 +0200
++++ collada2gltf/GLTF/GLTFAsset.cpp 2014-05-23 19:20:05.005245669 +0200
@@ -191,12 +191,9 @@
shared_ptr<GLTFOutputStream> GLTFAsset::createOutputStreamIfNeeded(const std::string& streamName) {
@@ -31,7 +31,7 @@ diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
}
COLLADABU::Utils::createDirectoryIfNeeded(this->_bundleOutputPath.c_str());
}
-@@ -376,9 +373,9 @@
+@@ -376,10 +373,10 @@
COLLADABU::URI outputImagePathURI(inputImagePath.c_str());
COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
@@ -39,10 +39,12 @@ diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
+ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
std::string outputPath = folder + outputImagePathURI.getPathFile();
-
+- std::ifstream f1(inputImagePath.c_str(), std::fstream::binary);
+
- std::ifstream f1(inputImagePath.c_str(), std::fstream::binary);
++ std::ifstream f1(COLLADABU::URI(inputImagePath).toNativePath().c_str(), std::fstream::binary);
std::ofstream f2(outputPath.c_str(), std::fstream::binary);
+ if (this->_converterConfig->boolForKeyPath("verboseLogging")) {
@@ -397,8 +394,8 @@
this->_root = shared_ptr <GLTF::JSONObject> (new GLTF::JSONObject());
this->_root->setString(kProfile, profile->id());
@@ -64,8 +66,8 @@ diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
obj->write(&resultsWriter);
diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
---- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-05-22 11:12:21.854416900 +0200
-+++ collada2gltf/shaders/commonProfileShaders.cpp 2014-05-22 14:24:57.063126800 +0200
+--- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-05-23 19:19:39.521246749 +0200
++++ collada2gltf/shaders/commonProfileShaders.cpp 2014-05-23 19:20:09.085245497 +0200
@@ -294,7 +294,7 @@
//also write the file on disk
if (shaderString.size() > 0) {
commit a13d9374f170d80208aba30390ee8260176aadef
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 19:19:02 2014 +0200
glTF: download *.dae and *.kmz files to the temp folder before conversion
Copy them to the same folder where the conversion output is written.
Change-Id: I38b93bf3fc427974cff7d6975151451a253b1cce
(cherry picked from commit b40ca0935d72a3aff8a2beeabec156850c3417ba)
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index a7237d5..7de35f7 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -153,12 +153,43 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
if (bIsDAE || bIsKMZ)
{
std::shared_ptr <GLTF::GLTFAsset> asset(new GLTF::GLTFAsset());
- asset->setInputFilePath(OUStringToOString( rSourceURL, RTL_TEXTENCODING_UTF8 ).getStr());
+
+ OUString sOutput;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sOutput);
+ // remove .tmp extension
+ sOutput = sOutput.copy(0, sOutput.getLength()-4);
+ asset->setBundleOutputPath(OUStringToOString( sOutput, RTL_TEXTENCODING_UTF8 ).getStr());
+
+ const INetURLObject aSourceURLObj(sSource);
+ // If *.dae or *.kmz file is not in the local file system, then copy them to a temp folder for the conversion
+ if(aSourceURLObj.GetProtocol() != INET_PROT_FILE )
+ {
+ try
+ {
+ ::ucbhelper::Content aSourceContent(sSource,
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
+
+ const OUString sTarget = sOutput + GetFilename(sSource);
+ ::ucbhelper::Content aTempContent(sTarget,
+ uno::Reference<ucb::XCommandEnvironment>(),
+ comphelper::getProcessComponentContext());
+
+ aTempContent.writeStream(aSourceContent.openStream(), true);
+ sSource = sTarget;
+ }
+ catch (const uno::Exception&)
+ {
+ SAL_WARN("avmedia.opengl", "Exception while trying to copy source file to the temp folder for conversion:\n" << sSource);
+ return false;
+ }
+ }
+
+ asset->setInputFilePath(OUStringToOString( sSource, RTL_TEXTENCODING_UTF8 ).getStr());
if (bIsKMZ)
{
// KMZ converter needs a system path
- const INetURLObject aSourceURLObj(rSourceURL);
const std::string sSourcePath =
OUStringToOString( aSourceURLObj.getFSysPath(INetURLObject::FSYS_DETECT), RTL_TEXTENCODING_UTF8 ).getStr();
const std::string strDaeFilePath = GLTF::Kmz2Collada()(sSourcePath);
@@ -172,12 +203,6 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
asset->setInputFilePath(OUStringToOString( sDaeFilePath, RTL_TEXTENCODING_UTF8 ).getStr());
}
- OUString sOutput;
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sOutput);
- // remove .tmp extension
- sOutput = sOutput.copy(0, sOutput.getLength()-4);
- asset->setBundleOutputPath(OUStringToOString( sOutput, RTL_TEXTENCODING_UTF8 ).getStr());
-
GLTF::COLLADA2GLTFWriter writer(asset);
writer.write();
// Path to the .json file created by COLLADA2GLTFWriter
commit f5c187c8ea24c71bdd4f5c9342c252743a096370
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:59:34 2014 +0200
collada2gltf: move patches to an own folder
Change-Id: Ife28845af92883d8090bb80283c59a0a9a350b32
(cherry picked from commit 60ce9e98cb3d1469d3e94164f5670daa2f3a26f0)
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index 0ced364..a3ba218 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -14,9 +14,9 @@ $(eval $(call gb_UnpackedTarball_set_tarball,collada2gltf,$(COLLADA2GLTF_TARBALL
$(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/GitSHA1.cpp))
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
- external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 \
- external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 \
- external/collada2gltf/wrong_uri_usage.patch.1 \
+ external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3 \
+ external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0 \
+ external/collada2gltf/patches/wrong_uri_usage.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 b/external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3
similarity index 100%
rename from external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3
rename to external/collada2gltf/patches/add-unzip-kmz-files-to-collada-files-module.patch.3
diff --git a/external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 b/external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0
similarity index 100%
rename from external/collada2gltf/write-only-.dae-file-which-we-need.patch.0
rename to external/collada2gltf/patches/write-only-.dae-file-which-we-need.patch.0
diff --git a/external/collada2gltf/wrong_uri_usage.patch.1 b/external/collada2gltf/patches/wrong_uri_usage.patch.1
similarity index 100%
rename from external/collada2gltf/wrong_uri_usage.patch.1
rename to external/collada2gltf/patches/wrong_uri_usage.patch.1
commit 478f7d8a88c36eb955d44558b10df2ed93a01561
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:56:19 2014 +0200
collada2gltf: fix URL problems
collada2gltf does not handle Windows pathes, the used COLLADABU::URI
class can't parse native Windows pathes so call COLLADA2GLTFWriter
with URL only.
Other problems:
collada2gltf uses the URL path for creating/opening files,
instead of native ones.
collada2gltf initializes _outputFilePath member in different way,
sometimes as an URL path, sometimes as a native one, but handle it
on the same way(as an URL).
Change-Id: I104182653c07e7dcf6fc5b6e32c7031d59246b84
(cherry picked from commit 1dd84fc4674141449c78f6c5838e2254c5a28f35)
diff --git a/avmedia/source/framework/modeltools.cxx b/avmedia/source/framework/modeltools.cxx
index c3fa11e..a7237d5 100644
--- a/avmedia/source/framework/modeltools.cxx
+++ b/avmedia/source/framework/modeltools.cxx
@@ -152,28 +152,36 @@ bool Embed3DModel( const uno::Reference<frame::XModel>& xModel,
const bool bIsKMZ = rSourceURL.endsWithIgnoreAsciiCase(".kmz");
if (bIsDAE || bIsKMZ)
{
- OUString sName;
- ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sName);
- // remove .tmp extension
- sName = sName.copy(0, sName.getLength() - 4);
- const INetURLObject aSourceURLObj(rSourceURL);
- std::string sSourcePath = OUStringToOString( aSourceURLObj.getFSysPath(INetURLObject::FSYS_DETECT), RTL_TEXTENCODING_UTF8 ).getStr();
-
std::shared_ptr <GLTF::GLTFAsset> asset(new GLTF::GLTFAsset());
- asset->setInputFilePath(sSourcePath);
+ asset->setInputFilePath(OUStringToOString( rSourceURL, RTL_TEXTENCODING_UTF8 ).getStr());
if (bIsKMZ)
{
- std::string strDaeFilePath = GLTF::Kmz2Collada()(asset->getInputFilePath());
+ // KMZ converter needs a system path
+ const INetURLObject aSourceURLObj(rSourceURL);
+ const std::string sSourcePath =
+ OUStringToOString( aSourceURLObj.getFSysPath(INetURLObject::FSYS_DETECT), RTL_TEXTENCODING_UTF8 ).getStr();
+ const std::string strDaeFilePath = GLTF::Kmz2Collada()(sSourcePath);
if (strDaeFilePath == "")
return false;
- asset->setInputFilePath(strDaeFilePath);
+
+ // DAE converter needs URL
+ OUString sDaeFilePath;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(
+ OStringToOUString(OString(strDaeFilePath.c_str()), RTL_TEXTENCODING_UTF8 ), sDaeFilePath);
+ asset->setInputFilePath(OUStringToOString( sDaeFilePath, RTL_TEXTENCODING_UTF8 ).getStr());
}
- asset->setBundleOutputPath(OUStringToOString( sName, RTL_TEXTENCODING_UTF8 ).getStr());
+
+ OUString sOutput;
+ ::utl::LocalFileHelper::ConvertPhysicalNameToURL(::utl::TempFile::CreateTempName(), sOutput);
+ // remove .tmp extension
+ sOutput = sOutput.copy(0, sOutput.getLength()-4);
+ asset->setBundleOutputPath(OUStringToOString( sOutput, RTL_TEXTENCODING_UTF8 ).getStr());
+
GLTF::COLLADA2GLTFWriter writer(asset);
writer.write();
// Path to the .json file created by COLLADA2GLTFWriter
- sSource = sName + "/" + GetFilename(sName) + ".json";
+ sSource = sOutput + "/" + GetFilename(sOutput) + ".json";
}
#endif
diff --git a/external/collada2gltf/UnpackedTarball_collada2gltf.mk b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
index 3112cd9..0ced364 100644
--- a/external/collada2gltf/UnpackedTarball_collada2gltf.mk
+++ b/external/collada2gltf/UnpackedTarball_collada2gltf.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_add_file,collada2gltf,.,external/collada2gltf/G
$(eval $(call gb_UnpackedTarball_add_patches,collada2gltf,\
external/collada2gltf/add-unzip-kmz-files-to-collada-files-module.patch.3 \
external/collada2gltf/write-only-.dae-file-which-we-need.patch.0 \
+ external/collada2gltf/wrong_uri_usage.patch.1 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/collada2gltf/wrong_uri_usage.patch.1 b/external/collada2gltf/wrong_uri_usage.patch.1
new file mode 100644
index 0000000..050fdaa
--- /dev/null
+++ b/external/collada2gltf/wrong_uri_usage.patch.1
@@ -0,0 +1,77 @@
+diff -ur collada2gltf.org/GLTF/GLTFAsset.cpp collada2gltf/GLTF/GLTFAsset.cpp
+--- collada2gltf.org/GLTF/GLTFAsset.cpp 2014-05-22 11:12:21.823216900 +0200
++++ collada2gltf/GLTF/GLTFAsset.cpp 2014-05-22 14:59:04.963439700 +0200
+@@ -191,12 +191,9 @@
+ shared_ptr<GLTFOutputStream> GLTFAsset::createOutputStreamIfNeeded(const std::string& streamName) {
+
+ if (this->_nameToOutputStream.count(streamName) == 0) {
+- COLLADABU::URI inputURI(this->getInputFilePath().c_str());
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+
+- std::string folder = outputURI.getPathDir();
+- std::string fileName = inputURI.getPathFileBase();
+-
++ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
+ shared_ptr<GLTFOutputStream> outputStream = shared_ptr <GLTFOutputStream> (new GLTFOutputStream(folder, streamName, ""));
+ this->_nameToOutputStream[streamName] = outputStream;
+ }
+@@ -280,13 +277,13 @@
+ this->_bundleOutputPath = outputBundlePathURI.toNativePath();
+
+ COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
+- this->_outputFilePath = outputPathURI.toNativePath();
++ this->_outputFilePath = outputPathURI.getURIString();
+ // this->log("outputBundlePath:%s\n",outputBundlePathURI.toNativePath().c_str());
+ // this->log("outputPath:%s\n",outputPathURI.toNativePath().c_str());
+ } else {
+ this->_bundleOutputPath = outputBundlePathURI.toNativePath();
+ COLLADABU::URI outputPathURI(outputBundlePathURI.getURIString() + "/" + outputBundlePathURI.getPathFileBase() + "." + "json");
+- this->_outputFilePath = outputPathURI.toNativePath();
++ this->_outputFilePath = outputPathURI.getURIString();
+ }
+ COLLADABU::Utils::createDirectoryIfNeeded(this->_bundleOutputPath.c_str());
+ }
+@@ -376,9 +373,9 @@
+ COLLADABU::URI outputImagePathURI(inputImagePath.c_str());
+
+ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
+- std::string folder = outputURI.getPathDir();
++ std::string folder = COLLADABU::URI(outputURI.getPathDir()).toNativePath();
+ std::string outputPath = folder + outputImagePathURI.getPathFile();
+-
++
+ std::ifstream f1(inputImagePath.c_str(), std::fstream::binary);
+ std::ofstream f2(outputPath.c_str(), std::fstream::binary);
+
+@@ -397,8 +394,8 @@
+ this->_root = shared_ptr <GLTF::JSONObject> (new GLTF::JSONObject());
+ this->_root->setString(kProfile, profile->id());
+ this->_root->createObjectIfNeeded(kNodes);
+-
+- this->_writer.initWithPath(this->getOutputFilePath().c_str());
++ COLLADABU::URI outputURI(this->getOutputFilePath().c_str());
++ this->_writer.initWithPath(outputURI.toNativePath().c_str());
+ }
+
+ static void __eval(JSONValue* value, void *context) {
+@@ -427,7 +424,7 @@
+ void GLTFAsset::_writeJSONResource(const std::string &path, shared_ptr<JSONObject> obj) {
+ GLTF::GLTFWriter resultsWriter;
+ COLLADABU::URI outputURI(this->resourceOuputPathForPath(path));
+- std::string aPath = this->getOutputFolderPath() + outputURI.getPathFile();
++ std::string aPath = COLLADABU::URI(this->getOutputFolderPath() + outputURI.getPathFile()).toNativePath();
+ resultsWriter.initWithPath(aPath);
+ obj->write(&resultsWriter);
+
+diff -ur collada2gltf.org/shaders/commonProfileShaders.cpp collada2gltf/shaders/commonProfileShaders.cpp
+--- collada2gltf.org/shaders/commonProfileShaders.cpp 2014-05-22 11:12:21.854416900 +0200
++++ collada2gltf/shaders/commonProfileShaders.cpp 2014-05-22 14:24:57.063126800 +0200
+@@ -294,7 +294,7 @@
+ //also write the file on disk
+ if (shaderString.size() > 0) {
+ COLLADABU::URI outputURI(asset->getOutputFilePath());
+- std::string shaderPath = outputURI.getPathDir() + path;
++ std::string shaderPath = COLLADABU::URI(outputURI.getPathDir()).toNativePath() + path;
+ GLTF::GLTFUtils::writeData(shaderPath, "w",(unsigned char*)shaderString.c_str(), shaderString.size());
+ if (!CONFIG_BOOL(asset, "outputProgress") && asset->converterConfig()->boolForKeyPath("verboseLogging")) {
+ asset->log("[shader]: %s\n", shaderPath.c_str());
commit cdee4e73eb7a6fa64dd382af7dfad707631d8fe5
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Thu May 22 15:39:43 2014 +0200
opencollada: move patches to an own folder
(cherry picked from commit d466f926f8dc07ec23efa5807fff35a0b6dd4146)
Change-Id: I0b60fa5b0af8224b4c517367130aa9738f071531
diff --git a/external/opencollada/UnpackedTarball_opencollada.mk b/external/opencollada/UnpackedTarball_opencollada.mk
index 579efc2..93e5480 100644
--- a/external/opencollada/UnpackedTarball_opencollada.mk
+++ b/external/opencollada/UnpackedTarball_opencollada.mk
@@ -12,8 +12,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,opencollada))
$(eval $(call gb_UnpackedTarball_set_tarball,opencollada,$(OPENCOLLADA_TARBALL)))
$(eval $(call gb_UnpackedTarball_add_patches,opencollada,\
- external/opencollada/opencollada.clang.patch.0 \
- external/opencollada/opencollada.libxml.patch.0 \
+ external/opencollada/patches/opencollada.clang.patch.0 \
+ external/opencollada/patches/opencollada.libxml.patch.0 \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/opencollada/opencollada.clang.patch.0 b/external/opencollada/patches/opencollada.clang.patch.0
similarity index 100%
rename from external/opencollada/opencollada.clang.patch.0
rename to external/opencollada/patches/opencollada.clang.patch.0
diff --git a/external/opencollada/opencollada.libxml.patch.0 b/external/opencollada/patches/opencollada.libxml.patch.0
similarity index 100%
rename from external/opencollada/opencollada.libxml.patch.0
rename to external/opencollada/patches/opencollada.libxml.patch.0
More information about the Libreoffice-commits
mailing list