@@ -140,6 +140,15 @@ ViewSceneDialog::ViewSceneDialog(const std::string& name, ModuleStateHandle stat
140140 state->connectSpecificStateChanged (Parameters::GeomData,[this ](){Q_EMIT newGeometryValueForwarder ();});
141141 connect (this , SIGNAL (newGeometryValueForwarder ()), this , SLOT (updateAllGeometries ()));
142142
143+ state->connectSpecificStateChanged (Modules::Render::ViewScene::CameraRotation,[this ](){Q_EMIT cameraRotationChangeForwarder ();});
144+ connect (this , SIGNAL (cameraRotationChangeForwarder ()), this , SLOT (pullCameraRotation ()));
145+
146+ state->connectSpecificStateChanged (Modules::Render::ViewScene::CameraLookAt,[this ](){Q_EMIT cameraLookAtChangeForwarder ();});
147+ connect (this , SIGNAL (cameraLookAtChangeForwarder ()), this , SLOT (pullCameraLookAt ()));
148+
149+ state->connectSpecificStateChanged (Modules::Render::ViewScene::CameraDistance,[this ](){Q_EMIT cameraDistnaceChangeForwarder ();});
150+ connect (this , SIGNAL (cameraDistnaceChangeForwarder ()), this , SLOT (pullCameraDistance ()));
151+
143152 std::string filesystemRoot = Application::Instance ().executablePath ().string ();
144153 std::string sep;
145154 sep += boost::filesystem::path::preferred_separator;
@@ -492,9 +501,43 @@ void ViewSceneDialog::pullCameraState()
492501 spire->setCameraRotation (glm::quat (rotation[0 ], rotation[1 ], rotation[2 ], rotation[3 ]));
493502}
494503
504+ // --------------------------------------------------------------------------------------------------
505+ void ViewSceneDialog::pullCameraRotation ()
506+ {
507+ if (pushingCameraState_) return ;
508+ auto spire = mSpire .lock ();
509+ if (!spire) return ;
510+
511+ auto rotation = toDoubleVector (state_->getValue (Modules::Render::ViewScene::CameraRotation).toVector ());
512+ spire->setCameraRotation (glm::quat (rotation[0 ], rotation[1 ], rotation[2 ], rotation[3 ]));
513+ }
514+
515+ // --------------------------------------------------------------------------------------------------
516+ void ViewSceneDialog::pullCameraLookAt ()
517+ {
518+ if (pushingCameraState_) return ;
519+ auto spire = mSpire .lock ();
520+ if (!spire) return ;
521+
522+ auto lookAt = toDoubleVector (state_->getValue (Modules::Render::ViewScene::CameraLookAt).toVector ());
523+ spire->setCameraLookAt (glm::vec3 (lookAt[0 ], lookAt[1 ], lookAt[2 ]));
524+ }
525+
526+ // --------------------------------------------------------------------------------------------------
527+ void ViewSceneDialog::pullCameraDistance ()
528+ {
529+ if (pushingCameraState_) return ;
530+ auto spire = mSpire .lock ();
531+ if (!spire) return ;
532+
533+ float distance = state_->getValue (Modules::Render::ViewScene::CameraDistance).toDouble ();
534+ spire->setCameraDistance (distance);
535+ }
536+
495537// --------------------------------------------------------------------------------------------------
496538void ViewSceneDialog::pushCameraState ()
497539{
540+ pushingCameraState_ = true ;
498541 auto spire = mSpire .lock ();
499542 if (!spire) return ;
500543
@@ -507,6 +550,7 @@ void ViewSceneDialog::pushCameraState()
507550 glm::quat q = spire->getCameraRotation ();
508551 auto rotation = makeAnonymousVariableList ((double )q.w , (double )q.x , (double )q.y , (double )q.z );
509552 state_->setValue (Modules::Render::ViewScene::CameraRotation, rotation);
553+ pushingCameraState_ = false ;
510554}
511555
512556// --------------------------------------------------------------------------------------------------
0 commit comments