mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-05 15:39:55 +02:00
Fixes for scaling tablet at high frame rates
This commit is contained in:
parent
9c6b8a6826
commit
1a01209020
3 changed files with 8 additions and 11 deletions
|
@ -3031,9 +3031,7 @@ function MyController(hand) {
|
||||||
Overlays.editOverlay(this.grabbedThingID, reparentProps);
|
Overlays.editOverlay(this.grabbedThingID, reparentProps);
|
||||||
// AJT: resize tablet to allow it to counter scale.
|
// AJT: resize tablet to allow it to counter scale.
|
||||||
if (this.grabbedThingID === HMD.tabletID) {
|
if (this.grabbedThingID === HMD.tabletID) {
|
||||||
var DEFAULT_TABLET_WIDTH = 0.4375;
|
resizeTablet(getTabletWidthFromSettings(), reparentProps.parentJointIndex);
|
||||||
var tabletScalePercentage = getTabletScalePercentageFromSettings();
|
|
||||||
resizeTablet(DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (grabbedProperties.userData.length > 0) {
|
if (grabbedProperties.userData.length > 0) {
|
||||||
|
@ -3813,9 +3811,7 @@ function MyController(hand) {
|
||||||
});
|
});
|
||||||
// AJT: resizeTablet to counter adjust offsets to account for change of scale from sensorToWorldMatrix
|
// AJT: resizeTablet to counter adjust offsets to account for change of scale from sensorToWorldMatrix
|
||||||
if (this.grabbedThingID === HMD.tabletID) {
|
if (this.grabbedThingID === HMD.tabletID) {
|
||||||
var DEFAULT_TABLET_WIDTH = 0.4375;
|
resizeTablet(getTabletWidthFromSettings(), this.previousParentJointIndex[this.grabbedThingID]);
|
||||||
var tabletScalePercentage = getTabletScalePercentageFromSettings();
|
|
||||||
resizeTablet(DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100));
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// we're putting this back as a child of some other parent, so zero its velocity
|
// we're putting this back as a child of some other parent, so zero its velocity
|
||||||
|
|
|
@ -178,7 +178,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
|
||||||
localPosition: {x: -0.001, y: -HOME_BUTTON_Y_OFFSET, z: 0.0},
|
localPosition: {x: -0.001, y: -HOME_BUTTON_Y_OFFSET, z: 0.0},
|
||||||
localRotation: {x: 0, y: 1, z: 0, w: 0},
|
localRotation: {x: 0, y: 1, z: 0, w: 0},
|
||||||
dimensions: { x: 4 * tabletScaleFactor, y: 4 * tabletScaleFactor, z: 4 * tabletScaleFactor},
|
dimensions: { x: 4 * tabletScaleFactor, y: 4 * tabletScaleFactor, z: 4 * tabletScaleFactor},
|
||||||
alpha: 1.0,
|
alpha: 0.0,
|
||||||
visible: visible,
|
visible: visible,
|
||||||
drawInFront: false,
|
drawInFront: false,
|
||||||
parentID: this.tabletEntityID,
|
parentID: this.tabletEntityID,
|
||||||
|
|
|
@ -352,7 +352,8 @@ flatten = function(array) {
|
||||||
return [].concat.apply([], array);
|
return [].concat.apply([], array);
|
||||||
}
|
}
|
||||||
|
|
||||||
getTabletScalePercentageFromSettings = function () {
|
getTabletWidthFromSettings = function () {
|
||||||
|
var DEFAULT_TABLET_WIDTH = 0.4375;
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var toolbarMode = tablet.toolbarMode;
|
var toolbarMode = tablet.toolbarMode;
|
||||||
var DEFAULT_TABLET_SCALE = 100;
|
var DEFAULT_TABLET_SCALE = 100;
|
||||||
|
@ -364,10 +365,10 @@ getTabletScalePercentageFromSettings = function () {
|
||||||
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_TABLET_SCALE;
|
tabletScalePercentage = Settings.getValue("desktopTabletScale") || DEFAULT_TABLET_SCALE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return tabletScalePercentage;
|
return DEFAULT_TABLET_WIDTH * (tabletScalePercentage / 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
resizeTablet = function (width, newParentJointID) {
|
resizeTablet = function (width, newParentJointIndex) {
|
||||||
|
|
||||||
if (!HMD.tabletID || !HMD.tabletScreenID || !HMD.homeButtonID) {
|
if (!HMD.tabletID || !HMD.tabletScreenID || !HMD.homeButtonID) {
|
||||||
return;
|
return;
|
||||||
|
@ -376,7 +377,7 @@ resizeTablet = function (width, newParentJointID) {
|
||||||
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
|
var sensorScaleFactor = MyAvatar.sensorToWorldScale;
|
||||||
var sensorScaleOffsetOverride = 1;
|
var sensorScaleOffsetOverride = 1;
|
||||||
var SENSOR_TO_ROOM_MATRIX = 65534;
|
var SENSOR_TO_ROOM_MATRIX = 65534;
|
||||||
var parentJointIndex = Overlays.getProperty(HMD.tabletID, "parentJointIndex");
|
var parentJointIndex = newParentJointIndex || Overlays.getProperty(HMD.tabletID, "parentJointIndex");
|
||||||
if (parentJointIndex === SENSOR_TO_ROOM_MATRIX) {
|
if (parentJointIndex === SENSOR_TO_ROOM_MATRIX) {
|
||||||
sensorScaleOffsetOverride = 1 / sensorScaleFactor;
|
sensorScaleOffsetOverride = 1 / sensorScaleFactor;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue