Apply lens distance ratio

This commit is contained in:
wheaney 2025-09-10 21:38:56 -07:00
parent e889857cd8
commit f27fd17b59
2 changed files with 11 additions and 8 deletions

View File

@ -5,6 +5,7 @@ Item {
id: root id: root
required property Camera camera required property Camera camera
required property var fovDetails
property var displayResolution: effect.displayResolution property var displayResolution: effect.displayResolution
property real diagonalFOV: effect.diagonalFOV property real diagonalFOV: effect.diagonalFOV
@ -19,8 +20,14 @@ Item {
id: displays id: displays
} }
function updateCamera(rotation) { function updateCamera() {
camera.eulerRotation = rotation; camera.eulerRotation = applyLookAhead(
effect.imuRotations[0],
effect.imuRotations[1],
effect.imuTimeElapsedMs,
lookAheadMS(effect.imuTimestamp, effect.lookAheadConfig, -1)
);
camera.position = effect.imuRotations[0].times(Qt.vector3d(0, 0, -fovDetails.lensDistancePixels));
} }
// how far to look ahead is how old the IMU data is plus a constant that is either the default for this device or an override // how far to look ahead is how old the IMU data is plus a constant that is either the default for this device or an override
@ -68,12 +75,7 @@ Item {
running: true running: true
onTriggered: { onTriggered: {
if (effect.imuRotations && effect.imuRotations.length > 0) { if (effect.imuRotations && effect.imuRotations.length > 0) {
updateCamera(applyLookAhead( updateCamera();
effect.imuRotations[0],
effect.imuRotations[1],
effect.imuTimeElapsedMs,
lookAheadMS(effect.imuTimestamp, effect.lookAheadConfig, -1)
));
} }
} }
} }

View File

@ -122,6 +122,7 @@ Item {
id: cameraController id: cameraController
anchors.fill: parent anchors.fill: parent
camera: camera camera: camera
fovDetails: fovDetails
} }
} }
} }