00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TGLLogicalShape
00013 #define ROOT_TGLLogicalShape
00014
00015 #ifndef ROOT_TGLBoundingBox
00016 #include "TGLBoundingBox.h"
00017 #endif
00018
00019 class TBuffer3D;
00020 class TObject;
00021 class TContextMenu;
00022
00023 class TGLPhysicalShape;
00024 class TGLRnrCtx;
00025 class TGLSelectRecord;
00026 class TGLViewer;
00027 class TGLSceneBase;
00028 class TGLScene;
00029
00030
00031 class TGLLogicalShape
00032 {
00033 friend class TGLScene;
00034
00035 private:
00036 TGLLogicalShape(const TGLLogicalShape&);
00037 TGLLogicalShape& operator=(const TGLLogicalShape&);
00038
00039 public:
00040 enum ELODAxes { kLODAxesNone = 0,
00041 kLODAxesX = 1 << 0,
00042 kLODAxesY = 1 << 1,
00043 kLODAxesZ = 1 << 2,
00044 kLODAxesAll = kLODAxesX | kLODAxesY | kLODAxesZ
00045 };
00046
00047 protected:
00048 mutable UInt_t fRef;
00049 mutable TGLPhysicalShape *fFirstPhysical;
00050
00051 TObject *fExternalObj;
00052 TGLBoundingBox fBoundingBox;
00053 mutable TGLScene *fScene;
00054 mutable UInt_t fDLBase;
00055 mutable Int_t fDLSize;
00056 mutable UShort_t fDLValid;
00057 mutable Bool_t fDLCache;
00058 mutable Bool_t fRefStrong;
00059 mutable Bool_t fOwnExtObj;
00060
00061 void PurgeDLRange(UInt_t base, Int_t size) const;
00062
00063 public:
00064 TGLLogicalShape();
00065 TGLLogicalShape(TObject* obj);
00066 TGLLogicalShape(const TBuffer3D & buffer);
00067 virtual ~TGLLogicalShape();
00068
00069
00070 UInt_t Ref() const { return fRef; }
00071 void AddRef(TGLPhysicalShape* phys) const;
00072 void SubRef(TGLPhysicalShape* phys) const;
00073 void StrongRef(Bool_t strong) const { fRefStrong = strong; }
00074 void DestroyPhysicals();
00075 UInt_t UnrefFirstPhysical();
00076
00077 const TGLPhysicalShape* GetFirstPhysical() const { return fFirstPhysical; }
00078
00079 TObject* ID() const { return fExternalObj; }
00080 TObject* GetExternal() const { return fExternalObj; }
00081 TGLScene* GetScene() const { return fScene; }
00082
00083 const TGLBoundingBox& BoundingBox() const { return fBoundingBox; }
00084 virtual void UpdateBoundingBox() {}
00085 void UpdateBoundingBoxesOfPhysicals();
00086
00087
00088 Bool_t SetDLCache(Bool_t cached);
00089 virtual Bool_t ShouldDLCache(const TGLRnrCtx & rnrCtx) const;
00090 virtual UInt_t DLOffset(Short_t ) const { return 0; }
00091 virtual void DLCacheClear();
00092 virtual void DLCacheDrop();
00093 virtual void DLCachePurge();
00094
00095 virtual ELODAxes SupportedLODAxes() const { return kLODAxesNone; }
00096 virtual Short_t QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD) const;
00097 virtual void Draw(TGLRnrCtx& rnrCtx) const;
00098 virtual void DirectDraw(TGLRnrCtx& rnrCtx) const = 0;
00099
00100 virtual void DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* pshp, Int_t lvl=-1) const;
00101
00102 virtual Bool_t IgnoreSizeForOfInterest() const { return kFALSE; }
00103
00104
00105 virtual Bool_t KeepDuringSmartRefresh() const { return kFALSE; }
00106
00107 virtual Bool_t SupportsSecondarySelect() const { return kFALSE; }
00108 virtual Bool_t AlwaysSecondarySelect() const { return kFALSE; }
00109 virtual void ProcessSelection(TGLRnrCtx& rnrCtx, TGLSelectRecord& rec);
00110
00111 void InvokeContextMenu(TContextMenu & menu, UInt_t x, UInt_t y) const;
00112
00113 ClassDef(TGLLogicalShape,0)
00114 };
00115
00116
00117 #endif // ROOT_TGLLogicalShape