mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-04 03:53:10 +02:00
Remove app->getAvatar
This commit is contained in:
parent
381ccfac37
commit
647a935eaa
18 changed files with 105 additions and 99 deletions
|
@ -171,8 +171,6 @@ public:
|
||||||
|
|
||||||
bool isThrottleRendering() const { return DependencyManager::get<GLCanvas>()->isThrottleRendering(); }
|
bool isThrottleRendering() const { return DependencyManager::get<GLCanvas>()->isThrottleRendering(); }
|
||||||
|
|
||||||
MyAvatar* getAvatar() { return _myAvatar; }
|
|
||||||
const MyAvatar* getAvatar() const { return _myAvatar; }
|
|
||||||
Camera* getCamera() { return &_myCamera; }
|
Camera* getCamera() { return &_myCamera; }
|
||||||
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
ViewFrustum* getViewFrustum() { return &_viewFrustum; }
|
||||||
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
ViewFrustum* getDisplayViewFrustum() { return &_displayViewFrustum; }
|
||||||
|
@ -266,7 +264,7 @@ public:
|
||||||
virtual float getSizeScale() const;
|
virtual float getSizeScale() const;
|
||||||
virtual int getBoundaryLevelAdjust() const;
|
virtual int getBoundaryLevelAdjust() const;
|
||||||
virtual PickRay computePickRay(float x, float y);
|
virtual PickRay computePickRay(float x, float y);
|
||||||
virtual const glm::vec3& getAvatarPosition() const { return getAvatar()->getPosition(); }
|
virtual const glm::vec3& getAvatarPosition() const { return _myAvatar->getPosition(); }
|
||||||
|
|
||||||
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
NodeBounds& getNodeBoundsDisplay() { return _nodeBoundsDisplay; }
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,8 @@ void DatagramProcessor::processDatagrams() {
|
||||||
int headerSize = numBytesForPacketHeaderGivenPacketType(PacketTypeMuteEnvironment);
|
int headerSize = numBytesForPacketHeaderGivenPacketType(PacketTypeMuteEnvironment);
|
||||||
memcpy(&position, incomingPacket.constData() + headerSize, sizeof(glm::vec3));
|
memcpy(&position, incomingPacket.constData() + headerSize, sizeof(glm::vec3));
|
||||||
memcpy(&radius, incomingPacket.constData() + headerSize + sizeof(glm::vec3), sizeof(float));
|
memcpy(&radius, incomingPacket.constData() + headerSize + sizeof(glm::vec3), sizeof(float));
|
||||||
distance = glm::distance(Application::getInstance()->getAvatar()->getPosition(), position);
|
distance = glm::distance(DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition(),
|
||||||
|
position);
|
||||||
|
|
||||||
mute = mute && (distance < radius);
|
mute = mute && (distance < radius);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "AccountManager.h"
|
#include "AccountManager.h"
|
||||||
#include "audio/AudioIOStatsRenderer.h"
|
#include "audio/AudioIOStatsRenderer.h"
|
||||||
#include "audio/AudioScope.h"
|
#include "audio/AudioScope.h"
|
||||||
|
#include "avatar/AvatarManager.h"
|
||||||
#include "devices/Faceshift.h"
|
#include "devices/Faceshift.h"
|
||||||
#include "devices/RealSense.h"
|
#include "devices/RealSense.h"
|
||||||
#include "devices/SixenseManager.h"
|
#include "devices/SixenseManager.h"
|
||||||
|
@ -186,26 +187,26 @@ Menu::Menu() {
|
||||||
SLOT(resetSensors()));
|
SLOT(resetSensors()));
|
||||||
|
|
||||||
QMenu* avatarMenu = addMenu("Avatar");
|
QMenu* avatarMenu = addMenu("Avatar");
|
||||||
|
QObject* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
|
||||||
QMenu* avatarSizeMenu = avatarMenu->addMenu("Size");
|
QMenu* avatarSizeMenu = avatarMenu->addMenu("Size");
|
||||||
addActionToQMenuAndActionHash(avatarSizeMenu,
|
addActionToQMenuAndActionHash(avatarSizeMenu,
|
||||||
MenuOption::IncreaseAvatarSize,
|
MenuOption::IncreaseAvatarSize,
|
||||||
Qt::Key_Plus,
|
Qt::Key_Plus,
|
||||||
qApp->getAvatar(),
|
avatar,
|
||||||
SLOT(increaseSize()));
|
SLOT(increaseSize()));
|
||||||
addActionToQMenuAndActionHash(avatarSizeMenu,
|
addActionToQMenuAndActionHash(avatarSizeMenu,
|
||||||
MenuOption::DecreaseAvatarSize,
|
MenuOption::DecreaseAvatarSize,
|
||||||
Qt::Key_Minus,
|
Qt::Key_Minus,
|
||||||
qApp->getAvatar(),
|
avatar,
|
||||||
SLOT(decreaseSize()));
|
SLOT(decreaseSize()));
|
||||||
addActionToQMenuAndActionHash(avatarSizeMenu,
|
addActionToQMenuAndActionHash(avatarSizeMenu,
|
||||||
MenuOption::ResetAvatarSize,
|
MenuOption::ResetAvatarSize,
|
||||||
Qt::Key_Equal,
|
Qt::Key_Equal,
|
||||||
qApp->getAvatar(),
|
avatar,
|
||||||
SLOT(resetSize()));
|
SLOT(resetSize()));
|
||||||
|
|
||||||
QObject* avatar = qApp->getAvatar();
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::KeyboardMotorControl,
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::KeyboardMotorControl,
|
|
||||||
Qt::CTRL | Qt::SHIFT | Qt::Key_K, true, avatar, SLOT(updateMotionBehavior()));
|
Qt::CTRL | Qt::SHIFT | Qt::Key_K, true, avatar, SLOT(updateMotionBehavior()));
|
||||||
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ScriptedMotorControl, 0, true,
|
addCheckableActionToQMenuAndActionHash(avatarMenu, MenuOption::ScriptedMotorControl, 0, true,
|
||||||
avatar, SLOT(updateMotionBehavior()));
|
avatar, SLOT(updateMotionBehavior()));
|
||||||
|
|
|
@ -273,7 +273,8 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
_referential->update();
|
_referential->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (postLighting && glm::distance(Application::getInstance()->getAvatar()->getPosition(), _position) < 10.0f) {
|
if (postLighting &&
|
||||||
|
glm::distance(DependencyManager::get<AvatarManager>()->getMyAvatar()->getPosition(), _position) < 10.0f) {
|
||||||
auto geometryCache = DependencyManager::get<GeometryCache>();
|
auto geometryCache = DependencyManager::get<GeometryCache>();
|
||||||
|
|
||||||
// render pointing lasers
|
// render pointing lasers
|
||||||
|
@ -354,7 +355,7 @@ void Avatar::render(const glm::vec3& cameraPosition, RenderMode renderMode, bool
|
||||||
const float GLOW_MAX_LOUDNESS = 2500.0f;
|
const float GLOW_MAX_LOUDNESS = 2500.0f;
|
||||||
const float MAX_GLOW = 0.5f;
|
const float MAX_GLOW = 0.5f;
|
||||||
|
|
||||||
float GLOW_FROM_AVERAGE_LOUDNESS = ((this == Application::getInstance()->getAvatar())
|
float GLOW_FROM_AVERAGE_LOUDNESS = ((this == DependencyManager::get<AvatarManager>()->getMyAvatar())
|
||||||
? 0.0f
|
? 0.0f
|
||||||
: MAX_GLOW * getHeadData()->getAudioLoudness() / GLOW_MAX_LOUDNESS);
|
: MAX_GLOW * getHeadData()->getAudioLoudness() / GLOW_MAX_LOUDNESS);
|
||||||
if (!Menu::getInstance()->isOptionChecked(MenuOption::GlowWhenSpeaking)) {
|
if (!Menu::getInstance()->isOptionChecked(MenuOption::GlowWhenSpeaking)) {
|
||||||
|
@ -1054,7 +1055,7 @@ void Avatar::setShowDisplayName(bool showDisplayName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// For myAvatar, the alpha update is not done (called in simulate for other avatars)
|
// For myAvatar, the alpha update is not done (called in simulate for other avatars)
|
||||||
if (Application::getInstance()->getAvatar() == this) {
|
if (DependencyManager::get<AvatarManager>()->getMyAvatar() == this) {
|
||||||
if (showDisplayName) {
|
if (showDisplayName) {
|
||||||
_displayNameAlpha = DISPLAYNAME_ALPHA;
|
_displayNameAlpha = DISPLAYNAME_ALPHA;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -12,15 +12,14 @@
|
||||||
|
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
#include <NodeList.h>
|
|
||||||
|
|
||||||
#include <GeometryUtil.h>
|
#include <GeometryUtil.h>
|
||||||
|
#include <NodeList.h>
|
||||||
#include <ProgramObject.h>
|
#include <ProgramObject.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "AvatarManager.h"
|
||||||
#include "Avatar.h"
|
|
||||||
#include "Hand.h"
|
#include "Hand.h"
|
||||||
#include "Menu.h"
|
#include "Menu.h"
|
||||||
|
#include "MyAvatar.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -132,8 +131,7 @@ void Hand::render(bool isMine, Model::RenderMode renderMode) {
|
||||||
void Hand::renderHandTargets(bool isMine) {
|
void Hand::renderHandTargets(bool isMine) {
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
const float avatarScale = DependencyManager::get<AvatarManager>()->getMyAvatar()->getScale();
|
||||||
const float avatarScale = Application::getInstance()->getAvatar()->getScale();
|
|
||||||
|
|
||||||
const float alpha = 1.0f;
|
const float alpha = 1.0f;
|
||||||
const glm::vec3 handColor(1.0, 0.0, 0.0); // Color the hand targets red to be different than skin
|
const glm::vec3 handColor(1.0, 0.0, 0.0); // Color the hand targets red to be different than skin
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
|
#include <avatar/MyAvatar.h>
|
||||||
#include <GlowEffect.h>
|
#include <GlowEffect.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <SharedUtil.h>
|
#include <SharedUtil.h>
|
||||||
|
@ -198,11 +200,12 @@ void OculusManager::disconnect() {
|
||||||
|
|
||||||
#ifdef HAVE_LIBOVR
|
#ifdef HAVE_LIBOVR
|
||||||
void OculusManager::positionCalibrationBillboard(Text3DOverlay* billboard) {
|
void OculusManager::positionCalibrationBillboard(Text3DOverlay* billboard) {
|
||||||
glm::quat headOrientation = Application::getInstance()->getAvatar()->getHeadOrientation();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
glm::quat headOrientation = myAvatar->getHeadOrientation();
|
||||||
headOrientation.x = 0;
|
headOrientation.x = 0;
|
||||||
headOrientation.z = 0;
|
headOrientation.z = 0;
|
||||||
glm::normalize(headOrientation);
|
glm::normalize(headOrientation);
|
||||||
billboard->setPosition(Application::getInstance()->getAvatar()->getHeadPosition()
|
billboard->setPosition(myAvatar->getHeadPosition()
|
||||||
+ headOrientation * glm::vec3(0.0f, 0.0f, -CALIBRATION_MESSAGE_DISTANCE));
|
+ headOrientation * glm::vec3(0.0f, 0.0f, -CALIBRATION_MESSAGE_DISTANCE));
|
||||||
billboard->setRotation(headOrientation);
|
billboard->setRotation(headOrientation);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QtDebug>
|
#include <QtDebug>
|
||||||
|
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
#include <FBXReader.h>
|
#include <FBXReader.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <TextRenderer.h>
|
#include <TextRenderer.h>
|
||||||
|
@ -42,7 +43,7 @@ static int indexOfHumanIKJoint(const char* jointName) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setPalm(float deltaTime, int index) {
|
static void setPalm(float deltaTime, int index) {
|
||||||
MyAvatar* avatar = Application::getInstance()->getAvatar();
|
MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
Hand* hand = avatar->getHand();
|
Hand* hand = avatar->getHand();
|
||||||
PalmData* palm;
|
PalmData* palm;
|
||||||
bool foundHand = false;
|
bool foundHand = false;
|
||||||
|
@ -86,9 +87,9 @@ static void setPalm(float deltaTime, int index) {
|
||||||
// TODO: transfom this to stay in the model-frame.
|
// TODO: transfom this to stay in the model-frame.
|
||||||
glm::vec3 position;
|
glm::vec3 position;
|
||||||
glm::quat rotation;
|
glm::quat rotation;
|
||||||
SkeletonModel* skeletonModel = &Application::getInstance()->getAvatar()->getSkeletonModel();
|
SkeletonModel* skeletonModel = &DependencyManager::get<AvatarManager>()->getMyAvatar()->getSkeletonModel();
|
||||||
int jointIndex;
|
int jointIndex;
|
||||||
glm::quat inverseRotation = glm::inverse(Application::getInstance()->getAvatar()->getOrientation());
|
glm::quat inverseRotation = glm::inverse(DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation());
|
||||||
if (index == LEFT_HAND_INDEX) {
|
if (index == LEFT_HAND_INDEX) {
|
||||||
jointIndex = skeletonModel->getLeftHandJointIndex();
|
jointIndex = skeletonModel->getLeftHandJointIndex();
|
||||||
skeletonModel->getJointRotationInWorldFrame(jointIndex, rotation);
|
skeletonModel->getJointRotationInWorldFrame(jointIndex, rotation);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
|
@ -144,7 +145,7 @@ void SixenseManager::setFilter(bool filter) {
|
||||||
|
|
||||||
void SixenseManager::update(float deltaTime) {
|
void SixenseManager::update(float deltaTime) {
|
||||||
#ifdef HAVE_SIXENSE
|
#ifdef HAVE_SIXENSE
|
||||||
Hand* hand = Application::getInstance()->getAvatar()->getHand();
|
Hand* hand = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHand();
|
||||||
if (_isInitialized && _isEnabled) {
|
if (_isInitialized && _isEnabled) {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
SixenseBaseFunction sixenseGetNumActiveControllers =
|
SixenseBaseFunction sixenseGetNumActiveControllers =
|
||||||
|
@ -458,8 +459,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) {
|
||||||
Application* application = Application::getInstance();
|
MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
MyAvatar* avatar = application->getAvatar();
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
QPoint pos;
|
QPoint pos;
|
||||||
|
|
||||||
|
@ -478,7 +478,7 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)
|
if (Menu::getInstance()->isOptionChecked(MenuOption::SixenseLasers)
|
||||||
|| Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
|
|| Menu::getInstance()->isOptionChecked(MenuOption::EnableVRMode)) {
|
||||||
pos = application->getApplicationOverlay().getPalmClickLocation(palm);
|
pos = qApp->getApplicationOverlay().getPalmClickLocation(palm);
|
||||||
} else {
|
} else {
|
||||||
// Get directon relative to avatar orientation
|
// Get directon relative to avatar orientation
|
||||||
glm::vec3 direction = glm::inverse(avatar->getOrientation()) * palm->getFingerDirection();
|
glm::vec3 direction = glm::inverse(avatar->getOrientation()) * palm->getFingerDirection();
|
||||||
|
@ -501,14 +501,14 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
if (_bumperPressed[index]) {
|
if (_bumperPressed[index]) {
|
||||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, bumperButton, bumperButton, 0);
|
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, bumperButton, bumperButton, 0);
|
||||||
|
|
||||||
application->mouseReleaseEvent(&mouseEvent, deviceID);
|
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||||
|
|
||||||
_bumperPressed[index] = false;
|
_bumperPressed[index] = false;
|
||||||
}
|
}
|
||||||
if (_triggerPressed[index]) {
|
if (_triggerPressed[index]) {
|
||||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, triggerButton, triggerButton, 0);
|
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, triggerButton, triggerButton, 0);
|
||||||
|
|
||||||
application->mouseReleaseEvent(&mouseEvent, deviceID);
|
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||||
|
|
||||||
_triggerPressed[index] = false;
|
_triggerPressed[index] = false;
|
||||||
}
|
}
|
||||||
|
@ -522,11 +522,11 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
//Only send the mouse event if the opposite left button isnt held down.
|
//Only send the mouse event if the opposite left button isnt held down.
|
||||||
if (triggerButton == Qt::LeftButton) {
|
if (triggerButton == Qt::LeftButton) {
|
||||||
if (!_triggerPressed[(int)(!index)]) {
|
if (!_triggerPressed[(int)(!index)]) {
|
||||||
application->mouseMoveEvent(&mouseEvent, deviceID);
|
qApp->mouseMoveEvent(&mouseEvent, deviceID);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!_bumperPressed[(int)(!index)]) {
|
if (!_bumperPressed[(int)(!index)]) {
|
||||||
application->mouseMoveEvent(&mouseEvent, deviceID);
|
qApp->mouseMoveEvent(&mouseEvent, deviceID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,12 +549,12 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
|
|
||||||
QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, bumperButton, bumperButton, 0);
|
QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, bumperButton, bumperButton, 0);
|
||||||
|
|
||||||
application->mousePressEvent(&mouseEvent, deviceID);
|
qApp->mousePressEvent(&mouseEvent, deviceID);
|
||||||
}
|
}
|
||||||
} else if (_bumperPressed[index]) {
|
} else if (_bumperPressed[index]) {
|
||||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, bumperButton, bumperButton, 0);
|
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, bumperButton, bumperButton, 0);
|
||||||
|
|
||||||
application->mouseReleaseEvent(&mouseEvent, deviceID);
|
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||||
|
|
||||||
_bumperPressed[index] = false;
|
_bumperPressed[index] = false;
|
||||||
}
|
}
|
||||||
|
@ -566,12 +566,12 @@ void SixenseManager::emulateMouse(PalmData* palm, int index) {
|
||||||
|
|
||||||
QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, triggerButton, triggerButton, 0);
|
QMouseEvent mouseEvent(QEvent::MouseButtonPress, pos, triggerButton, triggerButton, 0);
|
||||||
|
|
||||||
application->mousePressEvent(&mouseEvent, deviceID);
|
qApp->mousePressEvent(&mouseEvent, deviceID);
|
||||||
}
|
}
|
||||||
} else if (_triggerPressed[index]) {
|
} else if (_triggerPressed[index]) {
|
||||||
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, triggerButton, triggerButton, 0);
|
QMouseEvent mouseEvent(QEvent::MouseButtonRelease, pos, triggerButton, triggerButton, 0);
|
||||||
|
|
||||||
application->mouseReleaseEvent(&mouseEvent, deviceID);
|
qApp->mouseReleaseEvent(&mouseEvent, deviceID);
|
||||||
|
|
||||||
_triggerPressed[index] = false;
|
_triggerPressed[index] = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,10 +9,12 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
|
#include <avatar/MyAvatar.h>
|
||||||
|
#include <GLCanvas.h>
|
||||||
#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"
|
||||||
|
@ -41,7 +43,7 @@ void ControllerScriptingInterface::handleMetaEvent(HFMetaEvent* event) {
|
||||||
const PalmData* ControllerScriptingInterface::getPrimaryPalm() const {
|
const PalmData* ControllerScriptingInterface::getPrimaryPalm() const {
|
||||||
int leftPalmIndex, rightPalmIndex;
|
int leftPalmIndex, rightPalmIndex;
|
||||||
|
|
||||||
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData();
|
||||||
handData->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
handData->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
||||||
|
|
||||||
if (rightPalmIndex != -1) {
|
if (rightPalmIndex != -1) {
|
||||||
|
@ -52,7 +54,7 @@ const PalmData* ControllerScriptingInterface::getPrimaryPalm() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ControllerScriptingInterface::getNumberOfActivePalms() const {
|
int ControllerScriptingInterface::getNumberOfActivePalms() const {
|
||||||
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData();
|
||||||
int numberOfPalms = handData->getNumPalms();
|
int numberOfPalms = handData->getNumPalms();
|
||||||
int numberOfActivePalms = 0;
|
int numberOfActivePalms = 0;
|
||||||
for (int i = 0; i < numberOfPalms; i++) {
|
for (int i = 0; i < numberOfPalms; i++) {
|
||||||
|
@ -64,12 +66,12 @@ int ControllerScriptingInterface::getNumberOfActivePalms() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PalmData* ControllerScriptingInterface::getPalm(int palmIndex) const {
|
const PalmData* ControllerScriptingInterface::getPalm(int palmIndex) const {
|
||||||
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData();
|
||||||
return &handData->getPalms()[palmIndex];
|
return &handData->getPalms()[palmIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
const PalmData* ControllerScriptingInterface::getActivePalm(int palmIndex) const {
|
const PalmData* ControllerScriptingInterface::getActivePalm(int palmIndex) const {
|
||||||
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData();
|
||||||
int numberOfPalms = handData->getNumPalms();
|
int numberOfPalms = handData->getNumPalms();
|
||||||
int numberOfActivePalms = 0;
|
int numberOfActivePalms = 0;
|
||||||
for (int i = 0; i < numberOfPalms; i++) {
|
for (int i = 0; i < numberOfPalms; i++) {
|
||||||
|
|
|
@ -16,23 +16,24 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
#include <QFormLayout>
|
#include <QFormLayout>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
|
#include <QMenu>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
|
#include <DependencyManager.h>
|
||||||
#include <Settings.h>
|
#include <Settings.h>
|
||||||
|
|
||||||
#include "AnimationsDialog.h"
|
#include "AnimationsDialog.h"
|
||||||
#include "Application.h"
|
|
||||||
#include "MainWindow.h"
|
|
||||||
|
|
||||||
namespace SettingHandles {
|
namespace SettingHandles {
|
||||||
const SettingHandle<QString> animationDirectory("animation_directory", QString());
|
const SettingHandle<QString> animationDirectory("animation_directory", QString());
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationsDialog::AnimationsDialog(QWidget* parent) :
|
AnimationsDialog::AnimationsDialog(QWidget* parent) :
|
||||||
QDialog(parent) {
|
QDialog(parent)
|
||||||
|
{
|
||||||
setWindowTitle("Edit Animations");
|
setWindowTitle("Edit Animations");
|
||||||
setAttribute(Qt::WA_DeleteOnClose);
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
@ -48,7 +49,8 @@ AnimationsDialog::AnimationsDialog(QWidget* parent) :
|
||||||
area->setWidget(container);
|
area->setWidget(container);
|
||||||
_animations->addStretch(1);
|
_animations->addStretch(1);
|
||||||
|
|
||||||
foreach (const AnimationHandlePointer& handle, Application::getInstance()->getAvatar()->getAnimationHandles()) {
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
foreach (const AnimationHandlePointer& handle, myAvatar->getAnimationHandles()) {
|
||||||
_animations->insertWidget(_animations->count() - 1, new AnimationPanel(this, handle));
|
_animations->insertWidget(_animations->count() - 1, new AnimationPanel(this, handle));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,8 +76,8 @@ void AnimationsDialog::setVisible(bool visible) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationsDialog::addAnimation() {
|
void AnimationsDialog::addAnimation() {
|
||||||
_animations->insertWidget(_animations->count() - 1, new AnimationPanel(
|
_animations->insertWidget(_animations->count() - 1, new AnimationPanel(this,
|
||||||
this, Application::getInstance()->getAvatar()->addAnimationHandle()));
|
DependencyManager::get<AvatarManager>()->getMyAvatar()->addAnimationHandle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePointer& handle) :
|
AnimationPanel::AnimationPanel(AnimationsDialog* dialog, const AnimationHandlePointer& handle) :
|
||||||
|
@ -176,7 +178,7 @@ void AnimationPanel::chooseURL() {
|
||||||
void AnimationPanel::chooseMaskedJoints() {
|
void AnimationPanel::chooseMaskedJoints() {
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QStringList maskedJoints = _handle->getMaskedJoints();
|
QStringList maskedJoints = _handle->getMaskedJoints();
|
||||||
foreach (const QString& jointName, Application::getInstance()->getAvatar()->getJointNames()) {
|
foreach (const QString& jointName, DependencyManager::get<AvatarManager>()->getMyAvatar()->getJointNames()) {
|
||||||
QAction* action = menu.addAction(jointName);
|
QAction* action = menu.addAction(jointName);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
action->setChecked(maskedJoints.contains(jointName));
|
action->setChecked(maskedJoints.contains(jointName));
|
||||||
|
@ -207,6 +209,6 @@ void AnimationPanel::updateHandle() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationPanel::removeHandle() {
|
void AnimationPanel::removeHandle() {
|
||||||
Application::getInstance()->getAvatar()->removeAnimationHandle(_handle);
|
DependencyManager::get<AvatarManager>()->getMyAvatar()->removeAnimationHandle(_handle);
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <QOpenGLFramebufferObject>
|
#include <QOpenGLFramebufferObject>
|
||||||
|
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
|
|
||||||
|
@ -161,8 +162,7 @@ ApplicationOverlay::~ApplicationOverlay() {
|
||||||
// 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()");
|
||||||
Application* application = Application::getInstance();
|
Overlays& overlays = qApp->getOverlays();
|
||||||
Overlays& overlays = application->getOverlays();
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
_textureFov = glm::radians(_oculusUIAngularSize);
|
_textureFov = glm::radians(_oculusUIAngularSize);
|
||||||
|
@ -206,7 +206,7 @@ void ApplicationOverlay::renderOverlay(bool renderToTexture) {
|
||||||
renderStatsAndLogs();
|
renderStatsAndLogs();
|
||||||
|
|
||||||
// give external parties a change to hook in
|
// give external parties a change to hook in
|
||||||
emit application->renderingOverlay();
|
emit qApp->renderingOverlay();
|
||||||
|
|
||||||
overlays.renderHUD();
|
overlays.renderHUD();
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ void ApplicationOverlay::displayOverlayTextureOculus(Camera& whichCamera) {
|
||||||
|
|
||||||
|
|
||||||
//Update and draw the magnifiers
|
//Update and draw the magnifiers
|
||||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
const glm::quat& orientation = myAvatar->getOrientation();
|
const glm::quat& orientation = myAvatar->getOrientation();
|
||||||
const glm::vec3& position = myAvatar->getDefaultEyePosition();
|
const glm::vec3& position = myAvatar->getDefaultEyePosition();
|
||||||
const float scale = myAvatar->getScale() * _oculusUIRadius;
|
const float scale = myAvatar->getScale() * _oculusUIRadius;
|
||||||
|
@ -343,10 +343,8 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
const glm::vec3& viewMatrixTranslation = qApp->getViewMatrixTranslation();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
|
||||||
const glm::vec3& viewMatrixTranslation = application->getViewMatrixTranslation();
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
|
||||||
|
@ -407,8 +405,8 @@ void ApplicationOverlay::displayOverlayTexture3DTV(Camera& whichCamera, float as
|
||||||
const float reticleSize = 40.0f / glCanvas->width() * quadWidth;
|
const float reticleSize = 40.0f / glCanvas->width() * quadWidth;
|
||||||
x -= reticleSize / 2.0f;
|
x -= reticleSize / 2.0f;
|
||||||
y += reticleSize / 2.0f;
|
y += reticleSize / 2.0f;
|
||||||
const float mouseX = (application->getMouseX() / (float)glCanvas->width()) * quadWidth;
|
const float mouseX = (qApp->getMouseX() / (float)glCanvas->width()) * quadWidth;
|
||||||
const float mouseY = (1.0 - (application->getMouseY() / (float)glCanvas->height())) * quadHeight;
|
const float mouseY = (1.0 - (qApp->getMouseY() / (float)glCanvas->height())) * quadHeight;
|
||||||
|
|
||||||
glColor3f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2]);
|
glColor3f(RETICLE_COLOR[0], RETICLE_COLOR[1], RETICLE_COLOR[2]);
|
||||||
|
|
||||||
|
@ -441,22 +439,21 @@ void ApplicationOverlay::computeOculusPickRay(float x, float y, glm::vec3& origi
|
||||||
const glm::vec3 localDirection = orientation * IDENTITY_FRONT;
|
const glm::vec3 localDirection = orientation * IDENTITY_FRONT;
|
||||||
|
|
||||||
//Rotate the UI pick ray by the avatar orientation
|
//Rotate the UI pick ray by the avatar orientation
|
||||||
const MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
const MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
origin = myAvatar->getDefaultEyePosition();
|
origin = myAvatar->getDefaultEyePosition();
|
||||||
direction = myAvatar->getOrientation() * localDirection;
|
direction = myAvatar->getOrientation() * localDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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 {
|
||||||
Application* application = Application::getInstance();
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
|
||||||
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
|
glm::vec3 tip = myAvatar->getLaserPointerTipPosition(palm);
|
||||||
glm::vec3 eyePos = myAvatar->getHead()->getEyePosition();
|
glm::vec3 eyePos = myAvatar->getHead()->getEyePosition();
|
||||||
glm::quat invOrientation = glm::inverse(myAvatar->getOrientation());
|
glm::quat invOrientation = glm::inverse(myAvatar->getOrientation());
|
||||||
//direction of ray goes towards camera
|
//direction of ray goes towards camera
|
||||||
glm::vec3 dir = invOrientation * glm::normalize(application->getCamera()->getPosition() - tip);
|
glm::vec3 dir = invOrientation * glm::normalize(qApp->getCamera()->getPosition() - tip);
|
||||||
glm::vec3 tipPos = invOrientation * (tip - eyePos);
|
glm::vec3 tipPos = invOrientation * (tip - eyePos);
|
||||||
|
|
||||||
QPoint rv;
|
QPoint rv;
|
||||||
|
@ -490,7 +487,7 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
glm::dmat4 projection;
|
glm::dmat4 projection;
|
||||||
application->getProjectionMatrix(&projection);
|
qApp->getProjectionMatrix(&projection);
|
||||||
|
|
||||||
glm::vec4 clipSpacePos = glm::vec4(projection * glm::dvec4(tipPos, 1.0));
|
glm::vec4 clipSpacePos = glm::vec4(projection * glm::dvec4(tipPos, 1.0));
|
||||||
glm::vec3 ndcSpacePos;
|
glm::vec3 ndcSpacePos;
|
||||||
|
@ -506,8 +503,7 @@ QPoint ApplicationOverlay::getPalmClickLocation(const PalmData *palm) const {
|
||||||
|
|
||||||
//Finds the collision point of a world space ray
|
//Finds the collision point of a world space ray
|
||||||
bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const {
|
bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position, const glm::vec3& direction, glm::vec3& result) const {
|
||||||
Application* application = Application::getInstance();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
|
||||||
|
|
||||||
glm::quat orientation = myAvatar->getOrientation();
|
glm::quat orientation = myAvatar->getOrientation();
|
||||||
|
|
||||||
|
@ -527,7 +523,6 @@ bool ApplicationOverlay::calculateRayUICollisionPoint(const glm::vec3& position,
|
||||||
|
|
||||||
//Renders optional pointers
|
//Renders optional pointers
|
||||||
void ApplicationOverlay::renderPointers() {
|
void ApplicationOverlay::renderPointers() {
|
||||||
Application* application = Application::getInstance();
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
|
|
||||||
//lazily load crosshair texture
|
//lazily load crosshair texture
|
||||||
|
@ -539,12 +534,12 @@ void ApplicationOverlay::renderPointers() {
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
|
glBindTexture(GL_TEXTURE_2D, _crosshairTexture);
|
||||||
|
|
||||||
if (OculusManager::isConnected() && !application->getLastMouseMoveWasSimulated()) {
|
if (OculusManager::isConnected() && !qApp->getLastMouseMoveWasSimulated()) {
|
||||||
//If we are in oculus, render reticle later
|
//If we are in oculus, render reticle later
|
||||||
if (_lastMouseMove == 0) {
|
if (_lastMouseMove == 0) {
|
||||||
_lastMouseMove = usecTimestampNow();
|
_lastMouseMove = usecTimestampNow();
|
||||||
}
|
}
|
||||||
QPoint position = QPoint(application->getTrueMouseX(), application->getTrueMouseY());
|
QPoint position = QPoint(qApp->getTrueMouseX(), qApp->getTrueMouseY());
|
||||||
|
|
||||||
static const int MAX_IDLE_TIME = 3;
|
static const int MAX_IDLE_TIME = 3;
|
||||||
if (_reticlePosition[MOUSE] != position) {
|
if (_reticlePosition[MOUSE] != position) {
|
||||||
|
@ -563,7 +558,7 @@ void ApplicationOverlay::renderPointers() {
|
||||||
_magActive[MOUSE] = true;
|
_magActive[MOUSE] = true;
|
||||||
_reticleActive[LEFT_CONTROLLER] = false;
|
_reticleActive[LEFT_CONTROLLER] = false;
|
||||||
_reticleActive[RIGHT_CONTROLLER] = false;
|
_reticleActive[RIGHT_CONTROLLER] = false;
|
||||||
} else if (application->getLastMouseMoveWasSimulated() && Menu::getInstance()->isOptionChecked(MenuOption::SixenseMouseInput)) {
|
} else if (qApp->getLastMouseMoveWasSimulated() && Menu::getInstance()->isOptionChecked(MenuOption::SixenseMouseInput)) {
|
||||||
_lastMouseMove = 0;
|
_lastMouseMove = 0;
|
||||||
//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
|
||||||
_reticleActive[MOUSE] = false;
|
_reticleActive[MOUSE] = false;
|
||||||
|
@ -575,16 +570,15 @@ void ApplicationOverlay::renderPointers() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderControllerPointers() {
|
void ApplicationOverlay::renderControllerPointers() {
|
||||||
Application* application = Application::getInstance();
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
MyAvatar* myAvatar = application->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
|
||||||
//Static variables used for storing controller state
|
//Static variables used for storing controller state
|
||||||
static quint64 pressedTime[NUMBER_OF_RETICLES] = { 0ULL, 0ULL, 0ULL };
|
static quint64 pressedTime[NUMBER_OF_RETICLES] = { 0ULL, 0ULL, 0ULL };
|
||||||
static bool isPressed[NUMBER_OF_RETICLES] = { false, false, false };
|
static bool isPressed[NUMBER_OF_RETICLES] = { false, false, false };
|
||||||
static bool stateWhenPressed[NUMBER_OF_RETICLES] = { false, false, false };
|
static bool stateWhenPressed[NUMBER_OF_RETICLES] = { false, false, false };
|
||||||
|
|
||||||
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
const HandData* handData = DependencyManager::get<AvatarManager>()->getMyAvatar()->getHandData();
|
||||||
|
|
||||||
for (unsigned int palmIndex = 2; palmIndex < 4; palmIndex++) {
|
for (unsigned int palmIndex = 2; palmIndex < 4; palmIndex++) {
|
||||||
const int index = palmIndex - 1;
|
const int index = palmIndex - 1;
|
||||||
|
@ -692,7 +686,7 @@ void ApplicationOverlay::renderPointersOculus(const glm::vec3& eyePos) {
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
|
||||||
//Controller Pointers
|
//Controller Pointers
|
||||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
for (int i = 0; i < (int)myAvatar->getHand()->getNumPalms(); i++) {
|
for (int i = 0; i < (int)myAvatar->getHand()->getNumPalms(); i++) {
|
||||||
|
|
||||||
PalmData& palm = myAvatar->getHand()->getPalms()[i];
|
PalmData& palm = myAvatar->getHand()->getPalms()[i];
|
||||||
|
@ -904,13 +898,10 @@ void ApplicationOverlay::renderAudioMeter() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationOverlay::renderStatsAndLogs() {
|
void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
|
|
||||||
Application* application = Application::getInstance();
|
|
||||||
|
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
const OctreePacketProcessor& octreePacketProcessor = application->getOctreePacketProcessor();
|
const OctreePacketProcessor& octreePacketProcessor = qApp->getOctreePacketProcessor();
|
||||||
BandwidthMeter* bandwidthMeter = application->getBandwidthMeter();
|
BandwidthMeter* bandwidthMeter = qApp->getBandwidthMeter();
|
||||||
NodeBounds& nodeBoundsDisplay = application->getNodeBoundsDisplay();
|
NodeBounds& nodeBoundsDisplay = qApp->getNodeBoundsDisplay();
|
||||||
|
|
||||||
// Display stats and log text onscreen
|
// Display stats and log text onscreen
|
||||||
glLineWidth(1.0f);
|
glLineWidth(1.0f);
|
||||||
|
@ -921,8 +912,8 @@ void ApplicationOverlay::renderStatsAndLogs() {
|
||||||
int horizontalOffset = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
|
int horizontalOffset = MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
|
||||||
int voxelPacketsToProcess = octreePacketProcessor.packetsToProcessCount();
|
int voxelPacketsToProcess = octreePacketProcessor.packetsToProcessCount();
|
||||||
// Onscreen text about position, servers, etc
|
// Onscreen text about position, servers, etc
|
||||||
Stats::getInstance()->display(WHITE_TEXT, horizontalOffset, application->getFps(),
|
Stats::getInstance()->display(WHITE_TEXT, horizontalOffset, qApp->getFps(),
|
||||||
application->getPacketsPerSecond(), application->getBytesPerSecond(), voxelPacketsToProcess);
|
qApp->getPacketsPerSecond(), qApp->getBytesPerSecond(), voxelPacketsToProcess);
|
||||||
// Bandwidth meter
|
// Bandwidth meter
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Bandwidth)) {
|
||||||
Stats::drawBackground(0x33333399, glCanvas->width() - 296, glCanvas->height() - 68, 296, 68);
|
Stats::drawBackground(0x33333399, glCanvas->width() - 296, glCanvas->height() - 68, 296, 68);
|
||||||
|
|
|
@ -18,9 +18,12 @@
|
||||||
#include <QScrollArea>
|
#include <QScrollArea>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include "Application.h"
|
#include <avatar/AvatarManager.h>
|
||||||
|
#include <avatar/MyAvatar.h>
|
||||||
|
#include <DependencyManager.h>
|
||||||
|
|
||||||
#include "AttachmentsDialog.h"
|
#include "AttachmentsDialog.h"
|
||||||
#include "MainWindow.h"
|
#include "ModelsBrowser.h"
|
||||||
|
|
||||||
AttachmentsDialog::AttachmentsDialog(QWidget* parent) :
|
AttachmentsDialog::AttachmentsDialog(QWidget* parent) :
|
||||||
QDialog(parent) {
|
QDialog(parent) {
|
||||||
|
@ -40,7 +43,7 @@ AttachmentsDialog::AttachmentsDialog(QWidget* parent) :
|
||||||
area->setWidget(container);
|
area->setWidget(container);
|
||||||
_attachments->addStretch(1);
|
_attachments->addStretch(1);
|
||||||
|
|
||||||
foreach (const AttachmentData& data, Application::getInstance()->getAvatar()->getAttachmentData()) {
|
foreach (const AttachmentData& data, DependencyManager::get<AvatarManager>()->getMyAvatar()->getAttachmentData()) {
|
||||||
addAttachment(data);
|
addAttachment(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +73,7 @@ void AttachmentsDialog::updateAttachmentData() {
|
||||||
for (int i = 0; i < _attachments->count() - 1; i++) {
|
for (int i = 0; i < _attachments->count() - 1; i++) {
|
||||||
data.append(static_cast<AttachmentPanel*>(_attachments->itemAt(i)->widget())->getAttachmentData());
|
data.append(static_cast<AttachmentPanel*>(_attachments->itemAt(i)->widget())->getAttachmentData());
|
||||||
}
|
}
|
||||||
Application::getInstance()->getAvatar()->setAttachmentData(data);
|
DependencyManager::get<AvatarManager>()->getMyAvatar()->setAttachmentData(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AttachmentsDialog::addAttachment(const AttachmentData& data) {
|
void AttachmentsDialog::addAttachment(const AttachmentData& data) {
|
||||||
|
@ -116,7 +119,7 @@ AttachmentPanel::AttachmentPanel(AttachmentsDialog* dialog, const AttachmentData
|
||||||
connect(chooseURL, SIGNAL(clicked(bool)), SLOT(chooseModelURL()));
|
connect(chooseURL, SIGNAL(clicked(bool)), SLOT(chooseModelURL()));
|
||||||
|
|
||||||
layout->addRow("Joint:", _jointName = new QComboBox());
|
layout->addRow("Joint:", _jointName = new QComboBox());
|
||||||
QSharedPointer<NetworkGeometry> geometry = Application::getInstance()->getAvatar()->getSkeletonModel().getGeometry();
|
QSharedPointer<NetworkGeometry> geometry = DependencyManager::get<AvatarManager>()->getMyAvatar()->getSkeletonModel().getGeometry();
|
||||||
if (geometry && geometry->isLoaded()) {
|
if (geometry && geometry->isLoaded()) {
|
||||||
foreach (const FBXJoint& joint, geometry->getFBXGeometry().joints) {
|
foreach (const FBXJoint& joint, geometry->getFBXGeometry().joints) {
|
||||||
_jointName->addItem(joint.name);
|
_jointName->addItem(joint.name);
|
||||||
|
@ -177,7 +180,7 @@ void AttachmentPanel::modelURLChanged() {
|
||||||
_dialog->updateAttachmentData();
|
_dialog->updateAttachmentData();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AttachmentData attachment = Application::getInstance()->getAvatar()->loadAttachmentData(_modelURL->text());
|
AttachmentData attachment = DependencyManager::get<AvatarManager>()->getMyAvatar()->loadAttachmentData(_modelURL->text());
|
||||||
if (attachment.isValid()) {
|
if (attachment.isValid()) {
|
||||||
_applying = true;
|
_applying = true;
|
||||||
_jointName->setCurrentText(attachment.jointName);
|
_jointName->setCurrentText(attachment.jointName);
|
||||||
|
@ -195,7 +198,7 @@ void AttachmentPanel::jointNameChanged() {
|
||||||
_dialog->updateAttachmentData();
|
_dialog->updateAttachmentData();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AttachmentData attachment = Application::getInstance()->getAvatar()->loadAttachmentData(
|
AttachmentData attachment = DependencyManager::get<AvatarManager>()->getMyAvatar()->loadAttachmentData(
|
||||||
_modelURL->text(), _jointName->currentText());
|
_modelURL->text(), _jointName->currentText());
|
||||||
if (attachment.isValid()) {
|
if (attachment.isValid()) {
|
||||||
applyAttachmentData(attachment);
|
applyAttachmentData(attachment);
|
||||||
|
@ -209,7 +212,7 @@ void AttachmentPanel::updateAttachmentData() {
|
||||||
}
|
}
|
||||||
// save the attachment data under the model URL (if any)
|
// save the attachment data under the model URL (if any)
|
||||||
if (!_modelURL->text().isEmpty()) {
|
if (!_modelURL->text().isEmpty()) {
|
||||||
Application::getInstance()->getAvatar()->saveAttachmentData(getAttachmentData());
|
DependencyManager::get<AvatarManager>()->getMyAvatar()->saveAttachmentData(getAttachmentData());
|
||||||
}
|
}
|
||||||
_dialog->updateAttachmentData();
|
_dialog->updateAttachmentData();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,13 +33,13 @@
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
#include <AttributeRegistry.h>
|
#include <AttributeRegistry.h>
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
#include <GeometryCache.h>
|
#include <GeometryCache.h>
|
||||||
#include <MetavoxelMessages.h>
|
#include <MetavoxelMessages.h>
|
||||||
#include <MetavoxelUtil.h>
|
#include <MetavoxelUtil.h>
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "MetavoxelEditor.h"
|
#include "MetavoxelEditor.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -267,7 +267,7 @@ void MetavoxelEditor::deleteSelectedAttribute() {
|
||||||
void MetavoxelEditor::centerGridPosition() {
|
void MetavoxelEditor::centerGridPosition() {
|
||||||
const float CENTER_OFFSET = 0.625f;
|
const float CENTER_OFFSET = 0.625f;
|
||||||
float eyePosition = (glm::inverse(getGridRotation()) * Application::getInstance()->getCamera()->getPosition()).z -
|
float eyePosition = (glm::inverse(getGridRotation()) * Application::getInstance()->getCamera()->getPosition()).z -
|
||||||
Application::getInstance()->getAvatar()->getScale() * CENTER_OFFSET;
|
DependencyManager::get<AvatarManager>()->getMyAvatar()->getScale() * CENTER_OFFSET;
|
||||||
double step = getGridSpacing();
|
double step = getGridSpacing();
|
||||||
_gridPosition->setValue(step * floor(eyePosition / step));
|
_gridPosition->setValue(step * floor(eyePosition / step));
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
|
||||||
#include <AudioClient.h>
|
#include <AudioClient.h>
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
#include <devices/Faceshift.h>
|
#include <devices/Faceshift.h>
|
||||||
#include <devices/SixenseManager.h>
|
#include <devices/SixenseManager.h>
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ void PreferencesDialog::resizeEvent(QResizeEvent *resizeEvent) {
|
||||||
|
|
||||||
void PreferencesDialog::loadPreferences() {
|
void PreferencesDialog::loadPreferences() {
|
||||||
|
|
||||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
Menu* menuInstance = Menu::getInstance();
|
Menu* menuInstance = Menu::getInstance();
|
||||||
|
|
||||||
_displayNameString = myAvatar->getDisplayName();
|
_displayNameString = myAvatar->getDisplayName();
|
||||||
|
@ -173,7 +174,7 @@ void PreferencesDialog::loadPreferences() {
|
||||||
|
|
||||||
void PreferencesDialog::savePreferences() {
|
void PreferencesDialog::savePreferences() {
|
||||||
|
|
||||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
bool shouldDispatchIdentityPacket = false;
|
bool shouldDispatchIdentityPacket = false;
|
||||||
|
|
||||||
QString displayNameStr(ui.displayNameEdit->text());
|
QString displayNameStr(ui.displayNameEdit->text());
|
||||||
|
|
|
@ -17,8 +17,11 @@
|
||||||
#include <QTemporaryFile>
|
#include <QTemporaryFile>
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <Application.h>
|
#include <avatar/AvatarManager.h>
|
||||||
|
#include <avatar/MyAvatar.h>
|
||||||
#include <FileUtils.h>
|
#include <FileUtils.h>
|
||||||
|
#include <GLCanvas.h>
|
||||||
|
#include <NodeList.h>
|
||||||
|
|
||||||
#include "Snapshot.h"
|
#include "Snapshot.h"
|
||||||
|
|
||||||
|
@ -90,7 +93,7 @@ QFile* Snapshot::savedFileForSnapshot(bool isTemporary) {
|
||||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||||
QImage shot = glCanvas->grabFrameBuffer();
|
QImage shot = glCanvas->grabFrameBuffer();
|
||||||
|
|
||||||
Avatar* avatar = qApp->getAvatar();
|
Avatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
|
|
||||||
glm::vec3 location = avatar->getPosition();
|
glm::vec3 location = avatar->getPosition();
|
||||||
glm::quat orientation = avatar->getHead()->getOrientation();
|
glm::quat orientation = avatar->getHead()->getOrientation();
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
|
||||||
#include <Settings.h>
|
#include <Settings.h>
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ void Stats::display(
|
||||||
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _pingStatsWidth + 2;
|
horizontalOffset = _lastHorizontalOffset + _generalStatsWidth + _pingStatsWidth + 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
MyAvatar* myAvatar = Application::getInstance()->getAvatar();
|
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
glm::vec3 avatarPos = myAvatar->getPosition();
|
glm::vec3 avatarPos = myAvatar->getPosition();
|
||||||
|
|
||||||
lines = _expanded ? 8 : 3;
|
lines = _expanded ? 8 : 3;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include <typeinfo>
|
#include <typeinfo>
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <avatar/AvatarManager.h>
|
||||||
#include <devices/OculusManager.h>
|
#include <devices/OculusManager.h>
|
||||||
#include <LODManager.h>
|
#include <LODManager.h>
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, Re
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bool myAvatarComputed = false;
|
bool myAvatarComputed = false;
|
||||||
MyAvatar* avatar = NULL;
|
MyAvatar* avatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
||||||
glm::quat myAvatarRotation;
|
glm::quat myAvatarRotation;
|
||||||
glm::vec3 myAvatarPosition(0.0f);
|
glm::vec3 myAvatarPosition(0.0f);
|
||||||
float angle = 0.0f;
|
float angle = 0.0f;
|
||||||
|
@ -138,7 +139,6 @@ void Overlays::renderWorld(bool drawFront, RenderArgs::RenderMode renderMode, Re
|
||||||
switch (thisOverlay->getAnchor()) {
|
switch (thisOverlay->getAnchor()) {
|
||||||
case Overlay::MY_AVATAR:
|
case Overlay::MY_AVATAR:
|
||||||
if (!myAvatarComputed) {
|
if (!myAvatarComputed) {
|
||||||
avatar = Application::getInstance()->getAvatar();
|
|
||||||
myAvatarRotation = avatar->getOrientation();
|
myAvatarRotation = avatar->getOrientation();
|
||||||
myAvatarPosition = avatar->getPosition();
|
myAvatarPosition = avatar->getPosition();
|
||||||
angle = glm::degrees(glm::angle(myAvatarRotation));
|
angle = glm::degrees(glm::angle(myAvatarRotation));
|
||||||
|
|
Loading…
Reference in a new issue