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 does 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.
TGLLogicalShape& | operator=(const TGLLogicalShape&) |
TGLBoundingBox | fBoundingBox | ! Shape's bounding box. |
UInt_t | fDLBase | ! display-list id base |
Bool_t | fDLCache | ! use display list caching |
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!) |
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.
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.
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'
Override in sub-classes that do direct object rendering (e.g. TGLObject).
{ return kFALSE; }