mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-04-28 17:57:16 +02:00
[WIP] keep camera position after sync with camera
This commit is contained in:
parent
c9fc66a0d1
commit
118343a00f
3 changed files with 58 additions and 1 deletions
|
@ -116,7 +116,20 @@ FloatingPane {
|
|||
text: MaterialIcons.linked_camera
|
||||
ToolTip.text: "Sync with Image Selection"
|
||||
checked: enabled && Viewer3DSettings.syncViewpointCamera
|
||||
onClicked: Viewer3DSettings.syncViewpointCamera = !Viewer3DSettings.syncViewpointCamera
|
||||
onClicked: {
|
||||
Viewer3DSettings.syncViewpointCamera = !Viewer3DSettings.syncViewpointCamera;
|
||||
// Viewer3D.mainCamera.position = Viewer3D.viewpointCamera.camera.position;
|
||||
// Viewer3D.mainCamera.upVector = Viewer3D.viewpointCamera.camera.upVector;
|
||||
// console.warn(Viewer3D.viewpointCamera);
|
||||
// Viewer3D.mainCamera.viewCenter = Viewer3D.viewpointCamera.camera.viewCenter;
|
||||
// target: camera
|
||||
// fieldOfView: root.viewpoint.fieldOfView
|
||||
// upVector: root.viewpoint.upVector
|
||||
// target: transform
|
||||
// rotation: root.viewpoint.rotation
|
||||
// translation: root.viewpoint.translation
|
||||
// camera.aspectRatio: width/height
|
||||
}
|
||||
}
|
||||
// Image Overlay controls
|
||||
RowLayout {
|
||||
|
|
|
@ -21,6 +21,7 @@ FocusScope {
|
|||
property int renderMode: 2
|
||||
readonly property alias library: mediaLibrary
|
||||
readonly property alias mainCamera: mainCamera
|
||||
readonly property alias viewpointCamera: viewpointCamera
|
||||
|
||||
readonly property vector3d defaultCamPosition: Qt.vector3d(12.0, 10.0, -12.0)
|
||||
readonly property vector3d defaultCamUpVector: Qt.vector3d(0.0, 1.0, 0.0)
|
||||
|
@ -36,6 +37,44 @@ FocusScope {
|
|||
mainCamera.viewCenter = defaultCamViewCenter;
|
||||
}
|
||||
|
||||
function changeMainCamera() {
|
||||
console.warn("changeMainCamera");
|
||||
// console.warn(JSON.stringify(mainCamera.upVector));
|
||||
// console.warn(JSON.stringify(viewpointCamera));
|
||||
|
||||
var items = [mainCamera, viewpointCamera.camera]
|
||||
for (var i in items)
|
||||
{
|
||||
var item = items[i]
|
||||
for (var p in item)
|
||||
{
|
||||
if( typeof item[p] != "function" )
|
||||
if(p != "objectName" && p !== undefined)
|
||||
console.warn(p + ":" + item[p]);
|
||||
}
|
||||
console.warn("\n-------------\n")
|
||||
}
|
||||
|
||||
mainCamera.nearPlane = 0.1;
|
||||
mainCamera.farPlane = 10000.0;
|
||||
mainCamera.viewCenter = Qt.vector3d(0.0, 0.0, -1.0);
|
||||
mainCamera.fieldOfView = viewpoint.fieldOfView;
|
||||
mainCamera.upVector = viewpoint.upVector;
|
||||
mainCamera.transform.rotation = viewpoint.rotation;
|
||||
mainCamera.transform.translation = viewpoint.translation;
|
||||
trackballGizmo.transform.rotation = viewpoint.rotation;
|
||||
trackballGizmo.transform.translation = viewpoint.translation;
|
||||
// mainCamera.fieldOfView = viewpointCamera.camera.fieldOfView;
|
||||
// mainCamera.upVector = viewpointCamera.camera.upVector;
|
||||
// mainCamera.position = viewpointCamera.camera.position;
|
||||
// mainCamera.viewCenter = viewpointCamera.camera.viewVector;
|
||||
// mainCamera.projectionMatrix = viewpointCamera.camera.projectionMatrix;
|
||||
// mainCamera.transform.rotation = viewpointCamera.transform.rotation;
|
||||
// mainCamera.transform.translation = viewpointCamera.transform.translation;
|
||||
|
||||
// cameraSelector.camera = viewpointCamera.camera;
|
||||
}
|
||||
|
||||
function load(filepath, label = undefined) {
|
||||
mediaLibrary.load(filepath, label);
|
||||
}
|
||||
|
@ -95,6 +134,9 @@ FocusScope {
|
|||
{
|
||||
Viewer3DSettings.renderMode = event.key - Qt.Key_1;
|
||||
}
|
||||
else if (event.key == Qt.Key_S) {
|
||||
changeMainCamera();
|
||||
}
|
||||
else {
|
||||
event.accepted = false
|
||||
}
|
||||
|
@ -140,6 +182,7 @@ FocusScope {
|
|||
}
|
||||
|
||||
TrackballGizmo {
|
||||
id: trackballGizmo
|
||||
beamRadius: 4.0/root.height
|
||||
alpha: cameraController.moving ? 1.0 : 0.7
|
||||
enabled: Viewer3DSettings.displayGizmo && cameraSelector.camera == mainCamera
|
||||
|
|
|
@ -10,6 +10,7 @@ Entity {
|
|||
id: root
|
||||
|
||||
property variant viewpoint
|
||||
property alias transform: transform
|
||||
|
||||
property Camera camera: Camera {
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue