diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-04-18 12:55:56 +0200 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-04-18 12:56:11 +0200 |
commit | 62fd63050c355b06b449e58134fa482866102134 (patch) | |
tree | f396d105521afe7271985aa36d025534baa7bf8e /external | |
parent | fb46a354250fca80fbbfac20128551fd1c530747 (diff) |
Integrate libgltf for rendering gltf models
Change-Id: I7c30dbcf276052c01bb15f3b8c77a2406260aa7b
Diffstat (limited to 'external')
-rw-r--r-- | external/Module_external.mk | 1 | ||||
-rw-r--r-- | external/libgltf/Makefile | 14 | ||||
-rw-r--r-- | external/libgltf/Module_libgltf.mk | 17 | ||||
-rw-r--r-- | external/libgltf/README | 1 | ||||
-rw-r--r-- | external/libgltf/StaticLibrary_libgltf.mk | 47 | ||||
-rw-r--r-- | external/libgltf/UnpackedTarball_libgltf.mk | 28 | ||||
-rw-r--r-- | external/libgltf/patches/adress_of_temporary.patch | 13 | ||||
-rw-r--r-- | external/libgltf/patches/extra_qualification.patch | 12 | ||||
-rw-r--r-- | external/libgltf/patches/include_path_freetype.patch | 12 | ||||
-rw-r--r-- | external/libgltf/patches/include_path_glew.patch | 48 | ||||
-rw-r--r-- | external/libgltf/patches/include_typo_texture.patch | 12 | ||||
-rw-r--r-- | external/libgltf/patches/missing_include_cstring.patch | 11 | ||||
-rw-r--r-- | external/libgltf/patches/unneeded_context_handling.patch | 12 | ||||
-rw-r--r-- | external/libgltf/patches/win_only_variables.patch | 40 |
14 files changed, 268 insertions, 0 deletions
diff --git a/external/Module_external.mk b/external/Module_external.mk index e9e90c47acfe..02f659570230 100644 --- a/external/Module_external.mk +++ b/external/Module_external.mk @@ -57,6 +57,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\ $(call gb_Helper_optional,LIBATOMIC_OPS,libatomic_ops) \ $(call gb_Helper_optional,LIBEOT,libeot) \ $(call gb_Helper_optional,LIBEXTTEXTCAT,libexttextcat) \ + $(call gb_Helper_optional,LIBGLTF,libgltf) \ $(call gb_Helper_optional,LIBLANGTAG,liblangtag) \ $(call gb_Helper_optional,LIBPNG,libpng) \ $(call gb_Helper_optional,LIBXML2,libxml2) \ diff --git a/external/libgltf/Makefile b/external/libgltf/Makefile new file mode 100644 index 000000000000..569ad8a0ba7a --- /dev/null +++ b/external/libgltf/Makefile @@ -0,0 +1,14 @@ +# -*- 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/. +# + +module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) + +include $(module_directory)/../../solenv/gbuild/partial_build.mk + +# vim: set noet sw=4 ts=4: diff --git a/external/libgltf/Module_libgltf.mk b/external/libgltf/Module_libgltf.mk new file mode 100644 index 000000000000..b593f89398ea --- /dev/null +++ b/external/libgltf/Module_libgltf.mk @@ -0,0 +1,17 @@ +# -*- 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_Module_Module,libgltf)) + +$(eval $(call gb_Module_add_targets,libgltf,\ + StaticLibrary_libgltf \ + UnpackedTarball_libgltf \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libgltf/README b/external/libgltf/README new file mode 100644 index 000000000000..41fbde692e70 --- /dev/null +++ b/external/libgltf/README @@ -0,0 +1 @@ +Render glTF 3D models. diff --git a/external/libgltf/StaticLibrary_libgltf.mk b/external/libgltf/StaticLibrary_libgltf.mk new file mode 100644 index 000000000000..4628ebb9760a --- /dev/null +++ b/external/libgltf/StaticLibrary_libgltf.mk @@ -0,0 +1,47 @@ +# -*- 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 \ + freetype \ +)) + +$(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/Font \ + UnpackedTarball/libgltf/src/FPSCounter \ + 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 new file mode 100644 index 000000000000..44496d190be9 --- /dev/null +++ b/external/libgltf/UnpackedTarball_libgltf.mk @@ -0,0 +1,28 @@ +# -*- 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_UnpackedTarball_UnpackedTarball,libgltf)) + +$(eval $(call gb_UnpackedTarball_set_tarball,libgltf,$(LIBGLTF_TARBALL))) + +$(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/missing_include_cstring.patch \ + external/libgltf/patches/win_only_variables.patch \ + external/libgltf/patches/unneeded_context_handling.patch \ + external/libgltf/patches/include_typo_texture.patch \ + external/libgltf/patches/adress_of_temporary.patch \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/external/libgltf/patches/adress_of_temporary.patch b/external/libgltf/patches/adress_of_temporary.patch new file mode 100644 index 000000000000..d5ea4bc1ef6f --- /dev/null +++ b/external/libgltf/patches/adress_of_temporary.patch @@ -0,0 +1,13 @@ +diff -ur libgltf.org/src/FPSCounter.cpp libgltf/src/FPSCounter.cpp +--- libgltf.org/src/FPSCounter.cpp 2014-04-18 12:21:54.655972783 +0200 ++++ libgltf/src/FPSCounter.cpp 2014-04-18 12:22:25.280971654 +0200 +@@ -107,7 +107,8 @@ + glUseProgram(uiFPSProgram);
+ glDisable(GL_DEPTH_TEST);
+ GLuint iLoc = glGetUniformLocation(uiFPSProgram, "matrices.projMatrix");
+- glUniformMatrix4fv(iLoc, 1,false, (GLfloat*)(&glm::ortho(0.0f, float(pViewport->width), 0.0f, float(pViewport->height))));
++ const glm::mat4 aMat = glm::ortho(0.0f, float(pViewport->width), 0.0f, float(pViewport->height));
++ glUniformMatrix4fv(iLoc, 1,false, glm::value_ptr(aMat));
+ glm::vec4 lightVector = glm::vec4(1.0f, 1.0f, 1.0f, 1.0f);
+ iLoc = glGetUniformLocation(uiFPSProgram, "vColor");
+ glUniform4fv(iLoc, 1, (GLfloat*)&lightVector);
diff --git a/external/libgltf/patches/extra_qualification.patch b/external/libgltf/patches/extra_qualification.patch new file mode 100644 index 000000000000..213d8f08c1fd --- /dev/null +++ b/external/libgltf/patches/extra_qualification.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/Common.h libgltf/Common.h +--- libgltf.org/Common.h 2014-04-17 14:24:31.978887883 +0200 ++++ libgltf/Common.h 2014-04-17 14:24:57.505886942 +0200 +@@ -551,7 +551,7 @@ + std::map<std::string, class Technique*>& getTechniqueMap();
+
+ const std::string getCameraIndex() const;
+- const float* Scene::getCameraMatrix() const;
++ const float* getCameraMatrix() const;
+
+ char* getBuffer(unsigned int length);
+ bool setBuffer(const std::string& binName, unsigned int length);
diff --git a/external/libgltf/patches/include_path_freetype.patch b/external/libgltf/patches/include_path_freetype.patch new file mode 100644 index 000000000000..a365195ba6ed --- /dev/null +++ b/external/libgltf/patches/include_path_freetype.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/src/Font.h libgltf/src/Font.h +--- libgltf.org/src/Font.h 2014-04-18 12:07:57.573003655 +0200 ++++ libgltf/src/Font.h 2014-04-18 12:08:22.202002747 +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 new file mode 100644 index 000000000000..0d516da29258 --- /dev/null +++ b/external/libgltf/patches/include_path_glew.patch @@ -0,0 +1,48 @@ +diff -ur libgltf.org/src/Camera.h libgltf/src/Camera.h +--- libgltf.org/src/Camera.h 2014-04-18 12:05:38.343008790 +0200 ++++ libgltf/src/Camera.h 2014-04-18 12:05:50.331008348 +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-04-18 12:05:38.343008790 +0200 ++++ libgltf/src/Common.h 2014-04-18 12:05:52.245008277 +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-04-18 12:05:38.343008790 +0200 ++++ libgltf/src/Shaders.h 2014-04-18 12:06:02.907007884 +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-04-18 12:05:38.343008790 +0200 ++++ libgltf/src/Texture.h 2014-04-18 12:06:06.390007755 +0200 +@@ -10,7 +10,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/include_typo_texture.patch b/external/libgltf/patches/include_typo_texture.patch new file mode 100644 index 000000000000..9ddd269a0490 --- /dev/null +++ b/external/libgltf/patches/include_typo_texture.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/src/Texture.cpp libgltf/src/Texture.cpp +--- libgltf.org/src/Texture.cpp 2014-04-18 12:19:41.806977683 +0200 ++++ libgltf/src/Texture.cpp 2014-04-18 12:20:08.065976714 +0200 +@@ -5,7 +5,7 @@ + * 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/.
+ */
+-#include "texture.h"
++#include "Texture.h"
+
+ Texture::Texture()
+ {
diff --git a/external/libgltf/patches/missing_include_cstring.patch b/external/libgltf/patches/missing_include_cstring.patch new file mode 100644 index 000000000000..8b73389efe1b --- /dev/null +++ b/external/libgltf/patches/missing_include_cstring.patch @@ -0,0 +1,11 @@ +diff -ur libgltf.org/src/Common.cpp libgltf/src/Common.cpp +--- libgltf.org/src/Common.cpp 2014-04-18 12:09:30.459000229 +0200 ++++ libgltf/src/Common.cpp 2014-04-18 12:09:51.643999448 +0200 +@@ -6,6 +6,7 @@ + * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+ #include "Common.h"
++#include <cstring>
+
+ namespace glTF
+ {
diff --git a/external/libgltf/patches/unneeded_context_handling.patch b/external/libgltf/patches/unneeded_context_handling.patch new file mode 100644 index 000000000000..a5c14b5c7e3c --- /dev/null +++ b/external/libgltf/patches/unneeded_context_handling.patch @@ -0,0 +1,12 @@ +diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp +--- libgltf.org/src/RenderScene.cpp 2014-04-18 12:13:26.226991534 +0200 ++++ libgltf/src/RenderScene.cpp 2014-04-18 12:13:46.133990800 +0200 +@@ -587,8 +587,6 @@ + }
+ pFPSCounter->timeStampEnd();
+ pFPSCounter->printFPS(pViewport);
+-
+- SwapBuffers(wglGetCurrentDC());
+ }
+
+ void RenderScene::releaseRender(void* lpParam)
diff --git a/external/libgltf/patches/win_only_variables.patch b/external/libgltf/patches/win_only_variables.patch new file mode 100644 index 000000000000..bf2931d3c7e9 --- /dev/null +++ b/external/libgltf/patches/win_only_variables.patch @@ -0,0 +1,40 @@ +diff -ur libgltf.org/src/FPSCounter.cpp libgltf/src/FPSCounter.cpp +--- libgltf.org/src/FPSCounter.cpp 2014-04-18 12:10:37.031997774 +0200 ++++ libgltf/src/FPSCounter.cpp 2014-04-18 12:12:00.025994713 +0200 +@@ -115,8 +115,10 @@ + {
+ mFPS = getFPS();
+ mDurationTime = 0;
++#ifdef _WIN32
+ mTotalTime = getExecutionTime();
+ mGPUTime = mGPUDuration/dqFreq;
++#endif
+ }
+ else
+ {
+@@ -128,6 +130,8 @@ + }
+
+ pFont->printFormattedString(20, pViewport->height-30, 20, "FPS: %d", mFPS);
++#ifdef _WIN32
+ pFont->printFormattedString(20, pViewport->height-60, 20, "Render Total Time: %.2f ms, Draw Time: %.2f ms", mTotalTime*1000,mGPUTime*1000);
++#endif
+ glEnable(GL_DEPTH_TEST);
+-} +\ No newline at end of file ++}
+diff -ur libgltf.org/src/FPSCounter.h libgltf/src/FPSCounter.h +--- libgltf.org/src/FPSCounter.h 2014-04-18 12:10:37.038997774 +0200 ++++ libgltf/src/FPSCounter.h 2014-04-18 12:11:32.301995736 +0200 +@@ -51,9 +51,11 @@ + mFPS=0;
+ mDurationTime =0;
+ mGPUTime =0;
++#ifdef _WIN32
+ mTotalTime = 0;
+ QueryPerformanceFrequency(&f);
+ dqFreq=(double)f.QuadPart;
++#endif
+ }
+ ~FPSCounter()
+ {
|