mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 15:09:24 +02:00
Merge branch 'plugins_pt3' into plugins
This commit is contained in:
commit
8686ffb781
8 changed files with 56 additions and 29 deletions
|
@ -12,4 +12,9 @@ find_package(Bullet REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
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)
|
link_hifi_libraries(shared gpu script-engine render-utils)
|
||||||
|
|
|
@ -7,14 +7,10 @@ add_dependency_external_projects(glm)
|
||||||
find_package(GLM REQUIRED)
|
find_package(GLM REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} PUBLIC ${GLM_INCLUDE_DIRS})
|
||||||
|
|
||||||
add_dependency_external_projects(bullet polyvox)
|
add_dependency_external_projects(bullet)
|
||||||
|
|
||||||
find_package(Bullet REQUIRED)
|
find_package(Bullet REQUIRED)
|
||||||
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
target_include_directories(${TARGET_NAME} SYSTEM PRIVATE ${BULLET_INCLUDE_DIRS})
|
||||||
target_link_libraries(${TARGET_NAME} ${BULLET_LIBRARIES})
|
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)
|
link_hifi_libraries(avatars shared octree gpu model fbx networking animation environment)
|
||||||
|
|
|
@ -52,8 +52,8 @@ public:
|
||||||
void getFocalLength(float focalLength) { _focalLength = focalLength; }
|
void getFocalLength(float focalLength) { _focalLength = focalLength; }
|
||||||
|
|
||||||
// getters for lens attributes
|
// getters for lens attributes
|
||||||
const glm::mat4& getProjection() const { return _projection; };
|
const glm::mat4& getProjection() const { return _projection; }
|
||||||
const glm::mat4& getView() const { return _view; };
|
const glm::mat4& getView() const { return _view; }
|
||||||
float getWidth() const { return _width; }
|
float getWidth() const { return _width; }
|
||||||
float getHeight() const { return _height; }
|
float getHeight() const { return _height; }
|
||||||
float getFieldOfView() const { return _fieldOfView; }
|
float getFieldOfView() const { return _fieldOfView; }
|
||||||
|
|
|
@ -10,24 +10,12 @@
|
||||||
|
|
||||||
#include <QOpenGLContext>
|
#include <QOpenGLContext>
|
||||||
#include <QOpenGLDebugLogger>
|
#include <QOpenGLDebugLogger>
|
||||||
|
#include <GLHelpers.h>
|
||||||
|
|
||||||
static QSurfaceFormat getDefaultFormat() {
|
GlWindow::GlWindow(QOpenGLContext* shareContext) : GlWindow(getDefaultOpenGlSurfaceFormat(), shareContext) {
|
||||||
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(getDefaultFormat(), shareContext) {
|
GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext) {
|
||||||
}
|
|
||||||
|
|
||||||
GlWindow::GlWindow(const QSurfaceFormat& format, QOpenGLContext * shareContext) {
|
|
||||||
setSurfaceType(QSurface::OpenGLSurface);
|
setSurfaceType(QSurface::OpenGLSurface);
|
||||||
setFormat(format);
|
setFormat(format);
|
||||||
_context = new QOpenGLContext;
|
_context = new QOpenGLContext;
|
||||||
|
|
|
@ -11,24 +11,23 @@
|
||||||
#define hifi_GlWindow_h
|
#define hifi_GlWindow_h
|
||||||
|
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
#include <QSurfaceFormat>
|
|
||||||
|
|
||||||
class QOpenGLContext;
|
class QOpenGLContext;
|
||||||
class QOpenGLDebugLogger;
|
class QOpenGLDebugLogger;
|
||||||
|
|
||||||
class GlWindow : public QWindow {
|
class GlWindow : public QWindow {
|
||||||
public:
|
public:
|
||||||
GlWindow(QOpenGLContext * shareContext = nullptr);
|
GlWindow(QOpenGLContext* shareContext = nullptr);
|
||||||
GlWindow(const QSurfaceFormat& format, QOpenGLContext * shareContext = nullptr);
|
GlWindow(const QSurfaceFormat& format, QOpenGLContext* shareContext = nullptr);
|
||||||
virtual ~GlWindow();
|
virtual ~GlWindow();
|
||||||
void makeCurrent();
|
void makeCurrent();
|
||||||
void doneCurrent();
|
void doneCurrent();
|
||||||
void swapBuffers();
|
void swapBuffers();
|
||||||
private:
|
private:
|
||||||
QOpenGLContext * _context{ nullptr };
|
QOpenGLContext* _context{ nullptr };
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
QOpenGLDebugLogger * _logger{ nullptr };
|
QOpenGLDebugLogger* _logger{ nullptr };
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -31,7 +31,7 @@ protected:
|
||||||
QOpenGLContext _context;
|
QOpenGLContext _context;
|
||||||
QOffscreenSurface _offscreenSurface;
|
QOffscreenSurface _offscreenSurface;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
QOpenGLDebugLogger * _logger{ nullptr };
|
QOpenGLDebugLogger* _logger{ nullptr };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
16
libraries/shared/src/GLHelpers.cpp
Normal file
16
libraries/shared/src/GLHelpers.cpp
Normal 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;
|
||||||
|
}
|
23
libraries/shared/src/GLHelpers.h
Normal file
23
libraries/shared/src/GLHelpers.h
Normal 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
|
Loading…
Reference in a new issue