mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
Merge conflict
This commit is contained in:
commit
638eeede43
3 changed files with 38 additions and 11 deletions
|
@ -899,17 +899,34 @@ glm::vec3 Avatar::getDefaultJointTranslation(int index) const {
|
|||
}
|
||||
|
||||
glm::quat Avatar::getAbsoluteDefaultJointRotationInObjectFrame(int index) const {
|
||||
glm::quat rotation;
|
||||
glm::quat rot = _skeletonModel->getRig().getAnimSkeleton()->getAbsoluteDefaultPose(index).rot();
|
||||
return Quaternions::Y_180 * rot;
|
||||
// To make this thread safe, we hold onto the model by smart ptr, which prevents it from being deleted while we are accessing it.
|
||||
auto model = getSkeletonModel();
|
||||
if (model) {
|
||||
auto skeleton = model->getRig().getAnimSkeleton();
|
||||
if (skeleton && index >= 0 && index < skeleton->getNumJoints()) {
|
||||
// The rotation part of the geometry-to-rig transform is always identity so we can skip it.
|
||||
// Y_180 is to convert from rig-frame into avatar-frame
|
||||
return Quaternions::Y_180 * skeleton->getAbsoluteDefaultPose(index).rot();
|
||||
}
|
||||
}
|
||||
return Quaternions::Y_180;
|
||||
}
|
||||
|
||||
glm::vec3 Avatar::getAbsoluteDefaultJointTranslationInObjectFrame(int index) const {
|
||||
glm::vec3 translation;
|
||||
const Rig& rig = _skeletonModel->getRig();
|
||||
glm::vec3 trans = rig.getAnimSkeleton()->getAbsoluteDefaultPose(index).trans();
|
||||
glm::mat4 y180Mat = createMatFromQuatAndPos(Quaternions::Y_180, glm::vec3());
|
||||
return transformPoint(y180Mat * rig.getGeometryToRigTransform(), trans);
|
||||
// To make this thread safe, we hold onto the model by smart ptr, which prevents it from being deleted while we are accessing it.
|
||||
auto model = getSkeletonModel();
|
||||
if (model) {
|
||||
const Rig& rig = model->getRig();
|
||||
auto skeleton = rig.getAnimSkeleton();
|
||||
if (skeleton && index >= 0 && index < skeleton->getNumJoints()) {
|
||||
// trans is in geometry frame.
|
||||
glm::vec3 trans = skeleton->getAbsoluteDefaultPose(index).trans();
|
||||
// Y_180 is to convert from rig-frame into avatar-frame
|
||||
glm::mat4 geomToAvatarMat = Matrices::Y_180 * rig.getGeometryToRigTransform();
|
||||
return transformPoint(geomToAvatarMat, trans);
|
||||
}
|
||||
}
|
||||
return Vectors::ZERO;
|
||||
}
|
||||
|
||||
glm::quat Avatar::getAbsoluteJointRotationInObjectFrame(int index) const {
|
||||
|
|
|
@ -228,7 +228,12 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
connect(tabletRootWindow, &QmlWindowClass::fromQml, this, &TabletProxy::fromQml);
|
||||
} else {
|
||||
removeButtonsFromToolbar();
|
||||
addButtonsToHomeScreen();
|
||||
|
||||
if (_currentPathLoaded == TABLET_SOURCE_URL) {
|
||||
addButtonsToHomeScreen();
|
||||
} else {
|
||||
loadHomeScreen(true);
|
||||
}
|
||||
|
||||
// destroy desktop window
|
||||
if (_desktopWindow) {
|
||||
|
@ -236,7 +241,6 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
|
|||
_desktopWindow = nullptr;
|
||||
}
|
||||
}
|
||||
loadHomeScreen(true);
|
||||
}
|
||||
|
||||
static void addButtonProxyToQmlTablet(QQuickItem* qmlTablet, TabletButtonProxy* buttonProxy) {
|
||||
|
|
|
@ -381,7 +381,13 @@ function getAvatarFootOffset() {
|
|||
}
|
||||
if (footJointIndex != -1) {
|
||||
// default vertical offset from foot to avatar root.
|
||||
return -MyAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(footJointIndex).y;
|
||||
var footPos = MyAvatar.getAbsoluteDefaultJointTranslationInObjectFrame(footJointIndex);
|
||||
if (footPos.x === 0 && footPos.y === 0 && footPos.z === 0.0) {
|
||||
// if footPos is exactly zero, it's probably wrong because avatar is currently loading, fall back to default.
|
||||
return DEFAULT_ROOT_TO_FOOT_OFFSET * MyAvatar.scale;
|
||||
} else {
|
||||
return -footPos.y;
|
||||
}
|
||||
} else {
|
||||
return DEFAULT_ROOT_TO_FOOT_OFFSET * MyAvatar.scale;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue