Merge branch 'plugins_pt3' into plugins

This commit is contained in:
Brad Davis 2015-05-29 13:01:05 -07:00
commit 8686ffb781
8 changed files with 56 additions and 29 deletions

View file

@ -12,4 +12,9 @@ find_package(Bullet REQUIRED)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
add_dependency_external_projects(polyvox)
find_package(PolyVox REQUIRED)
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES})
link_hifi_libraries(shared gpu script-engine render-utils)

View file

@ -7,14 +7,10 @@ add_dependency_external_projects(glm)
find_package(GLM REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
add_dependency_external_projects(bullet polyvox)
add_dependency_external_projects(bullet)
find_package(Bullet REQUIRED)
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
find_package(PolyVox REQUIRED)
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC ${POLYVOX_INCLUDE_DIRS})
target_link_libraries(${TARGET_NAME} ${POLYVOX_LIBRARIES})
link_hifi_libraries(avatars shared octree gpu model fbx networking animation environment)

View file

@ -52,8 +52,8 @@ public:
void getFocalLength(float focalLength) { _focalLength = focalLength; }
// getters for lens attributes
const glm::mat4& getProjection() const { return _projection; };
const glm::mat4& getView() const { return _view; };
const glm::mat4& getProjection() const { return _projection; }
const glm::mat4& getView() const { return _view; }
float getWidth() const { return _width; }
float getHeight() const { return _height; }
float getFieldOfView() const { return _fieldOfView; }

View file

@ -10,24 +10,12 @@
#include <QOpenGLContext>
#include <QOpenGLDebugLogger>
#include <GLHelpers.h>
static QSurfaceFormat getDefaultFormat() {
QSurfaceFormat format;
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
format.setDepthBufferSize(16);
format.setStencilBufferSize(8);
format.setVersion(4, 1);
#ifdef DEBUG
format.setOption(QSurfaceFormat::DebugContext);
#endif
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile);
return format;
GlWindow::GlWindow(QOpenGLContext* shareContext) : GlWindow(getDefaultOpenGlSurfaceFormat(), shareContext) {
}
GlWindow::GlWindow(QOpenGLContext * shareContext) : GlWindow(getDefaultFormat(), shareContext) {
}
GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext * shareContext) {
GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext) {
setSurfaceType(QSurface::OpenGLSurface);
setFormat(format);
_context = new QOpenGLContext;

View file

@ -11,24 +11,23 @@
#define hifi_GlWindow_h
#include <QWindow>
#include <QSurfaceFormat>
class QOpenGLContext;
class QOpenGLDebugLogger;
class GlWindow : public QWindow {
public:
GlWindow(QOpenGLContext * shareContext = nullptr);
GlWindow(const QSurfaceFormat& format, QOpenGLContext * shareContext = nullptr);
GlWindow(QOpenGLContext* shareContext = nullptr);
GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext = nullptr);
virtual ~GlWindow();
void makeCurrent();
void doneCurrent();
void swapBuffers();
private:
QOpenGLContext * _context{ nullptr };
QOpenGLContext* _context{ nullptr };
#ifdef DEBUG
QOpenGLDebugLogger * _logger{ nullptr };
QOpenGLDebugLogger* _logger{ nullptr };
#endif
};
#endif
#endif

View file

@ -31,7 +31,7 @@ protected:
QOpenGLContext _context;
QOffscreenSurface _offscreenSurface;
#ifdef DEBUG
QOpenGLDebugLogger * _logger{ nullptr };
QOpenGLDebugLogger* _logger{ nullptr };
#endif
};

View file

@ -0,0 +1,16 @@
#include "GLHelpers.h"
QSurfaceFormat getDefaultOpenGlSurfaceFormat() {
QSurfaceFormat format;
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
format.setVersion(4, 1);
#ifdef DEBUG
format.setOption(QSurfaceFormat::DebugContext);
#endif
// FIXME move to core as soon as possible
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile);
return format;
}

View file

@ -0,0 +1,23 @@
//
// Created by Bradley Austin Davis 2015/05/29
// Copyright 2014 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#pragma once
#ifndef hifi_GLHelpers_h
#define hifi_GLHelpers_h
#include <QSurfaceFormat>
// 16 bits of depth precision
#define DEFAULT_GL_DEPTH_BUFFER_BITS 16
// 8 bits of stencil buffer (typically you really only need 1 bit for functionality
// but GL implementations usually just come with buffer sizes in multiples of 8)
#define DEFAULT_GL_STENCIL_BUFFER_BITS 8
QSurfaceFormat getDefaultOpenGlSurfaceFormat();
#endif