Fix ubuntu build

master
huxingyi 2018-05-10 23:18:22 +08:00
parent 8a6a2a6640
commit db0f0b3ed2
6 changed files with 21 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#include <QOpenGLFramebufferObjectFormat>
#include <QThread>
#include <QDebug>
#include <QtGlobal>
#define LIGHTMAPPER_IMPLEMENTATION
#include "qtlightmapper.h"
#include "ambientocclusionbaker.h"
@ -15,8 +16,9 @@ AmbientOcclusionBaker::AmbientOcclusionBaker(QScreen *targetScreen) :
m_bakeHeight(256),
m_ambientOcclusionImage(nullptr)
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
m_useCore = QSurfaceFormat::defaultFormat().profile() == QSurfaceFormat::CoreProfile;
#endif
create();
m_context = new QOpenGLContext();
@ -62,6 +64,7 @@ void AmbientOcclusionBaker::setRenderThread(QThread *thread)
void AmbientOcclusionBaker::bake()
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
if (m_meshResultContext.parts().empty())
return;
@ -213,4 +216,5 @@ void AmbientOcclusionBaker::bake()
free(sceneNormals);
m_context->doneCurrent();
#endif
}

View File

@ -10,7 +10,11 @@
#include "meshresultcontext.h"
#include "meshloader.h"
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
class AmbientOcclusionBaker : QOffscreenSurface, public QtLightMapper
#else
class AmbientOcclusionBaker : QOffscreenSurface
#endif
{
public:
AmbientOcclusionBaker(QScreen *targetScreen = Q_NULLPTR);

View File

@ -6,7 +6,7 @@
#include <QDir>
#include "gltffile.h"
#include "version.h"
#include "util.h"
#include "dust3dutil.h"
// Play with glTF online:
// https://gltf-viewer.donmccurdy.com/

View File

@ -15,6 +15,8 @@
* you are granted a perpetual, irrevocable license to copy *
* and modify this file however you want. *
***********************************************************/
#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
#ifndef QT_LIGHTMAPPER_H
#define QT_LIGHTMAPPER_H
@ -166,10 +168,10 @@ GLuint loadShader(GLenum type, const char *source);
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include <assert.h>
#include <limits.h>
#include <cmath>
#define LM_SWAP(type, a, b) { type tmp = (a); (a) = (b); (b) = tmp; }
@ -180,7 +182,7 @@ GLuint loadShader(GLenum type, const char *source);
#if defined(_MSC_VER) && (_MSC_VER <= 1700)
static inline lm_bool lm_finite(float a) { return _finite(a); }
#else
static inline lm_bool lm_finite(float a) { return isfinite(a); }
static inline lm_bool lm_finite(float a) { return std::isfinite(a); }
#endif
static inline int lm_mini (int a, int b) { return a < b ? a : b; }
@ -2087,3 +2089,5 @@ void QtLightMapper::destroyScene(scene_t *scene)
}
#endif // LIGHTMAPPER_IMPLEMENTATION
#endif

View File

@ -5,6 +5,10 @@
#include "Utils.h"
#include <stdlib.h>
#if defined(__APPLE__)
#else
#include <malloc.h>
#endif
#define USE_EFENCE 0

View File

@ -99,7 +99,7 @@ namespace nv
} // nv namespace
#include "box.inl"
#include "Box.inl"
#endif // NV_MATH_BOX_H