Kaydet (Commit) 62fd6305 authored tarafından Zolnai Tamás's avatar Zolnai Tamás

Integrate libgltf for rendering gltf models

Change-Id: I7c30dbcf276052c01bb15f3b8c77a2406260aa7b
üst fb46a354
......@@ -146,6 +146,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_host.mk $(SRCDIR)/download.lst $(SRCDIR)
$(call fetch_Optional,LANGUAGETOOL,$(LANGUAGETOOL_TARBALL)) \
$(call fetch_Optional,LCMS2,$(LCMS2_TARBALL)) \
$(call fetch_Optional,LIBEXTTEXTCAT,$(LIBEXTTEXTCAT_TARBALL)) \
$(call fetch_Optional,LIBGLTF,$(LIBGLTF_TARBALL)) \
$(call fetch_Optional,LIBLANGTAG,$(LIBLANGTAG_TARBALL)) \
$(call fetch_Optional,LIBXML2,$(LIBXML_TARBALL)) \
$(LIBXMLSEC_TARBALL) \
......
......@@ -21,7 +21,7 @@
# depending on the configure options these may be taken from the system,
# or the internal/bundled copy may be built.
# for every external, a function gb_LinkTarget_use__FOO is defined,
# for every external, a function gb_LinkTarget__use_FOO is defined,
# once for the system case, once for the internal case.
# in the system case, no libraries should be registered, but the target-local
......@@ -3087,6 +3087,22 @@ endif # SYSTEM_NSS
endif # DESKTOP
ifeq ($(ENABLE_GLTF),TRUE)
define gb_LinkTarget__use_libgltf
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,libgltf)/inc \
$$(INCLUDE) \
)
$(call gb_LinkTarget_use_static_libraries,$(1),\
libgltf \
)
endef
endif
### Jars ############################################################
ifneq ($(SYSTEM_HSQLDB),)
......
......@@ -10368,6 +10368,7 @@ AC_MSG_CHECKING([whether to enable glTF support])
if test "$enable_opengl" = "yes"; then
ENABLE_GLTF=TRUE
AC_MSG_RESULT([yes])
BUILD_TYPE="$BUILD_TYPE LIBGLTF"
if test "$test_freetype" = "no"; then
BUILD_TYPE="$BUILD_TYPE FREETYPE"
fi
......
......@@ -88,6 +88,7 @@ export JPEG_TARBALL := 52654eb3b2e60c35731ea8fc87f1bd29-jpegsrc.v8d.tar.gz
export LANGUAGETOOL_TARBALL := b63e6340a02ff1cacfeadb2c42286161-JLanguageTool-1.7.0.tar.bz2
export LCMS2_TARBALL := 861ef15fa0bc018f9ddc932c4ad8b6dd-lcms2-2.4.tar.gz
export LIBEXTTEXTCAT_TARBALL := ae330b9493bd4503ac390106ff6060d7-libexttextcat-3.4.3.tar.bz2
export LIBGLTF_TARBALL := 8ac8ae9829c4fefd1ae9f715f95d4e0b-libgltf.tar.gz
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
......
......@@ -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) \
......
# -*- 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:
# -*- 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:
# -*- 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:
# -*- 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 -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 -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 -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 -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 -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 -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 -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 -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()
{
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment