mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-12 18:56:30 +02:00
Merge pull request #5185 from jherico/mouse_flicker
Removing flickering mouse cursor in HMD
This commit is contained in:
commit
ee85ad8bf8
2 changed files with 0 additions and 30 deletions
|
@ -394,42 +394,13 @@ bool ApplicationCompositor::calculateRayUICollisionPoint(const glm::vec3& positi
|
||||||
void ApplicationCompositor::renderPointers(gpu::Batch& batch) {
|
void ApplicationCompositor::renderPointers(gpu::Batch& batch) {
|
||||||
if (qApp->isHMDMode() && !qApp->getLastMouseMoveWasSimulated() && !qApp->isMouseHidden()) {
|
if (qApp->isHMDMode() && !qApp->getLastMouseMoveWasSimulated() && !qApp->isMouseHidden()) {
|
||||||
//If we are in oculus, render reticle later
|
//If we are in oculus, render reticle later
|
||||||
if (_lastMouseMove == 0) {
|
|
||||||
_lastMouseMove = usecTimestampNow();
|
|
||||||
}
|
|
||||||
QPoint position = QPoint(qApp->getTrueMouseX(), qApp->getTrueMouseY());
|
QPoint position = QPoint(qApp->getTrueMouseX(), qApp->getTrueMouseY());
|
||||||
|
|
||||||
static const int MAX_IDLE_TIME = 3;
|
|
||||||
if (_reticlePosition[MOUSE] != position) {
|
|
||||||
_lastMouseMove = usecTimestampNow();
|
|
||||||
} else if (usecTimestampNow() - _lastMouseMove > MAX_IDLE_TIME * USECS_PER_SECOND) {
|
|
||||||
//float pitch = 0.0f, yaw = 0.0f, roll = 0.0f; // radians
|
|
||||||
//OculusManager::getEulerAngles(yaw, pitch, roll);
|
|
||||||
glm::quat orientation = qApp->getHeadOrientation(); // (glm::vec3(pitch, yaw, roll));
|
|
||||||
glm::vec3 result;
|
|
||||||
|
|
||||||
MyAvatar* myAvatar = DependencyManager::get<AvatarManager>()->getMyAvatar();
|
|
||||||
if (calculateRayUICollisionPoint(myAvatar->getEyePosition(),
|
|
||||||
myAvatar->getOrientation() * orientation * IDENTITY_FRONT,
|
|
||||||
result)) {
|
|
||||||
glm::vec3 lookAtDirection = glm::inverse(myAvatar->getOrientation()) * (result - myAvatar->getDefaultEyePosition());
|
|
||||||
glm::vec2 spericalPos = directionToSpherical(glm::normalize(lookAtDirection));
|
|
||||||
glm::vec2 screenPos = sphericalToScreen(spericalPos);
|
|
||||||
position = QPoint(screenPos.x, screenPos.y);
|
|
||||||
// FIXME
|
|
||||||
//glCanvas->cursor().setPos(glCanvas->mapToGlobal(position));
|
|
||||||
} else {
|
|
||||||
qDebug() << "No collision point";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_reticlePosition[MOUSE] = position;
|
_reticlePosition[MOUSE] = position;
|
||||||
_reticleActive[MOUSE] = true;
|
_reticleActive[MOUSE] = true;
|
||||||
_magActive[MOUSE] = _magnifier;
|
_magActive[MOUSE] = _magnifier;
|
||||||
_reticleActive[LEFT_CONTROLLER] = false;
|
_reticleActive[LEFT_CONTROLLER] = false;
|
||||||
_reticleActive[RIGHT_CONTROLLER] = false;
|
_reticleActive[RIGHT_CONTROLLER] = false;
|
||||||
} else if (qApp->getLastMouseMoveWasSimulated() && Menu::getInstance()->isOptionChecked(MenuOption::SixenseMouseInput)) {
|
} else if (qApp->getLastMouseMoveWasSimulated() && Menu::getInstance()->isOptionChecked(MenuOption::SixenseMouseInput)) {
|
||||||
_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;
|
||||||
_magActive[MOUSE] = false;
|
_magActive[MOUSE] = false;
|
||||||
|
|
|
@ -97,7 +97,6 @@ private:
|
||||||
QPoint _reticlePosition[NUMBER_OF_RETICLES];
|
QPoint _reticlePosition[NUMBER_OF_RETICLES];
|
||||||
bool _magActive[NUMBER_OF_RETICLES];
|
bool _magActive[NUMBER_OF_RETICLES];
|
||||||
float _magSizeMult[NUMBER_OF_RETICLES];
|
float _magSizeMult[NUMBER_OF_RETICLES];
|
||||||
quint64 _lastMouseMove{ 0 };
|
|
||||||
bool _magnifier{ true };
|
bool _magnifier{ true };
|
||||||
|
|
||||||
float _alpha{ 1.0f };
|
float _alpha{ 1.0f };
|
||||||
|
|
Loading…
Reference in a new issue