TGLOrthoCamera.h

Go to the documentation of this file.
00001 // @(#)root/gl:$Id: TGLOrthoCamera.h 28212 2009-04-15 11:05:29Z matevz $
00002 // Author:  Richard Maunder  25/05/2005
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_TGLOrthoCamera
00013 #define ROOT_TGLOrthoCamera
00014 
00015 #include "TGLCamera.h"
00016 
00017 
00018 //////////////////////////////////////////////////////////////////////////
00019 //                                                                      //
00020 // TGLOrthoCamera                                                       //
00021 //                                                                      //
00022 // Orthographic projection camera. Currently limited to three types     //
00023 // defined at construction time - kXOY, kXOZ, kZOY - where this refers  //
00024 // to the viewport plane axis - e.g. kXOY has X axis horizontal, Y      //
00025 // vertical - i.e. looking down Z axis with Y vertical.                 //
00026 //
00027 // The plane types restriction could easily be removed to supported     //
00028 // arbitary ortho projections along any axis/orientation with free      //
00029 // rotations about them.                                                //
00030 //                                                                      //
00031 //////////////////////////////////////////////////////////////////////////
00032 
00033 class TGLPaintDevice;
00034 
00035 class TGLOrthoCamera : public TGLCamera
00036 {
00037 public:
00038    enum EType { kZOY,  kXOZ,  kXOY,    // Pair of world axes aligned to h/v screen.
00039                 kZnOY, kXnOZ, kXnOY }; // 'n' means preceeding axis is negated.
00040 private:
00041    // Fields
00042    EType          fType;         //! camera type
00043    Bool_t         fEnableRotate; //! enable rotation
00044    Bool_t         fDollyToZoom;  //! zoom when dolly is requested
00045 
00046    // Limits - set in Setup()
00047    Double_t       fZoomMin;      //! minimum zoom factor
00048    Double_t       fZoomDefault;  //! default zoom factor
00049    Double_t       fZoomMax;      //! maximum zoom factor
00050    TGLBoundingBox fVolume;       //! scene volume
00051 
00052    // Current interaction
00053    Double_t       fDefXSize, fDefYSize; //! x, y size of scene from camera view
00054    Double_t       fZoom;                //! current zoom
00055 
00056    static UInt_t  fgZoomDeltaSens;
00057 
00058 public:
00059    TGLOrthoCamera(EType type, const TGLVector3 & hAxis, const TGLVector3 & vAxis);
00060    virtual ~TGLOrthoCamera();
00061 
00062    virtual Bool_t IsOrthographic() const { return kTRUE; }
00063 
00064    virtual void   Setup(const TGLBoundingBox & box, Bool_t reset=kTRUE);
00065    virtual void   Reset();
00066 
00067    virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2);
00068    virtual Bool_t Zoom (Int_t delta, Bool_t mod1, Bool_t mod2);
00069    using   TGLCamera::Truck;
00070    virtual Bool_t Truck(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
00071    virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
00072    virtual void   Apply(const TGLBoundingBox & sceneBox, const TGLRect * pickRect = 0) const;
00073 
00074    // External scripting control
00075    //   void Configure(Double_t left, Double_t right, Double_t top, Double_t bottom);
00076    virtual void Configure(Double_t zoom, Double_t dolly, Double_t center[3],
00077                           Double_t hRotate, Double_t vRotate);
00078 
00079    void     SetEnableRotate(Bool_t x) { fEnableRotate = x; }
00080    Bool_t   GetEnableRotate()   const { return fEnableRotate; }
00081 
00082    Double_t GetZoomMin() const { return fZoomMin; }
00083    Double_t GetZoomMax() const { return fZoomMax; }
00084    void     SetZoomMin(Double_t z);
00085    void     SetZoomMax(Double_t z);
00086    void     SetZoomMinMax(Double_t min, Double_t max) { SetZoomMin(min); SetZoomMax(max); }
00087 
00088    void     SetDollyToZoom(Bool_t x) { fDollyToZoom = x; }
00089    Bool_t   GetDollyToZoom()   const { return fDollyToZoom; }
00090 
00091    ClassDef(TGLOrthoCamera,0) // Camera for orthographic view.
00092 };
00093 
00094 #endif // ROOT_TGLOrthoCamera

Generated on Tue Jul 5 14:16:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1