mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 04:24:47 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into fix/settings
This commit is contained in:
commit
e6b9d3604d
16 changed files with 304 additions and 157 deletions
|
@ -43,26 +43,24 @@ macro(PACKAGE_LIBRARIES_FOR_DEPLOYMENT)
|
||||||
)
|
)
|
||||||
|
|
||||||
set(QTAUDIO_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audio)
|
set(QTAUDIO_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audio)
|
||||||
|
set(QTAUDIO_WIN7_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audioWin7/audio)
|
||||||
|
set(QTAUDIO_WIN8_PATH $<TARGET_FILE_DIR:${TARGET_NAME}>/audioWin8/audio)
|
||||||
|
|
||||||
if (DEPLOY_PACKAGE)
|
# copy qtaudio_wasapi.dll and qtaudio_windows.dll in the correct directories for runtime selection
|
||||||
# copy qtaudio_wasapi.dll alongside qtaudio_windows.dll, and let the installer resolve
|
add_custom_command(
|
||||||
add_custom_command(
|
TARGET ${TARGET_NAME}
|
||||||
TARGET ${TARGET_NAME}
|
POST_BUILD
|
||||||
POST_BUILD
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${QTAUDIO_WIN7_PATH}
|
||||||
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${QTAUDIO_WIN8_PATH}
|
||||||
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
|
# copy release DLLs
|
||||||
)
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E copy ${QTAUDIO_PATH}/qtaudio_windows.dll ${QTAUDIO_WIN7_PATH} )
|
||||||
elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS 6.2)
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_WIN8_PATH} )
|
||||||
# continue using qtaudio_windows.dll on Windows 7
|
# copy debug DLLs
|
||||||
else ()
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E copy ${QTAUDIO_PATH}/qtaudio_windowsd.dll ${QTAUDIO_WIN7_PATH} )
|
||||||
# replace qtaudio_windows.dll with qtaudio_wasapi.dll on Windows 8/8.1/10
|
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_WIN8_PATH} )
|
||||||
add_custom_command(
|
# remove directory
|
||||||
TARGET ${TARGET_NAME}
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${QTAUDIO_PATH}
|
||||||
POST_BUILD
|
)
|
||||||
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windows.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windows.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapi.pdb ${QTAUDIO_PATH} )
|
|
||||||
COMMAND if exist ${QTAUDIO_PATH}/qtaudio_windowsd.dll ( ${CMAKE_COMMAND} -E remove ${QTAUDIO_PATH}/qtaudio_windowsd.dll && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.dll ${QTAUDIO_PATH} && ${CMAKE_COMMAND} -E copy ${WASAPI_DLL_PATH}/qtaudio_wasapid.pdb ${QTAUDIO_PATH} )
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
|
@ -630,17 +630,6 @@ Section "-Core installation"
|
||||||
Delete "$INSTDIR\version"
|
Delete "$INSTDIR\version"
|
||||||
Delete "$INSTDIR\xinput1_3.dll"
|
Delete "$INSTDIR\xinput1_3.dll"
|
||||||
|
|
||||||
; The installer includes two different Qt audio plugins.
|
|
||||||
; On Windows 8 and above, only qtaudio_wasapi.dll should be installed.
|
|
||||||
; On Windows 7 and below, only qtaudio_windows.dll should be installed.
|
|
||||||
${If} ${AtLeastWin8}
|
|
||||||
Delete "$INSTDIR\audio\qtaudio_windows.dll"
|
|
||||||
Delete "$INSTDIR\audio\qtaudio_windows.pdb"
|
|
||||||
${Else}
|
|
||||||
Delete "$INSTDIR\audio\qtaudio_wasapi.dll"
|
|
||||||
Delete "$INSTDIR\audio\qtaudio_wasapi.pdb"
|
|
||||||
${EndIf}
|
|
||||||
|
|
||||||
; Delete old desktop shortcuts before they were renamed during Sandbox rename
|
; Delete old desktop shortcuts before they were renamed during Sandbox rename
|
||||||
Delete "$DESKTOP\@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@.lnk"
|
Delete "$DESKTOP\@PRE_SANDBOX_INTERFACE_SHORTCUT_NAME@.lnk"
|
||||||
Delete "$DESKTOP\@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@.lnk"
|
Delete "$DESKTOP\@PRE_SANDBOX_CONSOLE_SHORTCUT_NAME@.lnk"
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
|
|
||||||
#include <gl/QOpenGLContextWrapper.h>
|
#include <gl/QOpenGLContextWrapper.h>
|
||||||
|
|
||||||
|
#include <shared/GlobalAppProperties.h>
|
||||||
#include <ResourceScriptingInterface.h>
|
#include <ResourceScriptingInterface.h>
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
|
@ -166,6 +167,8 @@
|
||||||
// On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
|
// On Windows PC, NVidia Optimus laptop, we want to enable NVIDIA GPU
|
||||||
// FIXME seems to be broken.
|
// FIXME seems to be broken.
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
#include <VersionHelpers.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
|
||||||
}
|
}
|
||||||
|
@ -413,6 +416,17 @@ bool setupEssentials(int& argc, char** argv) {
|
||||||
|
|
||||||
Setting::init();
|
Setting::init();
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
// Select appropriate audio DLL
|
||||||
|
QString audioDLLPath = QCoreApplication::applicationDirPath();
|
||||||
|
if (IsWindows8OrGreater()) {
|
||||||
|
audioDLLPath += "/audioWin8";
|
||||||
|
} else {
|
||||||
|
audioDLLPath += "/audioWin7";
|
||||||
|
}
|
||||||
|
QCoreApplication::addLibraryPath(audioDLLPath);
|
||||||
|
#endif
|
||||||
|
|
||||||
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
|
||||||
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
|
||||||
bool previousSessionCrashed = CrashHandler::checkForResetSettings(suppressPrompt);
|
bool previousSessionCrashed = CrashHandler::checkForResetSettings(suppressPrompt);
|
||||||
|
@ -530,7 +544,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
_maxOctreePPS(maxOctreePacketsPerSecond.get()),
|
||||||
_lastFaceTrackerUpdate(0)
|
_lastFaceTrackerUpdate(0)
|
||||||
{
|
{
|
||||||
setProperty("com.highfidelity.launchedFromSteam", SteamClient::isRunning());
|
setProperty(hifi::properties::STEAM, SteamClient::isRunning());
|
||||||
|
setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
|
||||||
|
|
||||||
_runningMarker.startRunningMarker();
|
_runningMarker.startRunningMarker();
|
||||||
|
|
||||||
|
@ -1680,6 +1695,8 @@ void Application::initializeGL() {
|
||||||
|
|
||||||
_glWidget->makeCurrent();
|
_glWidget->makeCurrent();
|
||||||
gpu::Context::init<gpu::gl::GLBackend>();
|
gpu::Context::init<gpu::gl::GLBackend>();
|
||||||
|
qApp->setProperty(hifi::properties::gl::MAKE_PROGRAM_CALLBACK,
|
||||||
|
QVariant::fromValue((void*)(&gpu::gl::GLBackend::makeProgram)));
|
||||||
_gpuContext = std::make_shared<gpu::Context>();
|
_gpuContext = std::make_shared<gpu::Context>();
|
||||||
// The gpu context can make child contexts for transfers, so
|
// The gpu context can make child contexts for transfers, so
|
||||||
// we need to restore primary rendering context
|
// we need to restore primary rendering context
|
||||||
|
|
|
@ -117,6 +117,8 @@ void HmdDisplayPlugin::internalDeactivate() {
|
||||||
Parent::internalDeactivate();
|
Parent::internalDeactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const int32_t LINE_DATA_SLOT = 1;
|
||||||
|
|
||||||
void HmdDisplayPlugin::customizeContext() {
|
void HmdDisplayPlugin::customizeContext() {
|
||||||
Parent::customizeContext();
|
Parent::customizeContext();
|
||||||
_overlayRenderer.build();
|
_overlayRenderer.build();
|
||||||
|
@ -131,13 +133,11 @@ void HmdDisplayPlugin::customizeContext() {
|
||||||
state->setBlendFunction(true,
|
state->setBlendFunction(true,
|
||||||
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
gpu::State::SRC_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::INV_SRC_ALPHA,
|
||||||
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
gpu::State::FACTOR_ALPHA, gpu::State::BLEND_OP_ADD, gpu::State::ONE);
|
||||||
gpu::Shader::makeProgram(*program, gpu::Shader::BindingSet());
|
|
||||||
|
gpu::Shader::BindingSet bindings;
|
||||||
|
bindings.insert({ "lineData", LINE_DATA_SLOT });;
|
||||||
|
gpu::Shader::makeProgram(*program, bindings);
|
||||||
_glowLinePipeline = gpu::Pipeline::create(program, state);
|
_glowLinePipeline = gpu::Pipeline::create(program, state);
|
||||||
for (const auto& buffer : program->getBuffers()) {
|
|
||||||
if (buffer._name == "lineData") {
|
|
||||||
_handLaserUniformSlot = buffer._location;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_handLaserUniforms = std::array<gpu::BufferPointer, 2>{ { std::make_shared<gpu::Buffer>(), std::make_shared<gpu::Buffer>() } };
|
_handLaserUniforms = std::array<gpu::BufferPointer, 2>{ { std::make_shared<gpu::Buffer>(), std::make_shared<gpu::Buffer>() } };
|
||||||
_extraLaserUniforms = std::make_shared<gpu::Buffer>();
|
_extraLaserUniforms = std::make_shared<gpu::Buffer>();
|
||||||
};
|
};
|
||||||
|
@ -725,7 +725,7 @@ void HmdDisplayPlugin::compositeExtra() {
|
||||||
const auto& points = _presentHandLaserPoints[index];
|
const auto& points = _presentHandLaserPoints[index];
|
||||||
_handLaserUniforms[index]->resize(sizeof(HandLaserData));
|
_handLaserUniforms[index]->resize(sizeof(HandLaserData));
|
||||||
_handLaserUniforms[index]->setSubData(0, HandLaserData { vec4(points.first, 1.0f), vec4(points.second, 1.0f), _handLasers[index].color });
|
_handLaserUniforms[index]->setSubData(0, HandLaserData { vec4(points.first, 1.0f), vec4(points.second, 1.0f), _handLasers[index].color });
|
||||||
batch.setUniformBuffer(_handLaserUniformSlot, _handLaserUniforms[index]);
|
batch.setUniformBuffer(LINE_DATA_SLOT, _handLaserUniforms[index]);
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4, 0);
|
batch.draw(gpu::TRIANGLE_STRIP, 4, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -734,7 +734,7 @@ void HmdDisplayPlugin::compositeExtra() {
|
||||||
const auto& points = _presentExtraLaserPoints;
|
const auto& points = _presentExtraLaserPoints;
|
||||||
_extraLaserUniforms->resize(sizeof(HandLaserData));
|
_extraLaserUniforms->resize(sizeof(HandLaserData));
|
||||||
_extraLaserUniforms->setSubData(0, HandLaserData { vec4(points.first, 1.0f), vec4(points.second, 1.0f), _presentExtraLaser.color });
|
_extraLaserUniforms->setSubData(0, HandLaserData { vec4(points.first, 1.0f), vec4(points.second, 1.0f), _presentExtraLaser.color });
|
||||||
batch.setUniformBuffer(_handLaserUniformSlot, _extraLaserUniforms);
|
batch.setUniformBuffer(LINE_DATA_SLOT, _extraLaserUniforms);
|
||||||
batch.draw(gpu::TRIANGLE_STRIP, 4, 0);
|
batch.draw(gpu::TRIANGLE_STRIP, 4, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -119,7 +119,6 @@ private:
|
||||||
bool _monoPreview { true };
|
bool _monoPreview { true };
|
||||||
bool _clearPreviewFlag { false };
|
bool _clearPreviewFlag { false };
|
||||||
std::array<gpu::BufferPointer, 2> _handLaserUniforms;
|
std::array<gpu::BufferPointer, 2> _handLaserUniforms;
|
||||||
uint32_t _handLaserUniformSlot { 0 };
|
|
||||||
gpu::BufferPointer _extraLaserUniforms;
|
gpu::BufferPointer _extraLaserUniforms;
|
||||||
gpu::PipelinePointer _glowLinePipeline;
|
gpu::PipelinePointer _glowLinePipeline;
|
||||||
gpu::TexturePointer _previewTexture;
|
gpu::TexturePointer _previewTexture;
|
||||||
|
|
|
@ -19,10 +19,11 @@
|
||||||
#include <QtGui/QWindow>
|
#include <QtGui/QWindow>
|
||||||
#include <QtGui/QGuiApplication>
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
|
#include <shared/AbstractLoggerInterface.h>
|
||||||
|
#include <shared/GlobalAppProperties.h>
|
||||||
#include <GLMHelpers.h>
|
#include <GLMHelpers.h>
|
||||||
#include "GLLogging.h"
|
#include "GLLogging.h"
|
||||||
|
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -37,7 +38,6 @@ static bool enableDebugLogger = QProcessEnvironment::systemEnvironment().contain
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "GLHelpers.h"
|
#include "GLHelpers.h"
|
||||||
|
|
||||||
|
|
||||||
using namespace gl;
|
using namespace gl;
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@ void Context::setWindow(QWindow* window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
static const char* PRIMARY_CONTEXT_PROPERTY_NAME = "com.highfidelity.gl.primaryContext";
|
|
||||||
|
|
||||||
bool Context::makeCurrent() {
|
bool Context::makeCurrent() {
|
||||||
BOOL result = wglMakeCurrent(_hdc, _hglrc);
|
BOOL result = wglMakeCurrent(_hdc, _hglrc);
|
||||||
|
@ -153,7 +152,17 @@ void GLAPIENTRY debugMessageCallback(GLenum source, GLenum type, GLuint id, GLen
|
||||||
if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) {
|
if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qCDebug(glLogging) << "QQQ " << message;
|
qCDebug(glLogging) << "OpenGL: " << message;
|
||||||
|
|
||||||
|
// For high severity errors, force a sync to the log, since we might crash
|
||||||
|
// before the log file was flushed otherwise. Performance hit here
|
||||||
|
if (GL_DEBUG_SEVERITY_HIGH == severity) {
|
||||||
|
AbstractLoggerInterface* logger = AbstractLoggerInterface::get();
|
||||||
|
if (logger) {
|
||||||
|
// FIXME find a way to force the log file to sync that doesn't lead to a deadlock
|
||||||
|
// logger->sync();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME build the PFD based on the
|
// FIXME build the PFD based on the
|
||||||
|
@ -192,7 +201,7 @@ void setupPixelFormatSimple(HDC hdc) {
|
||||||
|
|
||||||
void Context::create() {
|
void Context::create() {
|
||||||
if (!PRIMARY) {
|
if (!PRIMARY) {
|
||||||
PRIMARY = static_cast<Context*>(qApp->property(PRIMARY_CONTEXT_PROPERTY_NAME).value<void*>());
|
PRIMARY = static_cast<Context*>(qApp->property(hifi::properties::gl::PRIMARY_CONTEXT).value<void*>());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRIMARY) {
|
if (PRIMARY) {
|
||||||
|
@ -205,6 +214,11 @@ void Context::create() {
|
||||||
// Create a temporary context to initialize glew
|
// Create a temporary context to initialize glew
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [&] {
|
std::call_once(once, [&] {
|
||||||
|
// If the previous run crashed, force GL debug logging on
|
||||||
|
if (qApp->property(hifi::properties::CRASHED).toBool()) {
|
||||||
|
enableDebugLogger = true;
|
||||||
|
}
|
||||||
|
|
||||||
auto hdc = GetDC(hwnd);
|
auto hdc = GetDC(hwnd);
|
||||||
setupPixelFormatSimple(hdc);
|
setupPixelFormatSimple(hdc);
|
||||||
auto glrc = wglCreateContext(hdc);
|
auto glrc = wglCreateContext(hdc);
|
||||||
|
@ -290,7 +304,7 @@ void Context::create() {
|
||||||
|
|
||||||
if (!PRIMARY) {
|
if (!PRIMARY) {
|
||||||
PRIMARY = this;
|
PRIMARY = this;
|
||||||
qApp->setProperty(PRIMARY_CONTEXT_PROPERTY_NAME, QVariant::fromValue((void*)PRIMARY));
|
qApp->setProperty(hifi::properties::gl::PRIMARY_CONTEXT, QVariant::fromValue((void*)PRIMARY));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableDebugLogger) {
|
if (enableDebugLogger) {
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "nvToolsExt.h"
|
#include "nvToolsExt.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <shared/GlobalAppProperties.h>
|
||||||
#include <GPUIdent.h>
|
#include <GPUIdent.h>
|
||||||
#include <gl/QOpenGLContextWrapper.h>
|
#include <gl/QOpenGLContextWrapper.h>
|
||||||
#include <QtCore/QProcessEnvironment>
|
#include <QtCore/QProcessEnvironment>
|
||||||
|
@ -36,7 +37,6 @@ static const QString DEBUG_FLAG("HIFI_DISABLE_OPENGL_45");
|
||||||
static bool disableOpenGL45 = QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG);
|
static bool disableOpenGL45 = QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG);
|
||||||
|
|
||||||
static GLBackend* INSTANCE{ nullptr };
|
static GLBackend* INSTANCE{ nullptr };
|
||||||
static const char* GL_BACKEND_PROPERTY_NAME = "com.highfidelity.gl.backend";
|
|
||||||
|
|
||||||
BackendPointer GLBackend::createBackend() {
|
BackendPointer GLBackend::createBackend() {
|
||||||
// The ATI memory info extension only exposes 'free memory' so we want to force it to
|
// The ATI memory info extension only exposes 'free memory' so we want to force it to
|
||||||
|
@ -60,7 +60,7 @@ BackendPointer GLBackend::createBackend() {
|
||||||
|
|
||||||
INSTANCE = result.get();
|
INSTANCE = result.get();
|
||||||
void* voidInstance = &(*result);
|
void* voidInstance = &(*result);
|
||||||
qApp->setProperty(GL_BACKEND_PROPERTY_NAME, QVariant::fromValue(voidInstance));
|
qApp->setProperty(hifi::properties::gl::BACKEND, QVariant::fromValue(voidInstance));
|
||||||
|
|
||||||
gl::GLTexture::initTextureTransferHelper();
|
gl::GLTexture::initTextureTransferHelper();
|
||||||
return result;
|
return result;
|
||||||
|
@ -68,7 +68,7 @@ BackendPointer GLBackend::createBackend() {
|
||||||
|
|
||||||
GLBackend& getBackend() {
|
GLBackend& getBackend() {
|
||||||
if (!INSTANCE) {
|
if (!INSTANCE) {
|
||||||
INSTANCE = static_cast<GLBackend*>(qApp->property(GL_BACKEND_PROPERTY_NAME).value<void*>());
|
INSTANCE = static_cast<GLBackend*>(qApp->property(hifi::properties::gl::BACKEND).value<void*>());
|
||||||
}
|
}
|
||||||
return *INSTANCE;
|
return *INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,10 +40,14 @@ public:
|
||||||
return _shaderObjects[version].glprogram;
|
return _shaderObjects[version].glprogram;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLint getUniformLocation(GLint srcLoc, Version version = Mono) {
|
GLint getUniformLocation(GLint srcLoc, Version version = Mono) const {
|
||||||
// THIS will be used in the future PR as we grow the number of versions
|
// This check protect against potential invalid src location for this shader, if unknown then return -1.
|
||||||
return _uniformMappings[version][srcLoc];
|
const auto& mapping = _uniformMappings[version];
|
||||||
// return srcLoc;
|
auto found = mapping.find(srcLoc);
|
||||||
|
if (found == mapping.end()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::weak_ptr<GLBackend> _backend;
|
const std::weak_ptr<GLBackend> _backend;
|
||||||
|
|
|
@ -9,8 +9,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
|
|
||||||
|
#include <shared/GlobalAppProperties.h>
|
||||||
|
|
||||||
#include "Frame.h"
|
#include "Frame.h"
|
||||||
#include "GPULogging.h"
|
#include "GPULogging.h"
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,6 +122,12 @@ void Context::executeFrame(const FramePointer& frame) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Context::makeProgram(Shader& shader, const Shader::BindingSet& bindings) {
|
bool Context::makeProgram(Shader& shader, const Shader::BindingSet& bindings) {
|
||||||
|
// If we're running in another DLL context, we need to fetch the program callback out of the application
|
||||||
|
// FIXME find a way to do this without reliance on Qt app properties
|
||||||
|
if (!_makeProgramCallback) {
|
||||||
|
void* rawCallback = qApp->property(hifi::properties::gl::MAKE_PROGRAM_CALLBACK).value<void*>();
|
||||||
|
_makeProgramCallback = reinterpret_cast<Context::MakeProgram>(rawCallback);
|
||||||
|
}
|
||||||
if (shader.isProgram() && _makeProgramCallback) {
|
if (shader.isProgram() && _makeProgramCallback) {
|
||||||
return _makeProgramCallback(shader, bindings);
|
return _makeProgramCallback(shader, bindings);
|
||||||
}
|
}
|
||||||
|
|
30
libraries/shared/src/shared/AbstractLoggerInterface.cpp
Normal file
30
libraries/shared/src/shared/AbstractLoggerInterface.cpp
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2016/11/29
|
||||||
|
// Copyright 2013-2016 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
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "AbstractLoggerInterface.h"
|
||||||
|
#include "GlobalAppProperties.h"
|
||||||
|
|
||||||
|
#include <QtCore/QCoreApplication>
|
||||||
|
#include <QtCore/QVariant>
|
||||||
|
|
||||||
|
AbstractLoggerInterface* AbstractLoggerInterface::get() {
|
||||||
|
QVariant loggerVar = qApp->property(hifi::properties::LOGGER);
|
||||||
|
QObject* loggerObject = qvariant_cast<QObject *>(loggerVar);
|
||||||
|
return qobject_cast<AbstractLoggerInterface*>(loggerObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractLoggerInterface::AbstractLoggerInterface(QObject* parent) : QObject(parent) {
|
||||||
|
qApp->setProperty(hifi::properties::LOGGER, QVariant::fromValue(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
AbstractLoggerInterface::~AbstractLoggerInterface() {
|
||||||
|
if (qApp) {
|
||||||
|
qApp->setProperty(hifi::properties::LOGGER, QVariant());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -20,13 +20,16 @@ class AbstractLoggerInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AbstractLoggerInterface(QObject* parent = NULL) : QObject(parent) {}
|
static AbstractLoggerInterface* get();
|
||||||
|
AbstractLoggerInterface(QObject* parent = NULL);
|
||||||
|
~AbstractLoggerInterface();
|
||||||
inline bool extraDebugging() { return _extraDebugging; }
|
inline bool extraDebugging() { return _extraDebugging; }
|
||||||
inline void setExtraDebugging(bool debugging) { _extraDebugging = debugging; }
|
inline void setExtraDebugging(bool debugging) { _extraDebugging = debugging; }
|
||||||
|
|
||||||
virtual void addMessage(const QString&) = 0;
|
virtual void addMessage(const QString&) = 0;
|
||||||
virtual QString getLogData() = 0;
|
virtual QString getLogData() = 0;
|
||||||
virtual void locateLog() = 0;
|
virtual void locateLog() = 0;
|
||||||
|
virtual void sync() {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void logReceived(QString message);
|
void logReceived(QString message);
|
||||||
|
|
|
@ -21,6 +21,25 @@
|
||||||
#include "../NumericalConstants.h"
|
#include "../NumericalConstants.h"
|
||||||
#include "../SharedUtil.h"
|
#include "../SharedUtil.h"
|
||||||
|
|
||||||
|
class FilePersistThread : public GenericQueueThread < QString > {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
FilePersistThread(const FileLogger& logger);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void rollingLogFile(QString newFilename);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void rollFileIfNecessary(QFile& file, bool notifyListenersIfRolled = true);
|
||||||
|
virtual bool processQueueItems(const Queue& messages) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const FileLogger& _logger;
|
||||||
|
QMutex _fileMutex;
|
||||||
|
uint64_t _lastRollTime;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const QString FILENAME_FORMAT = "hifi-log_%1_%2.txt";
|
static const QString FILENAME_FORMAT = "hifi-log_%1_%2.txt";
|
||||||
static const QString DATETIME_FORMAT = "yyyy-MM-dd_hh.mm.ss";
|
static const QString DATETIME_FORMAT = "yyyy-MM-dd_hh.mm.ss";
|
||||||
|
@ -97,6 +116,7 @@ void FilePersistThread::rollFileIfNecessary(QFile& file, bool notifyListenersIfR
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FilePersistThread::processQueueItems(const Queue& messages) {
|
bool FilePersistThread::processQueueItems(const Queue& messages) {
|
||||||
|
QMutexLocker lock(&_fileMutex);
|
||||||
QFile file(_logger._fileName);
|
QFile file(_logger._fileName);
|
||||||
rollFileIfNecessary(file);
|
rollFileIfNecessary(file);
|
||||||
if (file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
|
if (file.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)) {
|
||||||
|
@ -140,5 +160,7 @@ QString FileLogger::getLogData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLogger::sync() {
|
void FileLogger::sync() {
|
||||||
_persistThreadInstance->waitIdle();
|
_persistThreadInstance->process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "FileLogger.moc"
|
|
@ -28,7 +28,7 @@ public:
|
||||||
virtual void addMessage(const QString&) override;
|
virtual void addMessage(const QString&) override;
|
||||||
virtual QString getLogData() override;
|
virtual QString getLogData() override;
|
||||||
virtual void locateLog() override;
|
virtual void locateLog() override;
|
||||||
void sync();
|
virtual void sync() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void rollingLogFile(QString newFilename);
|
void rollingLogFile(QString newFilename);
|
||||||
|
@ -38,24 +38,6 @@ private:
|
||||||
friend class FilePersistThread;
|
friend class FilePersistThread;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FilePersistThread : public GenericQueueThread < QString > {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
FilePersistThread(const FileLogger& logger);
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void rollingLogFile(QString newFilename);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void rollFileIfNecessary(QFile& file, bool notifyListenersIfRolled = true);
|
|
||||||
virtual bool processQueueItems(const Queue& messages) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
const FileLogger& _logger;
|
|
||||||
uint64_t _lastRollTime;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif // hifi_FileLogger_h
|
#endif // hifi_FileLogger_h
|
||||||
|
|
23
libraries/shared/src/shared/GlobalAppProperties.cpp
Normal file
23
libraries/shared/src/shared/GlobalAppProperties.cpp
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2016/11/29
|
||||||
|
// Copyright 2013-2016 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
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "GlobalAppProperties.h"
|
||||||
|
|
||||||
|
namespace hifi { namespace properties {
|
||||||
|
|
||||||
|
const char* CRASHED = "com.highfidelity.crashed";
|
||||||
|
const char* STEAM = "com.highfidelity.launchedFromSteam";
|
||||||
|
const char* LOGGER = "com.highfidelity.logger";
|
||||||
|
|
||||||
|
namespace gl {
|
||||||
|
const char* BACKEND = "com.highfidelity.gl.backend";
|
||||||
|
const char* MAKE_PROGRAM_CALLBACK = "com.highfidelity.gl.makeProgram";
|
||||||
|
const char* PRIMARY_CONTEXT = "com.highfidelity.gl.primaryContext";
|
||||||
|
}
|
||||||
|
|
||||||
|
} }
|
28
libraries/shared/src/shared/GlobalAppProperties.h
Normal file
28
libraries/shared/src/shared/GlobalAppProperties.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2016/11/29
|
||||||
|
// Copyright 2013-2016 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_GlobalAppProperties_h
|
||||||
|
#define hifi_GlobalAppProperties_h
|
||||||
|
|
||||||
|
namespace hifi { namespace properties {
|
||||||
|
|
||||||
|
extern const char* CRASHED;
|
||||||
|
extern const char* STEAM;
|
||||||
|
extern const char* LOGGER;
|
||||||
|
|
||||||
|
namespace gl {
|
||||||
|
extern const char* BACKEND;
|
||||||
|
extern const char* MAKE_PROGRAM_CALLBACK;
|
||||||
|
extern const char* PRIMARY_CONTEXT;
|
||||||
|
}
|
||||||
|
|
||||||
|
} }
|
||||||
|
|
||||||
|
|
||||||
|
#endif // hifi_GlobalAppProperties_h
|
|
@ -46,6 +46,9 @@
|
||||||
#include <gpu/gl/GLTexture.h>
|
#include <gpu/gl/GLTexture.h>
|
||||||
#include <gpu/StandardShaderLib.h>
|
#include <gpu/StandardShaderLib.h>
|
||||||
|
|
||||||
|
#include <SimpleEntitySimulation.h>
|
||||||
|
#include <EntityActionInterface.h>
|
||||||
|
#include <EntityActionFactoryInterface.h>
|
||||||
#include <WebEntityItem.h>
|
#include <WebEntityItem.h>
|
||||||
#include <OctreeUtils.h>
|
#include <OctreeUtils.h>
|
||||||
#include <render/Engine.h>
|
#include <render/Engine.h>
|
||||||
|
@ -104,13 +107,13 @@ public:
|
||||||
class QWindowCamera : public Camera {
|
class QWindowCamera : public Camera {
|
||||||
Key forKey(int key) {
|
Key forKey(int key) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case Qt::Key_W: return FORWARD;
|
case Qt::Key_W: return FORWARD;
|
||||||
case Qt::Key_S: return BACK;
|
case Qt::Key_S: return BACK;
|
||||||
case Qt::Key_A: return LEFT;
|
case Qt::Key_A: return LEFT;
|
||||||
case Qt::Key_D: return RIGHT;
|
case Qt::Key_D: return RIGHT;
|
||||||
case Qt::Key_E: return UP;
|
case Qt::Key_E: return UP;
|
||||||
case Qt::Key_C: return DOWN;
|
case Qt::Key_C: return DOWN;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
return INVALID;
|
return INVALID;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +155,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
static QString toHumanSize(size_t size, size_t maxUnit = std::numeric_limits<size_t>::max()) {
|
static QString toHumanSize(size_t size, size_t maxUnit = std::numeric_limits<size_t>::max()) {
|
||||||
static const std::vector<QString> SUFFIXES{ { "B", "KB", "MB", "GB", "TB", "PB" } };
|
static const std::vector<QString> SUFFIXES { { "B", "KB", "MB", "GB", "TB", "PB" } };
|
||||||
const size_t maxIndex = std::min(maxUnit, SUFFIXES.size() - 1);
|
const size_t maxIndex = std::min(maxUnit, SUFFIXES.size() - 1);
|
||||||
size_t suffixIndex = 0;
|
size_t suffixIndex = 0;
|
||||||
|
|
||||||
|
@ -187,7 +190,7 @@ public:
|
||||||
gpu::ContextPointer _gpuContext; // initialized during window creation
|
gpu::ContextPointer _gpuContext; // initialized during window creation
|
||||||
std::atomic<size_t> _presentCount;
|
std::atomic<size_t> _presentCount;
|
||||||
QElapsedTimer _elapsed;
|
QElapsedTimer _elapsed;
|
||||||
std::atomic<uint16_t> _fps{ 1 };
|
std::atomic<uint16_t> _fps { 1 };
|
||||||
RateCounter<200> _fpsCounter;
|
RateCounter<200> _fpsCounter;
|
||||||
std::mutex _mutex;
|
std::mutex _mutex;
|
||||||
std::shared_ptr<gpu::Backend> _backend;
|
std::shared_ptr<gpu::Backend> _backend;
|
||||||
|
@ -197,7 +200,7 @@ public:
|
||||||
std::queue<gpu::FramePointer> _pendingFrames;
|
std::queue<gpu::FramePointer> _pendingFrames;
|
||||||
gpu::FramePointer _activeFrame;
|
gpu::FramePointer _activeFrame;
|
||||||
QSize _size;
|
QSize _size;
|
||||||
static const size_t FRAME_TIME_BUFFER_SIZE{ 8192 };
|
static const size_t FRAME_TIME_BUFFER_SIZE { 8192 };
|
||||||
|
|
||||||
void submitFrame(const gpu::FramePointer& frame) {
|
void submitFrame(const gpu::FramePointer& frame) {
|
||||||
std::unique_lock<std::mutex> lock(_frameLock);
|
std::unique_lock<std::mutex> lock(_frameLock);
|
||||||
|
@ -273,7 +276,7 @@ public:
|
||||||
_gpuContext->executeFrame(frame);
|
_gpuContext->executeFrame(frame);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
gpu::Batch presentBatch;
|
gpu::Batch presentBatch;
|
||||||
presentBatch.setViewportTransform({ 0, 0, _size.width(), _size.height() });
|
presentBatch.setViewportTransform({ 0, 0, _size.width(), _size.height() });
|
||||||
|
@ -290,7 +293,7 @@ public:
|
||||||
_context.makeCurrent();
|
_context.makeCurrent();
|
||||||
_context.swapBuffers();
|
_context.swapBuffers();
|
||||||
_fpsCounter.increment();
|
_fpsCounter.increment();
|
||||||
static size_t _frameCount{ 0 };
|
static size_t _frameCount { 0 };
|
||||||
++_frameCount;
|
++_frameCount;
|
||||||
if (_elapsed.elapsed() >= 500) {
|
if (_elapsed.elapsed() >= 500) {
|
||||||
_fps = _fpsCounter.rate();
|
_fps = _fpsCounter.rate();
|
||||||
|
@ -357,6 +360,21 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class TestActionFactory : public EntityActionFactoryInterface {
|
||||||
|
public:
|
||||||
|
virtual EntityActionPointer factory(EntityActionType type,
|
||||||
|
const QUuid& id,
|
||||||
|
EntityItemPointer ownerEntity,
|
||||||
|
QVariantMap arguments) override {
|
||||||
|
return EntityActionPointer();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
virtual EntityActionPointer factoryBA(EntityItemPointer ownerEntity, QByteArray data) override {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// Background Render Data & rendering functions
|
// Background Render Data & rendering functions
|
||||||
class BackgroundRenderData {
|
class BackgroundRenderData {
|
||||||
public:
|
public:
|
||||||
|
@ -386,17 +404,17 @@ namespace render {
|
||||||
auto backgroundMode = skyStage->getBackgroundMode();
|
auto backgroundMode = skyStage->getBackgroundMode();
|
||||||
|
|
||||||
switch (backgroundMode) {
|
switch (backgroundMode) {
|
||||||
case model::SunSkyStage::SKY_BOX: {
|
case model::SunSkyStage::SKY_BOX: {
|
||||||
auto skybox = skyStage->getSkybox();
|
auto skybox = skyStage->getSkybox();
|
||||||
if (skybox) {
|
if (skybox) {
|
||||||
PerformanceTimer perfTimer("skybox");
|
PerformanceTimer perfTimer("skybox");
|
||||||
skybox->render(batch, args->getViewFrustum());
|
skybox->render(batch, args->getViewFrustum());
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
default:
|
// this line intentionally left blank
|
||||||
// this line intentionally left blank
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,6 +470,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
//"/-17.2049,-8.08629,-19.4153/0,0.881994,0,-0.47126"
|
//"/-17.2049,-8.08629,-19.4153/0,0.881994,0,-0.47126"
|
||||||
static void setup() {
|
static void setup() {
|
||||||
|
DependencyManager::registerInheritance<EntityActionFactoryInterface, TestActionFactory>();
|
||||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||||
DependencyManager::registerInheritance<SpatialParentFinder, ParentFinder>();
|
DependencyManager::registerInheritance<SpatialParentFinder, ParentFinder>();
|
||||||
DependencyManager::set<AddressManager>();
|
DependencyManager::set<AddressManager>();
|
||||||
|
@ -466,6 +485,7 @@ public:
|
||||||
DependencyManager::set<ModelBlender>();
|
DependencyManager::set<ModelBlender>();
|
||||||
DependencyManager::set<PathUtils>();
|
DependencyManager::set<PathUtils>();
|
||||||
DependencyManager::set<SceneScriptingInterface>();
|
DependencyManager::set<SceneScriptingInterface>();
|
||||||
|
DependencyManager::set<TestActionFactory>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QTestWindow() {
|
QTestWindow() {
|
||||||
|
@ -486,6 +506,13 @@ public:
|
||||||
permissions.setAll(true);
|
permissions.setAll(true);
|
||||||
nodeList->setPermissions(permissions);
|
nodeList->setPermissions(permissions);
|
||||||
|
|
||||||
|
{
|
||||||
|
SimpleEntitySimulationPointer simpleSimulation { new SimpleEntitySimulation() };
|
||||||
|
simpleSimulation->setEntityTree(_octree->getTree());
|
||||||
|
_octree->getTree()->setSimulation(simpleSimulation);
|
||||||
|
_entitySimulation = simpleSimulation;
|
||||||
|
}
|
||||||
|
|
||||||
ResourceManager::init();
|
ResourceManager::init();
|
||||||
|
|
||||||
setFlags(Qt::MSWindowsOwnDC | Qt::Window | Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint);
|
setFlags(Qt::MSWindowsOwnDC | Qt::Window | Qt::Dialog | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint);
|
||||||
|
@ -561,49 +588,49 @@ protected:
|
||||||
|
|
||||||
void keyPressEvent(QKeyEvent* event) override {
|
void keyPressEvent(QKeyEvent* event) override {
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
case Qt::Key_F1:
|
case Qt::Key_F1:
|
||||||
importScene();
|
importScene();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F2:
|
case Qt::Key_F2:
|
||||||
reloadScene();
|
reloadScene();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F4:
|
case Qt::Key_F4:
|
||||||
cycleMode();
|
cycleMode();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F5:
|
case Qt::Key_F5:
|
||||||
goTo();
|
goTo();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F6:
|
case Qt::Key_F6:
|
||||||
savePosition();
|
savePosition();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F7:
|
case Qt::Key_F7:
|
||||||
restorePosition();
|
restorePosition();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F8:
|
case Qt::Key_F8:
|
||||||
resetPosition();
|
resetPosition();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_F9:
|
case Qt::Key_F9:
|
||||||
toggleCulling();
|
toggleCulling();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_Home:
|
case Qt::Key_Home:
|
||||||
gpu::Texture::setAllowedGPUMemoryUsage(0);
|
gpu::Texture::setAllowedGPUMemoryUsage(0);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case Qt::Key_End:
|
case Qt::Key_End:
|
||||||
gpu::Texture::setAllowedGPUMemoryUsage(MB_TO_BYTES(64));
|
gpu::Texture::setAllowedGPUMemoryUsage(MB_TO_BYTES(64));
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_camera.onKeyPress(event);
|
_camera.onKeyPress(event);
|
||||||
}
|
}
|
||||||
|
@ -676,7 +703,7 @@ private:
|
||||||
|
|
||||||
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
auto framebufferCache = DependencyManager::get<FramebufferCache>();
|
||||||
framebufferCache->setFrameBufferSize(windowSize);
|
framebufferCache->setFrameBufferSize(windowSize);
|
||||||
|
|
||||||
renderArgs._blitFramebuffer = framebufferCache->getFramebuffer();
|
renderArgs._blitFramebuffer = framebufferCache->getFramebuffer();
|
||||||
// Viewport is assigned to the size of the framebuffer
|
// Viewport is assigned to the size of the framebuffer
|
||||||
renderArgs._viewport = ivec4(0, 0, windowSize.width(), windowSize.height());
|
renderArgs._viewport = ivec4(0, 0, windowSize.width(), windowSize.height());
|
||||||
|
@ -756,34 +783,34 @@ private:
|
||||||
if (commandParams.length() < 2) {
|
if (commandParams.length() < 2) {
|
||||||
qDebug() << "No wait time specified";
|
qDebug() << "No wait time specified";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int seconds = commandParams[1].toInt();
|
int seconds = commandParams[1].toInt();
|
||||||
_nextCommandTime = usecTimestampNow() + seconds * USECS_PER_SECOND;
|
_nextCommandTime = usecTimestampNow() + seconds * USECS_PER_SECOND;
|
||||||
} else if (verb == "load") {
|
} else if (verb == "load") {
|
||||||
if (commandParams.length() < 2) {
|
if (commandParams.length() < 2) {
|
||||||
qDebug() << "No load file specified";
|
qDebug() << "No load file specified";
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
QString file = commandParams[1];
|
|
||||||
if (QFileInfo(file).isRelative()) {
|
|
||||||
file = _commandPath + "/" + file;
|
|
||||||
}
|
|
||||||
if (!QFileInfo(file).exists()) {
|
|
||||||
qDebug() << "Cannot find scene file " + file;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
importScene(file);
|
|
||||||
} else if (verb == "go") {
|
|
||||||
if (commandParams.length() < 2) {
|
|
||||||
qDebug() << "No destination specified for go command";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parsePath(commandParams[1]);
|
|
||||||
} else {
|
|
||||||
qDebug() << "Unknown command " << command;
|
|
||||||
}
|
}
|
||||||
|
QString file = commandParams[1];
|
||||||
|
if (QFileInfo(file).isRelative()) {
|
||||||
|
file = _commandPath + "/" + file;
|
||||||
|
}
|
||||||
|
if (!QFileInfo(file).exists()) {
|
||||||
|
qDebug() << "Cannot find scene file " + file;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
importScene(file);
|
||||||
|
} else if (verb == "go") {
|
||||||
|
if (commandParams.length() < 2) {
|
||||||
|
qDebug() << "No destination specified for go command";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
parsePath(commandParams[1]);
|
||||||
|
} else {
|
||||||
|
qDebug() << "Unknown command " << command;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void runNextCommand(quint64 now) {
|
void runNextCommand(quint64 now) {
|
||||||
if (_commands.empty()) {
|
if (_commands.empty()) {
|
||||||
|
@ -893,14 +920,14 @@ private:
|
||||||
}
|
}
|
||||||
auto frame = gpuContext->endFrame();
|
auto frame = gpuContext->endFrame();
|
||||||
frame->framebuffer = renderArgs->_blitFramebuffer;
|
frame->framebuffer = renderArgs->_blitFramebuffer;
|
||||||
frame->framebufferRecycler = [](const gpu::FramebufferPointer& framebuffer){
|
frame->framebufferRecycler = [](const gpu::FramebufferPointer& framebuffer) {
|
||||||
DependencyManager::get<FramebufferCache>()->releaseFramebuffer(framebuffer);
|
DependencyManager::get<FramebufferCache>()->releaseFramebuffer(framebuffer);
|
||||||
};
|
};
|
||||||
_renderThread.submitFrame(frame);
|
_renderThread.submitFrame(frame);
|
||||||
if (!_renderThread.isThreaded()) {
|
if (!_renderThread.isThreaded()) {
|
||||||
_renderThread.process();
|
_renderThread.process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,7 +1073,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
render::CullFunctor _cullFunctor { [&](const RenderArgs* args, const AABox& bounds)->bool{
|
render::CullFunctor _cullFunctor { [&](const RenderArgs* args, const AABox& bounds)->bool {
|
||||||
if (_cullingEnabled) {
|
if (_cullingEnabled) {
|
||||||
return cull(args, bounds);
|
return cull(args, bounds);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1068,6 +1095,7 @@ private:
|
||||||
model::SunSkyStage _sunSkyStage;
|
model::SunSkyStage _sunSkyStage;
|
||||||
model::LightPointer _globalLight { std::make_shared<model::Light>() };
|
model::LightPointer _globalLight { std::make_shared<model::Light>() };
|
||||||
bool _ready { false };
|
bool _ready { false };
|
||||||
|
EntitySimulationPointer _entitySimulation;
|
||||||
|
|
||||||
QStringList _commands;
|
QStringList _commands;
|
||||||
QString _commandPath;
|
QString _commandPath;
|
||||||
|
@ -1118,7 +1146,7 @@ int main(int argc, char** argv) {
|
||||||
QLoggingCategory::setFilterRules(LOG_FILTER_RULES);
|
QLoggingCategory::setFilterRules(LOG_FILTER_RULES);
|
||||||
QTestWindow::setup();
|
QTestWindow::setup();
|
||||||
QTestWindow window;
|
QTestWindow window;
|
||||||
//window.loadCommands("C:/Users/bdavis/Git/dreaming/exports/commands.txt");
|
//window.loadCommands("C:/Users/bdavis/Git/dreaming/exports2/commands.txt");
|
||||||
app.exec();
|
app.exec();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue