Merge branch 'master' of github.com:highfidelity/hifi

This commit is contained in:
Stephen Birarda 2015-02-25 17:49:02 -08:00
commit 53f265bca2
42 changed files with 104 additions and 141 deletions

View file

@ -215,7 +215,6 @@ bool setupEssentials(int& argc, char** argv) {
DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>(); DependencyManager::registerInheritance<AvatarHashMap, AvatarManager>();
// Set dependencies // Set dependencies
auto glCanvas = DependencyManager::set<GLCanvas>();
auto addressManager = DependencyManager::set<AddressManager>(); auto addressManager = DependencyManager::set<AddressManager>();
auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, listenPort); auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, listenPort);
auto geometryCache = DependencyManager::set<GeometryCache>(); auto geometryCache = DependencyManager::set<GeometryCache>();
@ -307,7 +306,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us Model::setAbstractViewStateInterface(this); // The model class will sometimes need to know view state details from us
auto glCanvas = DependencyManager::get<GLCanvas>();
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
_myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); _myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
@ -447,16 +445,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
ResourceCache::setRequestLimit(3); ResourceCache::setRequestLimit(3);
_window->setCentralWidget(glCanvas.data()); _window->setCentralWidget(_glWidget);
_window->restoreGeometry(); _window->restoreGeometry();
_window->setVisible(true); _window->setVisible(true);
glCanvas->setFocusPolicy(Qt::StrongFocus); _glWidget->setFocusPolicy(Qt::StrongFocus);
glCanvas->setFocus(); _glWidget->setFocus();
// enable mouse tracking; otherwise, we only get drag events // enable mouse tracking; otherwise, we only get drag events
glCanvas->setMouseTracking(true); _glWidget->setMouseTracking(true);
_toolWindow = new ToolWindow(); _toolWindow = new ToolWindow();
_toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint); _toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
@ -474,7 +472,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
checkVersion(); checkVersion();
_overlays.init(glCanvas.data()); // do this before scripts load _overlays.init(); // do this before scripts load
_runningScriptsWidget->setRunningScripts(getRunningScripts()); _runningScriptsWidget->setRunningScripts(getRunningScripts());
connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript); connect(_runningScriptsWidget, &RunningScriptsWidget::stopScriptName, this, &Application::stopScript);
@ -533,7 +531,7 @@ void Application::aboutToQuit() {
} }
void Application::cleanupBeforeQuit() { void Application::cleanupBeforeQuit() {
_datagramProcessor.shutdown(); // tell the datagram processor we're shutting down, so it can short circuit
_entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts _entities.shutdown(); // tell the entities system we're shutting down, so it will stop running scripts
ScriptEngine::stopAllScripts(this); // stop all currently running global scripts ScriptEngine::stopAllScripts(this); // stop all currently running global scripts
@ -584,8 +582,6 @@ Application::~Application() {
_entities.getTree()->setSimulation(NULL); _entities.getTree()->setSimulation(NULL);
tree->unlock(); tree->unlock();
qInstallMessageHandler(NULL);
// ask the datagram processing thread to quit and wait until it is done // ask the datagram processing thread to quit and wait until it is done
_nodeThread->quit(); _nodeThread->quit();
_nodeThread->wait(); _nodeThread->wait();
@ -599,13 +595,13 @@ Application::~Application() {
ModelEntityItem::cleanupLoadedAnimations() ; ModelEntityItem::cleanupLoadedAnimations() ;
DependencyManager::destroy<GLCanvas>();
DependencyManager::destroy<AnimationCache>(); DependencyManager::destroy<AnimationCache>();
DependencyManager::destroy<TextureCache>(); DependencyManager::destroy<TextureCache>();
DependencyManager::destroy<GeometryCache>(); DependencyManager::destroy<GeometryCache>();
DependencyManager::destroy<ScriptCache>(); DependencyManager::destroy<ScriptCache>();
DependencyManager::destroy<SoundCache>(); DependencyManager::destroy<SoundCache>();
qInstallMessageHandler(NULL); // NOTE: Do this as late as possible so we continue to get our log messages
} }
void Application::initializeGL() { void Application::initializeGL() {
@ -690,7 +686,7 @@ void Application::paintGL() {
if (OculusManager::isConnected()) { if (OculusManager::isConnected()) {
DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize()); DependencyManager::get<TextureCache>()->setFrameBufferSize(OculusManager::getRenderTargetSize());
} else { } else {
QSize fbSize = DependencyManager::get<GLCanvas>()->getDeviceSize() * getRenderResolutionScale(); QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize); DependencyManager::get<TextureCache>()->setFrameBufferSize(fbSize);
} }
@ -1057,8 +1053,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (isShifted) { if (isShifted) {
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f); _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() - 0.1f);
if (TV3DManager::isConnected()) { if (TV3DManager::isConnected()) {
auto glCanvas = DependencyManager::get<GLCanvas>(); TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
} }
} else { } else {
_myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0)); _myCamera.setEyeOffsetPosition(_myCamera.getEyeOffsetPosition() + glm::vec3(-0.001, 0, 0));
@ -1070,8 +1065,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
if (isShifted) { if (isShifted) {
_viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f); _viewFrustum.setFocalLength(_viewFrustum.getFocalLength() + 0.1f);
if (TV3DManager::isConnected()) { if (TV3DManager::isConnected()) {
auto glCanvas = DependencyManager::get<GLCanvas>(); TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
} }
} else { } else {
@ -1500,7 +1494,7 @@ void Application::idle() {
{ {
PerformanceTimer perfTimer("updateGL"); PerformanceTimer perfTimer("updateGL");
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()"); PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
DependencyManager::get<GLCanvas>()->updateGL(); _glWidget->updateGL();
} }
{ {
PerformanceTimer perfTimer("rest"); PerformanceTimer perfTimer("rest");
@ -1541,8 +1535,7 @@ void Application::setFullscreen(bool fullscreen) {
} }
void Application::setEnable3DTVMode(bool enable3DTVMode) { void Application::setEnable3DTVMode(bool enable3DTVMode) {
auto glCanvas = DependencyManager::get<GLCanvas>(); resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
} }
void Application::setEnableVRMode(bool enableVRMode) { void Application::setEnableVRMode(bool enableVRMode) {
@ -1567,8 +1560,7 @@ void Application::setEnableVRMode(bool enableVRMode) {
_myCamera.setHmdRotation(glm::quat()); _myCamera.setHmdRotation(glm::quat());
} }
auto glCanvas = DependencyManager::get<GLCanvas>(); resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
updateCursorVisibility(); updateCursorVisibility();
} }
@ -1579,9 +1571,8 @@ void Application::setLowVelocityFilter(bool lowVelocityFilter) {
bool Application::mouseOnScreen() const { bool Application::mouseOnScreen() const {
if (OculusManager::isConnected()) { if (OculusManager::isConnected()) {
auto glCanvas = DependencyManager::get<GLCanvas>(); return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() &&
return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() && getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight();
getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight();
} }
return true; return true;
} }
@ -1791,8 +1782,7 @@ void Application::init() {
_metavoxels.init(); _metavoxels.init();
auto glCanvas = DependencyManager::get<GLCanvas>(); _rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect);
_rearMirrorTools = new RearMirrorTools(glCanvas.data(), _mirrorViewRect);
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView())); connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView())); connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
@ -1800,10 +1790,10 @@ void Application::init() {
connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors())); connect(_rearMirrorTools, SIGNAL(resetView()), SLOT(resetSensors()));
// make sure our texture cache knows about window size changes // make sure our texture cache knows about window size changes
DependencyManager::get<TextureCache>()->associateWithWidget(glCanvas.data()); DependencyManager::get<TextureCache>()->associateWithWidget(_glWidget);
// initialize the GlowEffect with our widget // initialize the GlowEffect with our widget
DependencyManager::get<GlowEffect>()->init(glCanvas.data(), DependencyManager::get<GlowEffect>()->init(_glWidget,
Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect)); Menu::getInstance()->isOptionChecked(MenuOption::EnableGlowEffect));
} }
@ -2057,9 +2047,9 @@ void Application::updateCursor(float deltaTime) {
void Application::updateCursorVisibility() { void Application::updateCursorVisibility() {
if (!_cursorVisible || Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) { if (!_cursorVisible || Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
DependencyManager::get<GLCanvas>()->setCursor(Qt::BlankCursor); _glWidget->setCursor(Qt::BlankCursor);
} else { } else {
DependencyManager::get<GLCanvas>()->unsetCursor(); _glWidget->unsetCursor();
} }
} }
@ -2649,8 +2639,7 @@ void Application::updateShadowMap() {
fbo->release(); fbo->release();
auto glCanvas = DependencyManager::get<GLCanvas>(); glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
} }
const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f }; const GLfloat WORLD_AMBIENT_COLOR[] = { 0.525f, 0.525f, 0.6f };
@ -2700,7 +2689,7 @@ QImage Application::renderAvatarBillboard() {
Glower glower; Glower glower;
const int BILLBOARD_SIZE = 64; const int BILLBOARD_SIZE = 64;
renderRearViewMirror(QRect(0, DependencyManager::get<GLCanvas>()->getDeviceHeight() - BILLBOARD_SIZE, renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE,
BILLBOARD_SIZE, BILLBOARD_SIZE), BILLBOARD_SIZE, BILLBOARD_SIZE),
true); true);
@ -2992,9 +2981,8 @@ bool Application::getCascadeShadowsEnabled() {
} }
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) { glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
auto glCanvas = DependencyManager::get<GLCanvas>(); float horizontalScale = _glWidget->getDeviceWidth() / 2.0f;
float horizontalScale = glCanvas->getDeviceWidth() / 2.0f; float verticalScale = _glWidget->getDeviceHeight() / 2.0f;
float verticalScale = glCanvas->getDeviceHeight() / 2.0f;
// -1,-1 is 0,windowHeight // -1,-1 is 0,windowHeight
// 1,1 is windowWidth,0 // 1,1 is windowWidth,0
@ -3013,7 +3001,7 @@ glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
// -1,-1 1,-1 // -1,-1 1,-1
glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale, glm::vec2 screenPoint((projectedPoint.x + 1.0) * horizontalScale,
((projectedPoint.y + 1.0) * -verticalScale) + glCanvas->getDeviceHeight()); ((projectedPoint.y + 1.0) * -verticalScale) + _glWidget->getDeviceHeight());
return screenPoint; return screenPoint;
} }
@ -3149,7 +3137,7 @@ void Application::resetSensors() {
QScreen* currentScreen = _window->windowHandle()->screen(); QScreen* currentScreen = _window->windowHandle()->screen();
QWindow* mainWindow = _window->windowHandle(); QWindow* mainWindow = _window->windowHandle();
QPoint windowCenter = mainWindow->geometry().center(); QPoint windowCenter = mainWindow->geometry().center();
DependencyManager::get<GLCanvas>()->cursor().setPos(currentScreen, windowCenter); _glWidget->cursor().setPos(currentScreen, windowCenter);
_myAvatar->reset(); _myAvatar->reset();
@ -3785,7 +3773,7 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio
void Application::loadDialog() { void Application::loadDialog() {
QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>().data(), QString fileNameString = QFileDialog::getOpenFileName(_glWidget,
tr("Open Script"), tr("Open Script"),
getPreviousScriptLocation(), getPreviousScriptLocation(),
tr("JavaScript Files (*.js)")); tr("JavaScript Files (*.js)"));
@ -3826,7 +3814,7 @@ void Application::setScriptsLocation(const QString& scriptsLocation) {
void Application::toggleLogDialog() { void Application::toggleLogDialog() {
if (! _logDialog) { if (! _logDialog) {
_logDialog = new LogDialog(DependencyManager::get<GLCanvas>().data(), getLogger()); _logDialog = new LogDialog(_glWidget, getLogger());
} }
if (_logDialog->isVisible()) { if (_logDialog->isVisible()) {
@ -3883,7 +3871,7 @@ void Application::parseVersionXml() {
} }
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) { if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
new UpdateDialog(DependencyManager::get<GLCanvas>().data(), releaseNotes, latestVersion, downloadUrl); new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
} }
sender->deleteLater(); sender->deleteLater();
} }
@ -3916,7 +3904,7 @@ void Application::takeSnapshot() {
} }
if (!_snapshotShareDialog) { if (!_snapshotShareDialog) {
_snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>().data()); _snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget);
} }
_snapshotShareDialog->show(); _snapshotShareDialog->show();
} }

View file

@ -171,7 +171,8 @@ public:
bool event(QEvent* event); bool event(QEvent* event);
bool eventFilter(QObject* object, QEvent* event); bool eventFilter(QObject* object, QEvent* event);
bool isThrottleRendering() const { return DependencyManager::get<GLCanvas>()->isThrottleRendering(); } GLCanvas* getGLWidget() { return _glWidget; }
bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); }
Camera* getCamera() { return &_myCamera; } Camera* getCamera() { return &_myCamera; }
ViewFrustum* getViewFrustum() { return &_viewFrustum; } ViewFrustum* getViewFrustum() { return &_viewFrustum; }
@ -195,8 +196,8 @@ public:
bool mouseOnScreen() const; bool mouseOnScreen() const;
int getMouseX() const; int getMouseX() const;
int getMouseY() const; int getMouseY() const;
int getTrueMouseX() const { return DependencyManager::get<GLCanvas>()->mapFromGlobal(QCursor::pos()).x(); } int getTrueMouseX() const { return _glWidget->mapFromGlobal(QCursor::pos()).x(); }
int getTrueMouseY() const { return DependencyManager::get<GLCanvas>()->mapFromGlobal(QCursor::pos()).y(); } int getTrueMouseY() const { return _glWidget->mapFromGlobal(QCursor::pos()).y(); }
int getMouseDragStartedX() const; int getMouseDragStartedX() const;
int getMouseDragStartedY() const; int getMouseDragStartedY() const;
int getTrueMouseDragStartedX() const { return _mouseDragStartedX; } int getTrueMouseDragStartedX() const { return _mouseDragStartedX; }
@ -270,8 +271,8 @@ public:
FileLogger* getLogger() { return _logger; } FileLogger* getLogger() { return _logger; }
glm::vec2 getViewportDimensions() const { return glm::vec2(DependencyManager::get<GLCanvas>()->getDeviceWidth(), glm::vec2 getViewportDimensions() const { return glm::vec2(_glWidget->getDeviceWidth(),
DependencyManager::get<GLCanvas>()->getDeviceHeight()); } _glWidget->getDeviceHeight()); }
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; } NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
void skipVersion(QString latestVersion); void skipVersion(QString latestVersion);
@ -593,6 +594,8 @@ private:
QThread _settingsThread; QThread _settingsThread;
QTimer _settingsTimer; QTimer _settingsTimer;
GLCanvas* _glWidget = new GLCanvas(); // our GLCanvas has a couple extra features
}; };
#endif // hifi_Application_h #endif // hifi_Application_h

View file

@ -122,7 +122,7 @@ void Camera::setFarClip(float f) {
} }
PickRay Camera::computePickRay(float x, float y) { PickRay Camera::computePickRay(float x, float y) {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height()); return computeViewPickRay(x / glCanvas->width(), y / glCanvas->height());
} }

View file

@ -30,6 +30,10 @@ DatagramProcessor::DatagramProcessor(QObject* parent) :
void DatagramProcessor::processDatagrams() { void DatagramProcessor::processDatagrams() {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
"DatagramProcessor::processDatagrams()"); "DatagramProcessor::processDatagrams()");
if (_isShuttingDown) {
return; // bail early... we're shutting down.
}
HifiSockAddr senderSockAddr; HifiSockAddr senderSockAddr;

View file

@ -25,14 +25,17 @@ public:
int getOutByteCount() const { return _outByteCount; } int getOutByteCount() const { return _outByteCount; }
void resetCounters() { _inPacketCount = 0; _outPacketCount = 0; _inByteCount = 0; _outByteCount = 0; } void resetCounters() { _inPacketCount = 0; _outPacketCount = 0; _inByteCount = 0; _outByteCount = 0; }
void shutdown() { _isShuttingDown = true; }
public slots: public slots:
void processDatagrams(); void processDatagrams();
private: private:
int _inPacketCount; int _inPacketCount = 0;
int _outPacketCount; int _outPacketCount = 0;
int _inByteCount; int _inByteCount = 0;
int _outByteCount; int _outByteCount = 0;
bool _isShuttingDown = false;
}; };
#endif // hifi_DatagramProcessor_h #endif // hifi_DatagramProcessor_h

View file

@ -16,14 +16,13 @@
#include <QGLWidget> #include <QGLWidget>
#include <QTimer> #include <QTimer>
#include <DependencyManager.h>
/// customized canvas that simply forwards requests/events to the singleton application /// customized canvas that simply forwards requests/events to the singleton application
class GLCanvas : public QGLWidget, public Dependency { class GLCanvas : public QGLWidget {
Q_OBJECT Q_OBJECT
SINGLETON_DEPENDENCY
public: public:
GLCanvas();
bool isThrottleRendering() const; bool isThrottleRendering() const;
int getDeviceWidth() const; int getDeviceWidth() const;
@ -60,12 +59,8 @@ private slots:
void activeChanged(Qt::ApplicationState state); void activeChanged(Qt::ApplicationState state);
void throttleRender(); void throttleRender();
bool eventFilter(QObject*, QEvent* event); bool eventFilter(QObject*, QEvent* event);
private:
GLCanvas();
~GLCanvas() {
qDebug() << "Deleting GLCanvas";
}
}; };
#endif // hifi_GLCanvas_h #endif // hifi_GLCanvas_h

View file

@ -12,7 +12,6 @@
#include <QStyle> #include <QStyle>
#include <QStyleOptionTitleBar> #include <QStyleOptionTitleBar>
#include "DependencyManager.h"
#include "GLCanvas.h" #include "GLCanvas.h"
#include "UIUtil.h" #include "UIUtil.h"
@ -44,8 +43,6 @@ int UIUtil::getWindowTitleBarHeight(const QWidget* window) {
// this function at all. If you mix both you will end up with inconsistent results // this function at all. If you mix both you will end up with inconsistent results
// across platforms. // across platforms.
void UIUtil::scaleWidgetFontSizes(QWidget* widget) { void UIUtil::scaleWidgetFontSizes(QWidget* widget) {
auto glCanvas = DependencyManager::get<GLCanvas>();
// This is the base dpi that we are targetting. This is based on Mac OSXs default DPI, // This is the base dpi that we are targetting. This is based on Mac OSXs default DPI,
// and is the basis for all font sizes. // and is the basis for all font sizes.
const float BASE_DPI = 72.0f; const float BASE_DPI = 72.0f;

View file

@ -16,6 +16,7 @@
#include <PathUtils.h> #include <PathUtils.h>
#include <GeometryCache.h> #include <GeometryCache.h>
#include "Application.h"
#include "AudioToolBox.h" #include "AudioToolBox.h"
// Mute icon configration // Mute icon configration
@ -37,7 +38,7 @@ bool AudioToolBox::mousePressEvent(int x, int y) {
void AudioToolBox::render(int x, int y, bool boxed) { void AudioToolBox::render(int x, int y, bool boxed) {
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
if (_micTextureId == 0) { if (_micTextureId == 0) {
_micTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic.svg")); _micTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/mic.svg"));
} }
@ -105,8 +106,12 @@ void AudioToolBox::render(int x, int y, bool boxed) {
glm::vec2 bottomRight(_iconBounds.right(), _iconBounds.bottom()); glm::vec2 bottomRight(_iconBounds.right(), _iconBounds.bottom());
glm::vec2 texCoordTopLeft(1,1); glm::vec2 texCoordTopLeft(1,1);
glm::vec2 texCoordBottomRight(0,0); glm::vec2 texCoordBottomRight(0,0);
if (_boxQuadID == GeometryCache::UNKNOWN_ID) {
_boxQuadID = DependencyManager::get<GeometryCache>()->allocateID();
}
DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor); DependencyManager::get<GeometryCache>()->renderQuad(topLeft, bottomRight, texCoordTopLeft, texCoordBottomRight, quadColor, _boxQuadID);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
} }

View file

@ -13,6 +13,7 @@
#define hifi_AudioToolBox_h #define hifi_AudioToolBox_h
#include <DependencyManager.h> #include <DependencyManager.h>
#include <GeometryCache.h>
class AudioToolBox : public Dependency { class AudioToolBox : public Dependency {
SINGLETON_DEPENDENCY SINGLETON_DEPENDENCY
@ -26,6 +27,7 @@ private:
GLuint _micTextureId = 0; GLuint _micTextureId = 0;
GLuint _muteTextureId = 0; GLuint _muteTextureId = 0;
GLuint _boxTextureId = 0; GLuint _boxTextureId = 0;
int _boxQuadID = GeometryCache::UNKNOWN_ID;
QRect _iconBounds; QRect _iconBounds;
qint64 _iconPulseTimeReference = 0; qint64 _iconPulseTimeReference = 0;
}; };

View file

@ -566,7 +566,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
} }
// restore our normal viewport // restore our normal viewport
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight()); glViewport(0, 0, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
@ -585,7 +585,7 @@ void OculusManager::display(const glm::quat &bodyOrientation, const glm::vec3 &p
void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) { void OculusManager::renderDistortionMesh(ovrPosef eyeRenderPose[ovrEye_Count]) {
glLoadIdentity(); glLoadIdentity();
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
glOrtho(0, glCanvas->getDeviceWidth(), 0, glCanvas->getDeviceHeight(), -1.0, 1.0); glOrtho(0, glCanvas->getDeviceWidth(), 0, glCanvas->getDeviceHeight(), -1.0, 1.0);
glDisable(GL_DEPTH_TEST); glDisable(GL_DEPTH_TEST);

View file

@ -216,7 +216,7 @@ void PrioVR::renderCalibrationCountdown() {
static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold, static TextRenderer* textRenderer = TextRenderer::getInstance(MONO_FONT_FAMILY, 18, QFont::Bold,
false, TextRenderer::OUTLINE_EFFECT, 2); false, TextRenderer::OUTLINE_EFFECT, 2);
QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "..."; QByteArray text = "Assume T-Pose in " + QByteArray::number(secondsRemaining) + "...";
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
textRenderer->draw((glCanvas->width() - textRenderer->computeExtent(text.constData()).x) / 2, textRenderer->draw((glCanvas->width() - textRenderer->computeExtent(text.constData()).x) / 2,
glCanvas->height() / 2, glCanvas->height() / 2,
text, glm::vec4(1,1,1,1)); text, glm::vec4(1,1,1,1));

View file

@ -472,7 +472,7 @@ void SixenseManager::updateCalibration(const sixenseControllerData* controllers)
//Injecting mouse movements and clicks //Injecting mouse movements and clicks
void SixenseManager::emulateMouse(PalmData* palm, int index) { void SixenseManager::emulateMouse(PalmData* palm, int index) {
MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
QPoint pos; QPoint pos;
Qt::MouseButton bumperButton; Qt::MouseButton bumperButton;

View file

@ -35,7 +35,7 @@ bool TV3DManager::isConnected() {
} }
void TV3DManager::connect() { void TV3DManager::connect() {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
int width = glCanvas->getDeviceWidth(); int width = glCanvas->getDeviceWidth();
int height = glCanvas->getDeviceHeight(); int height = glCanvas->getDeviceHeight();
Camera& camera = *Application::getInstance()->getCamera(); Camera& camera = *Application::getInstance()->getCamera();
@ -93,7 +93,7 @@ void TV3DManager::display(Camera& whichCamera) {
// left eye portal // left eye portal
int portalX = 0; int portalX = 0;
int portalY = 0; int portalY = 0;
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
QSize deviceSize = glCanvas->getDeviceSize() * QSize deviceSize = glCanvas->getDeviceSize() *
Application::getInstance()->getRenderResolutionScale(); Application::getInstance()->getRenderResolutionScale();
int portalW = deviceSize.width() / 2; int portalW = deviceSize.width() / 2;

View file

@ -15,6 +15,7 @@
#include <HandData.h> #include <HandData.h>
#include <HFBackEvent.h> #include <HFBackEvent.h>
#include "Application.h"
#include "devices/MotionTracker.h" #include "devices/MotionTracker.h"
#include "devices/SixenseManager.h" #include "devices/SixenseManager.h"
#include "ControllerScriptingInterface.h" #include "ControllerScriptingInterface.h"
@ -285,7 +286,7 @@ void ControllerScriptingInterface::releaseJoystick(int joystickIndex) {
} }
glm::vec2 ControllerScriptingInterface::getViewportDimensions() const { glm::vec2 ControllerScriptingInterface::getViewportDimensions() const {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
return glm::vec2(glCanvas->width(), glCanvas->height()); return glm::vec2(glCanvas->width(), glCanvas->height());
} }

View file

@ -44,7 +44,7 @@ WebWindowClass* WindowScriptingInterface::doCreateWebWindow(const QString& title
} }
QScriptValue WindowScriptingInterface::hasFocus() { QScriptValue WindowScriptingInterface::hasFocus() {
return DependencyManager::get<GLCanvas>()->hasFocus(); return Application::getInstance()->getGLWidget()->hasFocus();
} }
void WindowScriptingInterface::setFocus() { void WindowScriptingInterface::setFocus() {

View file

@ -170,7 +170,7 @@ ApplicationOverlay::~ApplicationOverlay() {
void ApplicationOverlay::renderOverlay(bool renderToTexture) { void ApplicationOverlay::renderOverlay(bool renderToTexture) {
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()"); PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "ApplicationOverlay::displayOverlay()");
Overlays& overlays = qApp->getOverlays(); Overlays& overlays = qApp->getOverlays();
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
_textureFov = glm::radians(_oculusUIAngularSize); _textureFov = glm::radians(_oculusUIAngularSize);
_textureAspectRatio = (float)glCanvas->getDeviceWidth() / (float)glCanvas->getDeviceHeight(); _textureAspectRatio = (float)glCanvas->getDeviceWidth() / (float)glCanvas->getDeviceHeight();
@ -239,7 +239,7 @@ void ApplicationOverlay::displayOverlayTexture() {
if (_alpha == 0.0f) { if (_alpha == 0.0f) {
return; return;
} }
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
glEnable(GL_TEXTURE_2D); glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0); glActiveTexture(GL_TEXTURE0);
@ -401,7 +401,7 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
glm::vec2(1.0f, 0.0f), glm::vec2(0.0f, 0.0f), glm::vec2(1.0f, 0.0f), glm::vec2(0.0f, 0.0f),
overlayColor); overlayColor);
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
if (_crosshairTexture == 0) { if (_crosshairTexture == 0) {
_crosshairTexture = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png")); _crosshairTexture = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/sixense-reticle.png"));
} }
@ -451,7 +451,7 @@ void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origi
//Caculate the click location using one of the sixense controllers. Scale is not applied //Caculate the click location using one of the sixense controllers. Scale is not applied
QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const { QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm); glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
@ -528,7 +528,7 @@ bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position,
//Renders optional pointers //Renders optional pointers
void ApplicationOverlay::renderPointers() { void ApplicationOverlay::renderPointers() {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
//lazily load crosshair texture //lazily load crosshair texture
if (_crosshairTexture == 0) { if (_crosshairTexture == 0) {
@ -575,7 +575,7 @@ void ApplicationOverlay::renderPointers() {
} }
void ApplicationOverlay::renderControllerPointers() { void ApplicationOverlay::renderControllerPointers() {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
//Static variables used for storing controller state //Static variables used for storing controller state
@ -722,7 +722,7 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
if (!_magnifier) { if (!_magnifier) {
return; return;
} }
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
const int widgetWidth = glCanvas->width(); const int widgetWidth = glCanvas->width();
const int widgetHeight = glCanvas->height(); const int widgetHeight = glCanvas->height();
@ -787,7 +787,7 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
} }
void ApplicationOverlay::renderAudioMeter() { void ApplicationOverlay::renderAudioMeter() {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
auto audio = DependencyManager::get<AudioClient>(); auto audio = DependencyManager::get<AudioClient>();
// Audio VU Meter and Mute Icon // Audio VU Meter and Mute Icon
@ -905,7 +905,7 @@ void ApplicationOverlay::renderStatsAndLogs() {
Application* application = Application::getInstance(); Application* application = Application::getInstance();
QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>(); QSharedPointer<BandwidthRecorder> bandwidthRecorder = DependencyManager::get<BandwidthRecorder>();
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor(); const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay(); NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay();
@ -943,7 +943,7 @@ void ApplicationOverlay::renderDomainConnectionStatusBorder() {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
if (nodeList && !nodeList->getDomainHandler().isConnected()) { if (nodeList && !nodeList->getDomainHandler().isConnected()) {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
auto geometryCache = DependencyManager::get<GeometryCache>(); auto geometryCache = DependencyManager::get<GeometryCache>();
int width = glCanvas->width(); int width = glCanvas->width();
int height = glCanvas->height(); int height = glCanvas->height();
@ -1087,7 +1087,7 @@ void ApplicationOverlay::TexturedHemisphere::cleanupVBO() {
} }
void ApplicationOverlay::TexturedHemisphere::buildFramebufferObject() { void ApplicationOverlay::TexturedHemisphere::buildFramebufferObject() {
QSize size = DependencyManager::get<GLCanvas>()->getDeviceSize(); QSize size = Application::getInstance()->getGLWidget()->getDeviceSize();
if (_framebufferObject != NULL && size == _framebufferObject->size()) { if (_framebufferObject != NULL && size == _framebufferObject->size()) {
// Already build // Already build
return; return;
@ -1138,7 +1138,7 @@ void ApplicationOverlay::TexturedHemisphere::render() {
glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const { glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize(); QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
float yaw = -(screenPos.x / screenSize.width() - 0.5f) * MOUSE_YAW_RANGE; float yaw = -(screenPos.x / screenSize.width() - 0.5f) * MOUSE_YAW_RANGE;
float pitch = (screenPos.y / screenSize.height() - 0.5f) * MOUSE_PITCH_RANGE; float pitch = (screenPos.y / screenSize.height() - 0.5f) * MOUSE_PITCH_RANGE;
@ -1146,7 +1146,7 @@ glm::vec2 ApplicationOverlay::screenToSpherical(glm::vec2 screenPos) const {
} }
glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const { glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize(); QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
float x = (-sphericalPos.x / MOUSE_YAW_RANGE + 0.5f) * screenSize.width(); float x = (-sphericalPos.x / MOUSE_YAW_RANGE + 0.5f) * screenSize.width();
float y = (sphericalPos.y / MOUSE_PITCH_RANGE + 0.5f) * screenSize.height(); float y = (sphericalPos.y / MOUSE_PITCH_RANGE + 0.5f) * screenSize.height();
@ -1154,7 +1154,7 @@ glm::vec2 ApplicationOverlay::sphericalToScreen(glm::vec2 sphericalPos) const {
} }
glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const { glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize(); QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
float x = (-sphericalPos.x / (_textureFov * _textureAspectRatio) + 0.5f) * screenSize.width(); float x = (-sphericalPos.x / (_textureFov * _textureAspectRatio) + 0.5f) * screenSize.width();
float y = (sphericalPos.y / _textureFov + 0.5f) * screenSize.height(); float y = (sphericalPos.y / _textureFov + 0.5f) * screenSize.height();
@ -1162,7 +1162,7 @@ glm::vec2 ApplicationOverlay::sphericalToOverlay(glm::vec2 sphericalPos) const {
} }
glm::vec2 ApplicationOverlay::overlayToSpherical(glm::vec2 overlayPos) const { glm::vec2 ApplicationOverlay::overlayToSpherical(glm::vec2 overlayPos) const {
QSize screenSize = DependencyManager::get<GLCanvas>()->getDeviceSize(); QSize screenSize = Application::getInstance()->getGLWidget()->getDeviceSize();
float yaw = -(overlayPos.x / screenSize.width() - 0.5f) * _textureFov * _textureAspectRatio; float yaw = -(overlayPos.x / screenSize.width() - 0.5f) * _textureFov * _textureAspectRatio;
float pitch = (overlayPos.y / screenSize.height() - 0.5f) * _textureFov; float pitch = (overlayPos.y / screenSize.height() - 0.5f) * _textureFov;

View file

@ -140,7 +140,7 @@ MetavoxelEditor::MetavoxelEditor(QWidget* parent) :
connect(Application::getInstance()->getMetavoxels(), &MetavoxelSystem::rendering, connect(Application::getInstance()->getMetavoxels(), &MetavoxelSystem::rendering,
this, &MetavoxelEditor::renderPreview); this, &MetavoxelEditor::renderPreview);
DependencyManager::get<GLCanvas>()->installEventFilter(this); Application::getInstance()->getGLWidget()->installEventFilter(this);
show(); show();

View file

@ -235,7 +235,7 @@ void PreferencesDialog::savePreferences() {
myAvatar->setLeanScale(ui.leanScaleSpin->value()); myAvatar->setLeanScale(ui.leanScaleSpin->value());
myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value()); myAvatar->setClampedTargetScale(ui.avatarScaleSpin->value());
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height()); Application::getInstance()->resizeGL(glCanvas->width(), glCanvas->height());
DependencyManager::get<AvatarManager>()->getMyAvatar()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value()); DependencyManager::get<AvatarManager>()->getMyAvatar()->setRealWorldFieldOfView(ui.realWorldFieldOfViewSpin->value());

View file

@ -23,6 +23,7 @@
#include <GLCanvas.h> #include <GLCanvas.h>
#include <NodeList.h> #include <NodeList.h>
#include "Application.h"
#include "Snapshot.h" #include "Snapshot.h"
// filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg // filename format: hifi-snap-by-%username%-on-%date%_%time%_@-%location%.jpg
@ -93,7 +94,7 @@ QTemporaryFile* Snapshot::saveTempSnapshot() {
} }
QFile* Snapshot::savedFileForSnapshot(bool isTemporary) { QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
QImage shot = glCanvas->grabFrameBuffer(); QImage shot = glCanvas->grabFrameBuffer();
Avatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar(); Avatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();

View file

@ -62,7 +62,7 @@ Stats::Stats():
_metavoxelReceiveProgress(0), _metavoxelReceiveProgress(0),
_metavoxelReceiveTotal(0) _metavoxelReceiveTotal(0)
{ {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
resetWidth(glCanvas->width(), 0); resetWidth(glCanvas->width(), 0);
} }
@ -73,7 +73,7 @@ void Stats::toggleExpanded() {
// called on mouse click release // called on mouse click release
// check for clicks over stats in order to expand or contract them // check for clicks over stats in order to expand or contract them
void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) { void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset) {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) { if (0 != glm::compMax(glm::abs(glm::ivec2(mouseX - mouseDragStartedX, mouseY - mouseDragStartedY)))) {
// not worried about dragging on stats // not worried about dragging on stats
@ -128,7 +128,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
} }
void Stats::resetWidth(int width, int horizontalOffset) { void Stats::resetWidth(int width, int horizontalOffset) {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
int extraSpace = glCanvas->width() - horizontalOffset -2 int extraSpace = glCanvas->width() - horizontalOffset -2
- STATS_GENERAL_MIN_WIDTH - STATS_GENERAL_MIN_WIDTH
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0) - (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
@ -202,7 +202,7 @@ void Stats::display(
int outKbitsPerSecond, int outKbitsPerSecond,
int voxelPacketsToProcess) int voxelPacketsToProcess)
{ {
auto glCanvas = DependencyManager::get<GLCanvas>(); auto glCanvas = Application::getInstance()->getGLWidget();
unsigned int backgroundColor = 0x33333399; unsigned int backgroundColor = 0x33333399;
int verticalOffset = 0, lines = 0; int verticalOffset = 0, lines = 0;

View file

@ -11,7 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <SharedUtil.h> #include <SharedUtil.h>
#include "Application.h" #include "Application.h"

View file

@ -11,7 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <GeometryCache.h> #include <GeometryCache.h>
#include <GlowEffect.h> #include <GlowEffect.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -11,8 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <DeferredLightingEffect.h> #include <DeferredLightingEffect.h>
#include <GlowEffect.h> #include <GlowEffect.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -17,8 +17,6 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <QGLWidget>
#include <ProgramObject.h> #include <ProgramObject.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -11,7 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <QPainter> #include <QPainter>
#include <QSvgRenderer> #include <QSvgRenderer>

View file

@ -14,7 +14,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <QImage> #include <QImage>
#include <QNetworkReply> #include <QNetworkReply>
#include <QRect> #include <QRect>

View file

@ -11,16 +11,12 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QSvgRenderer>
#include <QPainter>
#include <QGLWidget>
#include <SharedUtil.h> #include <SharedUtil.h>
#include "Overlay.h" #include "Overlay.h"
Overlay::Overlay() : Overlay::Overlay() :
_parent(NULL),
_isLoaded(true), _isLoaded(true),
_alpha(DEFAULT_ALPHA), _alpha(DEFAULT_ALPHA),
_glowLevel(0.0f), _glowLevel(0.0f),
@ -40,7 +36,6 @@ Overlay::Overlay() :
} }
Overlay::Overlay(const Overlay* overlay) : Overlay::Overlay(const Overlay* overlay) :
_parent(NULL),
_isLoaded(overlay->_isLoaded), _isLoaded(overlay->_isLoaded),
_alpha(overlay->_alpha), _alpha(overlay->_alpha),
_glowLevel(overlay->_glowLevel), _glowLevel(overlay->_glowLevel),
@ -60,8 +55,7 @@ Overlay::Overlay(const Overlay* overlay) :
{ {
} }
void Overlay::init(QGLWidget* parent, QScriptEngine* scriptEngine) { void Overlay::init(QScriptEngine* scriptEngine) {
_parent = parent;
_scriptEngine = scriptEngine; _scriptEngine = scriptEngine;
} }

View file

@ -14,7 +14,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <QRect> #include <QRect>
#include <QScriptValue> #include <QScriptValue>
#include <QString> #include <QString>
@ -38,7 +37,7 @@ public:
Overlay(); Overlay();
Overlay(const Overlay* overlay); Overlay(const Overlay* overlay);
~Overlay(); ~Overlay();
void init(QGLWidget* parent, QScriptEngine* scriptEngine); void init(QScriptEngine* scriptEngine);
virtual void update(float deltatime) {} virtual void update(float deltatime) {}
virtual void render(RenderArgs* args) = 0; virtual void render(RenderArgs* args) = 0;
@ -85,7 +84,6 @@ public:
protected: protected:
float updatePulse(); float updatePulse();
QGLWidget* _parent;
bool _isLoaded; bool _isLoaded;
float _alpha; float _alpha;
float _glowLevel; float _glowLevel;

View file

@ -11,9 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QSvgRenderer>
#include <QPainter>
#include <QGLWidget>
#include <SharedUtil.h> #include <SharedUtil.h>
#include "Overlay2D.h" #include "Overlay2D.h"

View file

@ -14,7 +14,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <QRect> #include <QRect>
#include <QScriptValue> #include <QScriptValue>
#include <QString> #include <QString>

View file

@ -58,8 +58,7 @@ Overlays::~Overlays() {
} }
void Overlays::init(QGLWidget* parent) { void Overlays::init() {
_parent = parent;
_scriptEngine = new QScriptEngine(); _scriptEngine = new QScriptEngine();
} }
@ -202,7 +201,7 @@ unsigned int Overlays::addOverlay(const QString& type, const QScriptValue& prope
} }
unsigned int Overlays::addOverlay(Overlay* overlay) { unsigned int Overlays::addOverlay(Overlay* overlay) {
overlay->init(_parent, _scriptEngine); overlay->init(_scriptEngine);
QWriteLocker lock(&_lock); QWriteLocker lock(&_lock);
unsigned int thisID = _nextOverlayID; unsigned int thisID = _nextOverlayID;

View file

@ -51,7 +51,7 @@ class Overlays : public QObject {
public: public:
Overlays(); Overlays();
~Overlays(); ~Overlays();
void init(QGLWidget* parent); void init();
void update(float deltatime); void update(float deltatime);
void renderWorld(bool drawFront, RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE, void renderWorld(bool drawFront, RenderArgs::RenderMode renderMode = RenderArgs::DEFAULT_RENDER_MODE,
RenderArgs::RenderSide renderSide = RenderArgs::MONO); RenderArgs::RenderSide renderSide = RenderArgs::MONO);
@ -95,7 +95,6 @@ private:
QMap<unsigned int, Overlay*> _overlaysWorld; QMap<unsigned int, Overlay*> _overlaysWorld;
QList<Overlay*> _overlaysToDelete; QList<Overlay*> _overlaysToDelete;
unsigned int _nextOverlayID; unsigned int _nextOverlayID;
QGLWidget* _parent;
QReadWriteLock _lock; QReadWriteLock _lock;
QReadWriteLock _deleteLock; QReadWriteLock _deleteLock;
QScriptEngine* _scriptEngine; QScriptEngine* _scriptEngine;

View file

@ -11,7 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <PlaneShape.h> #include <PlaneShape.h>
#include <RayIntersectionInfo.h> #include <RayIntersectionInfo.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -16,7 +16,6 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <QGLWidget>
#include <QScriptValue> #include <QScriptValue>
#include "Base3DOverlay.h" #include "Base3DOverlay.h"

View file

@ -11,8 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <GeometryCache.h> #include <GeometryCache.h>
#include <GlowEffect.h> #include <GlowEffect.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -11,8 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <GlowEffect.h> #include <GlowEffect.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -11,8 +11,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <DependencyManager.h> #include <DependencyManager.h>
#include <GeometryCache.h> #include <GeometryCache.h>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -14,13 +14,9 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <QImage>
#include <QNetworkReply>
#include <QRect> #include <QRect>
#include <QScriptValue> #include <QScriptValue>
#include <QString> #include <QString>
#include <QUrl>
#include <SharedUtil.h> #include <SharedUtil.h>

View file

@ -14,7 +14,6 @@
// include this before QGLWidget, which includes an earlier version of OpenGL // include this before QGLWidget, which includes an earlier version of OpenGL
#include "InterfaceConfig.h" #include "InterfaceConfig.h"
#include <QGLWidget>
#include <AABox.h> #include <AABox.h>
#include <SharedUtil.h> #include <SharedUtil.h>
#include <StreamUtils.h> #include <StreamUtils.h>

View file

@ -16,7 +16,6 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <QGLWidget>
#include <QScriptValue> #include <QScriptValue>
#include "Base3DOverlay.h" #include "Base3DOverlay.h"

View file

@ -21,7 +21,7 @@ namespace gpu {
class GPUObject { class GPUObject {
public: public:
GPUObject() {} GPUObject() {}
~GPUObject() {} virtual ~GPUObject() {}
}; };
class Batch; class Batch;

View file

@ -32,7 +32,7 @@ public:
static void checkGLError(); static void checkGLError();
class GLBuffer { class GLBuffer : public GPUObject {
public: public:
Stamp _stamp; Stamp _stamp;
GLuint _buffer; GLuint _buffer;