File indexing completed on 2025-01-18 10:12:01
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGLSceneBase_H
0013 #define ROOT_TGLSceneBase_H
0014
0015 #include "TGLLockable.h"
0016 #include "TGLBoundingBox.h"
0017
0018 #include <TString.h>
0019
0020 #include <list>
0021
0022 class TGLViewerBase;
0023 class TGLSceneInfo;
0024 class TGLClip;
0025 class TGLRnrCtx;
0026 class TGLLogicalShape;
0027 class TGLSelectRecord;
0028
0029
0030
0031
0032 class TGLSceneBase : public TGLLockable
0033 {
0034 private:
0035 TGLSceneBase(const TGLSceneBase&) = delete;
0036 TGLSceneBase& operator=(const TGLSceneBase&) = delete;
0037
0038 static UInt_t fgSceneIDSrc;
0039
0040 protected:
0041 UInt_t fSceneID;
0042 TString fName;
0043 TString fTitle;
0044
0045 UInt_t fTimeStamp;
0046 UInt_t fMinorStamp;
0047 Short_t fLOD;
0048 Short_t fStyle;
0049 Float_t fWFLineW;
0050 Float_t fOLLineW;
0051 TGLClip * fClip;
0052 Bool_t fSelectable;
0053
0054
0055 mutable TGLBoundingBox fBoundingBox;
0056 mutable Bool_t fBoundingBoxValid;
0057
0058 Bool_t fDoFrustumCheck;
0059 Bool_t fDoClipCheck;
0060
0061
0062 typedef std::list<TGLViewerBase*> ViewerList_t;
0063 typedef std::list<TGLViewerBase*>::iterator ViewerList_i;
0064
0065 ViewerList_t fViewers;
0066 Bool_t fAutoDestruct;
0067
0068
0069
0070
0071 public:
0072 TGLSceneBase();
0073 ~TGLSceneBase() override;
0074
0075 void AddViewer(TGLViewerBase* viewer);
0076 void RemoveViewer(TGLViewerBase* viewer);
0077 void TagViewersChanged();
0078
0079 const char* LockIdStr() const override;
0080
0081 virtual const char *GetName() const { return fName; }
0082 virtual const char *GetTitle() const { return fTitle; }
0083 virtual void SetName (const char *name) { fName = name; }
0084 virtual void SetTitle(const char *title) { fTitle = title; }
0085 virtual void SetNameTitle(const char *name, const char *title) { SetName(name); SetTitle(title); }
0086
0087 virtual TGLSceneInfo* CreateSceneInfo(TGLViewerBase* view);
0088 virtual void RebuildSceneInfo(TGLRnrCtx& ctx);
0089 virtual void UpdateSceneInfo(TGLRnrCtx& ctx);
0090 virtual void LodifySceneInfo(TGLRnrCtx& ctx);
0091
0092
0093 virtual void PreDraw (TGLRnrCtx& rnrCtx);
0094 virtual void PreRender (TGLRnrCtx& rnrCtx);
0095 virtual void Render (TGLRnrCtx& rnrCtx);
0096 virtual void RenderOpaque (TGLRnrCtx& rnrCtx);
0097 virtual void RenderTransp (TGLRnrCtx& rnrCtx);
0098 virtual void RenderSelOpaque(TGLRnrCtx& rnrCtx);
0099 virtual void RenderSelTransp(TGLRnrCtx& rnrCtx);
0100 virtual void RenderSelOpaqueForHighlight(TGLRnrCtx& rnrCtx);
0101 virtual void RenderSelTranspForHighlight(TGLRnrCtx& rnrCtx);
0102 virtual void PostRender(TGLRnrCtx& rnrCtx);
0103 virtual void PostDraw (TGLRnrCtx& rnrCtx);
0104
0105 virtual TGLLogicalShape* FindLogical(TObject*) const { return nullptr; }
0106
0107
0108 virtual Bool_t ResolveSelectRecord(TGLSelectRecord& rec, Int_t curIdx);
0109
0110
0111
0112
0113 UInt_t GetTimeStamp() const { return fTimeStamp; }
0114 void IncTimeStamp() { ++fTimeStamp; fMinorStamp = 1; }
0115
0116 UInt_t GetMinorStamp() const { return fMinorStamp; }
0117 void IncMinorStamp() { ++fMinorStamp; }
0118
0119 Short_t LOD() const { return fLOD; }
0120 void SetLOD(Short_t lod) { fLOD = lod; }
0121
0122 Short_t Style() const { return fStyle; }
0123 void SetStyle(Short_t st) { fStyle = st; }
0124
0125 TGLClip* Clip() const { return fClip; }
0126 void SetClip(TGLClip *p) { fClip = p; }
0127
0128 Bool_t GetSelectable() const { return fSelectable; }
0129 void SetSelectable(Bool_t a) { fSelectable = a; }
0130
0131 Bool_t GetAutoDestruct() const { return fAutoDestruct; }
0132 void SetAutoDestruct(Bool_t a) { fAutoDestruct = a; }
0133
0134
0135
0136 virtual void CalcBoundingBox() const = 0;
0137 void InvalidateBoundingBox() { fBoundingBoxValid = kFALSE; }
0138 const TGLBoundingBox& BoundingBox() const
0139 { if (!fBoundingBoxValid) CalcBoundingBox(); return fBoundingBox; }
0140
0141
0142 ClassDefOverride(TGLSceneBase, 0)
0143 };
0144
0145
0146 #endif