diff --git a/graf3d/gl/inc/TGLViewer.h b/graf3d/gl/inc/TGLViewer.h index ffcff754ef4d4f826fd7aea5bfdaac67f15a2719..0e1271c639201f9bcd4d259a26f715a3e701c241 100644 --- a/graf3d/gl/inc/TGLViewer.h +++ b/graf3d/gl/inc/TGLViewer.h @@ -268,6 +268,7 @@ public: Double_t center[3], Double_t hRotate, Double_t vRotate); void SetPerspectiveCamera(ECameraType camera, Double_t fov, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate); + void ReinitializeCurrentCamera(const TGLVector3& hAxis, const TGLVector3& vAxis, Bool_t redraw=kTRUE); void GetGuideState(Int_t & axesType, Bool_t & axesDepthTest, Bool_t & referenceOn, Double_t* referencePos) const; void SetGuideState(Int_t axesType, Bool_t axesDepthTest, Bool_t referenceOn, const Double_t* referencePos); void SetDrawCameraCenter(Bool_t x); diff --git a/graf3d/gl/src/TGLViewer.cxx b/graf3d/gl/src/TGLViewer.cxx index dab522ced90122c128fe9ccf3c9c391a26c5b457..f6ffe211e0c8dec622065f8927984f58025c7395 100644 --- a/graf3d/gl/src/TGLViewer.cxx +++ b/graf3d/gl/src/TGLViewer.cxx @@ -1771,6 +1771,20 @@ void TGLViewer::SetPerspectiveCamera(ECameraType camera, } } +//______________________________________________________________________________ +void TGLViewer::ReinitializeCurrentCamera(const TGLVector3& hAxis, const TGLVector3& vAxis, Bool_t redraw) +{ + // Change base-vectors defining the camera-base transformation of current + // camera. hAxis and vAxis are the default directions for forward + // (inverted) and upwards. + + TGLMatrix& cb = fCurrentCamera->RefCamBase(); + cb.Set(cb.GetTranslation(), vAxis, hAxis); + fCurrentCamera->Setup(fOverallBoundingBox, kTRUE); + if (redraw) + RequestDraw(); +} + //______________________________________________________________________________ TGLAutoRotator* TGLViewer::GetAutoRotator() {