Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TGLCameraOverlay.h
Go to the documentation of this file.
1 // @(#)root/gl:$Id$
2 // Author: Alja Mrak-Tadel 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, 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_TGLCameraOverlay
13 #define ROOT_TGLCameraOverlay
14 
15 #include "TAttAxis.h"
16 #include "TGLOverlay.h"
17 #include "TGLUtil.h"
18 
19 class TGLAxisPainter;
20 class TGLFont;
21 
22 class TAttAxis;
23 class TAxis;
24 
25 class TGLCameraOverlay : public TGLOverlayElement
26 {
27 public:
28  enum EMode { kPlaneIntersect, kBar, kAxis, kGridFront, kGridBack };
29 
30 private:
31  TGLCameraOverlay(const TGLCameraOverlay&); // Not implemented
32  TGLCameraOverlay& operator=(const TGLCameraOverlay&); // Not implemented
33 
34 protected:
35  Bool_t fShowOrthographic;
36  Bool_t fShowPerspective;
37 
38  EMode fOrthographicMode;
39  EMode fPerspectiveMode;
40 
41  TGLAxisPainter *fAxisPainter;
42  TAxis *fAxis;
43  Float_t fAxisExtend;
44  Bool_t fUseAxisColors;
45 
46  TGLPlane fExternalRefPlane;
47  Bool_t fUseExternalRefPlane;
48 
49  Double_t fFrustum[4];
50 
51 
52  void RenderPlaneIntersect(TGLRnrCtx& rnrCtx);
53  void RenderAxis(TGLRnrCtx& rnrCtx, Bool_t drawGrid);
54  void RenderGrid(TGLRnrCtx& rnrCtx);
55  void RenderBar(TGLRnrCtx& rnrCtx);
56 
57 public:
58  TGLCameraOverlay(Bool_t showOrtho=kTRUE, Bool_t showPersp=kFALSE);
59  virtual ~TGLCameraOverlay();
60 
61  virtual void Render(TGLRnrCtx& rnrCtx);
62 
63  TGLPlane& RefExternalRefPlane() { return fExternalRefPlane; }
64  void UseExternalRefPlane(Bool_t x) { fUseExternalRefPlane=x; }
65  Bool_t GetUseExternalRefPlane() const { return fUseExternalRefPlane; }
66 
67  Int_t GetPerspectiveMode() const { return fPerspectiveMode;}
68  void SetPerspectiveMode(EMode m) {fPerspectiveMode = m;}
69  Int_t GetOrthographicMode() const { return fOrthographicMode;}
70  void SetOrthographicMode(EMode m) {fOrthographicMode = m;}
71 
72  Bool_t GetShowOrthographic() const { return fShowOrthographic; }
73  void SetShowOrthographic(Bool_t x) {fShowOrthographic =x;}
74  Bool_t GetShowPerspective() const { return fShowPerspective; }
75  void SetShowPerspective(Bool_t x) {fShowPerspective =x;}
76 
77  void SetFrustum(TGLCamera& cam);
78 
79  TAttAxis* GetAttAxis();
80 
81  ClassDef(TGLCameraOverlay, 1); // Show coorinates of current camera frustum.
82 };
83 
84 #endif