Working on display plugins

This commit is contained in:
Brad Davis 2015-05-01 15:14:50 -07:00
parent a482fa0a6d
commit d8415ce79b
35 changed files with 350 additions and 255 deletions

View file

@ -44,7 +44,7 @@ macro(GroupSources curdir)
GroupSources(${curdir}/${child})
else()
string(REPLACE "/" "\\" groupname ${curdir})
source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
source_group(${groupname} FILES ${PROJECT_SOURCE_DIR}/${curdir}/${child})
endif()
endforeach()
endmacro()

View file

@ -114,7 +114,7 @@
#include "gpu/Batch.h"
#include "gpu/GLBackend.h"
#include "plugins/render/RenderPlugin.h"
#include "plugins/render/DisplayPlugin.h"
#include "scripting/AccountScriptingInterface.h"
#include "scripting/AudioDeviceScriptingInterface.h"
@ -660,7 +660,7 @@ Application::~Application() {
ModelEntityItem::cleanupLoadedAnimations();
getActiveRenderPlugin()->deactivate();
getActiveDisplayPlugin()->deactivate();
DependencyManager::destroy<OffscreenUi>();
DependencyManager::destroy<AvatarManager>();
@ -773,22 +773,22 @@ void Application::initializeUi() {
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->create(_offscreenContext->getContext());
offscreenUi->resize(fromGlm(getActiveRenderPlugin()->getCanvasSize()));
offscreenUi->resize(fromGlm(getActiveDisplayPlugin()->getCanvasSize()));
offscreenUi->setProxyWindow(_window->windowHandle());
offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));
offscreenUi->load("Root.qml");
offscreenUi->load("RootMenu.qml");
VrMenu::load();
VrMenu::executeQueuedLambdas();
offscreenUi->setMouseTranslator(getActiveRenderPlugin()->getMouseTranslator());
offscreenUi->setMouseTranslator(getActiveDisplayPlugin()->getMouseTranslator());
offscreenUi->resume();
connect(_window, &MainWindow::windowGeometryChanged, [this](const QRect & r){
static qreal oldDevicePixelRatio = 0;
qreal devicePixelRatio = getActiveRenderPlugin()->devicePixelRatio();
qreal devicePixelRatio = getActiveDisplayPlugin()->devicePixelRatio();
if (devicePixelRatio != oldDevicePixelRatio) {
oldDevicePixelRatio = devicePixelRatio;
qDebug() << "Device pixel ratio changed, triggering GL resize";
auto canvasSize = getActiveRenderPlugin()->getCanvasSize();
auto canvasSize = getActiveDisplayPlugin()->getCanvasSize();
resizeGL(canvasSize.x, canvasSize.y);
}
});
@ -803,18 +803,18 @@ void Application::paintGL() {
PerformanceWarning warn(showWarnings, "Application::paintGL()");
_offscreenContext->makeCurrent();
QSize fbSize = getActiveRenderPlugin()->getRecommendedFramebufferSize() * getRenderResolutionScale();
QSize fbSize = getActiveDisplayPlugin()->getRecommendedFramebufferSize() * getRenderResolutionScale();
DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize);
glEnable(GL_LINE_SMOOTH);
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON) {
if (!getActiveRenderPlugin()->isHmd()) {
// If there isn't an HMD, match exactly to avatar's head
if (getActiveDisplayPlugin()->isHmd()) {
// For an HMD, set the base position and orientation to that of the avatar body
_myCamera.setPosition(_myAvatar->getHead()->getEyePosition());
_myCamera.setRotation(_myAvatar->getHead()->getCameraOrientation());
} else {
// For an HMD, set the base position and orientation to that of the avatar body
// If there isn't an HMD, match exactly to avatar's head
_myCamera.setPosition(_myAvatar->getDefaultEyePosition());
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
}
@ -822,7 +822,7 @@ void Application::paintGL() {
static const float THIRD_PERSON_CAMERA_DISTANCE = 1.5f;
_myCamera.setPosition(_myAvatar->getDefaultEyePosition() +
_myAvatar->getOrientation() * glm::vec3(0.0f, 0.0f, 1.0f) * THIRD_PERSON_CAMERA_DISTANCE * _myAvatar->getScale());
if (getActiveRenderPlugin()->isHmd()) {
if (getActiveDisplayPlugin()->isHmd()) {
_myCamera.setRotation(_myAvatar->getWorldAlignedOrientation());
} else {
_myCamera.setRotation(_myAvatar->getHead()->getOrientation());
@ -882,7 +882,7 @@ void Application::paintGL() {
_offscreenContext->doneCurrent();
Q_ASSERT(!QOpenGLContext::currentContext());
getActiveRenderPlugin()->render(gpu::GLBackend::getTextureID(finalFbo->getRenderBuffer(0)));
getActiveDisplayPlugin()->render(gpu::GLBackend::getTextureID(finalFbo->getRenderBuffer(0)));
Q_ASSERT(!QOpenGLContext::currentContext());
_offscreenContext->makeCurrent();
_frameCount++;
@ -934,7 +934,7 @@ void Application::resizeGL(int width, int height) {
updateProjectionMatrix();
glLoadIdentity();
auto canvasSize = getActiveRenderPlugin()->getCanvasSize();
auto canvasSize = getActiveDisplayPlugin()->getCanvasSize();
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->resize(fromGlm(canvasSize));
@ -1306,7 +1306,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
break;
}
case Qt::Key_Escape: {
getActiveRenderPlugin()->abandonCalibration();
getActiveDisplayPlugin()->abandonCalibration();
if (!event->isAutoRepeat()) {
// this starts the HFCancelEvent
HFBackEvent startBackEvent(HFBackEvent::startType());
@ -1441,8 +1441,8 @@ void Application::mouseMoveEvent(QMouseEvent* event, unsigned int deviceID) {
return;
}
if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen)
&& !Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
if (Menu::getInstance()->isOptionChecked(MenuOption::Fullscreen)) {
// Show/hide menu bar in fullscreen
if (event->globalY() > _menuBarHeight) {
_fullscreenMenuWidget->setFixedHeight(0);
@ -1720,7 +1720,7 @@ void Application::idle() {
{
PerformanceTimer perfTimer("updateGL");
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
getActiveRenderPlugin()->idle();
getActiveDisplayPlugin()->idle();
}
{
@ -1753,7 +1753,7 @@ void Application::setFullscreen(bool fullscreen) {
// app menu in a fullscreen window. However the OSX mechanism hides the
// application menu for fullscreen apps, so the check is not required.
#ifndef Q_OS_MAC
if (Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
if (getActiveDisplayPlugin()->isHmd()) {
if (fullscreen) {
// Menu hide() disables menu commands, and show() after hide() doesn't work with Rift VR display.
// So set height instead.
@ -1843,15 +1843,15 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
}
bool Application::mouseOnScreen() const {
return getActiveRenderPlugin()->isMouseOnScreen();
return getActiveDisplayPlugin()->isMouseOnScreen();
}
int Application::getMouseX() const {
return getActiveRenderPlugin()->getUiMousePosition().x;
return getActiveDisplayPlugin()->getUiMousePosition().x;
}
int Application::getMouseY() const {
return getActiveRenderPlugin()->getUiMousePosition().x;
return getActiveDisplayPlugin()->getUiMousePosition().x;
}
int Application::getMouseDragStartedX() const {
@ -2332,9 +2332,7 @@ void Application::updateCursor(float deltaTime) {
}
void Application::updateCursorVisibility() {
if (!_cursorVisible ||
Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode) ||
Menu::getInstance()->isOptionChecked(MenuOption::Enable3DTVMode)) {
if (!_cursorVisible || getActiveDisplayPlugin()->isStereo()) {
_window->setCursor(Qt::BlankCursor);
} else {
_window->unsetCursor();
@ -2714,7 +2712,7 @@ void Application::queryOctree(NodeType_t serverType, PacketType packetType, Node
}
bool Application::isHMDMode() const {
return getActiveRenderPlugin()->isHmd();
return getActiveDisplayPlugin()->isHmd();
}
QRect Application::getDesirableApplicationGeometry() {
@ -3287,7 +3285,7 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom
float& farVal, glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {
_displayViewFrustum.computeOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
// allow 3DTV/Oculus to override parameters from camera
getActiveRenderPlugin()->overrideOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
getActiveDisplayPlugin()->overrideOffAxisFrustum(left, right, bottom, top, nearVal, farVal, nearClipPlane, farClipPlane);
}
bool Application::getShadowsEnabled() {
@ -3378,7 +3376,7 @@ void Application::resetSensors() {
DependencyManager::get<Faceshift>()->reset();
DependencyManager::get<DdeFaceTracker>()->reset();
getActiveRenderPlugin()->resetSensors();
getActiveDisplayPlugin()->resetSensors();
//_leapmotion.reset();
#if 0
@ -4461,12 +4459,12 @@ PickRay Application::computePickRay(float x, float y) const {
return computeViewPickRay(x, y);
}
glm::ivec2 Application::getCanvasSize() const {
return getActiveRenderPlugin()->getCanvasSize();
glm::uvec2 Application::getCanvasSize() const {
return getActiveDisplayPlugin()->getCanvasSize();
}
QSize Application::getDeviceSize() const {
return getActiveRenderPlugin()->getRecommendedFramebufferSize(); // _glWidget->getDeviceSize();
return getActiveDisplayPlugin()->getRecommendedFramebufferSize(); // _glWidget->getDeviceSize();
}
void Application::resizeGL() {
@ -4475,49 +4473,150 @@ void Application::resizeGL() {
}
bool Application::hasFocus() const {
return getActiveRenderPlugin()->hasFocus();
return getActiveDisplayPlugin()->hasFocus();
}
glm::vec2 Application::getViewportDimensions() const {
return toGlm(getDeviceSize());
}
glm::ivec2 Application::getTrueMousePosition() const {
return getActiveDisplayPlugin()->getTrueMousePosition();
}
glm::quat Application::getHeadOrientation() const {
return getActiveDisplayPlugin()->headOrientation();
}
glm::vec3 Application::getHeadPosition() const {
return getActiveDisplayPlugin()->headTranslation();
}
int Application::getTrueMouseX() const {
return getActiveRenderPlugin()->getTrueMousePosition().x;
return getActiveDisplayPlugin()->getTrueMousePosition().x;
}
int Application::getTrueMouseY() const {
return getActiveRenderPlugin()->getTrueMousePosition().y;
return getActiveDisplayPlugin()->getTrueMousePosition().y;
}
bool Application::isThrottleRendering() const {
return getActiveRenderPlugin()->isThrottled();
return getActiveDisplayPlugin()->isThrottled();
}
#include "plugins/render/NullRenderPlugin.h"
#include "plugins/render/WindowRenderPlugin.h"
#include "plugins/render/LegacyRenderPlugin.h"
static RenderPlugin * renderPlugin = nullptr;
using DisplayPluginPointer = QSharedPointer<DisplayPlugin>;
RenderPlugin * Application::getActiveRenderPlugin() {
if (nullptr == renderPlugin) {
//renderPlugin = new WindowRenderPlugin();
renderPlugin = new LegacyRenderPlugin();
renderPlugin->init();
renderPlugin->activate();
connect(renderPlugin, &RenderPlugin::requestRender, this, [&] {
this->paintGL();
});
connect(renderPlugin, &RenderPlugin::recommendedFramebufferSizeChanged, this, [&](const QSize & size) {
DependencyManager::get<TextureCache>()->setFrameBufferSize(size * getRenderResolutionScale());
this->resizeGL(size.width(), size.height());
});
#include "plugins/render/NullDisplayPlugin.h"
#include "plugins/render/WindowDisplayPlugin.h"
#include "plugins/render/LegacyDisplayPlugin.h"
#include "plugins/render/OculusDirectD3DDisplayPlugin.h"
static DisplayPluginPointer _displayPlugin{ nullptr };
DisplayPlugin * Application::getActiveDisplayPlugin() {
if (nullptr == _displayPlugin) {
updateDisplayMode();
Q_ASSERT(_displayPlugin);
}
return _displayPlugin.data();
}
const DisplayPlugin * Application::getActiveDisplayPlugin() const {
return ((Application*)this)->getActiveDisplayPlugin();
}
/*
QAction* action = NULL;
QAction* actionBefore = NULL;
if (menuItemLocation >= 0 && destinationMenu->actions().size() > menuItemLocation) {
actionBefore = destinationMenu->actions()[menuItemLocation];
}
if (!actionBefore) {
if (receiver && member) {
action = destinationMenu->addAction(actionName, receiver, member, shortcut);
} else {
action = destinationMenu->addAction(actionName);
action->setShortcut(shortcut);
}
} else {
action = new QAction(actionName, destinationMenu);
action->setShortcut(shortcut);
destinationMenu->insertAction(actionBefore, action);
if (receiver && member) {
connect(action, SIGNAL(triggered()), receiver, member);
}
}
action->setMenuRole(role);
*/
static void addDisplayPluginToMenu(DisplayPluginPointer displayPlugin, bool active = false) {
auto menu = Menu::getInstance();
MenuItemProperties item(MenuOption::OutputMenu, displayPlugin->getName(), "", true, active);
item.isSeparator = false;
Q_ASSERT(!menu->menuItemExists(MenuOption::OutputMenu, item.menuItemName));
menu->addMenuItem(item);
Q_ASSERT(menu->menuItemExists(MenuOption::OutputMenu, item.menuItemName));
}
using DisplayPluginList = QVector<DisplayPluginPointer>;
// FIXME move to a plugin manager class
static const DisplayPluginList & getDisplayPlugins() {
static DisplayPluginList RENDER_PLUGINS;
static bool init = false;
if (!init) {
DisplayPluginPointer displayPlugin = DisplayPluginPointer(new LegacyDisplayPlugin()); // new WindowDisplayPlugin();
if (displayPlugin->isSupported()) {
displayPlugin->init();
RENDER_PLUGINS.push_back(DisplayPluginPointer(displayPlugin));
QObject::connect(displayPlugin.data(), &DisplayPlugin::requestRender, [] {
qApp->paintGL();
});
QObject::connect(displayPlugin.data(), &DisplayPlugin::recommendedFramebufferSizeChanged, [](const QSize & size) {
DependencyManager::get<TextureCache>()->setFrameBufferSize(size * qApp->getRenderResolutionScale());
qApp->resizeGL(size.width(), size.height());
});
addDisplayPluginToMenu(displayPlugin, true);
}
displayPlugin = DisplayPluginPointer(new NullDisplayPlugin());
if (displayPlugin->isSupported()) {
#ifdef DEBUG
addDisplayPluginToMenu(displayPlugin);
#endif
displayPlugin->init();
RENDER_PLUGINS.push_back(DisplayPluginPointer(displayPlugin));
}
}
return RENDER_PLUGINS;
}
void Application::updateDisplayMode() {
auto menu = Menu::getInstance();
DisplayPluginPointer newDisplayPlugin;
foreach(DisplayPluginPointer displayPlugin, getDisplayPlugins()) {
QString name = displayPlugin->getName();
QAction* action = menu->getActionForOption(name);
if (action->isChecked()) {
newDisplayPlugin = displayPlugin;
break;
}
}
if (_displayPlugin != newDisplayPlugin) {
if (_displayPlugin) {
_displayPlugin->deactivate();
}
_offscreenContext->makeCurrent();
_displayPlugin = newDisplayPlugin;
if (_displayPlugin) {
_displayPlugin->activate();
}
_offscreenContext->makeCurrent();
}
return renderPlugin;
}
const RenderPlugin * Application::getActiveRenderPlugin() const {
return ((Application*)this)->getActiveRenderPlugin();
Q_ASSERT_X(_displayPlugin, "Application::updateDisplayMode", "could not find an activated display plugin");
}

View file

@ -75,7 +75,7 @@
#include "octree/OctreePacketProcessor.h"
#include "UndoStackScriptingInterface.h"
class RenderPlugin;
class DisplayPlugin;
class QGLWidget;
class QKeyEvent;
class QMouseEvent;
@ -184,7 +184,7 @@ public:
bool event(QEvent* event);
bool eventFilter(QObject* object, QEvent* event);
glm::ivec2 getCanvasSize() const;
glm::uvec2 getCanvasSize() const;
QSize getDeviceSize() const;
bool hasFocus() const;
PickRay computePickRay() const;
@ -217,6 +217,7 @@ public:
bool mouseOnScreen() const;
int getMouseX() const;
int getMouseY() const;
glm::ivec2 getTrueMousePosition() const;
int getTrueMouseX() const;
int getTrueMouseY() const;
int getMouseDragStartedX() const;
@ -290,8 +291,11 @@ public:
virtual int getBoundaryLevelAdjust() const;
virtual PickRay computePickRay(float x, float y) const;
virtual const glm::vec3& getAvatarPosition() const { return _myAvatar->getPosition(); }
RenderPlugin * getActiveRenderPlugin();
const RenderPlugin * getActiveRenderPlugin() const;
private:
DisplayPlugin * getActiveDisplayPlugin();
const DisplayPlugin * getActiveDisplayPlugin() const;
public:
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
@ -320,7 +324,9 @@ public:
// rendering of several elements depend on that
// TODO: carry that information on the Camera as a setting
bool isHMDMode() const;
glm::quat getHeadOrientation() const;
glm::vec3 getHeadPosition() const;
QRect getDesirableApplicationGeometry();
RunningScriptsWidget* getRunningScriptsWidget() { return _runningScriptsWidget; }
@ -366,6 +372,7 @@ public slots:
void nodeAdded(SharedNodePointer node);
void nodeKilled(SharedNodePointer node);
void packetSent(quint64 length);
void updateDisplayMode();
QVector<EntityItemID> pasteEntities(float x, float y, float z);
bool exportEntities(const QString& filename, const QVector<EntityItemID>& entityIDs);

View file

@ -233,6 +233,11 @@ Menu::Menu() {
avatar, SLOT(updateMotionBehavior()));
MenuWrapper* viewMenu = addMenu("View");
{
MenuWrapper* displayModeMenu = addMenu(MenuOption::OutputMenu);
QActionGroup* displayModeGroup = new QActionGroup(displayModeMenu);
displayModeGroup->setExclusive(true);
}
addCheckableActionToQMenuAndActionHash(viewMenu,
MenuOption::Fullscreen,
@ -265,16 +270,9 @@ Menu::Menu() {
dialogsManager.data(),
SLOT(hmdTools(bool)));
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::EnableVRMode, 0,
false,
qApp,
SLOT(setEnableVRMode(bool)));
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Enable3DTVMode, 0,
false,
qApp,
SLOT(setEnable3DTVMode(bool)));
addActionToQMenuAndActionHash(editMenu, MenuOption::Attachments, 0,
dialogsManager.data(), SLOT(editAttachments()));
MenuWrapper* nodeBordersMenu = viewMenu->addMenu("Server Borders");
NodeBounds& nodeBounds = qApp->getNodeBoundsDisplay();

View file

@ -181,8 +181,7 @@ namespace MenuOption {
const QString EditEntitiesHelp = "Edit Entities Help...";
const QString Enable3DTVMode = "Enable 3DTV Mode";
const QString EnableCharacterController = "Enable avatar collisions";
const QString EnableGlowEffect = "Enable Glow Effect (Warning: Poor Oculus Performance)";
const QString EnableVRMode = "Enable VR Mode";
const QString EnableGlowEffect = "Enable Glow Effect";
const QString ExpandMyAvatarSimulateTiming = "Expand /myAvatar/simulation";
const QString ExpandMyAvatarTiming = "Expand /myAvatar";
const QString ExpandOtherAvatarTiming = "Expand /otherAvatar";
@ -215,6 +214,7 @@ namespace MenuOption {
const QString OctreeStats = "Entity Statistics";
const QString OffAxisProjection = "Off-Axis Projection";
const QString OnlyDisplayTopTen = "Only Display Top Ten";
const QString OutputMenu = "View>Display Mode";
const QString PackageModel = "Package Model...";
const QString Pair = "Pair";
const QString PhysicsShowOwned = "Highlight Simulation Ownership";

View file

@ -34,7 +34,7 @@
#include <UserActivityLogger.h>
#include "Application.h"
#include "plugins/render/RenderPlugin.h"
#include "plugins/render/DisplayPlugin.h"
#include "AvatarManager.h"
#include "Environment.h"
#include "Menu.h"
@ -231,15 +231,14 @@ void MyAvatar::simulate(float deltaTime) {
void MyAvatar::updateFromTrackers(float deltaTime) {
glm::vec3 estimatedPosition, estimatedRotation;
auto renderPlugin = qApp->getActiveRenderPlugin();
bool inHmd = renderPlugin->isHmd();
bool inHmd = qApp->isHMDMode();
if (isPlaying() && inHmd) {
return;
}
if (inHmd) {
estimatedPosition = renderPlugin->headTranslation();
estimatedPosition = qApp->getHeadPosition();
estimatedPosition.x *= -1.0f;
_trackedHeadPosition = estimatedPosition;
@ -886,15 +885,13 @@ void MyAvatar::updateLookAtTargetAvatar() {
howManyLookingAtMe++;
// Have that avatar look directly at my camera
// Philip TODO: correct to look at left/right eye
#if 0
if (OculusManager::isConnected()) {
avatar->getHead()->setCorrectedLookAtPosition(OculusManager::getLeftEyePosition());
} else {
#endif
if (qApp->isHMDMode()) {
avatar->getHead()->setCorrectedLookAtPosition(Application::getInstance()->getViewFrustum()->getPosition());
// FIXME what is the point of this?
// avatar->getHead()->setCorrectedLookAtPosition(OculusManager::getLeftEyePosition());
} else {
avatar->getHead()->setCorrectedLookAtPosition(Application::getInstance()->getViewFrustum()->getPosition());
#if 0
}
#endif
} else {
avatar->getHead()->clearCorrectedLookAtPosition();
}
@ -1185,8 +1182,7 @@ void MyAvatar::renderBody(ViewFrustum* renderFrustum, RenderArgs::RenderMode ren
renderFrustum->setNearClip(DEFAULT_NEAR_CLIP);
} else {
float clipDistance = _skeletonModel.getHeadClipDistance();
#if 0
if (OculusManager::isConnected()) {
if (qApp->isHMDMode()) {
// If avatar is horizontally in front of camera, increase clip distance by the amount it is in front.
glm::vec3 cameraToAvatar = _position - cameraPos;
cameraToAvatar.y = 0.0f;
@ -1196,7 +1192,6 @@ void MyAvatar::renderBody(ViewFrustum* renderFrustum, RenderArgs::RenderMode ren
clipDistance += headOffset;
}
}
#endif
renderFrustum->setNearClip(clipDistance);
}
}
@ -1231,13 +1226,11 @@ void MyAvatar::updateOrientation(float deltaTime) {
// Gather rotation information from keyboard
const float TIME_BETWEEN_HMD_TURNS = 0.5f;
const float HMD_TURN_DEGREES = 22.5f;
#if 0
if (!OculusManager::isConnected()) {
if (!qApp->isHMDMode()) {
// Smoothly rotate body with arrow keys if not in HMD
_bodyYawDelta -= _driveKeys[ROT_RIGHT] * YAW_SPEED * deltaTime;
_bodyYawDelta += _driveKeys[ROT_LEFT] * YAW_SPEED * deltaTime;
} else {
#endif
// Jump turns if in HMD
if (_driveKeys[ROT_RIGHT] || _driveKeys[ROT_LEFT]) {
if (_turningKeyPressTime == 0.0f) {
@ -1251,9 +1244,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
} else {
_turningKeyPressTime = 0.0f;
}
#if 0
}
#endif
getHead()->setBasePitch(getHead()->getBasePitch() + (_driveKeys[ROT_UP] - _driveKeys[ROT_DOWN]) * PITCH_SPEED * deltaTime);
// update body orientation by movement inputs
@ -1269,30 +1260,23 @@ void MyAvatar::updateOrientation(float deltaTime) {
float MINIMUM_ROTATION_RATE = 2.0f;
if (fabs(_bodyYawDelta) < MINIMUM_ROTATION_RATE) { _bodyYawDelta = 0.0f; }
#if 0
if (OculusManager::isConnected()) {
if (qApp->isHMDMode()) {
// these angles will be in radians
float yaw, pitch, roll;
OculusManager::getEulerAngles(yaw, pitch, roll);
glm::quat orientation = qApp->getHeadOrientation();
// ... so they need to be converted to degrees before we do math...
yaw *= DEGREES_PER_RADIAN;
pitch *= DEGREES_PER_RADIAN;
roll *= DEGREES_PER_RADIAN;
glm::vec3 euler = glm::eulerAngles(orientation) * DEGREES_PER_RADIAN;
//Invert yaw and roll when in mirror mode
Head* head = getHead();
if (Application::getInstance()->getCamera()->getMode() == CAMERA_MODE_MIRROR) {
head->setBaseYaw(-yaw);
head->setBasePitch(pitch);
head->setBaseRoll(-roll);
} else {
head->setBaseYaw(yaw);
head->setBasePitch(pitch);
head->setBaseRoll(roll);
YAW(euler) *= -1.0;
ROLL(euler) *= -1.0;
}
Head* head = getHead();
head->setBaseYaw(YAW(euler));
head->setBasePitch(PITCH(euler));
head->setBaseRoll(ROLL(euler));
}
#endif
}
glm::vec3 MyAvatar::applyKeyboardMotor(float deltaTime, const glm::vec3& localVelocity, bool isHovering) {

View file

@ -1,12 +1,12 @@
#pragma once
#include "plugins/Plugin.h"
#include "plugins/render/RenderPlugin.h"
#include "plugins/render/DisplayPlugin.h"
#include <QList>
#include <QSharedPointer>
class PluginManager : public QObject {
public:
static PluginManager * getInstance();
const QList<QSharedPointer<RenderPlugin>> getRenderPlugins();
const QList<QSharedPointer<DisplayPlugin>> getDisplayPlugins();
};

View file

@ -1,5 +1,5 @@
//
// RenderPlugin.cpp
// DisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,9 +7,9 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "RenderPlugin.h"
#include "DisplayPlugin.h"
bool RenderPlugin::isMouseOnScreen() const {
bool DisplayPlugin::isMouseOnScreen() const {
glm::ivec2 mousePosition = getTrueMousePosition();
return (glm::all(glm::greaterThanEqual(mousePosition, glm::ivec2(0))) &&
glm::all(glm::lessThanEqual(mousePosition, glm::ivec2(getCanvasSize()))));

View file

@ -1,5 +1,5 @@
//
// RenderPlugin.h
// DisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -19,7 +19,7 @@
#include <glm/gtc/quaternion.hpp>
#include <RegisteredMetaTypes.h>
class RenderPlugin : public Plugin {
class DisplayPlugin : public Plugin {
Q_OBJECT
public:
virtual bool isHmd() const { return false; }

View file

@ -1,5 +1,5 @@
//
// HmdRenderPlugin.cpp
// HmdDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -8,4 +8,4 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "HmdRenderPlugin.h"
#include "HmdDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// HmdRenderPlugin.h
// HmdDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -8,8 +8,8 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#pragma once
#include "StereoRenderPlugin.h"
#include "StereoDisplayPlugin.h"
class HmdRenderPlugin : public StereoRenderPlugin {
class HmdDisplayPlugin : public StereoDisplayPlugin {
virtual bool isHmd() const final { return true; }
};

View file

@ -1,5 +1,5 @@
//
// LegacyRenderPlugin.cpp
// LegacyDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -8,19 +8,19 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "Application.h"
#include "LegacyRenderPlugin.h"
#include "LegacyDisplayPlugin.h"
#include "MainWindow.h"
#include <RenderUtil.h>
const QString LegacyRenderPlugin::NAME("LegacyRenderPlugin");
const QString LegacyDisplayPlugin::NAME("2D Monitor (GL Windgets)");
const QString & LegacyRenderPlugin::getName() {
const QString & LegacyDisplayPlugin::getName() {
return NAME;
}
static QWidget * oldWidget = nullptr;
void LegacyRenderPlugin::activate() {
void LegacyDisplayPlugin::activate() {
_window = new GLCanvas();
QGLFormat format(QGL::NoDepthBuffer | QGL::NoStencilBuffer);
_window->setContext(new QGLContext(format),
@ -37,7 +37,7 @@ void LegacyRenderPlugin::activate() {
_window->installEventFilter(DependencyManager::get<OffscreenUi>().data());
}
void LegacyRenderPlugin::deactivate() {
void LegacyDisplayPlugin::deactivate() {
_window->removeEventFilter(DependencyManager::get<OffscreenUi>().data());
_window->removeEventFilter(qApp);
qApp->getWindow()->setCentralWidget(oldWidget);
@ -48,38 +48,38 @@ void LegacyRenderPlugin::deactivate() {
_window = nullptr;
}
QSize LegacyRenderPlugin::getRecommendedFramebufferSize() const {
QSize LegacyDisplayPlugin::getRecommendedFramebufferSize() const {
return _window->getDeviceSize();
}
void LegacyRenderPlugin::makeCurrent() {
void LegacyDisplayPlugin::makeCurrent() {
_window->makeCurrent();
QSize windowSize = _window->size();
glViewport(0, 0, windowSize.width(), windowSize.height());
}
void LegacyRenderPlugin::doneCurrent() {
void LegacyDisplayPlugin::doneCurrent() {
_window->doneCurrent();
}
void LegacyRenderPlugin::swapBuffers() {
void LegacyDisplayPlugin::swapBuffers() {
_window->swapBuffers();
glFinish();
}
void LegacyRenderPlugin::idle() {
void LegacyDisplayPlugin::idle() {
_window->updateGL();
}
glm::ivec2 LegacyRenderPlugin::getCanvasSize() const {
glm::ivec2 LegacyDisplayPlugin::getCanvasSize() const {
return toGlm(_window->size());
}
bool LegacyRenderPlugin::hasFocus() const {
bool LegacyDisplayPlugin::hasFocus() const {
return _window->hasFocus();
}
PickRay LegacyRenderPlugin::computePickRay(const glm::vec2 & pos) const {
PickRay LegacyDisplayPlugin::computePickRay(const glm::vec2 & pos) const {
return PickRay();
}
@ -87,6 +87,6 @@ bool isMouseOnScreen() {
return false;
}
bool LegacyRenderPlugin::isThrottled() {
bool LegacyDisplayPlugin::isThrottled() {
return _window->isThrottleRendering();
}

View file

@ -1,5 +1,5 @@
//
// LegacyRenderPlugin.h
// LegacyDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,10 +9,10 @@
//
#pragma once
#include "SimpleRenderPlugin.h"
#include "SimpleDisplayPlugin.h"
#include "GLCanvas.h"
class LegacyRenderPlugin : public SimpleRenderPlugin<GLCanvas> {
class LegacyDisplayPlugin : public SimpleDisplayPlugin<GLCanvas> {
Q_OBJECT
public:
static const QString NAME;

View file

@ -0,0 +1,44 @@
//
// NullDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 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 "NullDisplayPlugin.h"
const QString NullDisplayPlugin::NAME("NullDisplayPlugin");
const QString & NullDisplayPlugin::getName() {
return NAME;
}
QSize NullDisplayPlugin::getRecommendedFramebufferSize() const {
return QSize(100, 100);
}
glm::ivec2 NullDisplayPlugin::getCanvasSize() const {
return glm::ivec2(100, 100);
}
bool NullDisplayPlugin::hasFocus() const {
return false;
}
glm::ivec2 NullDisplayPlugin::getRelativeMousePosition() const {
return glm::ivec2();
}
glm::ivec2 NullDisplayPlugin::getTrueMousePosition() const {
return glm::ivec2();
}
PickRay NullDisplayPlugin::computePickRay(const glm::vec2 & pos) const {
return PickRay();
}
bool NullDisplayPlugin::isMouseOnScreen() {
return false;
}

View file

@ -1,5 +1,5 @@
//
// NullRenderPlugin.h
// NullDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,13 +9,13 @@
//
#pragma once
#include "RenderPlugin.h"
#include "DisplayPlugin.h"
class NullRenderPlugin : public RenderPlugin {
class NullDisplayPlugin : public DisplayPlugin {
public:
static const QString NAME;
virtual ~NullRenderPlugin() final {}
virtual ~NullDisplayPlugin() final {}
virtual const QString & getName();
virtual QSize getRecommendedFramebufferSize() const;

View file

@ -1,44 +0,0 @@
//
// NullRenderPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 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 "NullRenderPlugin.h"
const QString NullRenderPlugin::NAME("NullRenderPlugin");
const QString & NullRenderPlugin::getName() {
return NAME;
}
QSize NullRenderPlugin::getRecommendedFramebufferSize() const {
return QSize(100, 100);
}
glm::ivec2 NullRenderPlugin::getCanvasSize() const {
return glm::ivec2(100, 100);
}
bool NullRenderPlugin::hasFocus() const {
return false;
}
glm::ivec2 NullRenderPlugin::getRelativeMousePosition() const {
return glm::ivec2();
}
glm::ivec2 NullRenderPlugin::getTrueMousePosition() const {
return glm::ivec2();
}
PickRay NullRenderPlugin::computePickRay(const glm::vec2 & pos) const {
return PickRay();
}
bool NullRenderPlugin::isMouseOnScreen() {
return false;
}

View file

@ -1,5 +1,5 @@
//
// OculusBaseRenderPlugin.cpp
// OculusBaseDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,23 +7,23 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "OculusBaseRenderPlugin.h"
#include "OculusBaseDisplayPlugin.h"
#include <OVR_CAPI.h>
bool OculusBaseRenderPlugin::sdkInitialized = false;
bool OculusBaseDisplayPlugin::sdkInitialized = false;
bool OculusBaseRenderPlugin::enableSdk() {
bool OculusBaseDisplayPlugin::enableSdk() {
sdkInitialized = ovr_Initialize();
return sdkInitialized;
}
void OculusBaseRenderPlugin::disableSdk() {
void OculusBaseDisplayPlugin::disableSdk() {
ovr_Shutdown();
sdkInitialized = false;
}
void OculusBaseRenderPlugin::withSdkActive(std::function<void()> f) {
void OculusBaseDisplayPlugin::withSdkActive(std::function<void()> f) {
bool activateSdk = !sdkInitialized;
if (activateSdk && !enableSdk()) {
return;
@ -34,7 +34,7 @@ void OculusBaseRenderPlugin::withSdkActive(std::function<void()> f) {
}
}
bool OculusBaseRenderPlugin::isSupported() {
bool OculusBaseDisplayPlugin::isSupported() {
bool attached = false;
withSdkActive([&] {
attached = ovrHmd_Detect();
@ -42,11 +42,11 @@ bool OculusBaseRenderPlugin::isSupported() {
return attached;
}
void OculusBaseRenderPlugin::activate() {
void OculusBaseDisplayPlugin::activate() {
enableSdk();
}
void OculusBaseRenderPlugin::deactivate() {
void OculusBaseDisplayPlugin::deactivate() {
disableSdk();
}

View file

@ -1,5 +1,5 @@
//
// OculusBaseRenderPlugin.h
// OculusBaseDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,10 +9,10 @@
//
#pragma once
#include "HmdRenderPlugin.h"
#include "HmdDisplayPlugin.h"
#include <functional>
class OculusBaseRenderPlugin : public HmdRenderPlugin {
class OculusBaseDisplayPlugin : public HmdDisplayPlugin {
public:
virtual bool isSupported();

View file

@ -1,5 +1,5 @@
//
// OculusExtendedRenderPlugin.cpp
// OculusDirectD3DDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,4 +7,4 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "OculusExtendedRenderPlugin.h"
#include "OculusDirectD3DDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// OculusDirectD3DRenderPlugin.h
// OculusDirectD3DDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,4 +9,4 @@
//
#pragma once
#include "OculusBaseRenderPlugin.h"
#include "OculusBaseDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// OculusDirectRenderPlugin.cpp
// OculusDirectDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,4 +7,4 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "OculusDirectRenderPlugin.h"
#include "OculusDirectDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// OculusDirectRenderPlugin.h
// OculusDirectDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,4 +9,4 @@
//
#pragma once
#include "OculusBaseRenderPlugin.h"
#include "OculusBaseDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// OculusDirectD3DRenderPlugin.cpp
// OculusExtendedDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,4 +7,4 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "OculusDirectD3DRenderPlugin.h"
#include "OculusExtendedDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// OculusExtendedRenderPlugin.h
// OculusExtendedDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,4 +9,4 @@
//
#pragma once
#include "OculusBaseRenderPlugin.h"
#include "OculusBaseDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// SimpleRenderPlugin.cpp
// SimpleDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,7 +7,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "SimpleRenderPlugin.h"
#include "SimpleDisplayPlugin.h"
#include <RenderUtil.h>
#include <QOpenGLContext>

View file

@ -1,5 +1,5 @@
//
// SimpleRenderPlugin.h
// SimpleDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,13 +9,13 @@
//
#pragma once
#include "RenderPlugin.h"
#include "DisplayPlugin.h"
#include <QOpenGLContext>
#include <GLMHelpers.h>
#include <RenderUtil.h>
template <typename T>
class SimpleRenderPlugin : public RenderPlugin {
class SimpleDisplayPlugin : public DisplayPlugin {
public:
virtual void render(int finalSceneTexture) {
makeCurrent();

View file

@ -1,5 +1,5 @@
//
// StereoRenderPlugin.cpp
// StereoDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,4 +7,4 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "StereoRenderPlugin.h"
#include "StereoDisplayPlugin.h"

View file

@ -1,5 +1,5 @@
//
// StereoRenderPlugin.h
// StereoDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,9 +9,9 @@
//
#pragma once
#include "RenderPlugin.h"
#include "DisplayPlugin.h"
class StereoRenderPlugin : public RenderPlugin {
class StereoDisplayPlugin : public DisplayPlugin {
virtual bool isStereo() const final { return true; }
};

View file

@ -1,5 +1,5 @@
//
// Tv3dRenderPlugin.cpp
// Tv3dDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -8,16 +8,16 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "Tv3dRenderPlugin.h"
#include "Tv3dDisplayPlugin.h"
const QString Tv3dRenderPlugin::NAME("Tv3dRenderPlugin");
const QString Tv3dDisplayPlugin::NAME("Tv3dDisplayPlugin");
const QString & Tv3dRenderPlugin::getName() {
const QString & Tv3dDisplayPlugin::getName() {
return NAME;
}
void Tv3dRenderPlugin::overrideOffAxisFrustum(
void Tv3dDisplayPlugin::overrideOffAxisFrustum(
float& left, float& right, float& bottom, float& top,
float& nearVal, float& farVal,
glm::vec4& nearClipPlane, glm::vec4& farClipPlane) const {

View file

@ -1,5 +1,5 @@
//
// Tv3dRenderPlugin.h
// Tv3dDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -10,9 +10,9 @@
#pragma once
#include "StereoRenderPlugin.h"
#include "StereoDisplayPlugin.h"
class Tv3dRenderPlugin : public StereoRenderPlugin {
class Tv3dDisplayPlugin : public StereoDisplayPlugin {
Q_OBJECT
public:
static const QString NAME;

View file

@ -1,5 +1,5 @@
//
// WindowRenderPlugin.cpp
// WindowDisplayPlugin.cpp
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -7,24 +7,24 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "WindowRenderPlugin.h"
#include "WindowDisplayPlugin.h"
#include "RenderUtil.h"
#include <QCoreApplication>
WindowRenderPlugin::WindowRenderPlugin() {
WindowDisplayPlugin::WindowDisplayPlugin() {
connect(&_timer, &QTimer::timeout, this, [&] {
emit requestRender();
});
}
const QString WindowRenderPlugin::NAME("WindowRenderPlugin");
const QString WindowDisplayPlugin::NAME("WindowDisplayPlugin");
const QString & WindowRenderPlugin::getName() {
const QString & WindowDisplayPlugin::getName() {
return NAME;
}
void WindowRenderPlugin::activate() {
void WindowDisplayPlugin::activate() {
Q_ASSERT(nullptr == _window);
_context = new QOpenGLContext;
@ -52,7 +52,7 @@ void WindowRenderPlugin::activate() {
_timer.start(8);
}
void WindowRenderPlugin::deactivate() {
void WindowDisplayPlugin::deactivate() {
_timer.stop();
_context->doneCurrent();
_context->deleteLater();
@ -62,7 +62,7 @@ void WindowRenderPlugin::deactivate() {
_window = nullptr;
}
bool WindowRenderPlugin::eventFilter(QObject* object, QEvent* event) {
bool WindowDisplayPlugin::eventFilter(QObject* object, QEvent* event) {
switch (event->type()) {
case QEvent::MouseButtonPress:
case QEvent::MouseButtonRelease:
@ -80,21 +80,21 @@ bool WindowRenderPlugin::eventFilter(QObject* object, QEvent* event) {
return false;
}
QSize WindowRenderPlugin::getRecommendedFramebufferSize() const {
QSize WindowDisplayPlugin::getRecommendedFramebufferSize() const {
return _window->size();
}
void WindowRenderPlugin::makeCurrent() {
void WindowDisplayPlugin::makeCurrent() {
_context->makeCurrent(_window);
QSize windowSize = _window->size();
glViewport(0, 0, windowSize.width(), windowSize.height());
}
void WindowRenderPlugin::doneCurrent() {
void WindowDisplayPlugin::doneCurrent() {
_context->doneCurrent();
}
void WindowRenderPlugin::swapBuffers() {
void WindowDisplayPlugin::swapBuffers() {
_context->swapBuffers(_window);
}

View file

@ -1,5 +1,5 @@
//
// WindowRenderPlugin.h
// WindowDisplayPlugin.h
//
// Created by Bradley Austin Davis on 2014/04/13.
// Copyright 2015 High Fidelity, Inc.
@ -9,18 +9,18 @@
//
#pragma once
#include "SimpleRenderPlugin.h"
#include "SimpleDisplayPlugin.h"
#include <QWindow>
#include <QOpenGLContext>
#include <QTimer>
class WindowRenderPlugin : public SimpleRenderPlugin<QWindow> {
class WindowDisplayPlugin : public SimpleDisplayPlugin<QWindow> {
Q_OBJECT
public:
static const QString NAME;
WindowRenderPlugin();
WindowDisplayPlugin();
virtual const QString & getName();

View file

@ -27,7 +27,7 @@
#include "Application.h"
#include "ApplicationOverlay.h"
#include "devices/OculusManager.h"
#include "plugins/render/RenderPlugin.h"
#include "plugins/render/DisplayPlugin.h"
#include "Util.h"
#include "ui/Stats.h"
@ -478,7 +478,7 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
glm::vec3 tipPos = invOrientation * (tip - eyePos);
QPoint rv;
if (qApp->getActiveRenderPlugin()->isHmd()) {
if (qApp->isHMDMode()) {
float t;
//We back the ray up by dir to ensure that it will not start inside the UI.
@ -496,7 +496,7 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
float u = asin(collisionPos.x) / (_textureFov)+0.5f;
float v = 1.0 - (asin(collisionPos.y) / (_textureFov)+0.5f);
auto size = qApp->getActiveRenderPlugin()->getCanvasSize();
auto size = qApp->getCanvasSize();
rv.setX(u * size.x);
rv.setY(v * size.y);
@ -553,8 +553,8 @@ void ApplicationOverlay::renderPointers() {
glActiveTexture(GL_TEXTURE0);
_crosshairTexture->bind();
if (qApp->getActiveRenderPlugin()->isHmd() && !qApp->getLastMouseMoveWasSimulated() && !qApp->isMouseHidden()) {
glm::ivec2 trueMouse = qApp->getActiveRenderPlugin()->getTrueMousePosition();
if (qApp->isHMDMode() && !qApp->getLastMouseMoveWasSimulated() && !qApp->isMouseHidden()) {
glm::ivec2 trueMouse = qApp->getTrueMousePosition();
//If we are in oculus, render reticle later
if (_lastMouseMove == 0) {
_lastMouseMove = usecTimestampNow();
@ -966,7 +966,7 @@ void ApplicationOverlay::renderStatsAndLogs() {
(Menu::getInstance()->isOptionChecked(MenuOption::Stats))
? 80 : 20;
auto size = qApp->getActiveRenderPlugin()->getCanvasSize();
auto size = qApp->getCanvasSize();
// auto glCanvas = Application::getInstance()->getGLWidget();
drawText(size.x - 100, size.y - timerBottom,
0.30f, 0.0f, 0, frameTimer.toUtf8().constData(), WHITE_TEXT);

View file

@ -23,7 +23,8 @@ MenuItemProperties::MenuItemProperties() :
beforeItem(""),
afterItem(""),
isCheckable(false),
isChecked(false)
isChecked(false),
isSeparator(false)
{
};
@ -38,7 +39,8 @@ MenuItemProperties::MenuItemProperties(const QString& menuName, const QString& m
beforeItem(""),
afterItem(""),
isCheckable(checkable),
isChecked(checked)
isChecked(checked),
isSeparator(false)
{
}
@ -53,7 +55,8 @@ MenuItemProperties::MenuItemProperties(const QString& menuName, const QString& m
beforeItem(""),
afterItem(""),
isCheckable(checkable),
isChecked(checked)
isChecked(checked),
isSeparator(false)
{
}

View file

@ -117,4 +117,8 @@ QMatrix4x4 fromGlm(const glm::mat4 & m);
QRectF glmToRect(const glm::vec2 & pos, const glm::vec2 & size);
#define YAW(euler) euler.y
#define PITCH(euler) euler.x
#define ROLL(euler) euler.z
#endif // hifi_GLMHelpers_h