mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge pull request #6072 from howard-stearns/skip-some-reload-recenter-on-startup
Don't reload/recenter some avatar data on startup
This commit is contained in:
commit
073b019458
5 changed files with 40 additions and 34 deletions
|
@ -1559,7 +1559,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
cursor->setIcon(Cursor::Icon::DEFAULT);
|
cursor->setIcon(Cursor::Icon::DEFAULT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resetSensors();
|
resetSensors(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3581,7 +3581,7 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi
|
||||||
renderArgs->_viewport = originalViewport;
|
renderArgs->_viewport = originalViewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::resetSensors() {
|
void Application::resetSensors(bool andReload) {
|
||||||
DependencyManager::get<Faceshift>()->reset();
|
DependencyManager::get<Faceshift>()->reset();
|
||||||
DependencyManager::get<DdeFaceTracker>()->reset();
|
DependencyManager::get<DdeFaceTracker>()->reset();
|
||||||
DependencyManager::get<EyeTracker>()->reset();
|
DependencyManager::get<EyeTracker>()->reset();
|
||||||
|
@ -3593,7 +3593,7 @@ void Application::resetSensors() {
|
||||||
QPoint windowCenter = mainWindow->geometry().center();
|
QPoint windowCenter = mainWindow->geometry().center();
|
||||||
_glWidget->cursor().setPos(currentScreen, windowCenter);
|
_glWidget->cursor().setPos(currentScreen, windowCenter);
|
||||||
|
|
||||||
getMyAvatar()->reset();
|
getMyAvatar()->reset(andReload);
|
||||||
|
|
||||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection);
|
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ public slots:
|
||||||
void setRawAvatarUpdateThreading();
|
void setRawAvatarUpdateThreading();
|
||||||
void setRawAvatarUpdateThreading(bool isThreaded);
|
void setRawAvatarUpdateThreading(bool isThreaded);
|
||||||
|
|
||||||
void resetSensors();
|
void resetSensors(bool andReload = false);
|
||||||
void setActiveFaceTracker();
|
void setActiveFaceTracker();
|
||||||
|
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
|
|
|
@ -144,7 +144,7 @@ void PluginContainerProxy::unsetFullscreen(const QScreen* avoid) {
|
||||||
|
|
||||||
void PluginContainerProxy::requestReset() {
|
void PluginContainerProxy::requestReset() {
|
||||||
// We could signal qApp to sequence this, but it turns out that requestReset is only used from within the main thread anyway.
|
// We could signal qApp to sequence this, but it turns out that requestReset is only used from within the main thread anyway.
|
||||||
qApp->resetSensors();
|
qApp->resetSensors(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PluginContainerProxy::showDisplayPluginsTools() {
|
void PluginContainerProxy::showDisplayPluginsTools() {
|
||||||
|
|
|
@ -140,16 +140,18 @@ QByteArray MyAvatar::toByteArray(bool cullSmallChanges, bool sendAll) {
|
||||||
return AvatarData::toByteArray(cullSmallChanges, sendAll);
|
return AvatarData::toByteArray(cullSmallChanges, sendAll);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::reset() {
|
void MyAvatar::reset(bool andReload) {
|
||||||
// Gather animation mode...
|
// Gather animation mode...
|
||||||
// This should be simpler when we have only graph animations always on.
|
// This should be simpler when we have only graph animations always on.
|
||||||
bool isRig = _rig->getEnableRig();
|
bool isRig = _rig->getEnableRig();
|
||||||
// seting rig animation to true, below, will clear the graph animation menu item, so grab it now.
|
// seting rig animation to true, below, will clear the graph animation menu item, so grab it now.
|
||||||
bool isGraph = _rig->getEnableAnimGraph() || Menu::getInstance()->isOptionChecked(MenuOption::EnableAnimGraph);
|
bool isGraph = _rig->getEnableAnimGraph() || Menu::getInstance()->isOptionChecked(MenuOption::EnableAnimGraph);
|
||||||
// ... and get to sane configuration where other activity won't bother us.
|
// ... and get to sane configuration where other activity won't bother us.
|
||||||
qApp->setRawAvatarUpdateThreading(false);
|
if (andReload) {
|
||||||
_rig->disableHands = true;
|
qApp->setRawAvatarUpdateThreading(false);
|
||||||
setEnableRigAnimations(true);
|
_rig->disableHands = true;
|
||||||
|
setEnableRigAnimations(true);
|
||||||
|
}
|
||||||
|
|
||||||
// Reset dynamic state.
|
// Reset dynamic state.
|
||||||
_wasPushing = _isPushing = _isBraking = _billboardValid = _straighteningLean = false;
|
_wasPushing = _isPushing = _isBraking = _billboardValid = _straighteningLean = false;
|
||||||
|
@ -158,32 +160,34 @@ void MyAvatar::reset() {
|
||||||
_targetVelocity = glm::vec3(0.0f);
|
_targetVelocity = glm::vec3(0.0f);
|
||||||
setThrust(glm::vec3(0.0f));
|
setThrust(glm::vec3(0.0f));
|
||||||
|
|
||||||
// Get fresh data, in case we're really slow and out of wack.
|
if (andReload) {
|
||||||
_hmdSensorMatrix = qApp->getHMDSensorPose();
|
// Get fresh data, in case we're really slow and out of wack.
|
||||||
_hmdSensorPosition = extractTranslation(_hmdSensorMatrix);
|
_hmdSensorMatrix = qApp->getHMDSensorPose();
|
||||||
_hmdSensorOrientation = glm::quat_cast(_hmdSensorMatrix);
|
_hmdSensorPosition = extractTranslation(_hmdSensorMatrix);
|
||||||
|
_hmdSensorOrientation = glm::quat_cast(_hmdSensorMatrix);
|
||||||
|
|
||||||
// Reset body position/orientation under the head.
|
// Reset body position/orientation under the head.
|
||||||
auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation..
|
auto newBodySensorMatrix = deriveBodyFromHMDSensor(); // Based on current cached HMD position/rotation..
|
||||||
auto worldBodyMatrix = _sensorToWorldMatrix * newBodySensorMatrix;
|
auto worldBodyMatrix = _sensorToWorldMatrix * newBodySensorMatrix;
|
||||||
glm::vec3 worldBodyPos = extractTranslation(worldBodyMatrix);
|
glm::vec3 worldBodyPos = extractTranslation(worldBodyMatrix);
|
||||||
glm::quat worldBodyRot = glm::normalize(glm::quat_cast(worldBodyMatrix));
|
glm::quat worldBodyRot = glm::normalize(glm::quat_cast(worldBodyMatrix));
|
||||||
|
|
||||||
// FIXME: Hack to retain the previous behavior wrt height.
|
// FIXME: Hack to retain the previous behavior wrt height.
|
||||||
// I'd like to make the body match head height, but that will have to wait for separate PR.
|
// I'd like to make the body match head height, but that will have to wait for separate PR.
|
||||||
worldBodyPos.y = getPosition().y;
|
worldBodyPos.y = getPosition().y;
|
||||||
|
|
||||||
setPosition(worldBodyPos);
|
setPosition(worldBodyPos);
|
||||||
setOrientation(worldBodyRot);
|
setOrientation(worldBodyRot);
|
||||||
// If there is any discrepency between positioning and the head (as there is in initial deriveBodyFromHMDSensor),
|
// If there is any discrepency between positioning and the head (as there is in initial deriveBodyFromHMDSensor),
|
||||||
// we can make that right by setting _bodySensorMatrix = newBodySensorMatrix.
|
// we can make that right by setting _bodySensorMatrix = newBodySensorMatrix.
|
||||||
// However, doing so will make the head want to point to the previous body orientation, as cached above.
|
// However, doing so will make the head want to point to the previous body orientation, as cached above.
|
||||||
//_bodySensorMatrix = newBodySensorMatrix;
|
//_bodySensorMatrix = newBodySensorMatrix;
|
||||||
//updateSensorToWorldMatrix(); // Uses updated position/orientation and _bodySensorMatrix changes
|
//updateSensorToWorldMatrix(); // Uses updated position/orientation and _bodySensorMatrix changes
|
||||||
|
|
||||||
_skeletonModel.simulate(0.1f); // non-zero
|
_skeletonModel.simulate(0.1f); // non-zero
|
||||||
setEnableRigAnimations(false);
|
setEnableRigAnimations(false);
|
||||||
_skeletonModel.simulate(0.1f);
|
_skeletonModel.simulate(0.1f);
|
||||||
|
}
|
||||||
if (isRig) {
|
if (isRig) {
|
||||||
setEnableRigAnimations(true);
|
setEnableRigAnimations(true);
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::EnableRigAnimations, true);
|
Menu::getInstance()->setIsOptionChecked(MenuOption::EnableRigAnimations, true);
|
||||||
|
@ -191,8 +195,10 @@ void MyAvatar::reset() {
|
||||||
setEnableAnimGraph(true);
|
setEnableAnimGraph(true);
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::EnableAnimGraph, true);
|
Menu::getInstance()->setIsOptionChecked(MenuOption::EnableAnimGraph, true);
|
||||||
}
|
}
|
||||||
_rig->disableHands = false;
|
if (andReload) {
|
||||||
qApp->setRawAvatarUpdateThreading();
|
_rig->disableHands = false;
|
||||||
|
qApp->setRawAvatarUpdateThreading();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyAvatar::update(float deltaTime) {
|
void MyAvatar::update(float deltaTime) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ public:
|
||||||
AudioListenerMode getAudioListenerModeCamera() const { return FROM_CAMERA; }
|
AudioListenerMode getAudioListenerModeCamera() const { return FROM_CAMERA; }
|
||||||
AudioListenerMode getAudioListenerModeCustom() const { return CUSTOM; }
|
AudioListenerMode getAudioListenerModeCustom() const { return CUSTOM; }
|
||||||
|
|
||||||
void reset();
|
void reset(bool andReload = false);
|
||||||
void update(float deltaTime);
|
void update(float deltaTime);
|
||||||
void preRender(RenderArgs* renderArgs);
|
void preRender(RenderArgs* renderArgs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue