diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-06-25 15:19:41 +0200 |
---|---|---|
committer | Zolnai Tamás <zolnaitamas2000@gmail.com> | 2014-06-25 13:22:29 +0000 |
commit | 6403f2b59b4c83e0899012e5ca0ddd705784350c (patch) | |
tree | ccc8080f9b4ba808f2fec310aedd15703c41170b /external/libgltf | |
parent | 076e4afc61b216e34959bd4e3701f1fa19972d5c (diff) |
Update libgltf: new build system and various fixes
Building:
- The new tarball has reasonable build system so
build libgltf as external package instead of compiling
source files directly.
- Freetype dependancy is removed
Improvements comes with the new libgltf
- Can rotate the models too (orbit mode)
- Two camera handling mode: walkthrough and orbit
(press M to change).
- gltf_animation_set_time() works
- FPS can be displayed without freetype (press F)
Additional notes:
- There were some bugs/regressions which are fixed
during the integration (see patches).
- License files are uddated now.
- libgltf building is enabled only on those platforms
on which gltf support actually works (windows and linux)
Change-Id: Ia6c9c4da53a9b4fedba0d73aa5791489f8ad424b
Reviewed-on: https://gerrit.libreoffice.org/9895
Reviewed-by: Zolnai Tamás <zolnaitamas2000@gmail.com>
Tested-by: Zolnai Tamás <zolnaitamas2000@gmail.com>
Diffstat (limited to 'external/libgltf')
19 files changed, 313 insertions, 201 deletions
diff --git a/external/libgltf/ExternalProject_libgltf.mk b/external/libgltf/ExternalProject_libgltf.mk new file mode 100644 index 000000000000..d20616b47597 --- /dev/null +++ b/external/libgltf/ExternalProject_libgltf.mk @@ -0,0 +1,71 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_ExternalProject_ExternalProject,libgltf)) + +$(eval $(call gb_ExternalProject_use_autoconf,libgltf,build)) + +$(eval $(call gb_ExternalProject_register_targets,libgltf,\ + build \ +)) + +$(eval $(call gb_ExternalProject_use_externals,libgltf,\ + boost_headers \ + glew \ + glm_headers \ +)) + + +ifeq ($(COM),MSC) + +AdditionalIncludes := + +ifeq ($(SYSTEM_BOOST),) +AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,boost)" +AdditionalIncludes += "$(SRCDIR)/config_host" +endif + +ifeq ($(SYSTEM_GLEW),) +AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,glew)/include" +endif + +ifeq ($(SYSTEM_GLM),) +AdditionalIncludes += "$(call gb_UnpackedTarball_get_dir,glm)" +endif + +empty := +space := $(empty) $(empty) + +$(call gb_ExternalProject_get_state_target,libgltf,build) : + $(call gb_ExternalProject_run,build,\ + msbuild.exe libgltf.vcxproj \ + /p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \ + $(if $(filter 110,$(VCVER)),/p:PlatformToolset=$(if $(filter 80,$(WINDOWS_SDK_VERSION)),v110,v110_xp) \ + /p:VisualStudioVersion=11.0) \ + '/p:AdditionalIncludeDirectories=$(subst $(space),;,$(subst /,\,$(strip $(AdditionalIncludes))))' \ + /p:AdditionalLibraryDirectories=$(if $(SYSTEM_GLEW),,"$(subst /,\,$(call gb_UnpackedTarball_get_dir,glew))\lib\$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release)\Win32") \ + ,build/win32) + +else + +$(call gb_ExternalProject_get_state_target,libgltf,build) : + $(call gb_ExternalProject_run,build,\ + export PKG_CONFIG="" \ + && ./configure \ + --disable-debug \ + --disable-werror \ + BOOST_CFLAGS="$(if $(SYSTEM_BOOST),$(BOOST_CPPFLAGS),-I$(call gb_UnpackedTarball_get_dir,boost))" \ + GLEW_CFLAGS="$(if $(SYSTEM_GLEW),$(GLEW_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,glew)/include)" \ + GLM_CFLAGS="$(if $(SYSTEM_GLM),$(GLM_CFLAGS),-I$(call gb_UnpackedTarball_get_dir,glm))" \ + && $(MAKE) \ + ) + +endif + +# vim: set noet sw=4 ts=4: diff --git a/external/libgltf/Module_libgltf.mk b/external/libgltf/Module_libgltf.mk index b593f89398ea..c6ebed6102d8 100644 --- a/external/libgltf/Module_libgltf.mk +++ b/external/libgltf/Module_libgltf.mk @@ -10,7 +10,7 @@ $(eval $(call gb_Module_Module,libgltf)) $(eval $(call gb_Module_add_targets,libgltf,\ - StaticLibrary_libgltf \ + ExternalProject_libgltf \ UnpackedTarball_libgltf \ )) diff --git a/external/libgltf/StaticLibrary_libgltf.mk b/external/libgltf/StaticLibrary_libgltf.mk deleted file mode 100644 index 3575d1585a62..000000000000 --- a/external/libgltf/StaticLibrary_libgltf.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- -# -# This file is part of the LibreOffice project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# - -$(eval $(call gb_StaticLibrary_StaticLibrary,libgltf)) - -$(eval $(call gb_StaticLibrary_set_warnings_not_errors,libgltf)) - -$(eval $(call gb_StaticLibrary_use_unpacked,libgltf,libgltf)) - -$(eval $(call gb_StaticLibrary_set_generated_cxx_suffix,libgltf,cpp)) - -# Avoid warnings -$(eval $(call gb_StaticLibrary_add_cxxflags,libgltf,-w)) - -$(eval $(call gb_StaticLibrary_use_externals,libgltf,\ - boost_headers \ - glm_headers \ - mesa_headers \ - glew \ - zlib \ -)) - -$(eval $(call gb_StaticLibrary_set_include,libgltf,\ - -I$(call gb_UnpackedTarball_get_dir,libgltf)/inc \ - $$(INCLUDE) \ -)) - -$(eval $(call gb_StaticLibrary_add_generated_exception_objects,libgltf,\ - UnpackedTarball/libgltf/src/Camera \ - UnpackedTarball/libgltf/src/Common \ - UnpackedTarball/libgltf/src/libgltf \ - UnpackedTarball/libgltf/src/LoadScene \ - UnpackedTarball/libgltf/src/RenderScene \ - UnpackedTarball/libgltf/src/Shaders \ - UnpackedTarball/libgltf/src/Texture \ -)) - -# vim: set noet sw=4 ts=4: diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk index a1314bb19484..da5e018d1b58 100644 --- a/external/libgltf/UnpackedTarball_libgltf.mk +++ b/external/libgltf/UnpackedTarball_libgltf.mk @@ -16,12 +16,16 @@ $(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/patches/include_path_glew.patch \ - 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 \ external/libgltf/patches/init_scene_set_handle.patch \ + external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch \ + external/libgltf/patches/wrong_duration_caused_by_uninitialized_member.patch \ + external/libgltf/patches/wrong_media_time_caused_by_missing_fmod.patch \ + external/libgltf/patches/wrong_animation_state_when_set_time_to_null.patch \ + external/libgltf/patches/no_effect_of_set_looping.patch \ + external/libgltf/patches/wrong_media_time_at_first_run_caused_by_uninitilized_member.patch \ + external/libgltf/patches/no_animation_in_orbit_mode.patch \ + external/libgltf/patches/walkthrough_mode_affects_orbit_mode_unexpectedly.patch \ + external/libgltf/patches/move_fps_closer_to_the_corner.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libgltf/patches/deallocation_fix.patch b/external/libgltf/patches/deallocation_fix.patch deleted file mode 100644 index 4049e2faf16f..000000000000 --- a/external/libgltf/patches/deallocation_fix.patch +++ /dev/null @@ -1,12 +0,0 @@ -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;
- }
-
diff --git a/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch b/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch new file mode 100644 index 000000000000..8b9f3dbf7b25 --- /dev/null +++ b/external/libgltf/patches/extend_get_bitmap_for_rgba_ones.patch @@ -0,0 +1,76 @@ +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-06-23 18:49:46.603119797 +0200 ++++ libgltf/src/RenderScene.cpp 2014-06-23 19:00:17.583092627 +0200 +@@ -1735,28 +1735,29 @@ +
+ void RenderScene::setBitZoom(unsigned char* Dstbuffer,
+ unsigned char* Srcbuffer,
+- glTFViewport* pViewport)
++ glTFViewport* pViewport,
++ int bufferDepth )
+ {
+ const int width = pViewport->width;
+ const int height = pViewport->height;
+- const int newLineByte = (width * 3 + 3) / 4 * 4;
+- const int lineByte = (width * SSAA * 3 + 3) / 4 * 4;
++ const int newLineByte = width * bufferDepth;
++ const int lineByte = width * SSAA * bufferDepth;
+ for (int i = 0; i < height; i++)
+ {
+ for (int j = 0; j < width; j++)
+- for (int k = 0; k < 3; k++)
++ for (int k = 0; k < bufferDepth; k++)
+ {
+ long xData = (long)(i * SSAA + 0.5);
+ long yData = (long)(j * SSAA + 0.5);
+ if((yData >= 0) && (yData < width * SSAA) &&
+ (xData >= 0) && (xData < height * SSAA))
+ {
+- *(Dstbuffer + i * newLineByte + j * 3 + k) =
+- *(Srcbuffer + xData * lineByte + yData * 3 + k);
++ *(Dstbuffer + i * newLineByte + j * bufferDepth + k) =
++ *(Srcbuffer + xData * lineByte + yData * bufferDepth + k);
+ }
+ else
+ {
+- *(Dstbuffer + i * newLineByte + j * 3 + k) = 255;
++ *(Dstbuffer + i * newLineByte + j * bufferDepth + k) = 255;
+ }
+ }
+ }
+@@ -1782,12 +1783,20 @@ + {
+ return;
+ }
+- int imageSize = ((width + ((4 - (width % 4)) % 4)) *
+- height * 3) + 2;
++
++ int bufferDepth;
++ if( format == GL_RGB || format == GL_BGR )
++ bufferDepth = 3;
++ else if( format == GL_RGBA || format == GL_BGRA )
++ bufferDepth = 4;
++ else
++ return;
++
++ int imageSize = width * height * bufferDepth;
+ unsigned char *pbuffer = new unsigned char[imageSize];
+ glReadPixels(0, 0, width, height, format,
+ GL_UNSIGNED_BYTE, pbuffer);
+- setBitZoom(buffer, pbuffer, pViewport);
++ setBitZoom(buffer, pbuffer, pViewport, bufferDepth);
+ if (pbuffer)
+ {
+ delete [] pbuffer;
+diff -ur libgltf.org/src/RenderScene.h libgltf/src/RenderScene.h +--- libgltf.org/src/RenderScene.h 2014-06-23 18:49:46.587119798 +0200 ++++ libgltf/src/RenderScene.h 2014-06-23 18:59:46.991093944 +0200 +@@ -234,7 +234,7 @@ + void completeRenderBitmap(glTFViewport* pViewport,
+ unsigned char* buffer, GLenum format);
+ void setBitZoom(unsigned char* Dstbuffer,
+- unsigned char* Srcbuffer, glTFViewport* pViewport);
++ unsigned char* Srcbuffer, glTFViewport* pViewport, int bufferDepth );
+
+ // For animation
+ void startAnimation();
diff --git a/external/libgltf/patches/include_path_freetype.patch b/external/libgltf/patches/include_path_freetype.patch deleted file mode 100644 index 917b52c0dc8f..000000000000 --- a/external/libgltf/patches/include_path_freetype.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -ur libgltf.org/src/Font.h libgltf/src/Font.h ---- libgltf.org/src/Font.h 2014-05-05 14:35:24.155370405 +0200 -+++ libgltf/src/Font.h 2014-05-05 14:35:39.715371069 +0200 -@@ -8,7 +8,7 @@ - #ifndef FONT_H
- #define FONT_H
-
--#include "freetype/ft2build.h"
-+#include "ft2build.h"
- #include FT_FREETYPE_H
- #include "Texture.h"
-
diff --git a/external/libgltf/patches/include_path_glew.patch b/external/libgltf/patches/include_path_glew.patch deleted file mode 100644 index 51d222fe1c51..000000000000 --- a/external/libgltf/patches/include_path_glew.patch +++ /dev/null @@ -1,60 +0,0 @@ -diff -ur libgltf/inc/libgltf.h libgltf/inc/libgltf.h ---- libgltf/inc/libgltf.h 2014-05-05 14:26:11.911346850 +0200 -+++ libgltf/inc/libgltf.h 2014-05-05 14:27:07.295349212 +0200 -@@ -9,7 +9,7 @@ - #define LIBGLTF_H
- #include <stddef.h>
- #include "types.h"
--#include <glew/glew.h>
-+#include <GL/glew.h>
- #include <glm/glm.hpp>
- using namespace glTF;
-
-diff -ur libgltf.org/src/Camera.h libgltf/src/Camera.h ---- libgltf.org/src/Camera.h 2014-05-05 14:26:11.911346850 +0200 -+++ libgltf/src/Camera.h 2014-05-05 14:27:07.295349212 +0200 -@@ -8,7 +8,7 @@ - #ifndef CAMERA_H
- #define CAMERA_H
-
--#include <glew/glew.h>
-+#include <GL/glew.h>
- #include <glm/glm.hpp>
-
- class CPhysicalCamera
-diff -ur libgltf.org/src/Common.h libgltf/src/Common.h ---- libgltf.org/src/Common.h 2014-05-05 14:26:11.911346850 +0200 -+++ libgltf/src/Common.h 2014-05-05 14:27:18.927349708 +0200 -@@ -7,7 +7,7 @@ - */
- #ifndef COMMON_H
- #define COMMON_H
--#include <glew/glew.h>
-+#include <GL/glew.h>
- #include <glm/glm.hpp>
- #include <string>
- #include <vector>
-diff -ur libgltf.org/src/Shaders.h libgltf/src/Shaders.h ---- libgltf.org/src/Shaders.h 2014-05-05 14:26:11.923346850 +0200 -+++ libgltf/src/Shaders.h 2014-05-05 14:27:45.483350841 +0200 -@@ -8,7 +8,7 @@ - #ifndef SHADERS_H
- #define SHADERS_H
-
--#include <glew/glew.h>
-+#include <GL/glew.h>
- #include <glm/glm.hpp>
-
- #include <string>
-diff -ur libgltf.org/src/Texture.h libgltf/src/Texture.h ---- libgltf.org/src/Texture.h 2014-05-05 14:26:11.911346850 +0200 -+++ libgltf/src/Texture.h 2014-05-05 14:27:52.927351158 +0200 -@@ -11,7 +11,7 @@ - #include <string>
- #include <vector>
- #include <map>
--#include <glew/glew.h>
-+#include <GL/glew.h>
- #include <glm/glm.hpp>
-
- using namespace std;
diff --git a/external/libgltf/patches/init_scene_set_handle.patch b/external/libgltf/patches/init_scene_set_handle.patch index ef34fe34ed3f..88ad05325cf3 100644 --- a/external/libgltf/patches/init_scene_set_handle.patch +++ b/external/libgltf/patches/init_scene_set_handle.patch @@ -1,7 +1,7 @@ diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp ---- libgltf.org/src/LoadScene.cpp 2014-06-13 01:13:40.654653289 +0200 -+++ libgltf/src/LoadScene.cpp 2014-06-13 01:15:45.034648018 +0200 -@@ -148,10 +148,14 @@ +--- libgltf.org/src/LoadScene.cpp 2014-06-23 14:55:58.099723870 +0200 ++++ libgltf/src/LoadScene.cpp 2014-06-23 14:56:04.399723599 +0200 +@@ -149,10 +149,14 @@ return true;
}
@@ -16,12 +16,12 @@ diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp int status;
- this->pScene = pscene;
- {
- TRACE_TIME ("parseScene->readBuffers", CPU);
+ status = this->readBuffers();
+ if (status < 0)
diff -ur libgltf.org/src/LoadScene.h libgltf/src/LoadScene.h ---- libgltf.org/src/LoadScene.h 2014-06-13 01:13:40.654653289 +0200 -+++ libgltf/src/LoadScene.h 2014-06-13 01:16:03.886647220 +0200 -@@ -27,7 +27,8 @@ +--- libgltf.org/src/LoadScene.h 2014-06-23 14:55:58.079723871 +0200 ++++ libgltf/src/LoadScene.h 2014-06-23 14:56:37.303722182 +0200 +@@ -21,7 +21,8 @@ public:
glTFHandle* getFileNameInJson(const std::string& jsonFile);
bool releaseFileName();
@@ -31,41 +31,30 @@ diff -ur libgltf.org/src/LoadScene.h libgltf/src/LoadScene.h bool parseJsonFile();
void setJsonInfo(const std::string& sbuffer);
void setJsonInfo(const std::string& direct, const std::string& fileName);
-@@ -81,4 +82,4 @@ - bool is_json_in_buffer;
- };
-
--#endif -\ No newline at end of file -+#endif
diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp ---- libgltf.org/src/RenderScene.cpp 2014-06-13 01:13:40.654653289 +0200 -+++ libgltf/src/RenderScene.cpp 2014-06-13 01:15:11.222649451 +0200 -@@ -561,7 +561,7 @@ +--- libgltf.org/src/RenderScene.cpp 2014-06-23 14:55:58.099723870 +0200 ++++ libgltf/src/RenderScene.cpp 2014-06-23 14:56:07.239723477 +0200 +@@ -657,16 +657,15 @@ {
return LIBGLTF_PARSE_JSON_ERROR;
}
- int iStatus = mLoadJson.parseScene(&scene);
+ int iStatus = mLoadJson.parseScene();
- if (iStatus != LIBGLTF_SUCESS)
- {
- return iStatus;
-@@ -571,12 +571,11 @@ + return iStatus;
+ }
int RenderScene::loadScene(Scene& scene, glTFHandle* handle)
{
- scene.setGltfHandle(handle);
try
{
- {
- TRACE_TIME ("loadScene->parseScene", CPU);
-- int iStatus = mLoadJson.parseScene(&scene);
-+ int iStatus = mLoadJson.parseScene();
- if (iStatus != LIBGLTF_SUCESS)
- {
- return iStatus;
-@@ -612,7 +611,11 @@ - }
+- int iStatus = mLoadJson.parseScene(&scene);
++ int iStatus = mLoadJson.parseScene();
+ return iStatus;
+ }
+ catch (boost::property_tree::ptree_error& e)
+@@ -694,7 +693,11 @@ + return 0;
}
string tmpFileName(jsonfile->filename);
- return mLoadJson.getFileNameInJson(tmpFileName);
@@ -77,22 +66,15 @@ diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp }
unsigned int RenderScene::bindAttribute(const Attribute* pAttr)
-@@ -844,11 +847,6 @@ -
- int RenderScene::initRender(glTFHandle* handle)
+@@ -969,11 +972,6 @@ {
+ initOpengl();
+
- pScene = new Scene();
-- if(0 == pScene)
+- if (0 == pScene)
- {
- return LIBGLTF_MEMORY_ERROR;
- }
int iResult = loadScene(*pScene, handle);
- if( iResult != LIBGLTF_SUCESS)
+ if (iResult != LIBGLTF_SUCCESS)
{
-@@ -1543,4 +1541,4 @@ - int RenderScene::isAnimPlay()
- {
- return this->mAnimationPlay ? 1 : 0;
--} -\ No newline at end of file -+}
diff --git a/external/libgltf/patches/move_fps_closer_to_the_corner.patch b/external/libgltf/patches/move_fps_closer_to_the_corner.patch new file mode 100644 index 000000000000..10ef74c096bc --- /dev/null +++ b/external/libgltf/patches/move_fps_closer_to_the_corner.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/src/FPSCounter.cpp libgltf/src/FPSCounter.cpp +--- libgltf.org/src/FPSCounter.cpp 2014-06-24 18:10:46.317967903 +0200 ++++ libgltf/src/FPSCounter.cpp 2014-06-24 18:10:58.629967382 +0200 +@@ -104,7 +104,7 @@ + ++mFrames;
+ }
+
+- pFont->printFormattedString(pViewport->width - 100, 30, 15, "%d", mFPS);
++ pFont->printFormattedString(pViewport->width - 40, 10, 15, "%d", mFPS);
+
+ glEnable(GL_DEPTH_TEST);
+ }
diff --git a/external/libgltf/patches/no_animation_in_orbit_mode.patch b/external/libgltf/patches/no_animation_in_orbit_mode.patch new file mode 100644 index 000000000000..dab0244b9ef2 --- /dev/null +++ b/external/libgltf/patches/no_animation_in_orbit_mode.patch @@ -0,0 +1,43 @@ +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-06-24 16:53:41.030163890 +0200 ++++ libgltf/src/RenderScene.cpp 2014-06-24 16:53:44.406163746 +0200 +@@ -1848,8 +1848,6 @@ +
+ void RenderScene::startAnimation()
+ {
+- if (bAerialView)
+- return;
+ this->mAnimationPlay = true;
+ mCurrentTime = 0;
+ mUpdateTimeOut = 0;
+@@ -1858,8 +1856,6 @@ +
+ void RenderScene::stopAnimation()
+ {
+- if (bAerialView)
+- return;
+ if (pScene->getSkinSize() != 0)
+ {
+ this->mAnimationPlay = false;
+@@ -1874,10 +1870,6 @@ + roCameraY = glm::mat4(1.0);
+ pCamera->AerialViewY = 0.0;
+ bAerialView = false;
+- if (bAnimation)
+- {
+- startAnimation();
+- }
+ if (IsAerialMode)
+ {
+ pScene->setUseCameraInJson(true);
+@@ -1897,10 +1889,6 @@ + roCameraX = glm::mat4(1.0);
+ roCameraY = glm::mat4(1.0);
+ //Stop animation.
+- if (pScene->getSkinSize() != 0)
+- {
+- this->mAnimationPlay = false;
+- }
+ bAerialView = true;
+ if (pScene->getUseCameraInJson())
+ {
diff --git a/external/libgltf/patches/no_effect_of_set_looping.patch b/external/libgltf/patches/no_effect_of_set_looping.patch new file mode 100644 index 000000000000..1bfa4c901456 --- /dev/null +++ b/external/libgltf/patches/no_effect_of_set_looping.patch @@ -0,0 +1,14 @@ +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-06-23 21:16:55.134739637 +0200 ++++ libgltf/src/RenderScene.cpp 2014-06-23 21:16:58.834739477 +0200 +@@ -1976,5 +1976,10 @@ + {
+ bIsTimeAvailable = false;
+ }
++ if( !mAnimationLoop && mCurrentTime > mDuration )
++ {
++ stopAnimation();
++ setAnimTime(0.0);
++ }
+ }
+
diff --git a/external/libgltf/patches/openmp-disable.patch b/external/libgltf/patches/openmp-disable.patch deleted file mode 100644 index ef8bc2ef4a3b..000000000000 --- a/external/libgltf/patches/openmp-disable.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- libgltf/src/RenderScene.h -+++ libgltf/src/RenderScene.h -@@ -16,7 +16,8 @@ - #define TRACE_TIME
- #endif
-
--#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
diff --git a/external/libgltf/patches/rgba_textures.patch b/external/libgltf/patches/rgba_textures.patch deleted file mode 100644 index b22089475038..000000000000 --- a/external/libgltf/patches/rgba_textures.patch +++ /dev/null @@ -1,12 +0,0 @@ -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);
-
diff --git a/external/libgltf/patches/walkthrough_mode_affects_orbit_mode_unexpectedly.patch b/external/libgltf/patches/walkthrough_mode_affects_orbit_mode_unexpectedly.patch new file mode 100644 index 000000000000..ef7217b0e0f7 --- /dev/null +++ b/external/libgltf/patches/walkthrough_mode_affects_orbit_mode_unexpectedly.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/src/Camera.cpp libgltf/src/Camera.cpp +--- libgltf.org/src/Camera.cpp 2014-06-24 17:36:27.870055125 +0200 ++++ libgltf/src/Camera.cpp 2014-06-24 17:36:43.514054463 +0200 +@@ -243,6 +243,8 @@ + if (abs(horizontal) > planar || abs(vertical) > 0.0001)
+ {
+ bRotateCameraModel = true;
++ fRotateCameraXSpeed = 0;
++ fRotateCameraYSpeed = 0;
+ float deltaX = (float)(horizontal * fSensitivity * 0.01f);
+ float deltaY = (float)(-vertical * fSensitivity * 0.01f);
+ AerialViewY += -vertical;
diff --git a/external/libgltf/patches/wrong_animation_state_when_set_time_to_null.patch b/external/libgltf/patches/wrong_animation_state_when_set_time_to_null.patch new file mode 100644 index 000000000000..56548e24f648 --- /dev/null +++ b/external/libgltf/patches/wrong_animation_state_when_set_time_to_null.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/src/libgltf.cpp libgltf/src/libgltf.cpp +--- libgltf.org/src/libgltf.cpp 2014-06-23 20:38:35.470838661 +0200 ++++ libgltf/src/libgltf.cpp 2014-06-23 20:44:37.042823092 +0200 +@@ -235,7 +235,7 @@ + RenderScene* renderScene = (RenderScene*)handle->renderer;
+ if (time <= 0)
+ {
+- renderScene->startAnimation();
++ renderScene->setAnimTime(0.0);
+ }
+ else
+ {
diff --git a/external/libgltf/patches/wrong_duration_caused_by_uninitialized_member.patch b/external/libgltf/patches/wrong_duration_caused_by_uninitialized_member.patch new file mode 100644 index 000000000000..7e5554e6e648 --- /dev/null +++ b/external/libgltf/patches/wrong_duration_caused_by_uninitialized_member.patch @@ -0,0 +1,13 @@ +diff -ur libgltf.org/src/Common.cpp libgltf/src/Common.cpp +--- libgltf.org/src/Common.cpp 2014-06-23 20:16:17.746896264 +0200 ++++ libgltf/src/Common.cpp 2014-06-23 20:17:50.610892265 +0200 +@@ -1037,7 +1037,8 @@ +
+ /* -- Scene -- */
+ Scene::Scene()
+- : pRootNode(0)
++ : mDuration(0.0)
++ , pRootNode(0)
+ , pBuffer(0)
+ , pGltfHandle(0)
+ , bUseCameraInJson(false)
diff --git a/external/libgltf/patches/wrong_media_time_at_first_run_caused_by_uninitilized_member.patch b/external/libgltf/patches/wrong_media_time_at_first_run_caused_by_uninitilized_member.patch new file mode 100644 index 000000000000..aa30dc225256 --- /dev/null +++ b/external/libgltf/patches/wrong_media_time_at_first_run_caused_by_uninitilized_member.patch @@ -0,0 +1,11 @@ +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-06-23 21:17:51.466737211 +0200 ++++ libgltf/src/RenderScene.cpp 2014-06-23 21:23:23.718722904 +0200 +@@ -602,6 +602,7 @@ + , roCameraX(1.0f), roCameraY(1.0f)
+ , initCameraLocalMatrix(1.0f),initCameraGlobalMatrix(1.0f)
+ , bAnimation(true), pTempMatrix(0)
++ , bIsTimeAvailable(false)
+ {
+ mLastModelView = glm::mat4(0.0);
+ #if ENABLE_FPS
diff --git a/external/libgltf/patches/wrong_media_time_caused_by_missing_fmod.patch b/external/libgltf/patches/wrong_media_time_caused_by_missing_fmod.patch new file mode 100644 index 000000000000..07f7f6f84e80 --- /dev/null +++ b/external/libgltf/patches/wrong_media_time_caused_by_missing_fmod.patch @@ -0,0 +1,14 @@ +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-06-23 20:35:06.246847670 +0200 ++++ libgltf/src/RenderScene.cpp 2014-06-23 20:35:24.366846890 +0200 +@@ -1919,7 +1919,9 @@ +
+ double RenderScene::getAnimTime()
+ {
+- return mCurrentTime;
++ errno = 0;
++ double time = fmod(this->mCurrentTime, this->mDuration);
++ return errno == EDOM ? 0.0 : time;
+ }
+
+ void RenderScene::setAnimLoop(int loop)
|