Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc. Logical shapes are a unique piece of geometry, described in it's local frame - e.g if we have three spheres in : Sphere A - Radius r1, center v1 Sphere B - Radius r2, center v2 Sphere C - Radius r1, center v3 Spheres A and C can share a common logical sphere of radius r1 - and place them with two physicals with translations of v1 & v2. Sphere B requires a different logical (radius r2), placed with physical with translation v2. Physical shapes know about and can share logicals. Logicals do not about (aside from reference counting) physicals or share them. This sharing of logical shapes greatly reduces memory consumption and scene (re)build times in typical detector geometries which have many repeated objects placements. TGLLogicalShapes have reference counting, performed by the client physical shapes which are using it. Display list information is also stored here, possibly per LOD level. Most classes do not support LOD (only sphere and tube) and therefore reasonable defaults are encoded in the following virtual functions: * ELODAxes SupportedLODAxes() { return kLODAxesNone; } * Int_t DLCacheSize() { return 1; } * UInt_t DLOffset(lod); // Transform lod into DL offset. * Short_t QuantizeShapeLOD(); // Quantize lod. Classes that have per-LOD display-lists than override these functions. 'UShort_t fDLValid' is used as a bit-field determining validity of each quantized LOD-level; hopefully one will not have more than 16 LOD levels per class. See also: TGLPhysicalShape::CalculateShapeLOD() where LOD is calculated. See base/src/TVirtualViewer3D for description of common external 3D viewer architecture and how external viewer clients use it.
void | PurgeDLRange(UInt_t base, Int_t size) const |
TGLLogicalShape& | operator=(const TGLLogicalShape&) |
TGLLogicalShape(const TGLLogicalShape&) |
static TGLLogicalShape::ELODAxes | kLODAxesAll | |
static TGLLogicalShape::ELODAxes | kLODAxesNone | |
static TGLLogicalShape::ELODAxes | kLODAxesX | |
static TGLLogicalShape::ELODAxes | kLODAxesY | |
static TGLLogicalShape::ELODAxes | kLODAxesZ |
TGLBoundingBox | fBoundingBox | ! Shape's bounding box. |
UInt_t | fDLBase | ! display-list id base |
Bool_t | fDLCache | ! use display list caching |
Int_t | fDLSize | ! display-list size for different LODs |
UShort_t | fDLValid | ! display-list validity bit-field |
TObject* | fExternalObj | ! Also plays the role of ID. |
TGLPhysicalShape* | fFirstPhysical | ! first replica |
Bool_t | fOwnExtObj | ! External object is a fake |
UInt_t | fRef | ! physical instance ref counting |
Bool_t | fRefStrong | ! Strong ref (delete on 0 ref); not in scene |
TGLScene* | fScene | ! scene where object is stored (can be zero!) |
static Bool_t | fgIgnoreSizeForCameraInterest |
Remove reference to given physical shape, potentially deleting *this* object when hitting zero ref-count (if fRefStrong is true).
Unreference first physical in the list, returning its id and making it fit for destruction somewhere else. Returns 0 if there are no replicas attached.
Returns kTRUE if draws should be display list cached kFALSE otherwise. Here we check that: a) fScene is set (Scene manages link to GL-context); b) secondary selection is not in progress as different render-path is usually taken in this case. Otherwise we return internal bool. Override this in sub-class if different behaviour is required.
Clear all entries for all LODs for this drawable from the display list cache but keeping the reserved ids from GL context.
Drop all entries for all LODs for this drawable from the display list cache, WITHOUT returning the reserved ids to GL context. This is called by scene if it realized that the GL context was destroyed.
Purge all entries for all LODs for this drawable from the display list cache, returning the reserved ids to GL context. If you override this function: 1. call the base-class version from it; 2. call it from the destructor of the derived class!
Logical shapes usually support only discreet LOD values, especially in view of display-list caching. This function should be overriden to perform the desired quantization. See TGLSphere.
Draw the GL drawable, using draw flags. If DL caching is enabled (see SetDLCache) then attempt to draw from the cache, if not found attempt to capture the draw - done by DirectDraw() - into a new cache entry. If not cached just call DirectDraw() for normal non DL cached drawing.
Draw the logical shape in highlight mode. If lvl argument is less than 0 (-1 by default), the index into color-set is taken from the physical shape itself.
Virtual method called-back after a secondary selection hit is recorded (see TGLViewer::HandleButton(), Ctrl-Button1). The ptr argument holds the GL pick-record of the closest hit. This base-class implementation simply prints out the result.
Invoke popup menu or our bound external TObject (if any), using passed 'menu' object, at location 'x' 'y'
Return true if size of this shape should be ignored when determining if the object should be drawn. In this base-class we simply return state of static flag fgIgnoreSizeForCameraInterest. Several sub-classes override this virtual function.
Get state of static fgIgnoreSizeForCameraInterest flag. When this is true all objects, also very small, will be drawn by GL.
Set state of static fgIgnoreSizeForCameraInterest flag.
Override in sub-classes that do direct object rendering (e.g. TGLObject).
{ return kFALSE; }
Override in sub-classes that support secondary selection (e.g. TPointSet3DGL).
{ return kFALSE; }