mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 03:35:47 +02:00
Merge pull request #3024 from Barnold1953/OculusOverlay
Exposed sixense mouse options and oculus UI angle to prefs
This commit is contained in:
commit
0084c36cd0
10 changed files with 526 additions and 233 deletions
BIN
interface/resources/images/sixense-reticle.png
Normal file
BIN
interface/resources/images/sixense-reticle.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
|
@ -45,6 +45,7 @@
|
||||||
#include "ui/ModelsBrowser.h"
|
#include "ui/ModelsBrowser.h"
|
||||||
#include "ui/LoginDialog.h"
|
#include "ui/LoginDialog.h"
|
||||||
#include "ui/NodeBounds.h"
|
#include "ui/NodeBounds.h"
|
||||||
|
#include "devices/OculusManager.h"
|
||||||
|
|
||||||
|
|
||||||
Menu* Menu::_instance = NULL;
|
Menu* Menu::_instance = NULL;
|
||||||
|
@ -83,6 +84,7 @@ Menu::Menu() :
|
||||||
_audioJitterBufferSamples(0),
|
_audioJitterBufferSamples(0),
|
||||||
_bandwidthDialog(NULL),
|
_bandwidthDialog(NULL),
|
||||||
_fieldOfView(DEFAULT_FIELD_OF_VIEW_DEGREES),
|
_fieldOfView(DEFAULT_FIELD_OF_VIEW_DEGREES),
|
||||||
|
_realWorldFieldOfView(DEFAULT_REAL_WORLD_FIELD_OF_VIEW_DEGREES),
|
||||||
_faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION),
|
_faceshiftEyeDeflection(DEFAULT_FACESHIFT_EYE_DEFLECTION),
|
||||||
_frustumDrawMode(FRUSTUM_DRAW_MODE_ALL),
|
_frustumDrawMode(FRUSTUM_DRAW_MODE_ALL),
|
||||||
_viewFrustumOffset(DEFAULT_FRUSTUM_OFFSET),
|
_viewFrustumOffset(DEFAULT_FRUSTUM_OFFSET),
|
||||||
|
@ -91,6 +93,9 @@ Menu::Menu() :
|
||||||
_lodToolsDialog(NULL),
|
_lodToolsDialog(NULL),
|
||||||
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
|
_maxVoxels(DEFAULT_MAX_VOXELS_PER_SYSTEM),
|
||||||
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
_voxelSizeScale(DEFAULT_OCTREE_SIZE_SCALE),
|
||||||
|
_oculusUIAngularSize(DEFAULT_OCULUS_UI_ANGULAR_SIZE),
|
||||||
|
_sixenseReticleMoveSpeed(DEFAULT_SIXENSE_RETICLE_MOVE_SPEED),
|
||||||
|
_invertSixenseButtons(DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS),
|
||||||
_automaticAvatarLOD(true),
|
_automaticAvatarLOD(true),
|
||||||
_avatarLODDecreaseFPS(DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS),
|
_avatarLODDecreaseFPS(DEFAULT_ADJUST_AVATAR_LOD_DOWN_FPS),
|
||||||
_avatarLODIncreaseFPS(ADJUST_LOD_UP_FPS),
|
_avatarLODIncreaseFPS(ADJUST_LOD_UP_FPS),
|
||||||
|
@ -389,7 +394,6 @@ Menu::Menu() :
|
||||||
|
|
||||||
QMenu* sixenseOptionsMenu = developerMenu->addMenu("Sixense Options");
|
QMenu* sixenseOptionsMenu = developerMenu->addMenu("Sixense Options");
|
||||||
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseMouseInput, 0, true);
|
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseMouseInput, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseInvertInputButtons, 0, false);
|
|
||||||
|
|
||||||
QMenu* handOptionsMenu = developerMenu->addMenu("Hand Options");
|
QMenu* handOptionsMenu = developerMenu->addMenu("Hand Options");
|
||||||
|
|
||||||
|
|
|
@ -90,6 +90,12 @@ public:
|
||||||
void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; }
|
void setFieldOfView(float fieldOfView) { _fieldOfView = fieldOfView; }
|
||||||
float getRealWorldFieldOfView() const { return _realWorldFieldOfView; }
|
float getRealWorldFieldOfView() const { return _realWorldFieldOfView; }
|
||||||
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; }
|
void setRealWorldFieldOfView(float realWorldFieldOfView) { _realWorldFieldOfView = realWorldFieldOfView; }
|
||||||
|
float getOculusUIAngularSize() const { return _oculusUIAngularSize; }
|
||||||
|
void setOculusUIAngularSize(float oculusUIAngularSize) { _oculusUIAngularSize = oculusUIAngularSize; }
|
||||||
|
float getSixenseReticleMoveSpeed() const { return _sixenseReticleMoveSpeed; }
|
||||||
|
void setSixenseReticleMoveSpeed(float sixenseReticleMoveSpeed) { _sixenseReticleMoveSpeed = sixenseReticleMoveSpeed; }
|
||||||
|
bool getInvertSixenseButtons() const { return _invertSixenseButtons; }
|
||||||
|
void setInvertSixenseButtons(bool invertSixenseButtons) { _invertSixenseButtons = invertSixenseButtons; }
|
||||||
|
|
||||||
float getFaceshiftEyeDeflection() const { return _faceshiftEyeDeflection; }
|
float getFaceshiftEyeDeflection() const { return _faceshiftEyeDeflection; }
|
||||||
void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; }
|
void setFaceshiftEyeDeflection(float faceshiftEyeDeflection) { _faceshiftEyeDeflection = faceshiftEyeDeflection; }
|
||||||
|
@ -255,6 +261,9 @@ private:
|
||||||
LodToolsDialog* _lodToolsDialog;
|
LodToolsDialog* _lodToolsDialog;
|
||||||
int _maxVoxels;
|
int _maxVoxels;
|
||||||
float _voxelSizeScale;
|
float _voxelSizeScale;
|
||||||
|
float _oculusUIAngularSize;
|
||||||
|
float _sixenseReticleMoveSpeed;
|
||||||
|
bool _invertSixenseButtons;
|
||||||
bool _automaticAvatarLOD;
|
bool _automaticAvatarLOD;
|
||||||
float _avatarLODDecreaseFPS;
|
float _avatarLODDecreaseFPS;
|
||||||
float _avatarLODIncreaseFPS;
|
float _avatarLODIncreaseFPS;
|
||||||
|
@ -400,7 +409,6 @@ namespace MenuOption {
|
||||||
const QString SettingsExport = "Export Settings";
|
const QString SettingsExport = "Export Settings";
|
||||||
const QString SettingsImport = "Import Settings";
|
const QString SettingsImport = "Import Settings";
|
||||||
const QString SimpleShadows = "Simple";
|
const QString SimpleShadows = "Simple";
|
||||||
const QString SixenseInvertInputButtons = "Invert Sixense Mouse Input Buttons";
|
|
||||||
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
|
||||||
const QString ShowBordersVoxelNodes = "Show Voxel Nodes";
|
const QString ShowBordersVoxelNodes = "Show Voxel Nodes";
|
||||||
const QString ShowBordersModelNodes = "Show Model Nodes";
|
const QString ShowBordersModelNodes = "Show Model Nodes";
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
|
|
||||||
#include "renderer/ProgramObject.h"
|
#include "renderer/ProgramObject.h"
|
||||||
|
|
||||||
|
const float DEFAULT_OCULUS_UI_ANGULAR_SIZE = 72.0f;
|
||||||
|
|
||||||
class Camera;
|
class Camera;
|
||||||
|
|
||||||
/// Handles interaction with the Oculus Rift.
|
/// Handles interaction with the Oculus Rift.
|
||||||
|
|
|
@ -185,6 +185,17 @@ void SixenseManager::update(float deltaTime) {
|
||||||
#endif // HAVE_SIXENSE
|
#endif // HAVE_SIXENSE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Constants for getCursorPixelRangeMultiplier()
|
||||||
|
const float MIN_PIXEL_RANGE_MULT = 0.4f;
|
||||||
|
const float MAX_PIXEL_RANGE_MULT = 2.0f;
|
||||||
|
const float RANGE_MULT = (MAX_PIXEL_RANGE_MULT - MIN_PIXEL_RANGE_MULT) * 0.01;
|
||||||
|
|
||||||
|
//Returns a multiplier to be applied to the cursor range for the controllers
|
||||||
|
float SixenseManager::getCursorPixelRangeMult() const {
|
||||||
|
//scales (0,100) to (MINIMUM_PIXEL_RANGE_MULT, MAXIMUM_PIXEL_RANGE_MULT)
|
||||||
|
return Menu::getInstance()->getSixenseReticleMoveSpeed() * RANGE_MULT + MIN_PIXEL_RANGE_MULT;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
|
|
||||||
// the calibration sequence is:
|
// the calibration sequence is:
|
||||||
|
@ -339,7 +350,7 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
Qt::MouseButton bumperButton;
|
Qt::MouseButton bumperButton;
|
||||||
Qt::MouseButton triggerButton;
|
Qt::MouseButton triggerButton;
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseInvertInputButtons)) {
|
if (Menu::getInstance()->getInvertSixenseButtons()) {
|
||||||
bumperButton = Qt::LeftButton;
|
bumperButton = Qt::LeftButton;
|
||||||
triggerButton = Qt::RightButton;
|
triggerButton = Qt::RightButton;
|
||||||
} else {
|
} else {
|
||||||
|
@ -347,14 +358,15 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
triggerButton = Qt::LeftButton;
|
triggerButton = Qt::LeftButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the angles, scaled between 0-1
|
// Get the angles, scaled between (-0.5,0.5)
|
||||||
float xAngle = (atan2(direction.z, direction.x) + M_PI_2) + 0.5f;
|
float xAngle = (atan2(direction.z, direction.x) + M_PI_2);
|
||||||
float yAngle = 1.0f - ((atan2(direction.z, direction.y) + M_PI_2) + 0.5f);
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
float cursorRange = widget->width();
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
|
float cursorRange = widget->width() * getCursorPixelRangeMult();
|
||||||
|
|
||||||
pos.setX(cursorRange * xAngle);
|
pos.setX(widget->width() / 2.0f + cursorRange * xAngle);
|
||||||
pos.setY(cursorRange * yAngle);
|
pos.setY(widget->height() / 2.0f + cursorRange * yAngle);
|
||||||
|
|
||||||
//If we are off screen then we should stop processing, and if a trigger or bumper is pressed,
|
//If we are off screen then we should stop processing, and if a trigger or bumper is pressed,
|
||||||
//we should unpress them.
|
//we should unpress them.
|
||||||
|
|
|
@ -30,6 +30,9 @@ const unsigned int BUTTON_FWD = 1U << 7;
|
||||||
// Event type that represents moving the controller
|
// Event type that represents moving the controller
|
||||||
const unsigned int CONTROLLER_MOVE_EVENT = 1500U;
|
const unsigned int CONTROLLER_MOVE_EVENT = 1500U;
|
||||||
|
|
||||||
|
const float DEFAULT_SIXENSE_RETICLE_MOVE_SPEED = 37.5f;
|
||||||
|
const bool DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS = false;
|
||||||
|
|
||||||
/// Handles interaction with the Sixense SDK (e.g., Razer Hydra).
|
/// Handles interaction with the Sixense SDK (e.g., Razer Hydra).
|
||||||
class SixenseManager : public QObject {
|
class SixenseManager : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -39,6 +42,7 @@ public:
|
||||||
~SixenseManager();
|
~SixenseManager();
|
||||||
|
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
|
float getCursorPixelRangeMult() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@ ApplicationOverlay::ApplicationOverlay() :
|
||||||
_framebufferObject(NULL),
|
_framebufferObject(NULL),
|
||||||
_oculusAngle(65.0f * RADIANS_PER_DEGREE),
|
_oculusAngle(65.0f * RADIANS_PER_DEGREE),
|
||||||
_distance(0.5f),
|
_distance(0.5f),
|
||||||
_textureFov(PI / 2.5f),
|
_textureFov(DEFAULT_OCULUS_UI_ANGULAR_SIZE * RADIANS_PER_DEGREE),
|
||||||
_uiType(HEMISPHERE) {
|
_crosshairTexture(0) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,10 +46,14 @@ ApplicationOverlay::~ApplicationOverlay() {
|
||||||
|
|
||||||
const float WHITE_TEXT[] = { 0.93f, 0.93f, 0.93f };
|
const float WHITE_TEXT[] = { 0.93f, 0.93f, 0.93f };
|
||||||
|
|
||||||
|
const float RETICLE_COLOR[] = { 0.0f, 198.0f / 255.0f, 244.0f / 255.0f };
|
||||||
|
|
||||||
// Renders the overlays either to a texture or to the screen
|
// Renders the overlays either to a texture or to the screen
|
||||||
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()");
|
||||||
|
|
||||||
|
_textureFov = Menu::getInstance()->getOculusUIAngularSize() * RADIANS_PER_DEGREE;
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
|
|
||||||
Overlays& overlays = application->getOverlays();
|
Overlays& overlays = application->getOverlays();
|
||||||
|
@ -154,27 +158,6 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = application->getAvatar();
|
||||||
const glm::vec3& viewMatrixTranslation = application->getViewMatrixTranslation();
|
const glm::vec3& viewMatrixTranslation = application->getViewMatrixTranslation();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get vertical FoV of the displayed overlay texture
|
|
||||||
const float halfVerticalAngle = _oculusAngle / 2.0f;
|
|
||||||
const float overlayAspectRatio = glWidget->width() / (float)glWidget->height();
|
|
||||||
const float halfOverlayHeight = _distance * tan(halfVerticalAngle);
|
|
||||||
const float overlayHeight = halfOverlayHeight * 2.0f;
|
|
||||||
|
|
||||||
// The more vertices, the better the curve
|
|
||||||
const int numHorizontalVertices = 20;
|
|
||||||
const int numVerticalVertices = 20;
|
|
||||||
// U texture coordinate width at each quad
|
|
||||||
const float quadTexWidth = 1.0f / (numHorizontalVertices - 1);
|
|
||||||
const float quadTexHeight = 1.0f / (numVerticalVertices - 1);
|
|
||||||
|
|
||||||
// Get horizontal angle and angle increment from vertical angle and aspect ratio
|
|
||||||
const float horizontalAngle = halfVerticalAngle * 2.0f * overlayAspectRatio;
|
|
||||||
const float angleIncrement = horizontalAngle / (numHorizontalVertices - 1);
|
|
||||||
const float halfHorizontalAngle = horizontalAngle / 2;
|
|
||||||
|
|
||||||
const float verticalAngleIncrement = _oculusAngle / (numVerticalVertices - 1);
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
|
@ -210,8 +193,6 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
|
||||||
glEnable(GL_ALPHA_TEST);
|
glEnable(GL_ALPHA_TEST);
|
||||||
glAlphaFunc(GL_GREATER, 0.01f);
|
glAlphaFunc(GL_GREATER, 0.01f);
|
||||||
|
|
||||||
float leftX, rightX, leftZ, rightZ, topZ, bottomZ;
|
|
||||||
|
|
||||||
//Draw the magnifiers
|
//Draw the magnifiers
|
||||||
for (int i = 0; i < _numMagnifiers; i++) {
|
for (int i = 0; i < _numMagnifiers; i++) {
|
||||||
renderMagnifier(_mouseX[i], _mouseY[i]);
|
renderMagnifier(_mouseX[i], _mouseY[i]);
|
||||||
|
@ -220,41 +201,9 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
|
||||||
glDepthMask(GL_FALSE);
|
glDepthMask(GL_FALSE);
|
||||||
glDisable(GL_ALPHA_TEST);
|
glDisable(GL_ALPHA_TEST);
|
||||||
|
|
||||||
//TODO: Remove immediate mode in favor of VBO
|
renderTexturedHemisphere();
|
||||||
if (_uiType == HEMISPHERE) {
|
|
||||||
renderTexturedHemisphere();
|
renderControllerPointersOculus();
|
||||||
} else{
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
// Place the vertices in a semicircle curve around the camera
|
|
||||||
for (int i = 0; i < numHorizontalVertices - 1; i++) {
|
|
||||||
for (int j = 0; j < numVerticalVertices - 1; j++) {
|
|
||||||
|
|
||||||
// Calculate the X and Z coordinates from the angles and radius from camera
|
|
||||||
leftX = sin(angleIncrement * i - halfHorizontalAngle) * _distance;
|
|
||||||
rightX = sin(angleIncrement * (i + 1) - halfHorizontalAngle) * _distance;
|
|
||||||
leftZ = -cos(angleIncrement * i - halfHorizontalAngle) * _distance;
|
|
||||||
rightZ = -cos(angleIncrement * (i + 1) - halfHorizontalAngle) * _distance;
|
|
||||||
if (_uiType == 2) {
|
|
||||||
topZ = -cos((verticalAngleIncrement * (j + 1) - halfVerticalAngle) * overlayAspectRatio) * _distance;
|
|
||||||
bottomZ = -cos((verticalAngleIncrement * j - halfVerticalAngle) * overlayAspectRatio) * _distance;
|
|
||||||
} else {
|
|
||||||
topZ = -99999;
|
|
||||||
bottomZ = -99999;
|
|
||||||
}
|
|
||||||
|
|
||||||
glTexCoord2f(quadTexWidth * i, (j + 1) * quadTexHeight);
|
|
||||||
glVertex3f(leftX, (j + 1) * quadTexHeight * overlayHeight - halfOverlayHeight, max(topZ, leftZ));
|
|
||||||
glTexCoord2f(quadTexWidth * (i + 1), (j + 1) * quadTexHeight);
|
|
||||||
glVertex3f(rightX, (j + 1) * quadTexHeight * overlayHeight - halfOverlayHeight, max(topZ, rightZ));
|
|
||||||
glTexCoord2f(quadTexWidth * (i + 1), j * quadTexHeight);
|
|
||||||
glVertex3f(rightX, j * quadTexHeight * overlayHeight - halfOverlayHeight, max(bottomZ, rightZ));
|
|
||||||
glTexCoord2f(quadTexWidth * i, j * quadTexHeight);
|
|
||||||
glVertex3f(leftX, j * quadTexHeight * overlayHeight - halfOverlayHeight, max(bottomZ, leftZ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
||||||
|
@ -275,48 +224,36 @@ void ApplicationOverlay::renderPointers() {
|
||||||
int mouseX = application->getMouseX();
|
int mouseX = application->getMouseX();
|
||||||
int mouseY = application->getMouseY();
|
int mouseY = application->getMouseY();
|
||||||
|
|
||||||
if (OculusManager::isConnected() && application->getLastMouseMoveType() == QEvent::MouseMove) {
|
//lazily load crosshair texture
|
||||||
const float pointerWidth = 10;
|
if (_crosshairTexture == 0) {
|
||||||
const float pointerHeight = 10;
|
_crosshairTexture = Application::getInstance()->getGLWidget()->bindTexture(QImage(Application::resourcesPath() + "images/sixense-reticle.png"));
|
||||||
const float crossPad = 4;
|
}
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
|
||||||
|
|
||||||
|
|
||||||
|
if (OculusManager::isConnected() && application->getLastMouseMoveType() == QEvent::MouseMove) {
|
||||||
|
//If we are in oculus, render reticle later
|
||||||
_numMagnifiers = 1;
|
_numMagnifiers = 1;
|
||||||
_mouseX[0] = application->getMouseX();
|
_mouseX[0] = application->getMouseX();
|
||||||
_mouseY[0] = application->getMouseY();
|
_mouseY[0] = application->getMouseY();
|
||||||
|
|
||||||
mouseX -= pointerWidth / 2.0f;
|
|
||||||
mouseY += pointerHeight / 2.0f;
|
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
|
|
||||||
glColor3f(1, 0, 0);
|
|
||||||
|
|
||||||
//Horizontal crosshair
|
|
||||||
glVertex2i(mouseX, mouseY - crossPad);
|
|
||||||
glVertex2i(mouseX + pointerWidth, mouseY - crossPad);
|
|
||||||
glVertex2i(mouseX + pointerWidth, mouseY - pointerHeight + crossPad);
|
|
||||||
glVertex2i(mouseX, mouseY - pointerHeight + crossPad);
|
|
||||||
|
|
||||||
//Vertical crosshair
|
|
||||||
glVertex2i(mouseX + crossPad, mouseY);
|
|
||||||
glVertex2i(mouseX + pointerWidth - crossPad, mouseY);
|
|
||||||
glVertex2i(mouseX + pointerWidth - crossPad, mouseY - pointerHeight);
|
|
||||||
glVertex2i(mouseX + crossPad, mouseY - pointerHeight);
|
|
||||||
|
|
||||||
glEnd();
|
|
||||||
} else if (application->getLastMouseMoveType() == CONTROLLER_MOVE_EVENT && Menu::getInstance()->isOptionChecked(MenuOption::SixenseMouseInput)) {
|
} else if (application->getLastMouseMoveType() == CONTROLLER_MOVE_EVENT && Menu::getInstance()->isOptionChecked(MenuOption::SixenseMouseInput)) {
|
||||||
//only render controller pointer if we aren't already rendering a mouse pointer
|
//only render controller pointer if we aren't already rendering a mouse pointer
|
||||||
renderControllerPointer();
|
renderControllerPointers();
|
||||||
}
|
}
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderControllerPointer() {
|
void ApplicationOverlay::renderControllerPointers() {
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
QGLWidget* glWidget = application->getGLWidget();
|
QGLWidget* glWidget = application->getGLWidget();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = application->getAvatar();
|
||||||
|
|
||||||
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
||||||
int numberOfPalms = handData->getNumPalms();
|
|
||||||
|
|
||||||
for (unsigned int palmIndex = 2; palmIndex < 4; palmIndex++) {
|
for (unsigned int palmIndex = 2; palmIndex < 4; palmIndex++) {
|
||||||
const PalmData* palmData = NULL;
|
const PalmData* palmData = NULL;
|
||||||
|
@ -334,14 +271,15 @@ void ApplicationOverlay::renderControllerPointer() {
|
||||||
// Get directon relative to avatar orientation
|
// Get directon relative to avatar orientation
|
||||||
glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * palmData->getFingerDirection();
|
glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * palmData->getFingerDirection();
|
||||||
|
|
||||||
// Get the angles, scaled between 0-1
|
// Get the angles, scaled between (-0.5,0.5)
|
||||||
float xAngle = (atan2(direction.z, direction.x) + M_PI_2) + 0.5f;
|
float xAngle = (atan2(direction.z, direction.x) + M_PI_2) ;
|
||||||
float yAngle = 1.0f - ((atan2(direction.z, direction.y) + M_PI_2) + 0.5f);
|
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
|
||||||
|
|
||||||
float cursorRange = glWidget->width();
|
// Get the pixel range over which the xAngle and yAngle are scaled
|
||||||
|
float cursorRange = glWidget->width() * application->getSixenseManager()->getCursorPixelRangeMult();
|
||||||
|
|
||||||
int mouseX = cursorRange * xAngle;
|
int mouseX = glWidget->width() / 2.0f + cursorRange * xAngle;
|
||||||
int mouseY = cursorRange * yAngle;
|
int mouseY = glWidget->height() / 2.0f + cursorRange * yAngle;
|
||||||
|
|
||||||
//If the cursor is out of the screen then don't render it
|
//If the cursor is out of the screen then don't render it
|
||||||
if (mouseX < 0 || mouseX >= glWidget->width() || mouseY < 0 || mouseY >= glWidget->height()) {
|
if (mouseX < 0 || mouseX >= glWidget->width() || mouseY < 0 || mouseY >= glWidget->height()) {
|
||||||
|
@ -350,18 +288,16 @@ void ApplicationOverlay::renderControllerPointer() {
|
||||||
|
|
||||||
float pointerWidth = 40;
|
float pointerWidth = 40;
|
||||||
float pointerHeight = 40;
|
float pointerHeight = 40;
|
||||||
float crossPad = 16;
|
|
||||||
//if we have the oculus, we should make the cursor smaller since it will be
|
//if we have the oculus, we should make the cursor smaller since it will be
|
||||||
//magnified
|
//magnified
|
||||||
if (OculusManager::isConnected()) {
|
if (OculusManager::isConnected()) {
|
||||||
pointerWidth /= 4;
|
|
||||||
pointerHeight /= 4;
|
|
||||||
crossPad /= 4;
|
|
||||||
|
|
||||||
_mouseX[_numMagnifiers] = mouseX;
|
_mouseX[_numMagnifiers] = mouseX;
|
||||||
_mouseY[_numMagnifiers] = mouseY;
|
_mouseY[_numMagnifiers] = mouseY;
|
||||||
_numMagnifiers++;
|
_numMagnifiers++;
|
||||||
|
//If oculus is enabled, we draw the crosshairs later
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
mouseX -= pointerWidth / 2.0f;
|
mouseX -= pointerWidth / 2.0f;
|
||||||
|
@ -369,98 +305,41 @@ void ApplicationOverlay::renderControllerPointer() {
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glColor3f(0.0f, 0.0f, 1.0f);
|
glColor3f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2]);
|
||||||
|
|
||||||
//Horizontal crosshair
|
glTexCoord2d(0.0f, 0.0f); glVertex2i(mouseX, mouseY);
|
||||||
glVertex2i(mouseX, mouseY - crossPad);
|
glTexCoord2d(1.0f, 0.0f); glVertex2i(mouseX + pointerWidth, mouseY);
|
||||||
glVertex2i(mouseX + pointerWidth, mouseY - crossPad);
|
glTexCoord2d(1.0f, 1.0f); glVertex2i(mouseX + pointerWidth, mouseY - pointerHeight);
|
||||||
glVertex2i(mouseX + pointerWidth, mouseY - pointerHeight + crossPad);
|
glTexCoord2d(0.0f, 1.0f); glVertex2i(mouseX, mouseY - pointerHeight);
|
||||||
glVertex2i(mouseX, mouseY - pointerHeight + crossPad);
|
|
||||||
|
|
||||||
//Vertical crosshair
|
|
||||||
glVertex2i(mouseX + crossPad, mouseY);
|
|
||||||
glVertex2i(mouseX + pointerWidth - crossPad, mouseY);
|
|
||||||
glVertex2i(mouseX + pointerWidth - crossPad, mouseY - pointerHeight);
|
|
||||||
glVertex2i(mouseX + crossPad, mouseY - pointerHeight);
|
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Renders a small magnification of the currently bound texture at the coordinates
|
void ApplicationOverlay::renderControllerPointersOculus() {
|
||||||
void ApplicationOverlay::renderMagnifier(int mouseX, int mouseY)
|
|
||||||
{
|
|
||||||
Application* application = Application::getInstance();
|
Application* application = Application::getInstance();
|
||||||
QGLWidget* glWidget = application->getGLWidget();
|
QGLWidget* glWidget = application->getGLWidget();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
|
||||||
const glm::vec3& viewMatrixTranslation = application->getViewMatrixTranslation();
|
|
||||||
|
|
||||||
float leftX, rightX, leftZ, rightZ, topZ, bottomZ;
|
|
||||||
|
|
||||||
const int widgetWidth = glWidget->width();
|
const int widgetWidth = glWidget->width();
|
||||||
const int widgetHeight = glWidget->height();
|
const int widgetHeight = glWidget->height();
|
||||||
const float magnification = 4.0f;
|
|
||||||
|
const float reticleSize = 50.0f;
|
||||||
|
|
||||||
// Get vertical FoV of the displayed overlay texture
|
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
|
||||||
const float halfVerticalAngle = _oculusAngle / 2.0f;
|
glDisable(GL_DEPTH_TEST);
|
||||||
const float overlayAspectRatio = glWidget->width() / (float)glWidget->height();
|
|
||||||
const float halfOverlayHeight = _distance * tan(halfVerticalAngle);
|
for (int i = 0; i < _numMagnifiers; i++) {
|
||||||
|
|
||||||
// Get horizontal angle and angle increment from vertical angle and aspect ratio
|
|
||||||
const float horizontalAngle = halfVerticalAngle * 2.0f * overlayAspectRatio;
|
|
||||||
const float halfHorizontalAngle = horizontalAngle / 2;
|
|
||||||
|
|
||||||
|
|
||||||
float magnifyWidth = 80.0f;
|
|
||||||
float magnifyHeight = 60.0f;
|
|
||||||
|
|
||||||
mouseX -= magnifyWidth / 2;
|
|
||||||
mouseY -= magnifyHeight / 2;
|
|
||||||
|
|
||||||
//clamp the magnification
|
|
||||||
if (mouseX < 0) {
|
|
||||||
magnifyWidth += mouseX;
|
|
||||||
mouseX = 0;
|
|
||||||
} else if (mouseX + magnifyWidth > widgetWidth) {
|
|
||||||
magnifyWidth = widgetWidth - mouseX;
|
|
||||||
}
|
|
||||||
if (mouseY < 0) {
|
|
||||||
magnifyHeight += mouseY;
|
|
||||||
mouseY = 0;
|
|
||||||
} else if (mouseY + magnifyHeight > widgetHeight) {
|
|
||||||
magnifyHeight = widgetHeight - mouseY;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float halfMagnifyHeight = magnifyHeight / 2.0f;
|
|
||||||
|
|
||||||
float newWidth = magnifyWidth * magnification;
|
|
||||||
float newHeight = magnifyHeight * magnification;
|
|
||||||
|
|
||||||
// Magnification Texture Coordinates
|
|
||||||
float magnifyULeft = mouseX / (float)widgetWidth;
|
|
||||||
float magnifyURight = (mouseX + magnifyWidth) / (float)widgetWidth;
|
|
||||||
float magnifyVBottom = 1.0f - mouseY / (float)widgetHeight;
|
|
||||||
float magnifyVTop = 1.0f - (mouseY + magnifyHeight) / (float)widgetHeight;
|
|
||||||
|
|
||||||
// Coordinates of magnification overlay
|
|
||||||
float newMouseX = (mouseX + magnifyWidth / 2) - newWidth / 2.0f;
|
|
||||||
float newMouseY = (mouseY + magnifyHeight / 2) + newHeight / 2.0f;
|
|
||||||
|
|
||||||
// Get angle on the UI
|
|
||||||
float leftAngle = (newMouseX / (float)widgetWidth) * horizontalAngle - halfHorizontalAngle;
|
|
||||||
float rightAngle = ((newMouseX + newWidth) / (float)widgetWidth) * horizontalAngle - halfHorizontalAngle;
|
|
||||||
|
|
||||||
float bottomAngle = (newMouseY / (float)widgetHeight) * _oculusAngle - halfVerticalAngle;
|
|
||||||
float topAngle = ((newMouseY - newHeight) / (float)widgetHeight) * _oculusAngle - halfVerticalAngle;
|
|
||||||
|
|
||||||
// Get position on hemisphere using angle
|
|
||||||
if (_uiType == HEMISPHERE) {
|
|
||||||
|
|
||||||
|
float mouseX = (float)_mouseX[i];
|
||||||
|
float mouseY = (float)_mouseY[i];
|
||||||
|
mouseX -= reticleSize / 2;
|
||||||
|
mouseY += reticleSize / 2;
|
||||||
|
|
||||||
//Get new UV coordinates from our magnification window
|
//Get new UV coordinates from our magnification window
|
||||||
float newULeft = newMouseX / widgetWidth;
|
float newULeft = mouseX / widgetWidth;
|
||||||
float newURight = (newMouseX + newWidth) / widgetWidth;
|
float newURight = (mouseX + reticleSize) / widgetWidth;
|
||||||
float newVBottom = 1.0 - newMouseY / widgetHeight;
|
float newVBottom = 1.0 - mouseY / widgetHeight;
|
||||||
float newVTop = 1.0 - (newMouseY - newHeight) / widgetHeight;
|
float newVTop = 1.0 - (mouseY - reticleSize) / widgetHeight;
|
||||||
|
|
||||||
// Project our position onto the hemisphere using the UV coordinates
|
// Project our position onto the hemisphere using the UV coordinates
|
||||||
float lX = sin((newULeft - 0.5f) * _textureFov);
|
float lX = sin((newULeft - 0.5f) * _textureFov);
|
||||||
|
@ -484,40 +363,86 @@ void ApplicationOverlay::renderMagnifier(int mouseX, int mouseY)
|
||||||
|
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
glTexCoord2f(magnifyULeft, magnifyVBottom); glVertex3f(lX, tY, -tlZ);
|
glColor3f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2]);
|
||||||
glTexCoord2f(magnifyURight, magnifyVBottom); glVertex3f(rX, tY, -trZ);
|
|
||||||
glTexCoord2f(magnifyURight, magnifyVTop); glVertex3f(rX, bY, -brZ);
|
glTexCoord2f(0.0f, 0.0f); glVertex3f(lX, tY, -tlZ);
|
||||||
glTexCoord2f(magnifyULeft, magnifyVTop); glVertex3f(lX, bY, -blZ);
|
glTexCoord2f(1.0f, 0.0f); glVertex3f(rX, tY, -trZ);
|
||||||
|
glTexCoord2f(1.0f, 1.0f); glVertex3f(rX, bY, -brZ);
|
||||||
glEnd();
|
glTexCoord2f(0.0f, 1.0f); glVertex3f(lX, bY, -blZ);
|
||||||
|
|
||||||
} else {
|
|
||||||
leftX = sin(leftAngle) * _distance;
|
|
||||||
rightX = sin(rightAngle) * _distance;
|
|
||||||
leftZ = -cos(leftAngle) * _distance;
|
|
||||||
rightZ = -cos(rightAngle) * _distance;
|
|
||||||
if (_uiType == CURVED_SEMICIRCLE) {
|
|
||||||
topZ = -cos(topAngle * overlayAspectRatio) * _distance;
|
|
||||||
bottomZ = -cos(bottomAngle * overlayAspectRatio) * _distance;
|
|
||||||
} else {
|
|
||||||
// Dont want to use topZ or bottomZ for SEMICIRCLE
|
|
||||||
topZ = -99999;
|
|
||||||
bottomZ = -99999;
|
|
||||||
}
|
|
||||||
|
|
||||||
float bottomY = (1.0 - newMouseY / (float)widgetHeight) * halfOverlayHeight * 2.0f - halfOverlayHeight;
|
|
||||||
float topY = bottomY + (newHeight / widgetHeight) * halfOverlayHeight * 2;
|
|
||||||
|
|
||||||
//TODO: Remove immediate mode in favor of VBO
|
|
||||||
glBegin(GL_QUADS);
|
|
||||||
|
|
||||||
glTexCoord2f(magnifyULeft, magnifyVBottom); glVertex3f(leftX, topY, max(topZ, leftZ));
|
|
||||||
glTexCoord2f(magnifyURight, magnifyVBottom); glVertex3f(rightX, topY, max(topZ, rightZ));
|
|
||||||
glTexCoord2f(magnifyURight, magnifyVTop); glVertex3f(rightX, bottomY, max(bottomZ, rightZ));
|
|
||||||
glTexCoord2f(magnifyULeft, magnifyVTop); glVertex3f(leftX, bottomY, max(bottomZ, leftZ));
|
|
||||||
|
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
glEnable(GL_DEPTH_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Renders a small magnification of the currently bound texture at the coordinates
|
||||||
|
void ApplicationOverlay::renderMagnifier(int mouseX, int mouseY)
|
||||||
|
{
|
||||||
|
Application* application = Application::getInstance();
|
||||||
|
QGLWidget* glWidget = application->getGLWidget();
|
||||||
|
|
||||||
|
|
||||||
|
const int widgetWidth = glWidget->width();
|
||||||
|
const int widgetHeight = glWidget->height();
|
||||||
|
const float magnification = 4.0f;
|
||||||
|
|
||||||
|
float magnifyWidth = 80.0f;
|
||||||
|
float magnifyHeight = 60.0f;
|
||||||
|
|
||||||
|
mouseX -= magnifyWidth / 2;
|
||||||
|
mouseY -= magnifyHeight / 2;
|
||||||
|
|
||||||
|
float newWidth = magnifyWidth * magnification;
|
||||||
|
float newHeight = magnifyHeight * magnification;
|
||||||
|
|
||||||
|
// Magnification Texture Coordinates
|
||||||
|
float magnifyULeft = mouseX / (float)widgetWidth;
|
||||||
|
float magnifyURight = (mouseX + magnifyWidth) / (float)widgetWidth;
|
||||||
|
float magnifyVBottom = 1.0f - mouseY / (float)widgetHeight;
|
||||||
|
float magnifyVTop = 1.0f - (mouseY + magnifyHeight) / (float)widgetHeight;
|
||||||
|
|
||||||
|
// Coordinates of magnification overlay
|
||||||
|
float newMouseX = (mouseX + magnifyWidth / 2) - newWidth / 2.0f;
|
||||||
|
float newMouseY = (mouseY + magnifyHeight / 2) + newHeight / 2.0f;
|
||||||
|
|
||||||
|
// Get position on hemisphere using angle
|
||||||
|
|
||||||
|
//Get new UV coordinates from our magnification window
|
||||||
|
float newULeft = newMouseX / widgetWidth;
|
||||||
|
float newURight = (newMouseX + newWidth) / widgetWidth;
|
||||||
|
float newVBottom = 1.0 - newMouseY / widgetHeight;
|
||||||
|
float newVTop = 1.0 - (newMouseY - newHeight) / widgetHeight;
|
||||||
|
|
||||||
|
// Project our position onto the hemisphere using the UV coordinates
|
||||||
|
float lX = sin((newULeft - 0.5f) * _textureFov);
|
||||||
|
float rX = sin((newURight - 0.5f) * _textureFov);
|
||||||
|
float bY = sin((newVBottom - 0.5f) * _textureFov);
|
||||||
|
float tY = sin((newVTop - 0.5f) * _textureFov);
|
||||||
|
|
||||||
|
float dist;
|
||||||
|
//Bottom Left
|
||||||
|
dist = sqrt(lX * lX + bY * bY);
|
||||||
|
float blZ = sqrt(1.0f - dist * dist);
|
||||||
|
//Top Left
|
||||||
|
dist = sqrt(lX * lX + tY * tY);
|
||||||
|
float tlZ = sqrt(1.0f - dist * dist);
|
||||||
|
//Bottom Right
|
||||||
|
dist = sqrt(rX * rX + bY * bY);
|
||||||
|
float brZ = sqrt(1.0f - dist * dist);
|
||||||
|
//Top Right
|
||||||
|
dist = sqrt(rX * rX + tY * tY);
|
||||||
|
float trZ = sqrt(1.0f - dist * dist);
|
||||||
|
|
||||||
|
glBegin(GL_QUADS);
|
||||||
|
|
||||||
|
glTexCoord2f(magnifyULeft, magnifyVBottom); glVertex3f(lX, tY, -tlZ);
|
||||||
|
glTexCoord2f(magnifyURight, magnifyVBottom); glVertex3f(rX, tY, -trZ);
|
||||||
|
glTexCoord2f(magnifyURight, magnifyVTop); glVertex3f(rX, bY, -brZ);
|
||||||
|
glTexCoord2f(magnifyULeft, magnifyVTop); glVertex3f(lX, bY, -blZ);
|
||||||
|
|
||||||
|
glEnd();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderAudioMeter() {
|
void ApplicationOverlay::renderAudioMeter() {
|
||||||
|
@ -696,8 +621,11 @@ void ApplicationOverlay::renderTexturedHemisphere() {
|
||||||
static VerticesIndices vbo(0, 0);
|
static VerticesIndices vbo(0, 0);
|
||||||
int vertices = slices * (stacks - 1) + 1;
|
int vertices = slices * (stacks - 1) + 1;
|
||||||
int indices = slices * 2 * 3 * (stacks - 2) + slices * 3;
|
int indices = slices * 2 * 3 * (stacks - 2) + slices * 3;
|
||||||
//We only generate the VBO once
|
|
||||||
if (vbo.first == 0) {
|
static float oldTextureFOV = _textureFov;
|
||||||
|
//We only generate the VBO when the _textureFov changes
|
||||||
|
if (vbo.first == 0 || oldTextureFOV != _textureFov) {
|
||||||
|
oldTextureFOV = _textureFov;
|
||||||
TextureVertex* vertexData = new TextureVertex[vertices];
|
TextureVertex* vertexData = new TextureVertex[vertices];
|
||||||
TextureVertex* vertex = vertexData;
|
TextureVertex* vertex = vertexData;
|
||||||
for (int i = 0; i < stacks - 1; i++) {
|
for (int i = 0; i < stacks - 1; i++) {
|
||||||
|
@ -722,7 +650,9 @@ void ApplicationOverlay::renderTexturedHemisphere() {
|
||||||
vertex->uv.y = 0.5f;
|
vertex->uv.y = 0.5f;
|
||||||
vertex++;
|
vertex++;
|
||||||
|
|
||||||
glGenBuffers(1, &vbo.first);
|
if (vbo.first == 0){
|
||||||
|
glGenBuffers(1, &vbo.first);
|
||||||
|
}
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vbo.first);
|
glBindBuffer(GL_ARRAY_BUFFER, vbo.first);
|
||||||
const int BYTES_PER_VERTEX = sizeof(TextureVertex);
|
const int BYTES_PER_VERTEX = sizeof(TextureVertex);
|
||||||
glBufferData(GL_ARRAY_BUFFER, vertices * BYTES_PER_VERTEX, vertexData, GL_STATIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, vertices * BYTES_PER_VERTEX, vertexData, GL_STATIC_DRAW);
|
||||||
|
|
|
@ -19,8 +19,6 @@ class QOpenGLFramebufferObject;
|
||||||
class ApplicationOverlay {
|
class ApplicationOverlay {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
enum UIType { HEMISPHERE, SEMICIRCLE, CURVED_SEMICIRCLE };
|
|
||||||
|
|
||||||
ApplicationOverlay();
|
ApplicationOverlay();
|
||||||
~ApplicationOverlay();
|
~ApplicationOverlay();
|
||||||
|
|
||||||
|
@ -31,12 +29,7 @@ public:
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
QOpenGLFramebufferObject* getFramebufferObject();
|
QOpenGLFramebufferObject* getFramebufferObject();
|
||||||
float getOculusAngle() const { return _oculusAngle; }
|
|
||||||
|
|
||||||
// Setters
|
|
||||||
void setOculusAngle(float oculusAngle) { _oculusAngle = oculusAngle; }
|
|
||||||
void setUIType(UIType uiType) { _uiType = uiType; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Interleaved vertex data
|
// Interleaved vertex data
|
||||||
struct TextureVertex {
|
struct TextureVertex {
|
||||||
|
@ -47,7 +40,8 @@ private:
|
||||||
typedef QPair<GLuint, GLuint> VerticesIndices;
|
typedef QPair<GLuint, GLuint> VerticesIndices;
|
||||||
|
|
||||||
void renderPointers();
|
void renderPointers();
|
||||||
void renderControllerPointer();
|
void renderControllerPointers();
|
||||||
|
void renderControllerPointersOculus();
|
||||||
void renderMagnifier(int mouseX, int mouseY);
|
void renderMagnifier(int mouseX, int mouseY);
|
||||||
void renderAudioMeter();
|
void renderAudioMeter();
|
||||||
void renderStatsAndLogs();
|
void renderStatsAndLogs();
|
||||||
|
@ -58,10 +52,11 @@ private:
|
||||||
float _oculusAngle;
|
float _oculusAngle;
|
||||||
float _distance;
|
float _distance;
|
||||||
float _textureFov;
|
float _textureFov;
|
||||||
UIType _uiType;
|
|
||||||
int _mouseX[2];
|
int _mouseX[2];
|
||||||
int _mouseY[2];
|
int _mouseY[2];
|
||||||
int _numMagnifiers;
|
int _numMagnifiers;
|
||||||
|
|
||||||
|
GLuint _crosshairTexture;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ApplicationOverlay_h
|
#endif // hifi_ApplicationOverlay_h
|
|
@ -137,6 +137,13 @@ void PreferencesDialog::loadPreferences() {
|
||||||
ui.maxVoxelsSpin->setValue(menuInstance->getMaxVoxels());
|
ui.maxVoxelsSpin->setValue(menuInstance->getMaxVoxels());
|
||||||
|
|
||||||
ui.maxVoxelsPPSSpin->setValue(menuInstance->getMaxVoxelPacketsPerSecond());
|
ui.maxVoxelsPPSSpin->setValue(menuInstance->getMaxVoxelPacketsPerSecond());
|
||||||
|
|
||||||
|
ui.oculusUIAngularSizeSpin->setValue(menuInstance->getOculusUIAngularSize());
|
||||||
|
|
||||||
|
ui.sixenseReticleMoveSpeedSpin->setValue(menuInstance->getSixenseReticleMoveSpeed());
|
||||||
|
|
||||||
|
ui.invertSixenseButtonsCheckBox->setChecked(menuInstance->getInvertSixenseButtons());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreferencesDialog::savePreferences() {
|
void PreferencesDialog::savePreferences() {
|
||||||
|
@ -189,6 +196,12 @@ void PreferencesDialog::savePreferences() {
|
||||||
(float)ui.faceshiftEyeDeflectionSider->maximum());
|
(float)ui.faceshiftEyeDeflectionSider->maximum());
|
||||||
Menu::getInstance()->setMaxVoxelPacketsPerSecond(ui.maxVoxelsPPSSpin->value());
|
Menu::getInstance()->setMaxVoxelPacketsPerSecond(ui.maxVoxelsPPSSpin->value());
|
||||||
|
|
||||||
|
Menu::getInstance()->setOculusUIAngularSize(ui.oculusUIAngularSizeSpin->value());
|
||||||
|
|
||||||
|
Menu::getInstance()->setSixenseReticleMoveSpeed(ui.sixenseReticleMoveSpeedSpin->value());
|
||||||
|
|
||||||
|
Menu::getInstance()->setInvertSixenseButtons(ui.invertSixenseButtonsCheckBox->isChecked());
|
||||||
|
|
||||||
Menu::getInstance()->setAudioJitterBufferSamples(ui.audioJitterSpin->value());
|
Menu::getInstance()->setAudioJitterBufferSamples(ui.audioJitterSpin->value());
|
||||||
Application::getInstance()->getAudio()->setJitterBufferSamples(ui.audioJitterSpin->value());
|
Application::getInstance()->getAudio()->setJitterBufferSamples(ui.audioJitterSpin->value());
|
||||||
|
|
||||||
|
|
|
@ -154,9 +154,9 @@ color: #0e7077</string>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>-204</y>
|
<y>-1002</y>
|
||||||
<width>494</width>
|
<width>477</width>
|
||||||
<height>1091</height>
|
<height>1386</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -1605,6 +1605,331 @@ padding: 10px;margin-top:10px</string>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="oculusRiftTitleLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: #0e7077</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Oculus Rift</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_15">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(51, 51, 51)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>User Interface Angular Size</string>
|
||||||
|
</property>
|
||||||
|
<property name="indent">
|
||||||
|
<number>15</number>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>maxVoxelsSpin</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_15">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="oculusUIAngularSizeSpin">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>125</width>
|
||||||
|
<height>36</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>30</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>160</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>72</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="sixenseControllersTitleLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
<pointsize>20</pointsize>
|
||||||
|
<weight>50</weight>
|
||||||
|
<bold>false</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: #0e7077</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Sixense Controllers</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_17">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_14">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(51, 51, 51)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Invert Mouse Buttons</string>
|
||||||
|
</property>
|
||||||
|
<property name="indent">
|
||||||
|
<number>15</number>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>maxVoxelsSpin</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_17">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="invertSixenseButtonsCheckBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="baseSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize">
|
||||||
|
<size>
|
||||||
|
<width>32</width>
|
||||||
|
<height>32</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_16">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="styleSheet">
|
||||||
|
<string notr="true">color: rgb(51, 51, 51)</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Reticle Movement Speed</string>
|
||||||
|
</property>
|
||||||
|
<property name="indent">
|
||||||
|
<number>15</number>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>maxVoxelsSpin</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_16">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QSpinBox" name="sixenseReticleMoveSpeedSpin">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>125</width>
|
||||||
|
<height>36</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Arial</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>50</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Reference in a new issue