diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-07-14 11:04:51 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-07-14 11:04:51 +0200 |
commit | ae4004548adcdcbaa5979d58f7a3324674ae21cf (patch) | |
tree | c4d4a0395f67cf214fcdb2df5e0dbf9271736a98 /external | |
parent | 409e30a0d526375f66245a81fe3d503b2cd9cc83 (diff) |
Revert "Update libgltf: various fixes, memory usage optimization"
This reverts commit fc40081993d29c422fd19bb80f4d9db06b4dce0d.
Some files are missing from the new tarball, so revert
this until this is fixed.
Diffstat (limited to 'external')
18 files changed, 527 insertions, 0 deletions
diff --git a/external/libgltf/UnpackedTarball_libgltf.mk b/external/libgltf/UnpackedTarball_libgltf.mk index 176c1d15246b..f1e618c23b80 100644 --- a/external/libgltf/UnpackedTarball_libgltf.mk +++ b/external/libgltf/UnpackedTarball_libgltf.mk @@ -16,6 +16,23 @@ $(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/libgltf_configure.patch \ + external/libgltf/patches/remove_config_h_in_dependencies.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 \ + external/libgltf/patches/compiler_error_fixes.patch \ + external/libgltf/patches/fix_package_file.patch \ + external/libgltf/patches/comma_at_end_of_enumerator_list.patch \ + external/libgltf/patches/extra_semicolon.patch \ + external/libgltf/patches/stop_a_potential_memory_leak.patch \ )) # vim: set noet sw=4 ts=4: diff --git a/external/libgltf/patches/comma_at_end_of_enumerator_list.patch b/external/libgltf/patches/comma_at_end_of_enumerator_list.patch new file mode 100644 index 000000000000..7e336f7de841 --- /dev/null +++ b/external/libgltf/patches/comma_at_end_of_enumerator_list.patch @@ -0,0 +1,51 @@ +diff -ur libgltf.org/src/Common.h libgltf/src/Common.h +--- libgltf.org/src/Common.h 2014-06-28 12:17:56.880068394 +0200 ++++ libgltf/src/Common.h 2014-06-28 12:22:32.940078647 +0200 +@@ -86,7 +86,7 @@ + DataType_FLOAT_MAT3 = 0x8B5B,
+ DataType_FLOAT_MAT4 = 0x8B5C,
+ DataType_SAMPLER_2D = 0x8B5E,
+- DataType_SAMPLER_CUBE = 0x8B60,
++ DataType_SAMPLER_CUBE = 0x8B60
+ } DataType_E;
+
+ class Attribute
+@@ -119,7 +119,7 @@ + LightSource_DIRECTIONAL = 0x1,
+ LightSource_POINT = 0x2,
+ LightSource_SPOT = 0x3,
+- LightSource_AMBIET = 0x4,
++ LightSource_AMBIET = 0x4
+ } LightSourceType_E;
+
+ class Light
+@@ -252,7 +252,7 @@ + TextureType_DISPLACEMENT = 0x9,
+ TextureType_LIGHTMAP = 0xA,
+ TextureType_REFLECTION = 0xB,
+- TextureType_UNKNOWN = 0xC,
++ TextureType_UNKNOWN = 0xC
+ } TextureType_E;
+
+ class MaterialProperty
+@@ -449,7 +449,7 @@ + NodeType_Node = 0x1,
+ NodeType_Mesh = 0x2,
+ NodeType_Camera = 0x4,
+- NodeType_Light = 0x8,
++ NodeType_Light = 0x8
+ } NodeType_E;
+
+ class Node
+diff -ur libgltf.org/src/Texture.h libgltf/src/Texture.h +--- libgltf.org/src/Texture.h 2014-06-28 12:17:56.880068394 +0200 ++++ libgltf/src/Texture.h 2014-06-28 12:18:19.740069243 +0200 +@@ -24,7 +24,7 @@ + TEXTURE_FILTER_MIN_BILINEAR,
+ TEXTURE_FILTER_MIN_NEAREST_MIPMAP,
+ TEXTURE_FILTER_MIN_BILINEAR_MIPMAP,
+- TEXTURE_FILTER_MIN_TRILINEAR,
++ TEXTURE_FILTER_MIN_TRILINEAR
+ };
+
+ class Texture
diff --git a/external/libgltf/patches/compiler_error_fixes.patch b/external/libgltf/patches/compiler_error_fixes.patch new file mode 100644 index 000000000000..a2ff1728c72f --- /dev/null +++ b/external/libgltf/patches/compiler_error_fixes.patch @@ -0,0 +1,41 @@ +diff -ur libgltf.org/src/Camera.cpp libgltf/src/Camera.cpp +--- libgltf.org/src/Camera.cpp 2014-06-26 15:49:57.807687346 +0200 ++++ libgltf/src/Camera.cpp 2014-06-26 15:50:46.195685296 +0200 +@@ -161,7 +161,7 @@ + }
+ else
+ {
+- if (abs(x) > 0.0001 || abs(y) > 0.0001 || abs(z) > 0.0001)
++ if (std::abs(x) > 0.0001 || std::abs(y) > 0.0001 || std::abs(z) > 0.0001)
+ {
+ bMoveCmeraModel = true;
+ }
+@@ -240,7 +240,7 @@ + {
+ if (!bAerialView)
+ return;
+- if (abs(horizontal) > planar || abs(vertical) > 0.0001)
++ if (std::abs(horizontal) > planar || std::abs(vertical) > 0.0001)
+ {
+ bRotateCameraModel = true;
+ fRotateCameraXSpeed = 0;
+@@ -275,7 +275,7 @@ + void CPhysicalCamera::RotateCamera(double horizontal, double vertical,
+ double planar)
+ {
+- if (abs(horizontal) > planar || abs(vertical) > 0.0001)
++ if (std::abs(horizontal) > planar || std::abs(vertical) > 0.0001)
+ {
+ bRotateCameraModel = true;
+ }
+diff -ur libgltf.org/src/Font.cpp libgltf/src/Font.cpp +--- libgltf.org/src/Font.cpp 2014-06-26 15:49:57.807687346 +0200 ++++ libgltf/src/Font.cpp 2014-06-26 15:50:57.619684812 +0200 +@@ -8,6 +8,7 @@ + #include "Font.h"
+
+ #include <glm/gtc/matrix_transform.hpp>
++#include <cstdio>
+
+ using namespace std;
+
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/extra_semicolon.patch b/external/libgltf/patches/extra_semicolon.patch new file mode 100644 index 000000000000..42602d6bba96 --- /dev/null +++ b/external/libgltf/patches/extra_semicolon.patch @@ -0,0 +1,18 @@ +diff -ur libgltf.org/src/Common.cpp libgltf/src/Common.cpp +--- libgltf.org/src/Common.cpp 2014-06-28 12:30:58.792097436 +0200 ++++ libgltf/src/Common.cpp 2014-06-28 12:31:13.884097997 +0200 +@@ -550,12 +550,12 @@ + /* -- Primitives -- */
+ Primitives::Primitives()
+ {
+-};
++}
+
+ Primitives::~Primitives()
+ {
+ mAttributeMap.clear();
+-};
++}
+
+ void Primitives::setMaterialIndex(std::string materialIndex)
+ {
diff --git a/external/libgltf/patches/fix_package_file.patch b/external/libgltf/patches/fix_package_file.patch new file mode 100644 index 000000000000..509634d7327a --- /dev/null +++ b/external/libgltf/patches/fix_package_file.patch @@ -0,0 +1,13 @@ +diff -ur libgltf.org/libgltf.pc.in libgltf/libgltf.pc.in +--- libgltf.org/libgltf.pc.in 2014-06-27 18:52:24.323562505 +0200 ++++ libgltf/libgltf.pc.in 2014-06-27 18:52:48.423561484 +0200 +@@ -6,8 +6,7 @@ + Name: libgltf-@GLTF_MAJOR_VERSION@.@GLTF_MINOR_VERSION@ + Description: Library for rendering glTF models. + Version: @VERSION@ +-Requires: glew-1.10.0 glm glu ++Requires: glew + Libs: -L${libdir} -lgltf-@GLTF_MAJOR_VERSION@.@GLTF_MINOR_VERSION@ + Cflags: -I${includedir}/libgltf-@GLTF_MAJOR_VERSION@.@GLTF_MINOR_VERSION@ + +-Requires.private: boost diff --git a/external/libgltf/patches/init_scene_set_handle.patch b/external/libgltf/patches/init_scene_set_handle.patch new file mode 100644 index 000000000000..88ad05325cf3 --- /dev/null +++ b/external/libgltf/patches/init_scene_set_handle.patch @@ -0,0 +1,80 @@ +diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp +--- 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;
+ }
+
+-int Parser::parseScene(Scene* pscene)
++void Parser::setScene(Scene* pscene)
++{
++ pScene = pscene;
++}
++
++int Parser::parseScene()
+ {
+ int status;
+- this->pScene = pscene;
+
+ status = this->readBuffers();
+ if (status < 0)
+diff -ur libgltf.org/src/LoadScene.h libgltf/src/LoadScene.h +--- 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();
+- int parseScene(Scene* pscene);
++ void setScene(Scene* pscene);
++ int parseScene();
+ bool parseJsonFile();
+ void setJsonInfo(const std::string& sbuffer);
+ void setJsonInfo(const std::string& direct, const std::string& fileName);
+diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- 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();
+ return iStatus;
+ }
+
+ int RenderScene::loadScene(Scene& scene, glTFHandle* handle)
+ {
+- scene.setGltfHandle(handle);
+ try
+ {
+- 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);
++ glTFHandle* handle = mLoadJson.getFileNameInJson(tmpFileName);
++ pScene = new Scene();
++ pScene->setGltfHandle(handle);
++ mLoadJson.setScene(pScene);
++ return handle;
+ }
+
+ unsigned int RenderScene::bindAttribute(const Attribute* pAttr)
+@@ -969,11 +972,6 @@ + {
+ initOpengl();
+
+- pScene = new Scene();
+- if (0 == pScene)
+- {
+- return LIBGLTF_MEMORY_ERROR;
+- }
+ int iResult = loadScene(*pScene, handle);
+ if (iResult != LIBGLTF_SUCCESS)
+ {
diff --git a/external/libgltf/patches/libgltf_configure.patch b/external/libgltf/patches/libgltf_configure.patch new file mode 100644 index 000000000000..d224ab9b7a8c --- /dev/null +++ b/external/libgltf/patches/libgltf_configure.patch @@ -0,0 +1,61 @@ +diff -ur libgltf.org/configure libgltf/configure +--- libgltf.org/configure 2014-06-25 18:41:32.470228670 +0200 ++++ libgltf/configure 2014-06-25 18:42:03.922227337 +0200 +@@ -15581,15 +15581,18 @@ + # ========= + # Find boost + # ========= ++save_CPPFLAGS=$CPPFLAGS ++CPPFLAGS="$CPPFLAGS $BOOST_CFLAGS" + + ac_fn_cxx_check_header_mongrel "$LINENO" "boost/property_tree/json_parser.hpp" "ac_cv_header_boost_property_tree_json_parser_hpp" "$ac_includes_default" + if test "x$ac_cv_header_boost_property_tree_json_parser_hpp" = xyes; then : +- BOOST_CFLAGS= ++ + else + as_fn_error $? "boost/property_tree/json_parser.hpp not found. install boost" "$LINENO" 5 + fi + + ++CPPFLAGS=$save_CPPFLAGS + + + # ========= +@@ -15685,14 +15688,17 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + $as_echo "yes" >&6; } + ++ save_CPPFLAGS=$CPPFLAGS ++ CPPFLAGS="$CPPFLAGS $GLEW_CFLAGS" + ac_fn_cxx_check_header_mongrel "$LINENO" "GL/glew.h" "ac_cv_header_GL_glew_h" "$ac_includes_default" + if test "x$ac_cv_header_GL_glew_h" = xyes; then : +- GLEW_CFLAGS= ++ + else + as_fn_error $? "GL/glew.h not found. install glew" "$LINENO" 5 + fi + + ++ CPPFLAGS=$save_CPPFLAGS + + fi + +@@ -15707,14 +15713,17 @@ + ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' + ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + ++save_CPPFLAGS=$CPPFLAGS ++CPPFLAGS="$CPPFLAGS $GLM_CFLAGS" + ac_fn_cxx_check_header_mongrel "$LINENO" "glm/glm.hpp" "ac_cv_header_glm_glm_hpp" "$ac_includes_default" + if test "x$ac_cv_header_glm_glm_hpp" = xyes; then : +- GLM_CFLAGS= ++ + else + as_fn_error $? "glm/glm.hpp not found. install glm" "$LINENO" 5 + fi + + ++CPPFLAGS=$save_CPPFLAGS + ac_ext=cpp + ac_cpp='$CXXCPP $CPPFLAGS' + ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' 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/remove_config_h_in_dependencies.patch b/external/libgltf/patches/remove_config_h_in_dependencies.patch new file mode 100644 index 000000000000..fae09e77d4be --- /dev/null +++ b/external/libgltf/patches/remove_config_h_in_dependencies.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/Makefile.in libgltf/Makefile.in +--- libgltf.org/Makefile.in 2014-06-25 23:16:52.417528674 +0200 ++++ libgltf/Makefile.in 2014-06-25 23:16:56.493528501 +0200 +@@ -419,7 +419,7 @@ + stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +-$(srcdir)/config.h.in: $(am__configure_deps) ++$(srcdir)/config.h.in: + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ diff --git a/external/libgltf/patches/stop_a_potential_memory_leak.patch b/external/libgltf/patches/stop_a_potential_memory_leak.patch new file mode 100644 index 000000000000..1dff583410bc --- /dev/null +++ b/external/libgltf/patches/stop_a_potential_memory_leak.patch @@ -0,0 +1,27 @@ +changeset: 1068:ef62f9d46016 +branch: improvement +parent: 1065:ce62a560f347 +user: LeiQu +date: Tue Jul 01 14:46:15 2014 +0800 +summary: Fix the bug of memory leak + +diff -ur libgltf.org/src/LoadScene.cpp libgltf/src/LoadScene.cpp +--- libgltf.org/src/LoadScene.cpp 2014-07-04 16:35:53.702409179 +0200 ++++ libgltf/src/LoadScene.cpp 2014-07-04 16:35:59.926408911 +0200 +@@ -1052,10 +1052,14 @@ + std::string nodeId;
+ for (; it != itEnd; ++it)
+ {
+- Animation* pAnimation = new Animation();
+ boost::property_tree::ptree pAnimTree = it->second;
+ nodeId = parseChannel(pAnimTree);
+- parsePara(pAnimTree, pAnimation, nodeId);
++ if (nodeId.empty())
++ {
++ continue;
++ }
++ Animation* pAnimation = new Animation();
++ parsePara(pAnimTree, pAnimation, nodeId);
+ this->pScene->insertAnimMap(nodeId, pAnimation);
+ }
+ return true;
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)
|