Logo ROOT   6.14/05
Reference Guide
TGLOrthoCamera.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Richard Maunder 25/05/2005
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TGLOrthoCamera
13 #define ROOT_TGLOrthoCamera
14 
15 #include "TGLCamera.h"
16 
17 
18 //////////////////////////////////////////////////////////////////////////
19 // //
20 // TGLOrthoCamera //
21 // //
22 // Orthographic projection camera. Currently limited to three types //
23 // defined at construction time - kXOY, kXOZ, kZOY - where this refers //
24 // to the viewport plane axis - e.g. kXOY has X axis horizontal, Y //
25 // vertical - i.e. looking down Z axis with Y vertical. //
26 //
27 // The plane types restriction could easily be removed to supported //
28 // arbitary ortho projections along any axis/orientation with free //
29 // rotations about them. //
30 // //
31 //////////////////////////////////////////////////////////////////////////
32 
33 class TGLPaintDevice;
34 
35 class TGLOrthoCamera : public TGLCamera
36 {
37 public:
38  enum EType { kZOY, kXOZ, kXOY, // Pair of world axes aligned to h/v screen.
39  kZnOY, kXnOZ, kXnOY, kZOX, kZnOX}; // 'n' means preceding axis is negated.
40 private:
41  // Fields
42  EType fType; // camera type
43  Bool_t fEnableRotate; // enable rotation
44  Bool_t fDollyToZoom; // zoom when dolly is requested
45 
46  // Limits - set in Setup()
47  Double_t fZoomMin; // minimum zoom factor
48  Double_t fZoomDefault; // default zoom factor
49  Double_t fZoomMax; // maximum zoom factor
50  TGLBoundingBox fVolume; //! scene volume
51 
52  // Current interaction
53  Double_t fDefXSize, fDefYSize; //! x, y size of scene from camera view
54  Double_t fZoom; // current zoom
55 
57 
58 public:
60  TGLOrthoCamera(EType type, const TGLVector3 & hAxis, const TGLVector3 & vAxis);
61  virtual ~TGLOrthoCamera();
62 
63  virtual Bool_t IsOrthographic() const { return kTRUE; }
64 
65  virtual void Setup(const TGLBoundingBox & box, Bool_t reset=kTRUE);
66  virtual void Reset();
67 
68  virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2);
69  virtual Bool_t Zoom (Int_t delta, Bool_t mod1, Bool_t mod2);
70  using TGLCamera::Truck;
71  virtual Bool_t Truck(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
72  virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2);
73  virtual void Apply(const TGLBoundingBox & sceneBox, const TGLRect * pickRect = 0) const;
74 
75  // External scripting control
76  // void Configure(Double_t left, Double_t right, Double_t top, Double_t bottom);
77  virtual void Configure(Double_t zoom, Double_t dolly, Double_t center[3],
78  Double_t hRotate, Double_t vRotate);
79 
80  void SetEnableRotate(Bool_t x) { fEnableRotate = x; }
81  Bool_t GetEnableRotate() const { return fEnableRotate; }
82 
83  Double_t GetZoomMin() const { return fZoomMin; }
84  Double_t GetZoomMax() const { return fZoomMax; }
85  void SetZoomMin(Double_t z);
86  void SetZoomMax(Double_t z);
87  void SetZoomMinMax(Double_t min, Double_t max) { SetZoomMin(min); SetZoomMax(max); }
88 
89  void SetDollyToZoom(Bool_t x) { fDollyToZoom = x; }
90  Bool_t GetDollyToZoom() const { return fDollyToZoom; }
91 
92  void SetZoom(Double_t x) { fZoom = x; }
93  Double_t GetZoom() const { return fZoom; }
94 
95  ClassDef(TGLOrthoCamera,1) // Camera for orthographic view.
96 };
97 
98 #endif // ROOT_TGLOrthoCamera
TGLOrthoCamera()
Construct kXOY orthographic camera.
Double_t GetZoom() const
Double_t fZoom
x, y size of scene from camera view
Double_t fZoomMin
Abstract base camera class - concrete classes for orthographic and perspective cameras derive from it...
Definition: TGLCamera.h:43
virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2)
Dolly the camera.
void SetZoom(Double_t x)
Double_t GetZoomMin() const
void SetZoomMax(Double_t z)
Set maximum zoom factor.
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition: fillpatterns.C:1
Bool_t GetEnableRotate() const
void SetEnableRotate(Bool_t x)
virtual Bool_t Zoom(Int_t delta, Bool_t mod1, Bool_t mod2)
Zoom the camera - 'adjust lens focal length, retaining camera position'.
virtual Bool_t IsOrthographic() const
Double_t x[n]
Definition: legend1.C:17
#define ClassDef(name, id)
Definition: Rtypes.h:320
Viewport (pixel base) 2D rectangle class.
Definition: TGLUtil.h:422
Double_t fDefXSize
scene volume
3 component (x/y/z) vector class.
Definition: TGLUtil.h:246
TGLBoundingBox fVolume
virtual void Setup(const TGLBoundingBox &box, Bool_t reset=kTRUE)
Setup camera limits suitable to view the world volume defined by 'box' and call Reset() to initialise...
void SetZoomMinMax(Double_t min, Double_t max)
Bool_t fEnableRotate
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual Bool_t Truck(Double_t xDelta, Double_t yDelta)
Truck the camera - 'move camera parallel to film plane'.
Definition: TGLCamera.cxx:894
virtual ~TGLOrthoCamera()
Destroy orthographic camera.
virtual Bool_t Truck(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Truck the camera - 'move camera parallel to film plane'.
virtual void Apply(const TGLBoundingBox &sceneBox, const TGLRect *pickRect=0) const
Apply the camera to the current GL context, setting the viewport, projection and modelview matrices...
void SetDollyToZoom(Bool_t x)
double Double_t
Definition: RtypesCore.h:55
virtual void Reset()
Reset the camera to defaults - trucking, zooming to reframe the world volume established in Setup()...
int type
Definition: TGX11.cxx:120
virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta, Bool_t mod1, Bool_t mod2)
Rotate the camera - 'swivel round the view volume center'.
virtual void Configure(Double_t zoom, Double_t dolly, Double_t center[3], Double_t hRotate, Double_t vRotate)
Configure the camera state.
Bool_t GetDollyToZoom() const
Orthographic projection camera.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices. ...
you should not use this method at all Int_t Int_t z
Definition: TRolke.cxx:630
Double_t GetZoomMax() const
Double_t fDefYSize
const Bool_t kTRUE
Definition: RtypesCore.h:87
Double_t fZoomDefault
void SetZoomMin(Double_t z)
Set minimum zoom factor.
Double_t fZoomMax
static UInt_t fgZoomDeltaSens