ROOT logo
// @(#)root/gl:$Id: TGLOrthoCamera.h 28201 2009-04-14 16:04:20Z matevz $
// Author:  Richard Maunder  25/05/2005

/*************************************************************************
 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGLOrthoCamera
#define ROOT_TGLOrthoCamera

#include "TGLCamera.h"


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGLOrthoCamera                                                       //
//                                                                      //
// Orthographic projection camera. Currently limited to three types     //
// defined at construction time - kXOY, kXOZ, kZOY - where this refers  //
// to the viewport plane axis - e.g. kXOY has X axis horizontal, Y      //
// vertical - i.e. looking down Z axis with Y vertical.                 //
//
// The plane types restriction could easily be removed to supported     //
// arbitary ortho projections along any axis/orientation with free      //
// rotations about them.                                                //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

class TGLPaintDevice;

class TGLOrthoCamera : public TGLCamera
{
public:
   enum EType { kZOY,  kXOZ,  kXOY,    // Pair of world axes aligned to h/v screen.
                kZnOY, kXnOZ, kXnOY }; // 'n' means preceeding axis is negated.
private:
   // Fields
   EType          fType;         //! camera type
   Bool_t         fEnableRotate; //! enable rotation
   Bool_t         fDollyToZoom;  //! zoom when dolly is requested

   // Limits - set in Setup()
   Double_t       fZoomMin;      //! minimum zoom factor
   Double_t       fZoomDefault;  //! default zoom factor
   Double_t       fZoomMax;      //! maximum zoom factor
   TGLBoundingBox fVolume;       //! scene volume

   // Current interaction
   Double_t       fDefXSize, fDefYSize; //! x, y size of scene from camera view
   Double_t       fZoom;                //! current zoom

   static UInt_t  fgZoomDeltaSens;

public:
   TGLOrthoCamera();
   TGLOrthoCamera(EType type, const TGLVector3 & hAxis, const TGLVector3 & vAxis);
   virtual ~TGLOrthoCamera();

   virtual Bool_t IsOrthographic() const { return kTRUE; }

   virtual void   Setup(const TGLBoundingBox & box, Bool_t reset=kTRUE);
   virtual void   Reset();

   virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2);
   virtual Bool_t Zoom (Int_t delta, Bool_t mod1, Bool_t mod2);
   using   TGLCamera::Truck;
   virtual Bool_t Truck(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
   virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
   virtual void   Apply(const TGLBoundingBox & sceneBox, const TGLRect * pickRect = 0) const;

   // External scripting control
   //   void Configure(Double_t left, Double_t right, Double_t top, Double_t bottom);
   virtual void Configure(Double_t zoom, Double_t dolly, Double_t center[3],
                          Double_t hRotate, Double_t vRotate);

   void     SetEnableRotate(Bool_t x) { fEnableRotate = x; }
   Bool_t   GetEnableRotate()   const { return fEnableRotate; }

   Double_t GetZoomMin() const { return fZoomMin; }
   Double_t GetZoomMax() const { return fZoomMax; }
   void     SetZoomMin(Double_t z);
   void     SetZoomMax(Double_t z);
   void     SetZoomMinMax(Double_t min, Double_t max) { SetZoomMin(min); SetZoomMax(max); }

   void     SetDollyToZoom(Bool_t x) { fDollyToZoom = x; }
   Bool_t   GetDollyToZoom()   const { return fDollyToZoom; }

   ClassDef(TGLOrthoCamera,0) // Camera for orthographic view.
};

#endif // ROOT_TGLOrthoCamera
 TGLOrthoCamera.h:1
 TGLOrthoCamera.h:2
 TGLOrthoCamera.h:3
 TGLOrthoCamera.h:4
 TGLOrthoCamera.h:5
 TGLOrthoCamera.h:6
 TGLOrthoCamera.h:7
 TGLOrthoCamera.h:8
 TGLOrthoCamera.h:9
 TGLOrthoCamera.h:10
 TGLOrthoCamera.h:11
 TGLOrthoCamera.h:12
 TGLOrthoCamera.h:13
 TGLOrthoCamera.h:14
 TGLOrthoCamera.h:15
 TGLOrthoCamera.h:16
 TGLOrthoCamera.h:17
 TGLOrthoCamera.h:18
 TGLOrthoCamera.h:19
 TGLOrthoCamera.h:20
 TGLOrthoCamera.h:21
 TGLOrthoCamera.h:22
 TGLOrthoCamera.h:23
 TGLOrthoCamera.h:24
 TGLOrthoCamera.h:25
 TGLOrthoCamera.h:26
 TGLOrthoCamera.h:27
 TGLOrthoCamera.h:28
 TGLOrthoCamera.h:29
 TGLOrthoCamera.h:30
 TGLOrthoCamera.h:31
 TGLOrthoCamera.h:32
 TGLOrthoCamera.h:33
 TGLOrthoCamera.h:34
 TGLOrthoCamera.h:35
 TGLOrthoCamera.h:36
 TGLOrthoCamera.h:37
 TGLOrthoCamera.h:38
 TGLOrthoCamera.h:39
 TGLOrthoCamera.h:40
 TGLOrthoCamera.h:41
 TGLOrthoCamera.h:42
 TGLOrthoCamera.h:43
 TGLOrthoCamera.h:44
 TGLOrthoCamera.h:45
 TGLOrthoCamera.h:46
 TGLOrthoCamera.h:47
 TGLOrthoCamera.h:48
 TGLOrthoCamera.h:49
 TGLOrthoCamera.h:50
 TGLOrthoCamera.h:51
 TGLOrthoCamera.h:52
 TGLOrthoCamera.h:53
 TGLOrthoCamera.h:54
 TGLOrthoCamera.h:55
 TGLOrthoCamera.h:56
 TGLOrthoCamera.h:57
 TGLOrthoCamera.h:58
 TGLOrthoCamera.h:59
 TGLOrthoCamera.h:60
 TGLOrthoCamera.h:61
 TGLOrthoCamera.h:62
 TGLOrthoCamera.h:63
 TGLOrthoCamera.h:64
 TGLOrthoCamera.h:65
 TGLOrthoCamera.h:66
 TGLOrthoCamera.h:67
 TGLOrthoCamera.h:68
 TGLOrthoCamera.h:69
 TGLOrthoCamera.h:70
 TGLOrthoCamera.h:71
 TGLOrthoCamera.h:72
 TGLOrthoCamera.h:73
 TGLOrthoCamera.h:74
 TGLOrthoCamera.h:75
 TGLOrthoCamera.h:76
 TGLOrthoCamera.h:77
 TGLOrthoCamera.h:78
 TGLOrthoCamera.h:79
 TGLOrthoCamera.h:80
 TGLOrthoCamera.h:81
 TGLOrthoCamera.h:82
 TGLOrthoCamera.h:83
 TGLOrthoCamera.h:84
 TGLOrthoCamera.h:85
 TGLOrthoCamera.h:86
 TGLOrthoCamera.h:87
 TGLOrthoCamera.h:88
 TGLOrthoCamera.h:89
 TGLOrthoCamera.h:90
 TGLOrthoCamera.h:91
 TGLOrthoCamera.h:92
 TGLOrthoCamera.h:93
 TGLOrthoCamera.h:94
 TGLOrthoCamera.h:95