Upgrade libgltf

Change-Id: Ib7bc9562602d1d8da4082987302834ac2486d78a
This commit is contained in:
Zolnai Tamás 2014-05-06 17:10:59 +02:00
parent 0ece50a4ce
commit b4b10fc873
25 changed files with 198 additions and 208 deletions

View File

@ -3109,11 +3109,9 @@ endif # DESKTOP
ifeq ($(ENABLE_GLTF),TRUE)
# !! We need to avoid setting src as include (changes needed in libgltf)
define gb_LinkTarget__use_libgltf
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,libgltf)/inc \
-I$(call gb_UnpackedTarball_get_dir,libgltf)/src \
$$(INCLUDE) \
)

View File

@ -13,9 +13,6 @@ $(eval $(call gb_Library_set_componentfile,avmediaogl,avmedia/source/opengl/avme
$(eval $(call gb_Library_use_sdk_api,avmediaogl))
# Avoid warnings until libgltf's interface is minimized
$(eval $(call gb_Library_add_cxxflags,avmediaogl,-w))
$(eval $(call gb_Library_use_externals,avmediaogl, \
boost_headers \
libgltf \

View File

@ -37,7 +37,7 @@ uno::Reference< css::graphic::XGraphic > SAL_CALL OGLFrameGrabber::grabFrame( do
throw ( uno::RuntimeException, std::exception )
{
boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[m_pHandle->viewport.width * m_pHandle->viewport.height * 4]);
gltf_renderer_get_bitmap(m_pHandle, fMediaTime, (char*)pBuffer.get(), m_pHandle->viewport.width, m_pHandle->viewport.height, GL_BGRA);
gltf_renderer_get_bitmap(m_pHandle, fMediaTime, (char*)pBuffer.get(), GL_BGRA);
BitmapEx aBitmap = OpenGLHelper::ConvertBGRABufferToBitmapEx(pBuffer.get(), m_pHandle->viewport.width, m_pHandle->viewport.height);
return Graphic( aBitmap ).GetXGraphic();
}

View File

@ -25,7 +25,6 @@ namespace avmedia { namespace ogl {
OGLPlayer::OGLPlayer()
: Player_BASE(m_aMutex)
, m_pHandle(NULL)
, m_bIsPlayingTmp(false)
{
}
@ -102,20 +101,18 @@ void SAL_CALL OGLPlayer::start() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
gltf_animation_start(m_pHandle);
m_bIsPlayingTmp = true;
}
void SAL_CALL OGLPlayer::stop() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
gltf_animation_stop(m_pHandle);
m_bIsPlayingTmp = false;
}
sal_Bool SAL_CALL OGLPlayer::isPlaying() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
return m_bIsPlayingTmp; //(sal_Bool)gltf_animation_is_playing(m_pHandle)
return (sal_Bool)gltf_animation_is_playing(m_pHandle);
}
double SAL_CALL OGLPlayer::getDuration() throw ( uno::RuntimeException, std::exception )
@ -139,7 +136,7 @@ double SAL_CALL OGLPlayer::getMediaTime() throw ( ::com::sun::star::uno::Runtime
double SAL_CALL OGLPlayer::getRate() throw ( uno::RuntimeException, std::exception )
{
osl::MutexGuard aGuard(m_aMutex);
// TODO: Get the speed of stream reading (see com::sun::star::media::XPlayer)
// Seems unused
return 1.0;
}
@ -179,7 +176,7 @@ sal_Bool SAL_CALL OGLPlayer::isMute() throw ( uno::RuntimeException, std::except
awt::Size SAL_CALL OGLPlayer::getPreferredPlayerWindowSize() throw ( uno::RuntimeException, std::exception )
{
return awt::Size( 480, 360 ); // TODO: It will be good for OpenGL too?
return awt::Size( 480, 360 );
}
uno::Reference< media::XPlayerWindow > SAL_CALL OGLPlayer::createPlayerWindow( const uno::Sequence< uno::Any >& rArguments )
@ -215,7 +212,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL OGLPlayer::createFrameGrabber()
m_pHandle->viewport.height = getPreferredPlayerWindowSize().Height;
gltf_renderer_set_content(m_pHandle);
OGLFrameGrabber *pFrameGrabber = new OGLFrameGrabber( m_pHandle );
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );;
return uno::Reference< media::XFrameGrabber >( pFrameGrabber );
}
OUString SAL_CALL OGLPlayer::getImplementationName()

View File

@ -58,7 +58,6 @@ private:
OUString m_sURL;
glTFHandle* m_pHandle;
OpenGLContext m_aContext;
bool m_bIsPlayingTmp; // Temporarly while libgltf does not implement the corresponding methods
};
} // namespace ogl

View File

@ -30,7 +30,9 @@ void SAL_CALL OGLWindow::update() throw (css::uno::RuntimeException, std::except
{
m_pContext->makeCurrent();
gltf_renderer_set_content(m_pHandle);
gltf_prepare_renderer(m_pHandle);
gltf_renderer(m_pHandle);
gltf_complete_renderer();
m_pContext->swapBuffers();
}

View File

@ -88,7 +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 LIBGLTF_TARBALL := 1c366663a8d54d570b8b2f90784814d9-libgltf.tar.bz2
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

View File

@ -18,15 +18,15 @@ $(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/typedef_used_as_struct.patch \
external/libgltf/patches/avoid_c++11_copy_filestream.patch \
external/libgltf/patches/unneeded_context_handling.patch \
external/libgltf/patches/include_typo_texture.patch \
external/libgltf/patches/adress_of_temporary.patch \
external/libgltf/patches/avoid_c++11.patch \
external/libgltf/patches/json_charbuffer_used_as_cstring.patch \
external/libgltf/patches/win_only_variables.patch \
external/libgltf/patches/constify_for_temporaries.patch \
external/libgltf/patches/shader_charbuffer_used_as_cstring.patch \
external/libgltf/patches/format_parameter_for_bitmap.patch \
external/libgltf/patches/get_bitmap_new_syntax.patch \
external/libgltf/patches/remove_extra_include.patch \
external/libgltf/patches/fmod_error_handling.patch \
))
# vim: set noet sw=4 ts=4:

View File

@ -1,13 +0,0 @@
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);

View File

@ -1,12 +0,0 @@
diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
--- libgltf.org/src/Shaders.cpp 2014-04-18 13:47:18.006783834 +0200
+++ libgltf/src/Shaders.cpp 2014-04-18 13:49:20.175779328 +0200
@@ -219,7 +219,7 @@
bool ShaderProgram::readShaderFile(const std::string& fileName, std::string& value)
{
- std::ifstream shaderStream(fileName, std::ios::in);
+ std::ifstream shaderStream(fileName.c_str(), std::ios::in);
if (!shaderStream.is_open())
{
return false;

View File

@ -0,0 +1,12 @@
diff -ur libgltf.org/src/FPSCounter.h libgltf/src/FPSCounter.h
--- libgltf.org/src/FPSCounter.h 2014-05-05 14:36:38.983373597 +0200
+++ libgltf/src/FPSCounter.h 2014-05-05 14:40:20.327383038 +0200
@@ -70,7 +70,7 @@
#endif
#if WRITEFPS2FILE
- FPSFile = ofstream("./FPSCounter.txt");
+ FPSFile.open("./FPSCounter.txt");
#endif
}
~FPSCounter()

View File

@ -0,0 +1,24 @@
diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
--- libgltf.org/src/RenderScene.cpp 2014-05-05 14:45:21.447395883 +0200
+++ libgltf/src/RenderScene.cpp 2014-05-05 14:47:14.819400718 +0200
@@ -776,7 +776,7 @@
return;
}
-void RenderScene::updateBoneMatrix(Bone* pBone, glm::mat4& matrix)
+void RenderScene::updateBoneMatrix(Bone* pBone, const glm::mat4& matrix)
{
if (0 == pBone)
{
diff -ur libgltf.org/src/RenderScene.h libgltf/src/RenderScene.h
--- libgltf.org/src/RenderScene.h 2014-05-05 14:45:21.447395883 +0200
+++ libgltf/src/RenderScene.h 2014-05-05 14:47:48.111402138 +0200
@@ -170,7 +170,7 @@
void renderPrimitive(class RenderPrimitive* pPrimitive);
void updateJointInfo(Bone* pBone);
- void updateBoneMatrix(Bone* pBone, glm::mat4& matrix);
+ void updateBoneMatrix(Bone* pBone, const glm::mat4& matrix);
glm::mat4* calcProjectionMatrix();
glm::vec3* calcLightColor();

View File

@ -1,12 +0,0 @@
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);

View File

@ -0,0 +1,14 @@
diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
--- libgltf.org/src/RenderScene.cpp 2014-05-06 12:01:08.204238237 +0200
+++ libgltf/src/RenderScene.cpp 2014-05-06 12:21:58.720287272 +0200
@@ -979,7 +979,9 @@
double RenderScene::getAnimTime()
{
- return fmod(this->mCurrentTime, this->mDuration);
+ errno = 0;
+ double time = fmod(this->mCurrentTime, this->mDuration);
+ return errno == EDOM ? 0.0 : time;
}
void RenderScene::setAnimLoop(int loop)

View File

@ -1,43 +1,44 @@
diff -ur libgltf.org/inc/libgltf.h libgltf/inc/libgltf.h
--- libgltf.org/inc/libgltf.h 2014-04-27 14:10:06.191988313 +0200
+++ libgltf/inc/libgltf.h 2014-04-27 14:12:03.171983919 +0200
@@ -47,7 +47,7 @@
--- libgltf.org/inc/libgltf.h 2014-05-06 11:56:54.756228299 +0200
+++ libgltf/inc/libgltf.h 2014-05-06 11:57:55.104230666 +0200
@@ -10,6 +10,7 @@
#include <stddef.h>
#include "types.h"
#include "Common.h"
+#include <GL/glew.h>
#include <glm/glm.hpp>
using namespace glTF;
@@ -66,7 +67,7 @@
/** Get a bitmap of the screen in the given point in time. */
extern "C"
void gltf_renderer_get_bitmap(glTFHandle *handle, double time,
- char* buffer, long width, long height);
+ char* buffer, long width, long height, GLenum format);
+ char* buffer, GLenum format);
/** Start playing the glTF animation to the current openGLcontext. */
extern "C"
@@ -80,4 +80,4 @@
/** Query where exactly the animation is, in seconds. */
extern "C"
double gltf_animation_get_time(glTFHandle *handle);
-#endif
\ No newline at end of file
+#endif
diff -ur libgltf.org/src/libgltf.cpp libgltf/src/libgltf.cpp
--- libgltf.org/src/libgltf.cpp 2014-04-27 14:10:06.192988313 +0200
+++ libgltf/src/libgltf.cpp 2014-04-27 14:12:06.648983788 +0200
@@ -70,10 +70,10 @@
--- libgltf.org/src/libgltf.cpp 2014-05-06 11:56:54.756228299 +0200
+++ libgltf/src/libgltf.cpp 2014-05-06 11:57:00.620228529 +0200
@@ -95,10 +95,10 @@
extern "C"
void gltf_renderer_get_bitmap(glTFHandle *handle, double time,
- char* buffer, long width, long height)
+ char* buffer, long width, long height, GLenum format)
+ char* buffer, GLenum format)
{
class RenderScene* renderScene = (RenderScene*)handle->renderer;
RenderScene* renderScene = (RenderScene*)handle->renderer;
- renderScene->renderToBuffer(&(handle->viewport), (unsigned char*)buffer);
+ renderScene->renderToBuffer(&(handle->viewport), (unsigned char*)buffer, format);
return;
}
diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
--- libgltf.org/src/RenderScene.cpp 2014-04-27 14:10:06.192988313 +0200
+++ libgltf/src/RenderScene.cpp 2014-04-27 14:11:03.199986172 +0200
@@ -630,7 +630,7 @@
return pCamera;
--- libgltf.org/src/RenderScene.cpp 2014-05-06 11:56:54.756228299 +0200
+++ libgltf/src/RenderScene.cpp 2014-05-06 11:57:03.852228656 +0200
@@ -859,7 +859,7 @@
return sCamera;
}
-void RenderScene::renderToBuffer(glTFViewport* pViewport, unsigned char * buffer)
@ -45,7 +46,7 @@ diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
{
createRenderObj(pViewport->width, pViewport->height);
createTextureObj(pViewport->width, pViewport->height);
@@ -647,7 +647,7 @@
@@ -876,7 +876,7 @@
GLenum fbResult = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if( fbResult != GL_FRAMEBUFFER_COMPLETE )
result = false;
@ -55,14 +56,14 @@ diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers(1, &mFBOID);
diff -ur libgltf.org/src/RenderScene.h libgltf/src/RenderScene.h
--- libgltf.org/src/RenderScene.h 2014-04-27 14:10:06.192988313 +0200
+++ libgltf/src/RenderScene.h 2014-04-27 14:13:41.291980233 +0200
@@ -91,7 +91,7 @@
void render(void* lpParam);
--- libgltf.org/src/RenderScene.h 2014-05-06 11:56:54.756228299 +0200
+++ libgltf/src/RenderScene.h 2014-05-06 11:57:01.524228565 +0200
@@ -124,7 +124,7 @@
void releaseRender(void* lpParam);
CPhysicalCamera* getCamera();
// For bitmap
- void renderToBuffer(glTFViewport* pViewpoit, unsigned char * buffer);
+ void renderToBuffer(glTFViewport* pViewpoit, unsigned char * buffer, GLenum format);
void renderRotateCamera(double horizontal, double vertical,
double planar, double time);
void renderMoveCamera(double x, double y, double z, double time);
// For animation
void startAnimation();

View File

@ -1,6 +1,6 @@
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
--- 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
@ -10,3 +10,10 @@ diff -ur libgltf.org/src/Font.h libgltf/src/Font.h
#include FT_FREETYPE_H
#include "Texture.h"
@@ -49,4 +49,4 @@
FT_Face mFTFace;
unsigned int mShaderId;
};
-#endif
\ No newline at end of file
+#endif

View File

@ -1,6 +1,6 @@
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
--- 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
@ -10,9 +10,16 @@ diff -ur libgltf.org/src/Camera.h libgltf/src/Camera.h
#include <glm/glm.hpp>
class CPhysicalCamera
@@ -45,4 +45,4 @@
int iForw, iBack, iLeft, iRight;
};
-#endif
\ No newline at end of file
+#endif
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
--- 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
@ -23,8 +30,8 @@ diff -ur libgltf.org/src/Common.h libgltf/src/Common.h
#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
--- 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
@ -35,14 +42,14 @@ diff -ur libgltf.org/src/Shaders.h libgltf/src/Shaders.h
#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 @@
--- 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;
using namespace std;

View File

@ -1,12 +0,0 @@
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()
{

View File

@ -1,12 +0,0 @@
diff -ur libgltf.org/src/RenderScene.cpp libgltf/src/RenderScene.cpp
--- libgltf.org/src/RenderScene.cpp 2014-04-18 13:52:31.148772285 +0200
+++ libgltf/src/RenderScene.cpp 2014-04-18 15:08:15.001604707 +0200
@@ -211,7 +211,7 @@
{
if(0 == jsonfile)
return 0;
- string tmpStr(jsonfile->buffer);
+ string tmpStr(jsonfile->buffer,jsonfile->size);
loadJson.setJsonInfo(tmpStr);
if (!loadJson.parseJsonFile())
return 0;

View File

@ -1,11 +0,0 @@
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
{

View File

@ -0,0 +1,11 @@
diff -ur libgltf.org/inc/libgltf.h libgltf/inc/libgltf.h
--- libgltf.org/inc/libgltf.h 2014-05-06 11:59:40.224234787 +0200
+++ libgltf/inc/libgltf.h 2014-05-06 12:00:15.192236159 +0200
@@ -9,7 +9,6 @@
#define LIBGLTF_H
#include <stddef.h>
#include "types.h"
-#include "Common.h"
#include <GL/glew.h>
#include <glm/glm.hpp>
using namespace glTF;

View File

@ -1,7 +1,7 @@
diff -ur libgltf.org/src/Common.cpp libgltf/src/Common.cpp
--- libgltf.org/src/Common.cpp 2014-04-20 10:46:20.065036606 +0200
+++ libgltf/src/Common.cpp 2014-04-20 12:12:26.940821223 +0200
@@ -521,8 +521,10 @@
--- libgltf.org/src/Common.cpp 2014-05-05 15:02:17.155439207 +0200
+++ libgltf/src/Common.cpp 2014-05-05 15:04:25.631444687 +0200
@@ -518,8 +518,10 @@
if(vShaderIdx >= 0 && fShaderIdx >= 0)
{
const char* pvShader = pGltfHandle->files[vShaderIdx]->buffer;
@ -14,10 +14,10 @@ diff -ur libgltf.org/src/Common.cpp libgltf/src/Common.cpp
if (0 != mProgramId)
{
diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
--- libgltf.org/src/Shaders.cpp 2014-04-20 10:46:20.065036606 +0200
+++ libgltf/src/Shaders.cpp 2014-04-20 12:15:42.683813064 +0200
@@ -110,12 +110,12 @@
return programId;
--- libgltf.org/src/Shaders.cpp 2014-05-05 15:02:17.155439207 +0200
+++ libgltf/src/Shaders.cpp 2014-05-05 15:09:30.143457676 +0200
@@ -105,12 +105,12 @@
return programId;
}
-unsigned int ShaderProgram::createProgram(const char* pvShader, const char* pfShader)
@ -32,17 +32,17 @@ diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
return 0;
return programId;
@@ -142,7 +142,7 @@
return false;
}
@@ -137,7 +137,7 @@
return false;
}
- if (!compileShader(shaderCode.c_str(), shaderId))
+ if (!compileShader(shaderCode.c_str(), shader.length(), shaderId))
{
std::cout << "compileShader : compileShader failed." << std::endl;
return false;
@@ -158,11 +158,11 @@
return true;
- if (!compileShader(shaderCode.c_str(), shaderId))
+ if (!compileShader(shaderCode.c_str(), shader.length(), shaderId))
{
std::cout << "compileShader : compileShader failed." << std::endl;
return false;
@@ -153,11 +153,11 @@
return true;
}
-bool ShaderProgram::loadShader(unsigned int programId, const char* pShader, int type)
@ -55,22 +55,22 @@ diff -ur libgltf.org/src/Shaders.cpp libgltf/src/Shaders.cpp
{
std::cout << "compileShader : compileShader failed." << std::endl;
return false;
@@ -178,9 +178,10 @@
@@ -173,9 +173,10 @@
return true;
}
-bool ShaderProgram::compileShader(const char* pShader, unsigned int shaderId)
+bool ShaderProgram::compileShader(const char* pShader, size_t iSize, unsigned int shaderId)
{
- glShaderSource(shaderId, 1, &pShader, NULL);
+ GLint iGLSize = iSize;
+ glShaderSource(shaderId, 1, &pShader, &iGLSize);
glCompileShader(shaderId);
int iStatus = 0;
glGetShaderiv(shaderId, GL_COMPILE_STATUS, &iStatus);
- glShaderSource(shaderId, 1, &pShader, NULL);
+ GLint iGLSize = iSize;
+ glShaderSource(shaderId, 1, &pShader, &iGLSize);
glCompileShader(shaderId);
int iStatus = 0;
glGetShaderiv(shaderId, GL_COMPILE_STATUS, &iStatus);
diff -ur libgltf.org/src/Shaders.h libgltf/src/Shaders.h
--- libgltf.org/src/Shaders.h 2014-04-20 10:46:20.065036606 +0200
+++ libgltf/src/Shaders.h 2014-04-20 12:11:36.816823313 +0200
--- libgltf.org/src/Shaders.h 2014-05-05 15:02:17.155439207 +0200
+++ libgltf/src/Shaders.h 2014-05-05 15:10:26.003460059 +0200
@@ -39,17 +39,17 @@
void setUniform(unsigned int uProgId, const char* name, const glm::mat4 mMatrix);
@ -84,7 +84,7 @@ diff -ur libgltf.org/src/Shaders.h libgltf/src/Shaders.h
bool loadShader(unsigned int programId, const std::string& shaderName, int type);
- bool loadShader(unsigned int programId, const char* pShader, int type);
+ bool loadShader(unsigned int programId, const char* pShader, size_t iSize, int type);
+ bool loadShader(unsigned int programId, const char* pShader, size_t iSize, int type);;
private:
- bool compileShader(const char* pShader, unsigned int shaderId);

View File

@ -0,0 +1,14 @@
diff -ur libgltf.org/src/Common.h libgltf/src/Common.h
--- libgltf.org/src/Common.h 2014-05-05 14:31:00.483359159 +0200
+++ libgltf/src/Common.h 2014-05-05 14:34:02.055366903 +0200
@@ -536,8 +536,8 @@
unsigned int mCount;
double mMaxTime;
double mMinTime;
- std::vector<struct QuatKey> mTimeRorateVec;
- //std::vector<struct QuatKey> mTimeTransfromVec;
+ std::vector<QuatKey> mTimeRorateVec;
+ //std::vector<QuatKey> mTimeTransfromVec;
};
class Animation

View File

@ -1,12 +1,18 @@
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());
--- libgltf.org/src/RenderScene.cpp 2014-05-05 14:42:40.523389018 +0200
+++ libgltf/src/RenderScene.cpp 2014-05-05 14:43:01.027389893 +0200
@@ -746,7 +746,6 @@
#if ENABLE_FPS
pFPSCounter->printFPS(&viewport);
#endif
- SwapBuffers(wglGetCurrentDC());
return;
}
void RenderScene::releaseRender(void* lpParam)
@@ -1004,4 +1003,4 @@
int RenderScene::isAnimPlay()
{
return this->mAnimationPlay ? 1 : 0;
-}
\ No newline at end of file
+}

View File

@ -1,40 +1,13 @@
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;
--- libgltf.org/src/FPSCounter.cpp 2014-05-05 14:44:01.711392481 +0200
+++ libgltf/src/FPSCounter.cpp 2014-05-05 14:44:34.495393880 +0200
@@ -119,7 +119,9 @@
if (timeCounter>=TIMETHRESHOLD)
{
FPSFile<<"FPS:"<<mFPS<<"\n";
+#ifdef _WIN32
mTotalTime = getExecutionTime();
mGPUTime = mGPUDuration/dqFreq;
FPSFile<<"Render Total Time: "<<mTotalTime*1000<<" ms"<<"Draw Time: "<<mGPUTime*1000<<" ms\n";
+#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()
{
timeCounter = 0;
}
#endif