Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/root/TGLSceneInfo.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // @(#)root/gl:$Id$
0002 // Author:  Matevz Tadel, Feb 2007
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2004, 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_TGLSceneInfo_H
0013 #define ROOT_TGLSceneInfo_H
0014 
0015 #include "Rtypes.h"
0016 
0017 #include "TGLBoundingBox.h"
0018 #include "TGLUtil.h"
0019 #include <vector>
0020 
0021 class TGLViewerBase;
0022 class TGLSceneBase;
0023 class TGLClip;
0024 class TGLRenderContext;
0025 class TGLCamera;
0026 
0027 class TGLSceneInfo
0028 {
0029    friend class TGLSceneBase;
0030 
0031 public:
0032    enum EClipTest { kClipNone, kClipOutside, kClipInside };
0033 
0034 private:
0035    TGLSceneInfo(const TGLSceneInfo&) = delete;
0036    TGLSceneInfo& operator=(const TGLSceneInfo&) = delete;
0037 
0038 protected:
0039    TGLViewerBase  * fViewer;
0040    TGLSceneBase   * fScene;
0041    Bool_t           fActive;      // Show fScene in fViewer
0042 
0043    Short_t          fLOD;         // Optional override of scene lod
0044    Short_t          fStyle;       // Optional override of scene style
0045    Float_t          fWFLineW;     // Optional override of scene wire-frame line-width
0046    Float_t          fOLLineW;     // Optional override of scene outline line-width
0047    TGLClip        * fClip;        // Optional override of clipping-plane
0048 
0049    Short_t          fLastLOD;     // Last combined viewer/scene lod   (set in scene::lodify-scene-info).
0050    Short_t          fLastStyle;   // Last combined viewer/scene style (set in scene::pre-draw).
0051    Float_t          fLastWFLineW; // Last combined viewer/scene wire-frame line-width (set in scene::pre-draw).
0052    Float_t          fLastOLLineW; // Last combined viewer/scene outline line-width (set in scene::pre-draw).
0053    TGLClip        * fLastClip;    // Last combined viewer/scene clip  (set in scene::update)
0054    TGLCamera      * fLastCamera;  // Last camera used.
0055 
0056    UInt_t           fSceneStamp;  // Scene's time-stamp on last update.
0057    UInt_t           fClipStamp;   // Clip's time-stamp on last update.
0058    UInt_t           fCameraStamp; // Camera's time-stamp on last update.
0059    Bool_t           fUpdateTimeouted; // Set if update was interrupted.
0060 
0061    // Eventually we will allow additional per-scene transforamtion.
0062    // TGLMatrix  fSceneTrans;
0063    // Also needed:
0064    // *) transformed clipping planes of the camera
0065    // *) transformed bounding-box of the scene
0066    TGLBoundingBox   fTransformedBBox;
0067 
0068    Bool_t           fViewCheck;     // Viewer side check if render is necessary.
0069    Bool_t           fInFrustum;     // Is scene intersecting view-frustum.
0070    Bool_t           fInClip;        // Is scene contained within clipping-volume.
0071    Char_t           fClipMode;      // Clipping mode, can be disbled.
0072    TGLPlaneSet_t    fFrustumPlanes; // Clipping planes defined by frustum; only those intersecting the scene volume are kept.
0073    TGLPlaneSet_t    fClipPlanes;    // Clipping planes from clip-object; which planes are kept depends on inside/outside mode.
0074 
0075    // Additional stuff (scene-class specific) can be added by sub-classing.
0076    // For TGLScene these data include draw-lists after clipping.
0077 
0078 public:
0079    TGLSceneInfo(TGLViewerBase* view=nullptr, TGLSceneBase* scene=nullptr);
0080    virtual ~TGLSceneInfo() {}
0081 
0082    TGLViewerBase * GetViewer() const { return  fViewer; }
0083    TGLViewerBase & RefViewer() const { return *fViewer; }
0084    TGLSceneBase  * GetScene()  const { return  fScene;  }
0085    TGLSceneBase  & RefScene()  const { return *fScene;  }
0086 
0087    Bool_t GetActive() const { return fActive; }
0088    void   SetActive(Bool_t a);
0089 
0090    void  SetupTransformsAndBBox();
0091 
0092    const TGLBoundingBox& GetTransformedBBox() { return fTransformedBBox; }
0093 
0094    virtual void SetSceneTrans(TGLMatrix&) { ResetSceneStamp(); }
0095 
0096    Bool_t   ViewCheck() const   { return fViewCheck; }
0097    void     ViewCheck(Bool_t c) { fViewCheck = c;    }
0098    Bool_t   IsInFrustum() const { return fInFrustum; }
0099    void     InFrustum(Bool_t f) { fInFrustum = f;    }
0100    Bool_t   IsInClip()    const { return fInClip;    }
0101    void     InClip(Bool_t c)    { fInClip = c;       }
0102    Char_t   ClipMode()    const { return fClipMode;  }
0103    void     ClipMode(Char_t m)  { fClipMode = m;     }
0104 
0105    Bool_t   ShouldClip()  const { return fClipMode != kClipNone; }
0106    Bool_t   IsVisible()   const { return fInFrustum && fInClip;  }
0107 
0108    std::vector<TGLPlane>& FrustumPlanes() { return fFrustumPlanes; }
0109    std::vector<TGLPlane>& ClipPlanes()    { return fClipPlanes;    }
0110 
0111    Short_t  LOD()          const { return fLOD; }
0112    void     SetLOD(Short_t lod)  { fLOD = lod;  }
0113 
0114    Short_t  Style()        const { return fStyle; }
0115    void     SetStyle(Short_t st) { fStyle = st;   }
0116 
0117    Float_t  WFLineW()       const { return fWFLineW; }
0118    void     SetWFLineW(Float_t w) { fWFLineW = w;    }
0119    Float_t  OLLineW()       const { return fOLLineW; }
0120    void     SetOLLineW(Float_t w) { fOLLineW = w;    }
0121 
0122    TGLClip* Clip()         const { return fClip; }
0123    void     SetClip(TGLClip *p)  { fClip = p;    }
0124 
0125    Short_t  LastLOD()        const { return fLastLOD; }
0126    void     SetLastLOD(Short_t ld) { fLastLOD = ld;   }
0127 
0128    Short_t  LastStyle()      const   { return fLastStyle; }
0129    void     SetLastStyle(Short_t st) { fLastStyle = st;   }
0130 
0131    Float_t  LastWFLineW()       const { return fLastWFLineW; }
0132    void     SetLastWFLineW(Float_t w) { fLastWFLineW = w;    }
0133    Float_t  LastOLLineW()       const { return fLastOLLineW; }
0134    void     SetLastOLLineW(Float_t w) { fLastOLLineW = w;    }
0135 
0136    TGLClip* LastClip()         const { return fLastClip; }
0137    void     SetLastClip(TGLClip *p)  { fLastClip = p;    }
0138 
0139    TGLCamera* LastCamera()        const { return fLastCamera; }
0140    void     SetLastCamera(TGLCamera *p) { fLastCamera = p;    }
0141 
0142    UInt_t   SceneStamp()       const { return fSceneStamp; }
0143    void     SetSceneStamp(UInt_t ts) { fSceneStamp = ts;   }
0144    void     ResetSceneStamp()        { fSceneStamp = 0;    }
0145 
0146    UInt_t   ClipStamp()       const { return fClipStamp; }
0147    void     SetClipStamp(UInt_t ts) { fClipStamp = ts;   }
0148    void     ResetClipStamp()        { fClipStamp = 0;    }
0149 
0150    UInt_t   CameraStamp()       const { return fCameraStamp; }
0151    void     SetCameraStamp(UInt_t ts) { fCameraStamp = ts;   }
0152    void     ResetCameraStamp()        { fCameraStamp = 0;    }
0153 
0154    Bool_t   HasUpdateTimeouted() const { return fUpdateTimeouted;   }
0155    void     UpdateTimeouted()          { fUpdateTimeouted = kTRUE;  }
0156    void     ResetUpdateTimeouted()     { fUpdateTimeouted = kFALSE; }
0157 
0158    ClassDef(TGLSceneInfo, 0) // Data about a scene within a viewer context.
0159 }; // endclass TGLSceneInfo
0160 
0161 
0162 #endif