ROOT logo
// @(#)root/gl:$Id$
// Author: Alja Mrak-Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, 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_TGLCameraOverlay
#define ROOT_TGLCameraOverlay

#include "TAttAxis.h"
#include "TGLOverlay.h"
#include "TGLUtil.h"

class TGLAxisPainter;
class TGLFont;

class TAttAxis;
class TAxis;

class TGLCameraOverlay : public TGLOverlayElement
{
public:
   enum EMode { kPlaneIntersect, kBar, kAxis, kGridFront, kGridBack };

private:
   TGLCameraOverlay(const TGLCameraOverlay&);            // Not implemented
   TGLCameraOverlay& operator=(const TGLCameraOverlay&); // Not implemented

protected:
   Bool_t         fShowOrthographic;
   Bool_t         fShowPerspective;

   EMode          fOrthographicMode;
   EMode          fPerspectiveMode;

   TGLAxisPainter *fAxisPainter;
   TAxis          *fAxis;
   Float_t         fAxisExtend;
   Bool_t          fUseAxisColors;

   TGLPlane       fExternalRefPlane;
   Bool_t         fUseExternalRefPlane;

   Double_t       fFrustum[4];


   void    RenderPlaneIntersect(TGLRnrCtx& rnrCtx);
   void    RenderAxis(TGLRnrCtx& rnrCtx, Bool_t drawGrid);
   void    RenderGrid(TGLRnrCtx& rnrCtx);
   void    RenderBar(TGLRnrCtx& rnrCtx);

public:
   TGLCameraOverlay(Bool_t showOrtho=kTRUE, Bool_t showPersp=kFALSE);
   virtual ~TGLCameraOverlay();

   virtual  void   Render(TGLRnrCtx& rnrCtx);

   TGLPlane& RefExternalRefPlane() { return fExternalRefPlane; }
   void      UseExternalRefPlane(Bool_t x) { fUseExternalRefPlane=x; }
   Bool_t    GetUseExternalRefPlane() const { return fUseExternalRefPlane; }

   Int_t    GetPerspectiveMode() const { return fPerspectiveMode;}
   void     SetPerspectiveMode(EMode m) {fPerspectiveMode = m;}
   Int_t    GetOrthographicMode() const { return fOrthographicMode;}
   void     SetOrthographicMode(EMode m) {fOrthographicMode = m;}

   Bool_t   GetShowOrthographic() const { return fShowOrthographic; }
   void     SetShowOrthographic(Bool_t x) {fShowOrthographic =x;}
   Bool_t   GetShowPerspective() const { return fShowPerspective; }
   void     SetShowPerspective(Bool_t x) {fShowPerspective =x;}

   void     SetFrustum(TGLCamera& cam);

   TAttAxis* GetAttAxis();

   ClassDef(TGLCameraOverlay, 1); // Show coorinates of current camera frustum.
};

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