diff --git a/apps/opencs/view/render/cameracontroller.cpp b/apps/opencs/view/render/cameracontroller.cpp index 3967c983d..ab066033b 100644 --- a/apps/opencs/view/render/cameracontroller.cpp +++ b/apps/opencs/view/render/cameracontroller.cpp @@ -367,6 +367,11 @@ namespace CSVRender { } + osg::Vec3d OrbitCameraController::getCenter() const + { + return mCenter; + } + double OrbitCameraController::getOrbitSpeed() const { return mOrbitSpeed; @@ -382,6 +387,19 @@ namespace CSVRender return mPickingMask; } + void OrbitCameraController::setCenter(const osg::Vec3d& value) + { + osg::Vec3d eye, center, up; + getCamera()->getViewMatrixAsLookAt(eye, center, up); + + mCenter = value; + mDistance = (eye - mCenter).length(); + + getCamera()->setViewMatrixAsLookAt(eye, mCenter, up); + + mInitialized = true; + } + void OrbitCameraController::setOrbitSpeed(double value) { mOrbitSpeed = value; diff --git a/apps/opencs/view/render/cameracontroller.hpp b/apps/opencs/view/render/cameracontroller.hpp index 7c1f96e15..b1dcc320a 100644 --- a/apps/opencs/view/render/cameracontroller.hpp +++ b/apps/opencs/view/render/cameracontroller.hpp @@ -113,10 +113,12 @@ namespace CSVRender OrbitCameraController(); + osg::Vec3d getCenter() const; double getOrbitSpeed() const; double getOrbitSpeedMultiplier() const; unsigned int getPickingMask() const; + void setCenter(const osg::Vec3d& center); void setOrbitSpeed(double value); void setOrbitSpeedMultiplier(double value); void setPickingMask(unsigned int value);