Port over more of the monitor distance logic, v2.6.3
This commit is contained in:
parent
29cebd5d9b
commit
538782b585
|
|
@ -73,6 +73,8 @@ private:
|
||||||
int m_smoothFollowThreshold = 1;
|
int m_smoothFollowThreshold = 1;
|
||||||
QString m_connectedDeviceBrand;
|
QString m_connectedDeviceBrand;
|
||||||
QString m_connectedDeviceModel;
|
QString m_connectedDeviceModel;
|
||||||
|
int m_connectedDeviceFullDistanceCm = 0;
|
||||||
|
int m_connectedDeviceFullSizeCm = 0;
|
||||||
QTimer m_statePollTimer; // periodic driver state polling
|
QTimer m_statePollTimer; // periodic driver state polling
|
||||||
QTimer m_virtualDisplayPollTimer; // periodic virtual display list polling
|
QTimer m_virtualDisplayPollTimer; // periodic virtual display list polling
|
||||||
bool m_licenseLoading = false;
|
bool m_licenseLoading = false;
|
||||||
|
|
|
||||||
|
|
@ -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
|
// 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) {
|
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(
|
var vectorUpPixels = upAngleToLength(
|
||||||
fovDetails.defaultDistanceVerticalRadians,
|
fovDetails.defaultDistanceVerticalRadians,
|
||||||
fovDetails.heightPixels,
|
fovDetails.heightPixels,
|
||||||
fovDetails.completeScreenDistancePixels,
|
monitorDistance,
|
||||||
monitorVector.z,
|
monitorVector.z,
|
||||||
monitorVector.x
|
monitorVector.x
|
||||||
);
|
) * distanceAdjustment;
|
||||||
var upPercentage = Math.abs(lookUpPixels - vectorUpPixels) / monitorDetails.height;
|
var upPercentage = Math.abs(lookUpPixels * distanceAdjustment - vectorUpPixels) / monitorDetails.height;
|
||||||
|
|
||||||
var vectorWestPixels = westAngleToLength(
|
var vectorWestPixels = westAngleToLength(
|
||||||
fovDetails.defaultDistanceHorizontalRadians,
|
fovDetails.defaultDistanceHorizontalRadians,
|
||||||
fovDetails.widthPixels,
|
fovDetails.widthPixels,
|
||||||
fovDetails.completeScreenDistancePixels,
|
monitorDistance,
|
||||||
monitorVector.y,
|
monitorVector.y,
|
||||||
monitorVector.x
|
monitorVector.x
|
||||||
);
|
) * distanceAdjustment;
|
||||||
var westPercentage = Math.abs(lookWestPixels - vectorWestPixels) / monitorDetails.width;
|
var westPercentage = Math.abs(lookWestPixels * distanceAdjustment - vectorWestPixels) / monitorDetails.width;
|
||||||
|
|
||||||
// how close we are to any edge is the largest of the two percentages
|
// how close we are to any edge is the largest of the two percentages
|
||||||
return Math.max(upPercentage, westPercentage);
|
return Math.max(upPercentage, westPercentage);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue