Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGLOrthoCamera.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Richard Maunder  25/05/2005
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLOrthoCamera
0013 #define ROOT_TGLOrthoCamera
0014 
0015 #include "TGLCamera.h"
0016 
0017 
0018 //////////////////////////////////////////////////////////////////////////
0019 //                                                                      //
0020 // TGLOrthoCamera                                                       //
0021 //                                                                      //
0022 // Orthographic projection camera. Currently limited to three types     //
0023 // defined at construction time - kXOY, kXOZ, kZOY - where this refers  //
0024 // to the viewport plane axis - e.g. kXOY has X axis horizontal, Y      //
0025 // vertical - i.e. looking down Z axis with Y vertical.                 //
0026 //
0027 // The plane types restriction could easily be removed to supported     //
0028 // arbitary ortho projections along any axis/orientation with free      //
0029 // rotations about them.                                                //
0030 //                                                                      //
0031 //////////////////////////////////////////////////////////////////////////
0032 
0033 class TGLPaintDevice;
0034 
0035 class TGLOrthoCamera : public TGLCamera
0036 {
0037 public:
0038    enum EType { kZOY,  kXOZ,  kXOY,    // Pair of world axes aligned to h/v screen.
0039                 kZnOY, kXnOZ, kXnOY, kZOX, kZnOX}; // 'n' means preceding axis is negated.
0040 private:
0041    // Fields
0042    EType          fType;         // camera type
0043    Bool_t         fEnableRotate; // enable rotation
0044    Bool_t         fDollyToZoom;  // zoom when dolly is requested
0045 
0046    // Limits - set in Setup()
0047    Double_t       fZoomMin;      //  minimum zoom factor
0048    Double_t       fZoomDefault;  //  default zoom factor
0049    Double_t       fZoomMax;      //  maximum zoom factor
0050    TGLBoundingBox fVolume;       //! scene volume
0051 
0052    // Current interaction
0053    Double_t       fDefXSize, fDefYSize; //! x, y size of scene from camera view
0054    Double_t       fZoom;                //  current zoom
0055 
0056    static UInt_t  fgZoomDeltaSens;
0057 
0058 public:
0059    TGLOrthoCamera();
0060    TGLOrthoCamera(EType type, const TGLVector3 & hAxis, const TGLVector3 & vAxis);
0061    ~TGLOrthoCamera() override;
0062 
0063    Bool_t IsOrthographic() const override { return kTRUE; }
0064 
0065    void   Setup(const TGLBoundingBox & box, Bool_t reset=kTRUE) override;
0066    void   Reset() override;
0067 
0068    Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2) override;
0069    Bool_t Zoom (Int_t delta, Bool_t mod1, Bool_t mod2) override;
0070    using   TGLCamera::Truck;
0071    Bool_t Truck(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2) override;
0072    Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2) override;
0073    void   Apply(const TGLBoundingBox & sceneBox, const TGLRect * pickRect = nullptr) const override;
0074 
0075    // External scripting control
0076    //   void Configure(Double_t left, Double_t right, Double_t top, Double_t bottom);
0077    void Configure(Double_t zoom, Double_t dolly, Double_t center[3],
0078                           Double_t hRotate, Double_t vRotate) override;
0079 
0080    void     SetEnableRotate(Bool_t x) { fEnableRotate = x; }
0081    Bool_t   GetEnableRotate()   const { return fEnableRotate; }
0082 
0083    Double_t GetZoomMin() const { return fZoomMin; }
0084    Double_t GetZoomMax() const { return fZoomMax; }
0085    void     SetZoomMin(Double_t z);
0086    void     SetZoomMax(Double_t z);
0087    void     SetZoomMinMax(Double_t min, Double_t max) { SetZoomMin(min); SetZoomMax(max); }
0088 
0089    void     SetDollyToZoom(Bool_t x) { fDollyToZoom = x; }
0090    Bool_t   GetDollyToZoom()   const { return fDollyToZoom; }
0091 
0092    void     SetZoom(Double_t x) { fZoom = x; }
0093    Double_t GetZoom() const { return fZoom; }
0094 
0095    ClassDefOverride(TGLOrthoCamera,1) // Camera for orthographic view.
0096 };
0097 
0098 #endif // ROOT_TGLOrthoCamera