Added checkable menu option for laser toggle

This commit is contained in:
barnold1953 2014-07-21 12:35:46 -07:00
parent 98babe1751
commit 03bc3a9ff8
5 changed files with 23 additions and 9 deletions

View File

@ -2809,7 +2809,9 @@ void Application::displaySide(Camera& whichCamera, bool selfAvatarOnly) {
_avatarManager.renderAvatars(mirrorMode ? Avatar::MIRROR_RENDER_MODE : Avatar::NORMAL_RENDER_MODE, selfAvatarOnly);
//Render the sixense lasers
_myAvatar->renderLaserPointers();
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) {
_myAvatar->renderLaserPointers();
}
}
if (!selfAvatarOnly) {

View File

@ -413,6 +413,7 @@ Menu::Menu() :
QMenu* sixenseOptionsMenu = developerMenu->addMenu("Sixense Options");
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseMouseInput, 0, true);
addCheckableActionToQMenuAndActionHash(sixenseOptionsMenu, MenuOption::SixenseLasers, 0, true);
QMenu* handOptionsMenu = developerMenu->addMenu("Hand Options");

View File

@ -431,6 +431,7 @@ namespace MenuOption {
const QString ShowIKConstraints = "Show IK Constraints";
const QString SimpleShadows = "Simple";
const QString SixenseMouseInput = "Enable Sixense Mouse Input";
const QString SixenseLasers = "Enable Sixense UI Lasers";
const QString StandOnNearbyFloors = "Stand on nearby floors";
const QString Stars = "Stars";
const QString Stats = "Stats";

View File

@ -381,8 +381,7 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
triggerButton = Qt::LeftButton;
}
const bool useLasers = true;
if (useLasers) {
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) {
pos = application->getApplicationOverlay().getPalmClickLocation(palm);
} else {
// Get directon relative to avatar orientation

View File

@ -353,9 +353,6 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
Application* application = Application::getInstance();
MyAvatar* myAvatar = application->getAvatar();
//Render the sixense lasers
myAvatar->renderLaserPointers();
glActiveTexture(GL_TEXTURE0);
@ -656,10 +653,24 @@ void ApplicationOverlay::renderControllerPointers() {
}
int mouseX, mouseY;
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)) {
QPoint res = getPalmClickLocation(palmData);
mouseX = res.x();
mouseY = res.y();
} else {
// Get directon relative to avatar orientation
glm::vec3 direction = glm::inverse(myAvatar->getOrientation()) * palmData->getFingerDirection();
QPoint res = getPalmClickLocation(palmData);
mouseX = res.x();
mouseY = res.y();
// Get the angles, scaled between (-0.5,0.5)
float xAngle = (atan2(direction.z, direction.x) + M_PI_2);
float yAngle = 0.5f - ((atan2(direction.z, direction.y) + M_PI_2));
// Get the pixel range over which the xAngle and yAngle are scaled
float cursorRange = glWidget->width() * application->getSixenseManager()->getCursorPixelRangeMult();
mouseX = (glWidget->width() / 2.0f + cursorRange * xAngle);
mouseY = (glWidget->height() / 2.0f + cursorRange * yAngle);
}
//If the cursor is out of the screen then don't render it
if (mouseX < 0 || mouseX >= glWidget->width() || mouseY < 0 || mouseY >= glWidget->height()) {