Port over more of the monitor distance logic, v2.6.3

This commit is contained in:
wheaney 2026-01-14 15:37:53 -08:00
parent 29cebd5d9b
commit 538782b585
3 changed files with 14 additions and 7 deletions

View File

@ -1 +1 @@
2.6.2
2.6.3

View File

@ -73,6 +73,8 @@ private:
int m_smoothFollowThreshold = 1;
QString m_connectedDeviceBrand;
QString m_connectedDeviceModel;
int m_connectedDeviceFullDistanceCm = 0;
int m_connectedDeviceFullSizeCm = 0;
QTimer m_statePollTimer; // periodic driver state polling
QTimer m_virtualDisplayPollTimer; // periodic virtual display list polling
bool m_licenseLoading = false;

View File

@ -367,23 +367,28 @@ QtObject {
// returns how far the look vector is from the center of the monitor, as a percentage of the monitor's dimensions
function getMonitorDistance(fovDetails, lookUpPixels, lookWestPixels, monitorVector, monitorDetails, upAngleToLength, westAngleToLength) {
// since the monitor vector has been modified to be relative to the lens position, we need to calculate its distance from the lens
// we need to adjust all angle-based lengths based on new vector distance
const monitorDistance = monitorVector.length();
const distanceAdjustment = monitorDistance / fovDetails.completeScreenDistancePixels;
var vectorUpPixels = upAngleToLength(
fovDetails.defaultDistanceVerticalRadians,
fovDetails.heightPixels,
fovDetails.completeScreenDistancePixels,
monitorDistance,
monitorVector.z,
monitorVector.x
);
var upPercentage = Math.abs(lookUpPixels - vectorUpPixels) / monitorDetails.height;
) * distanceAdjustment;
var upPercentage = Math.abs(lookUpPixels * distanceAdjustment - vectorUpPixels) / monitorDetails.height;
var vectorWestPixels = westAngleToLength(
fovDetails.defaultDistanceHorizontalRadians,
fovDetails.widthPixels,
fovDetails.completeScreenDistancePixels,
monitorDistance,
monitorVector.y,
monitorVector.x
);
var westPercentage = Math.abs(lookWestPixels - vectorWestPixels) / monitorDetails.width;
) * distanceAdjustment;
var westPercentage = Math.abs(lookWestPixels * distanceAdjustment - vectorWestPixels) / monitorDetails.width;
// how close we are to any edge is the largest of the two percentages
return Math.max(upPercentage, westPercentage);