Logo ROOT  
Reference Guide
No Matches
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Richard Maunder 25/05/2005
5 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
12#ifndef ROOT_TGLLogicalShape
13#define ROOT_TGLLogicalShape
15#include "TGLBoundingBox.h"
17class TBuffer3D;
18class TObject;
19class TContextMenu;
22class TGLRnrCtx;
23class TGLSelectRecord;
24class TGLViewer;
25class TGLSceneBase;
26class TGLScene;
31 friend class TGLScene;
38 enum ELODAxes { kLODAxesNone = 0, // LOD will be set to high or pixel.
39 kLODAxesX = 1 << 0,
40 kLODAxesY = 1 << 1,
41 kLODAxesZ = 1 << 2,
43 };
46 mutable UInt_t fRef; //! physical instance ref counting
47 mutable TGLPhysicalShape *fFirstPhysical; //! first replica
49 TObject *fExternalObj; //! Also plays the role of ID.
50 TGLBoundingBox fBoundingBox; //! Shape's bounding box.
51 mutable TGLScene *fScene; //! scene where object is stored (can be zero!)
52 mutable UInt_t fDLBase; //! display-list id base
53 mutable Int_t fDLSize; //! display-list size for different LODs
54 mutable UShort_t fDLValid; //! display-list validity bit-field
55 mutable Bool_t fDLCache; //! use display list caching
56 mutable Bool_t fRefStrong; //! Strong ref (delete on 0 ref); not in scene
57 mutable Bool_t fOwnExtObj; //! External object is a fake
59 void PurgeDLRange(UInt_t base, Int_t size) const;
63 static Bool_t fgUseDLs; //! global flag for usage of display-lists
64 static Bool_t fgUseDLsForVertArrs; //! global flag for usage of display-lists in shapes that use vertex arrays
69 TGLLogicalShape(const TBuffer3D & buffer);
70 virtual ~TGLLogicalShape();
72 // Physical shape reference-counting, replica management
73 UInt_t Ref() const { return fRef; }
74 void AddRef(TGLPhysicalShape* phys) const;
75 void SubRef(TGLPhysicalShape* phys) const;
76 void StrongRef(Bool_t strong) const { fRefStrong = strong; }
77 void DestroyPhysicals();
82 TObject* ID() const { return fExternalObj; }
83 TObject* GetExternal() const { return fExternalObj; }
84 TGLScene* GetScene() const { return fScene; }
86 const TGLBoundingBox& BoundingBox() const { return fBoundingBox; }
87 virtual void UpdateBoundingBox() {}
90 // Display List Caching
91 Bool_t SetDLCache(Bool_t cached);
92 virtual Bool_t ShouldDLCache(const TGLRnrCtx & rnrCtx) const;
93 virtual UInt_t DLOffset(Short_t /*lod*/) const { return 0; }
94 virtual void DLCacheClear();
95 virtual void DLCacheDrop();
96 virtual void DLCachePurge();
98 virtual ELODAxes SupportedLODAxes() const { return kLODAxesNone; }
99 virtual Short_t QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD) const;
100 virtual void Draw(TGLRnrCtx& rnrCtx) const;
101 virtual void DirectDraw(TGLRnrCtx& rnrCtx) const = 0; // Actual draw method (non DL cached)
103 virtual void DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* pshp, Int_t lvl=-1) const;
105 virtual Bool_t IgnoreSizeForOfInterest() const;
107 // Override in sub-classes that do direct object rendering (e.g. TGLObject).
108 virtual Bool_t KeepDuringSmartRefresh() const { return kFALSE; }
109 // Override in sub-classes that support secondary selection (e.g. TPointSet3DGL).
110 virtual Bool_t SupportsSecondarySelect() const { return kFALSE; }
111 virtual Bool_t AlwaysSecondarySelect() const { return kFALSE; }
112 virtual void ProcessSelection(TGLRnrCtx& rnrCtx, TGLSelectRecord& rec);
114 void InvokeContextMenu(TContextMenu & menu, UInt_t x, UInt_t y) const;
117 static void SetIgnoreSizeForCameraInterest(Bool_t isfci);
119 static void SetEnvDefaults();
121 ClassDef(TGLLogicalShape,0) // a logical (non-placed, local frame) drawable object
125#endif // ROOT_TGLLogicalShape
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
unsigned short UShort_t
Definition RtypesCore.h:40
unsigned int UInt_t
Definition RtypesCore.h:46
short Short_t
Definition RtypesCore.h:39
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
#define ClassDef(name, id)
Definition Rtypes.h:337
Generic 3D primitive description class.
Definition TBuffer3D.h:18
This class provides an interface to context sensitive popup menus.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Virtual method called-back after a secondary selection hit is recorded (see TGLViewer::HandleButton()...
virtual Bool_t SupportsSecondarySelect() const
TGLBoundingBox fBoundingBox
Also plays the role of ID.
virtual void DLCachePurge()
Purge all entries for all LODs for this drawable from the display list cache, returning the reserved ...
TObject * fExternalObj
first replica
virtual Bool_t ShouldDLCache(const TGLRnrCtx &rnrCtx) const
Returns kTRUE if draws should be display list cached kFALSE otherwise.
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const =0
virtual void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *pshp, Int_t lvl=-1) const
Draw the logical shape in highlight mode.
UInt_t UnrefFirstPhysical()
Unreferenced first physical in the list, returning its id and making it fit for destruction somewhere...
virtual ~TGLLogicalShape()
Destroy logical shape.
void SubRef(TGLPhysicalShape *phys) const
Remove reference to given physical shape, potentially deleting this object when hitting zero ref-coun...
virtual Short_t QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD) const
Logical shapes usually support only discreet LOD values, especially in view of display-list caching.
virtual ELODAxes SupportedLODAxes() const
global flag for usage of display-lists in shapes that use vertex arrays
virtual UInt_t DLOffset(Short_t) const
Bool_t fOwnExtObj
Strong ref (delete on 0 ref); not in scene.
static void SetIgnoreSizeForCameraInterest(Bool_t isfci)
Set state of static fgIgnoreSizeForCameraInterest flag.
virtual Bool_t KeepDuringSmartRefresh() const
UShort_t fDLValid
display-list size for different LODs
const TGLBoundingBox & BoundingBox() const
virtual void DLCacheDrop()
Drop all entries for all LODs for this drawable from the display list cache, WITHOUT returning the re...
void UpdateBoundingBoxesOfPhysicals()
Update bounding-boxed of all dependent physicals.
static Bool_t fgIgnoreSizeForCameraInterest
void AddRef(TGLPhysicalShape *phys) const
Add reference to given physical shape.
TObject * GetExternal() const
void DestroyPhysicals()
Destroy all physicals attached to this logical.
static void SetEnvDefaults()
void InvokeContextMenu(TContextMenu &menu, UInt_t x, UInt_t y) const
Invoke popup menu or our bound external TObject (if any), using passed 'menu' object,...
TGLLogicalShape(const TGLLogicalShape &)=delete
TObject * ID() const
virtual void UpdateBoundingBox()
void StrongRef(Bool_t strong) const
UInt_t Ref() const
TGLPhysicalShape * fFirstPhysical
physical instance ref counting
Bool_t SetDLCache(Bool_t cached)
Modify capture of draws into display list cache kTRUE - capture, kFALSE direct draw.
UInt_t fDLBase
scene where object is stored (can be zero!)
TGLScene * GetScene() const
TGLScene * fScene
Shape's bounding box.
void PurgeDLRange(UInt_t base, Int_t size) const
External object is a fake.
static Bool_t GetIgnoreSizeForCameraInterest()
Get state of static fgIgnoreSizeForCameraInterest flag.
Int_t fDLSize
display-list id base
Bool_t fDLCache
display-list validity bit-field
virtual void DLCacheClear()
Clear all entries for all LODs for this drawable from the display list cache but keeping the reserved...
virtual Bool_t AlwaysSecondarySelect() const
static Bool_t fgUseDLs
virtual Bool_t IgnoreSizeForOfInterest() const
Return true if size of this shape should be ignored when determining if the object should be drawn.
const TGLPhysicalShape * GetFirstPhysical() const
static Bool_t fgUseDLsForVertArrs
global flag for usage of display-lists
TGLLogicalShape & operator=(const TGLLogicalShape &)=delete
Bool_t fRefStrong
use display list caching
Concrete physical shape - a GL drawable.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
TGLScene provides management and rendering of ROOT's default 3D /object representation as logical and...
Definition TGLScene.h:29
Standard selection record including information about containing scene and details ob out selected ob...
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Definition TGLViewer.h:55
Mother of all ROOT objects.
Definition TObject.h:41
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
th1 Draw()