[Libreoffice-commits] core.git: 2 commits - avmedia/source external/libgltf
Zolnai Tamás
tamas.zolnai at collabora.com
Wed Jul 16 05:51:42 PDT 2014
avmedia/source/opengl/oglwindow.cxx | 5
external/libgltf/UnpackedTarball_libgltf.mk | 1
external/libgltf/pathces/fix_rendering_of_resized_model.patch | 71 ++++++++++
3 files changed, 75 insertions(+), 2 deletions(-)
New commits:
commit 51ba2df1cb29d4343f92174da6dc8f36ba9152eb
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Tue Jul 15 23:37:10 2014 +0200
fdo#81182: Resizing glTF window affects camera position
Camera moves by click and drag, with checking the last mouse
position we can make sure click was done inside the window
before drag.
Resizing can trigger drag event, but not click event.
Change-Id: I9e8b70fcb4a0abf26e76e03cafd026f940eceb10
diff --git a/avmedia/source/opengl/oglwindow.cxx b/avmedia/source/opengl/oglwindow.cxx
index dbb3662..d082aa9 100644
--- a/avmedia/source/opengl/oglwindow.cxx
+++ b/avmedia/source/opengl/oglwindow.cxx
@@ -19,7 +19,7 @@ OGLWindow::OGLWindow( glTFHandle& rHandle, OpenGLContext& rContext, Window& rEve
, m_rContext( rContext )
, m_rEventHandler( rEventHandlerParent )
, m_bVisible ( false )
- , m_aLastMousePos(Point())
+ , m_aLastMousePos(Point(0,0))
, m_bIsOrbitMode( false )
, m_fCameraDistance(0.0)
{
@@ -321,7 +321,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
m_rEventHandler.GrabFocus();
}
MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
- if(pMouseEvt && pMouseEvt->IsLeft())
+ if(pMouseEvt && pMouseEvt->IsLeft() && m_aLastMousePos != Point(0,0))
{
const Point& aCurPos = pMouseEvt->GetPosPixel();
float fSensitivity = std::min(m_rHandle.viewport.width, m_rHandle.viewport.height);
@@ -353,6 +353,7 @@ IMPL_LINK(OGLWindow, CameraHandler, VclWindowEvent*, pEvent)
MouseEvent* pMouseEvt = (MouseEvent*)pEvent->GetData();
if(pMouseEvt && pMouseEvt->IsLeft() && pMouseEvt->GetClicks() == 1)
{
+ m_aLastMousePos = Point(0,0);
gltf_renderer_stop_rotate_model(&m_rHandle);
}
}
commit 3cd7c0f6b6cdb8ebc6c72d2ffe1e0bc18968e27b
Author: Zolnai Tamás <tamas.zolnai at collabora.com>
Date: Tue Jul 15 23:15:08 2014 +0200
fdo#81182: glTF window size does not match with the scene size after resizing
When viewport changed it is necessary to resize the whole scene.
Calling releasFbo removes size dependent objects and triggers
creating the new ones with the new size.
Change-Id: Ibd8be1e92be92da31add4a30aa799f0995b1cc88
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk
index 176c1d1..a7565ea 100644
--- a/external/libgltf/UnpackedTarball_libgltf.mk
+++ b/external/libgltf/UnpackedTarball_libgltf.mk
@@ -16,6 +16,7 @@ $(eval $(call gb_UnpackedTarball_set_patchflags,libgltf,--binary))
$(eval $(call gb_UnpackedTarball_set_patchlevel,libgltf,1))
$(eval $(call gb_UnpackedTarball_add_patches,libgltf,\
+ external/libgltf/pathces/fix_rendering_of_resized_model.patch \
))
# vim: set noet sw=4 ts=4:
diff --git a/external/libgltf/pathces/fix_rendering_of_resized_model.patch b/external/libgltf/pathces/fix_rendering_of_resized_model.patch
new file mode 100644
index 0000000..57af9f9
--- /dev/null
+++ b/external/libgltf/pathces/fix_rendering_of_resized_model.patch
@@ -0,0 +1,71 @@
+diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
+--- libgltf.org/src/RenderScene.cpp 2014-07-15 17:33:12.615059856 +0200
++++ libgltf/src/RenderScene.cpp 2014-07-15 22:24:20.862307666 +0200
+@@ -639,7 +639,7 @@
+ , pScene(0)
+ , mLoadJson()
+ , mBindBufferMap()
+- , viewport()
++ , mCurrentViewport()
+ , fbo()
+ , mEnableTransparency(false)
+ , mEnableRotation(false)
+@@ -1555,10 +1555,9 @@
+ pFPSCounter->timeStamp();
+ }
+ #endif
+- viewport = *((glTFViewport*)lpParam);
+ {
+ TRACE_TIME;
+- status = initSSAAFrameBuf(&viewport);
++ status = initSSAAFrameBuf(((glTFViewport*)lpParam));
+ if (LIBGLTF_SUCCESS != status)
+ return status;
+ }
+@@ -1569,6 +1568,15 @@
+ {
+ if (0 == pViewport->width)
+ return LIBGLTF_INVALID_SIZE;
++
++ // When viewport changes we need to release fbo and create a new one
++ if( mCurrentViewport.x != pViewport->x || mCurrentViewport.y != pViewport->y ||
++ mCurrentViewport.width != pViewport->width || mCurrentViewport.height != pViewport->height )
++ {
++ fbo.releaseFbo();
++ mCurrentViewport = *pViewport;
++ }
++
+ #if DEFAULT_VIEW
+ unsigned int width = SSAA * DEFAULT_VIEW;
+ unsigned int height = (SSAA * DEFAULT_VIEW *
+@@ -1730,14 +1738,14 @@
+ #if ENABLE_FPS
+ if (0 != pFPSCounter)
+ {
+- pFPSCounter->printFPS(&viewport);
++ pFPSCounter->printFPS(&mCurrentViewport);
+ }
+ #endif
+
+ {
+ TRACE_TIME;
+- glViewport(viewport.x, viewport.y,
+- viewport.width, viewport.height);
++ glViewport(mCurrentViewport.x, mCurrentViewport.y,
++ mCurrentViewport.width, mCurrentViewport.height);
+ glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ fbo.renderFboTexture();
+ }
+Only in libgltf/src: RenderScene.cpp~
+diff -ur libgltf.org/src/RenderScene.h libgltf/src/RenderScene.h
+--- libgltf.org/src/RenderScene.h 2014-07-15 17:33:12.615059856 +0200
++++ libgltf/src/RenderScene.h 2014-07-15 22:18:01.306324010 +0200
+@@ -349,7 +349,7 @@
+ std::map<std::string, BindBufferInfo> mBindBufferMap;
+
+ static ShaderProgram mShaderProgram;
+- glTFViewport viewport;
++ glTFViewport mCurrentViewport;
+ RenderWithFBO fbo;
+
+ bool mEnableTransparency;
More information about the Libreoffice-commits
mailing list