File indexing completed on 2025-01-18 10:12:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGLViewerBase
0013 #define ROOT_TGLViewerBase
0014
0015 #include <TObject.h>
0016
0017 #include "TGLLockable.h"
0018 #include <TGLBoundingBox.h>
0019 #include "TGLOverlay.h"
0020
0021 #include <list>
0022 #include <vector>
0023
0024 class TGLSceneBase;
0025 class TGLSceneInfo;
0026 class TGLCamera;
0027 class TGLClip;
0028 class TGLRnrCtx;
0029 class TGLLogicalShape;
0030 class TGLSelectRecord;
0031 class TGLOvlSelectRecord;
0032 class TGLOverlayElement;
0033
0034
0035
0036 class TGLViewerBase : public TGLLockable
0037 {
0038 private:
0039 TGLViewerBase(const TGLViewerBase&) = delete;
0040 TGLViewerBase& operator=(const TGLViewerBase&) = delete;
0041
0042 protected:
0043 typedef std::list<TGLSceneInfo*> SceneInfoList_t;
0044 typedef SceneInfoList_t::iterator SceneInfoList_i;
0045
0046 typedef std::vector<TGLSceneInfo*> SceneInfoVec_t;
0047 typedef SceneInfoVec_t::iterator SceneInfoVec_i;
0048
0049 typedef std::vector<TGLOverlayElement*> OverlayElmVec_t;
0050 typedef OverlayElmVec_t::iterator OverlayElmVec_i;
0051
0052 SceneInfoList_i FindScene(TGLSceneBase* scene);
0053
0054 typedef void (TGLSceneBase::* SubRender_foo) (TGLRnrCtx &);
0055
0056 void SubRenderScenes(SubRender_foo render_foo);
0057
0058 virtual void SetupClipObject();
0059
0060
0061
0062 TGLRnrCtx *fRnrCtx;
0063
0064 TGLCamera *fCamera;
0065 TGLClip *fClip;
0066 Short_t fLOD;
0067 Short_t fStyle;
0068 Float_t fWFLineW;
0069 Float_t fOLLineW;
0070
0071 Bool_t fResetSceneInfosOnRender;
0072 Bool_t fChanged;
0073
0074 SceneInfoList_t fScenes;
0075 SceneInfoVec_t fVisScenes;
0076
0077 TGLBoundingBox fOverallBoundingBox;
0078
0079 OverlayElmVec_t fOverlay;
0080
0081
0082
0083 public:
0084
0085 TGLViewerBase();
0086 ~TGLViewerBase() override;
0087
0088 const char* LockIdStr() const override;
0089
0090 TGLSceneInfo* AddScene(TGLSceneBase* scene);
0091 void RemoveScene(TGLSceneBase* scene);
0092 void RemoveAllScenes();
0093 void SceneDestructing(TGLSceneBase* scene);
0094
0095 TGLSceneInfo* GetSceneInfo(TGLSceneBase* scene);
0096
0097 TGLLogicalShape* FindLogicalInScenes(TObject* id);
0098
0099 virtual void AddOverlayElement(TGLOverlayElement* el);
0100 virtual void RemoveOverlayElement(TGLOverlayElement* el);
0101 virtual void DeleteOverlayAnnotations();
0102 virtual void DeleteOverlayElements(TGLOverlayElement::ERole r);
0103
0104 TGLClip* Clip() const { return fClip; }
0105 void SetClip(TGLClip *p) { fClip = p; }
0106
0107 Short_t LOD() const { return fLOD; }
0108 void SetLOD(Short_t lod) { fLOD = lod; }
0109
0110 Short_t Style() const { return fStyle; }
0111 void SetStyle(Short_t st) { fStyle = st; }
0112
0113 Float_t WFLineW() const { return fWFLineW; }
0114 void SetWFLineW(Float_t w) { fWFLineW = w; }
0115 Float_t OLLineW() const { return fOLLineW; }
0116 void SetOLLineW(Float_t w) { fOLLineW = w; }
0117
0118
0119
0120 virtual void ResetSceneInfos();
0121 virtual void Changed() { fChanged = kTRUE; }
0122 virtual Bool_t IsChanged() const { return fChanged; }
0123
0124 virtual void MergeSceneBBoxes(TGLBoundingBox& bbox);
0125
0126 const TGLBoundingBox& RefOverallBoundingBox() const { return fOverallBoundingBox; }
0127
0128
0129
0130
0131 virtual void PreRender();
0132 virtual void Render();
0133 virtual void RenderNonSelected();
0134 virtual void RenderSelected();
0135 virtual void RenderSelectedForHighlight();
0136 virtual void RenderOpaque(Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE);
0137 virtual void RenderTransparent(Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE);
0138 virtual void RenderOverlay(Int_t state, Bool_t selection);
0139 virtual void PostRender();
0140
0141 virtual void PreRenderOverlaySelection();
0142 virtual void PostRenderOverlaySelection();
0143
0144
0145
0146
0147
0148
0149
0150 Bool_t ResolveSelectRecord(TGLSelectRecord& rec, Int_t recIdx);
0151
0152 Bool_t FindClosestRecord (TGLSelectRecord& rec, Int_t& recIdx);
0153 Bool_t FindClosestOpaqueRecord(TGLSelectRecord& rec, Int_t& recIdx);
0154
0155
0156 Bool_t FindClosestOverlayRecord(TGLOvlSelectRecord& rec, Int_t& recIdx);
0157
0158 TGLRnrCtx* GetRnrCtx() const { return fRnrCtx; }
0159 TGLRnrCtx& RnrCtx() const { return *fRnrCtx; }
0160
0161 ClassDefOverride(TGLViewerBase, 0);
0162 };
0163
0164
0165 #endif