Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:11:58

0001 // @(#)root/gl:$Id$
0002 // Author: Alja Mrak-Tadel 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT_TGLCameraOverlay
0013 #define ROOT_TGLCameraOverlay
0014 
0015 #include "TAttAxis.h"
0016 #include "TGLOverlay.h"
0017 #include "TGLUtil.h"
0018 
0019 class TGLAxisPainter;
0020 class TGLFont;
0021 
0022 class TAttAxis;
0023 class TAxis;
0024 
0025 class TGLCameraOverlay : public TGLOverlayElement
0026 {
0027 public:
0028    enum EMode { kPlaneIntersect, kBar, kAxis, kGridFront, kGridBack };
0029 
0030 private:
0031    TGLCameraOverlay(const TGLCameraOverlay&) = delete;
0032    TGLCameraOverlay& operator=(const TGLCameraOverlay&) = delete;
0033 
0034 protected:
0035    Bool_t         fShowOrthographic;
0036    Bool_t         fShowPerspective;
0037 
0038    EMode          fOrthographicMode;
0039    EMode          fPerspectiveMode;
0040 
0041    TGLAxisPainter *fAxisPainter;
0042    TAxis          *fAxis;
0043    Float_t         fAxisExtend;
0044    Bool_t          fUseAxisColors;
0045 
0046    TGLPlane       fExternalRefPlane;
0047    Bool_t         fUseExternalRefPlane;
0048 
0049    Double_t       fFrustum[4];
0050 
0051 
0052    void    RenderPlaneIntersect(TGLRnrCtx& rnrCtx);
0053    void    RenderAxis(TGLRnrCtx& rnrCtx, Bool_t drawGrid);
0054    void    RenderGrid(TGLRnrCtx& rnrCtx);
0055    void    RenderBar(TGLRnrCtx& rnrCtx);
0056 
0057 public:
0058    TGLCameraOverlay(Bool_t showOrtho=kTRUE, Bool_t showPersp=kFALSE);
0059    ~TGLCameraOverlay() override;
0060 
0061     void   Render(TGLRnrCtx& rnrCtx) override;
0062 
0063    TGLPlane& RefExternalRefPlane() { return fExternalRefPlane; }
0064    void      UseExternalRefPlane(Bool_t x) { fUseExternalRefPlane=x; }
0065    Bool_t    GetUseExternalRefPlane() const { return fUseExternalRefPlane; }
0066 
0067    Int_t    GetPerspectiveMode() const { return fPerspectiveMode;}
0068    void     SetPerspectiveMode(EMode m) {fPerspectiveMode = m;}
0069    Int_t    GetOrthographicMode() const { return fOrthographicMode;}
0070    void     SetOrthographicMode(EMode m) {fOrthographicMode = m;}
0071 
0072    Bool_t   GetShowOrthographic() const { return fShowOrthographic; }
0073    void     SetShowOrthographic(Bool_t x) {fShowOrthographic =x;}
0074    Bool_t   GetShowPerspective() const { return fShowPerspective; }
0075    void     SetShowPerspective(Bool_t x) {fShowPerspective =x;}
0076 
0077    void     SetFrustum(TGLCamera& cam);
0078 
0079    TAttAxis* GetAttAxis();
0080 
0081    ClassDefOverride(TGLCameraOverlay, 1); // Show coorinates of current camera frustum.
0082 };
0083 
0084 #endif