mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
Moved GLCanvas to DependencyManager
This commit is contained in:
parent
25df784f43
commit
68430e1346
3 changed files with 68 additions and 49 deletions
|
@ -146,7 +146,6 @@ QString& Application::resourcesPath() {
|
||||||
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
QApplication(argc, argv),
|
QApplication(argc, argv),
|
||||||
_window(new MainWindow(desktop())),
|
_window(new MainWindow(desktop())),
|
||||||
_glWidget(new GLCanvas()),
|
|
||||||
_toolWindow(NULL),
|
_toolWindow(NULL),
|
||||||
_nodeThread(new QThread(this)),
|
_nodeThread(new QThread(this)),
|
||||||
_datagramProcessor(),
|
_datagramProcessor(),
|
||||||
|
@ -195,7 +194,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
_isVSyncOn(true),
|
_isVSyncOn(true),
|
||||||
_aboutToQuit(false)
|
_aboutToQuit(false)
|
||||||
{
|
{
|
||||||
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
// read the ApplicationInfo.ini file for Name/Version/Domain information
|
||||||
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
QSettings applicationInfo(Application::resourcesPath() + "info/ApplicationInfo.ini", QSettings::IniFormat);
|
||||||
|
|
||||||
|
@ -365,16 +365,16 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
ResourceCache::setRequestLimit(3);
|
ResourceCache::setRequestLimit(3);
|
||||||
|
|
||||||
_window->setCentralWidget(_glWidget);
|
_window->setCentralWidget(glCanvas);
|
||||||
|
|
||||||
restoreSizeAndPosition();
|
restoreSizeAndPosition();
|
||||||
|
|
||||||
_window->setVisible(true);
|
_window->setVisible(true);
|
||||||
_glWidget->setFocusPolicy(Qt::StrongFocus);
|
glCanvas->setFocusPolicy(Qt::StrongFocus);
|
||||||
_glWidget->setFocus();
|
glCanvas->setFocus();
|
||||||
|
|
||||||
// enable mouse tracking; otherwise, we only get drag events
|
// enable mouse tracking; otherwise, we only get drag events
|
||||||
_glWidget->setMouseTracking(true);
|
glCanvas->setMouseTracking(true);
|
||||||
|
|
||||||
_toolWindow = new ToolWindow();
|
_toolWindow = new ToolWindow();
|
||||||
_toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
|
_toolWindow->setWindowFlags(_toolWindow->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||||
|
@ -393,7 +393,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
|
|
||||||
checkVersion();
|
checkVersion();
|
||||||
|
|
||||||
_overlays.init(_glWidget); // do this before scripts load
|
_overlays.init(glCanvas); // do this before scripts load
|
||||||
|
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
LocalVoxelsList::getInstance()->addPersistantTree(DOMAIN_TREE_NAME, _voxels.getTree());
|
||||||
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
LocalVoxelsList::getInstance()->addPersistantTree(CLIPBOARD_TREE_NAME, &_clipboard);
|
||||||
|
@ -483,8 +483,6 @@ Application::~Application() {
|
||||||
Menu::getInstance()->deleteLater();
|
Menu::getInstance()->deleteLater();
|
||||||
|
|
||||||
_myAvatar = NULL;
|
_myAvatar = NULL;
|
||||||
|
|
||||||
delete _glWidget;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::saveSettings() {
|
void Application::saveSettings() {
|
||||||
|
@ -624,7 +622,7 @@ void Application::paintGL() {
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
_textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());
|
_textureCache.setFrameBufferSize(OculusManager::getRenderTargetSize());
|
||||||
} else {
|
} else {
|
||||||
QSize fbSize = _glWidget->getDeviceSize() * getRenderResolutionScale();
|
QSize fbSize = DependencyManager::get<GLCanvas>()->getDeviceSize() * getRenderResolutionScale();
|
||||||
_textureCache.setFrameBufferSize(fbSize);
|
_textureCache.setFrameBufferSize(fbSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1046,8 @@ 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()) {
|
||||||
TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
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));
|
||||||
|
@ -1060,7 +1059,8 @@ 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()) {
|
||||||
TV3DManager::configureCamera(_myCamera, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
TV3DManager::configureCamera(_myCamera, glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1506,7 +1506,7 @@ void Application::idle() {
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("updateGL");
|
PerformanceTimer perfTimer("updateGL");
|
||||||
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
|
PerformanceWarning warn(showWarnings, "Application::idle()... updateGL()");
|
||||||
_glWidget->updateGL();
|
DependencyManager::get<GLCanvas>()->updateGL();
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("rest");
|
PerformanceTimer perfTimer("rest");
|
||||||
|
@ -1532,13 +1532,14 @@ void Application::idle() {
|
||||||
|
|
||||||
void Application::checkBandwidthMeterClick() {
|
void Application::checkBandwidthMeterClick() {
|
||||||
// ... to be called upon button release
|
// ... to be called upon button release
|
||||||
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth) &&
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
Menu::getInstance()->isOptionChecked(MenuOption::Stats) &&
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
|
Menu::getInstance()->isOptionChecked(MenuOption::UserInterface) &&
|
||||||
glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(),
|
glm::compMax(glm::abs(glm::ivec2(getMouseX() - getMouseDragStartedX(),
|
||||||
getMouseY() - getMouseDragStartedY())))
|
getMouseY() - getMouseDragStartedY())))
|
||||||
<= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH
|
<= BANDWIDTH_METER_CLICK_MAX_DRAG_LENGTH
|
||||||
&& _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), _glWidget->width(), _glWidget->height())) {
|
&& _bandwidthMeter.isWithinArea(getMouseX(), getMouseY(), glCanvas->width(), glCanvas->height())) {
|
||||||
|
|
||||||
// The bandwidth meter is visible, the click didn't get dragged too far and
|
// The bandwidth meter is visible, the click didn't get dragged too far and
|
||||||
// we actually hit the bandwidth meter
|
// we actually hit the bandwidth meter
|
||||||
|
@ -1567,7 +1568,8 @@ void Application::setFullscreen(bool fullscreen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setEnable3DTVMode(bool enable3DTVMode) {
|
void Application::setEnable3DTVMode(bool enable3DTVMode) {
|
||||||
resizeGL(_glWidget->getDeviceWidth(),_glWidget->getDeviceHeight());
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setEnableVRMode(bool enableVRMode) {
|
void Application::setEnableVRMode(bool enableVRMode) {
|
||||||
|
@ -1592,7 +1594,8 @@ void Application::setEnableVRMode(bool enableVRMode) {
|
||||||
_myCamera.setHmdRotation(glm::quat());
|
_myCamera.setHmdRotation(glm::quat());
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeGL(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
resizeGL(glCanvas->getDeviceWidth(), glCanvas->getDeviceHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setRenderVoxels(bool voxelRender) {
|
void Application::setRenderVoxels(bool voxelRender) {
|
||||||
|
@ -1654,8 +1657,9 @@ glm::vec3 Application::getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVox
|
||||||
|
|
||||||
bool Application::mouseOnScreen() const {
|
bool Application::mouseOnScreen() const {
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
return getMouseX() >= 0 && getMouseX() <= _glWidget->getDeviceWidth() &&
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
getMouseY() >= 0 && getMouseY() <= _glWidget->getDeviceHeight();
|
return getMouseX() >= 0 && getMouseX() <= glCanvas->getDeviceWidth() &&
|
||||||
|
getMouseY() >= 0 && getMouseY() <= glCanvas->getDeviceHeight();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1774,7 +1778,8 @@ void Application::exportVoxels(const VoxelDetail& sourceVoxel) {
|
||||||
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
QString desktopLocation = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
QString suggestedName = desktopLocation.append("/voxels.svo");
|
QString suggestedName = desktopLocation.append("/voxels.svo");
|
||||||
|
|
||||||
QString fileNameString = QFileDialog::getSaveFileName(_glWidget, tr("Export Voxels"), suggestedName,
|
QString fileNameString = QFileDialog::getSaveFileName(DependencyManager::get<GLCanvas>(),
|
||||||
|
tr("Export Voxels"), suggestedName,
|
||||||
tr("Sparse Voxel Octree Files (*.svo)"));
|
tr("Sparse Voxel Octree Files (*.svo)"));
|
||||||
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
QByteArray fileNameAscii = fileNameString.toLocal8Bit();
|
||||||
const char* fileName = fileNameAscii.data();
|
const char* fileName = fileNameAscii.data();
|
||||||
|
@ -2029,9 +2034,9 @@ void Application::init() {
|
||||||
|
|
||||||
_metavoxels.init();
|
_metavoxels.init();
|
||||||
|
|
||||||
_audio.init(_glWidget);
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
_audio.init(glCanvas);
|
||||||
_rearMirrorTools = new RearMirrorTools(_glWidget, _mirrorViewRect, _settings);
|
_rearMirrorTools = new RearMirrorTools(glCanvas, _mirrorViewRect, _settings);
|
||||||
|
|
||||||
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
|
connect(_rearMirrorTools, SIGNAL(closeView()), SLOT(closeMirrorView()));
|
||||||
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
|
connect(_rearMirrorTools, SIGNAL(restoreView()), SLOT(restoreMirrorView()));
|
||||||
|
@ -2913,8 +2918,9 @@ void Application::updateShadowMap() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fbo->release();
|
fbo->release();
|
||||||
|
|
||||||
glViewport(0, 0, _glWidget->getDeviceWidth(), _glWidget->getDeviceHeight());
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
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 };
|
||||||
|
@ -2944,7 +2950,9 @@ QImage Application::renderAvatarBillboard() {
|
||||||
Glower glower;
|
Glower glower;
|
||||||
|
|
||||||
const int BILLBOARD_SIZE = 64;
|
const int BILLBOARD_SIZE = 64;
|
||||||
renderRearViewMirror(QRect(0, _glWidget->getDeviceHeight() - BILLBOARD_SIZE, BILLBOARD_SIZE, BILLBOARD_SIZE), true);
|
renderRearViewMirror(QRect(0, DependencyManager::get<GLCanvas>()->getDeviceHeight() - BILLBOARD_SIZE,
|
||||||
|
BILLBOARD_SIZE, BILLBOARD_SIZE),
|
||||||
|
true);
|
||||||
|
|
||||||
QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
|
QImage image(BILLBOARD_SIZE, BILLBOARD_SIZE, QImage::Format_ARGB32);
|
||||||
glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
|
glReadPixels(0, 0, BILLBOARD_SIZE, BILLBOARD_SIZE, GL_BGRA, GL_UNSIGNED_BYTE, image.bits());
|
||||||
|
@ -3239,8 +3247,9 @@ void Application::computeOffAxisFrustum(float& left, float& right, float& bottom
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
glm::vec2 Application::getScaledScreenPoint(glm::vec2 projectedPoint) {
|
||||||
float horizontalScale = _glWidget->getDeviceWidth() / 2.0f;
|
GLCanvas* glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
float verticalScale = _glWidget->getDeviceHeight() / 2.0f;
|
float horizontalScale = glCanvas->getDeviceWidth() / 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
|
||||||
|
@ -3259,7 +3268,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) + _glWidget->getDeviceHeight());
|
((projectedPoint.y + 1.0) * -verticalScale) + glCanvas->getDeviceHeight());
|
||||||
|
|
||||||
return screenPoint;
|
return screenPoint;
|
||||||
}
|
}
|
||||||
|
@ -3570,7 +3579,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();
|
||||||
_glWidget->cursor().setPos(currentScreen, windowCenter);
|
DependencyManager::get<GLCanvas>()->cursor().setPos(currentScreen, windowCenter);
|
||||||
|
|
||||||
_myAvatar->reset();
|
_myAvatar->reset();
|
||||||
|
|
||||||
|
@ -4251,7 +4260,8 @@ void Application::setPreviousScriptLocation(const QString& previousScriptLocatio
|
||||||
|
|
||||||
void Application::loadDialog() {
|
void Application::loadDialog() {
|
||||||
|
|
||||||
QString fileNameString = QFileDialog::getOpenFileName(_glWidget, tr("Open Script"),
|
QString fileNameString = QFileDialog::getOpenFileName(DependencyManager::get<GLCanvas>(),
|
||||||
|
tr("Open Script"),
|
||||||
getPreviousScriptLocation(),
|
getPreviousScriptLocation(),
|
||||||
tr("JavaScript Files (*.js)"));
|
tr("JavaScript Files (*.js)"));
|
||||||
if (!fileNameString.isEmpty()) {
|
if (!fileNameString.isEmpty()) {
|
||||||
|
@ -4287,7 +4297,7 @@ void Application::loadScriptURLDialog() {
|
||||||
|
|
||||||
void Application::toggleLogDialog() {
|
void Application::toggleLogDialog() {
|
||||||
if (! _logDialog) {
|
if (! _logDialog) {
|
||||||
_logDialog = new LogDialog(_glWidget, getLogger());
|
_logDialog = new LogDialog(DependencyManager::get<GLCanvas>(), getLogger());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_logDialog->isVisible()) {
|
if (_logDialog->isVisible()) {
|
||||||
|
@ -4347,7 +4357,7 @@ void Application::parseVersionXml() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
|
if (!shouldSkipVersion(latestVersion) && applicationVersion() != latestVersion) {
|
||||||
new UpdateDialog(_glWidget, releaseNotes, latestVersion, downloadUrl);
|
new UpdateDialog(DependencyManager::get<GLCanvas>(), releaseNotes, latestVersion, downloadUrl);
|
||||||
}
|
}
|
||||||
sender->deleteLater();
|
sender->deleteLater();
|
||||||
}
|
}
|
||||||
|
@ -4380,7 +4390,7 @@ void Application::takeSnapshot() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_snapshotShareDialog) {
|
if (!_snapshotShareDialog) {
|
||||||
_snapshotShareDialog = new SnapshotShareDialog(fileName, _glWidget);
|
_snapshotShareDialog = new SnapshotShareDialog(fileName, DependencyManager::get<GLCanvas>());
|
||||||
}
|
}
|
||||||
_snapshotShareDialog->show();
|
_snapshotShareDialog->show();
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,46 +171,50 @@ public:
|
||||||
void removeVoxel(glm::vec3 position, float scale);
|
void removeVoxel(glm::vec3 position, float scale);
|
||||||
|
|
||||||
glm::vec3 getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel);
|
glm::vec3 getMouseVoxelWorldCoordinates(const VoxelDetail& mouseVoxel);
|
||||||
|
bool isThrottleRendering() const { return DependencyManager::get<GLCanvas>()->isThrottleRendering(); }
|
||||||
|
|
||||||
GLCanvas* getGLWidget() { return _glWidget; }
|
GLCanvas* getGLWidget() { return DependencyManager::get<GLCanvas>(); } // TODO: remove
|
||||||
bool isThrottleRendering() const { return _glWidget->isThrottleRendering(); }
|
|
||||||
MyAvatar* getAvatar() { return _myAvatar; }
|
MyAvatar* getAvatar() { return _myAvatar; }
|
||||||
Audio* getAudio() { return &_audio; }
|
Audio* getAudio() { return &_audio; }
|
||||||
Camera* getCamera() { return &_myCamera; }
|
Camera* getCamera() { return &_myCamera; }
|
||||||
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
||||||
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
||||||
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
ViewFrustum* getShadowViewFrustum() { return &_shadowViewFrustum; }
|
||||||
VoxelImporter* getVoxelImporter() { return &_voxelImporter; }
|
|
||||||
VoxelSystem* getVoxels() { return &_voxels; }
|
VoxelSystem* getVoxels() { return &_voxels; }
|
||||||
VoxelTree* getVoxelTree() { return _voxels.getTree(); }
|
|
||||||
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
const OctreePacketProcessor& getOctreePacketProcessor() const { return _octreeProcessor; }
|
||||||
MetavoxelSystem* getMetavoxels() { return &_metavoxels; }
|
MetavoxelSystem* getMetavoxels() { return &_metavoxels; }
|
||||||
EntityTreeRenderer* getEntities() { return &_entities; }
|
EntityTreeRenderer* getEntities() { return &_entities; }
|
||||||
bool getImportSucceded() { return _importSucceded; }
|
|
||||||
VoxelSystem* getSharedVoxelSystem() { return &_sharedVoxelSystem; }
|
VoxelSystem* getSharedVoxelSystem() { return &_sharedVoxelSystem; }
|
||||||
|
Environment* getEnvironment() { return &_environment; }
|
||||||
|
PrioVR* getPrioVR() { return &_prioVR; }
|
||||||
|
QUndoStack* getUndoStack() { return &_undoStack; }
|
||||||
|
MainWindow* getWindow() { return _window; }
|
||||||
|
|
||||||
|
VoxelImporter* getVoxelImporter() { return &_voxelImporter; }
|
||||||
VoxelTree* getClipboard() { return &_clipboard; }
|
VoxelTree* getClipboard() { return &_clipboard; }
|
||||||
EntityTree* getEntityClipboard() { return &_entityClipboard; }
|
EntityTree* getEntityClipboard() { return &_entityClipboard; }
|
||||||
EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; }
|
EntityTreeRenderer* getEntityClipboardRenderer() { return &_entityClipboardRenderer; }
|
||||||
Environment* getEnvironment() { return &_environment; }
|
VoxelTree* getVoxelTree() { return _voxels.getTree(); }
|
||||||
|
bool getImportSucceded() { return _importSucceded; }
|
||||||
|
|
||||||
bool isMousePressed() const { return _mousePressed; }
|
bool isMousePressed() const { return _mousePressed; }
|
||||||
bool isMouseHidden() const { return _glWidget->cursor().shape() == Qt::BlankCursor; }
|
bool isMouseHidden() const { return DependencyManager::get<GLCanvas>()->cursor().shape() == Qt::BlankCursor; }
|
||||||
void setCursorVisible(bool visible);
|
void setCursorVisible(bool visible);
|
||||||
const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; }
|
const glm::vec3& getMouseRayOrigin() const { return _mouseRayOrigin; }
|
||||||
const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; }
|
const glm::vec3& getMouseRayDirection() const { return _mouseRayDirection; }
|
||||||
bool mouseOnScreen() const;
|
bool mouseOnScreen() const;
|
||||||
int getMouseX() const;
|
int getMouseX() const;
|
||||||
int getMouseY() const;
|
int getMouseY() const;
|
||||||
int getTrueMouseX() const { return _glWidget->mapFromGlobal(QCursor::pos()).x(); }
|
int getTrueMouseX() const { return DependencyManager::get<GLCanvas>()->mapFromGlobal(QCursor::pos()).x(); }
|
||||||
int getTrueMouseY() const { return _glWidget->mapFromGlobal(QCursor::pos()).y(); }
|
int getTrueMouseY() const { return DependencyManager::get<GLCanvas>()->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; }
|
||||||
int getTrueMouseDragStartedY() const { return _mouseDragStartedY; }
|
int getTrueMouseDragStartedY() const { return _mouseDragStartedY; }
|
||||||
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
bool getLastMouseMoveWasSimulated() const { return _lastMouseMoveWasSimulated; }
|
||||||
|
|
||||||
FaceTracker* getActiveFaceTracker();
|
FaceTracker* getActiveFaceTracker();
|
||||||
PrioVR* getPrioVR() { return &_prioVR; }
|
|
||||||
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
BandwidthMeter* getBandwidthMeter() { return &_bandwidthMeter; }
|
||||||
QUndoStack* getUndoStack() { return &_undoStack; }
|
|
||||||
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
|
QSystemTrayIcon* getTrayIcon() { return _trayIcon; }
|
||||||
ApplicationOverlay& getApplicationOverlay() { return _applicationOverlay; }
|
ApplicationOverlay& getApplicationOverlay() { return _applicationOverlay; }
|
||||||
Overlays& getOverlays() { return _overlays; }
|
Overlays& getOverlays() { return _overlays; }
|
||||||
|
@ -230,7 +234,6 @@ public:
|
||||||
|
|
||||||
void saveSettings();
|
void saveSettings();
|
||||||
|
|
||||||
MainWindow* getWindow() { return _window; }
|
|
||||||
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
NodeToOctreeSceneStats* getOcteeSceneStats() { return &_octreeServerSceneStats; }
|
||||||
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
void lockOctreeSceneStats() { _octreeSceneStatsLock.lockForRead(); }
|
||||||
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
void unlockOctreeSceneStats() { _octreeSceneStatsLock.unlock(); }
|
||||||
|
@ -278,7 +281,8 @@ public:
|
||||||
|
|
||||||
FileLogger* getLogger() { return _logger; }
|
FileLogger* getLogger() { return _logger; }
|
||||||
|
|
||||||
glm::vec2 getViewportDimensions() const { return glm::vec2(_glWidget->getDeviceWidth(), _glWidget->getDeviceHeight()); }
|
glm::vec2 getViewportDimensions() const { return glm::vec2(DependencyManager::get<GLCanvas>()->getDeviceWidth(),
|
||||||
|
DependencyManager::get<GLCanvas>()->getDeviceHeight()); }
|
||||||
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
NodeToJurisdictionMap& getVoxelServerJurisdictions() { return _voxelServerJurisdictions; }
|
||||||
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
|
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
|
||||||
void pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination);
|
void pasteVoxelsToOctalCode(const unsigned char* octalCodeDestination);
|
||||||
|
@ -456,7 +460,6 @@ private:
|
||||||
int sendNackPackets();
|
int sendNackPackets();
|
||||||
|
|
||||||
MainWindow* _window;
|
MainWindow* _window;
|
||||||
GLCanvas* _glWidget; // our GLCanvas has a couple extra features
|
|
||||||
|
|
||||||
ToolWindow* _toolWindow;
|
ToolWindow* _toolWindow;
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,12 @@
|
||||||
#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 {
|
class GLCanvas : public QGLWidget, public DependencyManager::Dependency {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
GLCanvas();
|
|
||||||
bool isThrottleRendering() const;
|
bool isThrottleRendering() const;
|
||||||
|
|
||||||
int getDeviceWidth() const;
|
int getDeviceWidth() const;
|
||||||
|
@ -56,6 +57,11 @@ 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();
|
||||||
|
friend class DependencyManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_GLCanvas_h
|
#endif // hifi_GLCanvas_h
|
||||||
|
|
Loading…
Reference in a new issue