ROOT 6.14/05 Reference Guide |
TGLScene provides management and rendering of ROOT's default 3D /object representation as logical and physical shapes.
A GL scene is the container for all the viewable objects (shapes) loaded into the viewer. It consists of two main stl::maps containing the TGLLogicalShape and TGLPhysicalShape collections, and interface functions enabling viewers to manage objects in these. The physical shapes defined the placement of copies of the logical shapes - see TGLLogicalShape/TGLPhysicalShape for more information on relationship
The scene can be drawn by owning viewer, passing camera, draw style & quality (LOD), clipping etc - see Draw(). The scene can also be drawn for selection in similar fashion - see Select(). The scene keeps track of a single selected physical - which can be modified by viewers.
The scene maintains a lazy calculated bounding box for the total scene extents, axis aligned round TGLPhysicalShape shapes.
Currently a scene is owned exclusively by one viewer - however it is intended that it could easily be shared by multiple viewers - for efficiency and synchronisation reasons. Hence viewer variant objects camera, clips etc being owned by viewer and passed at draw/select
Definition at line 30 of file TGLScene.h.
Classes | |
struct | DrawElement_t |
class | TSceneInfo |
Public Types | |
typedef std::vector< DrawElement_t * >::iterator | DrawElementPtrVec_i |
typedef std::vector< DrawElement_t * > | DrawElementPtrVec_t |
typedef std::vector< DrawElement_t >::iterator | DrawElementVec_i |
typedef std::vector< DrawElement_t > | DrawElementVec_t |
typedef std::map< TObject *, TGLLogicalShape * > | LogicalShapeMap_t |
typedef LogicalShapeMap_t::const_iterator | LogicalShapeMapCIt_t |
typedef LogicalShapeMap_t::iterator | LogicalShapeMapIt_t |
typedef LogicalShapeMap_t::value_type | LogicalShapeMapValueType_t |
typedef std::map< UInt_t, TGLPhysicalShape * > | PhysicalShapeMap_t |
typedef PhysicalShapeMap_t::const_iterator | PhysicalShapeMapCIt_t |
typedef PhysicalShapeMap_t::iterator | PhysicalShapeMapIt_t |
typedef PhysicalShapeMap_t::value_type | PhysicalShapeMapValueType_t |
typedef ShapeVec_t::iterator | ShapeVec_i |
typedef std::vector< const TGLPhysicalShape * > | ShapeVec_t |
Public Types inherited from TGLLockable | |
enum | ELock { kUnlocked, kDrawLock, kSelectLock, kModifyLock } |
Public Member Functions | |
TGLScene () | |
virtual | ~TGLScene () |
Destroy scene objects. More... | |
virtual void | AdoptLogical (TGLLogicalShape &shape) |
Adopt dynamically created logical 'shape' - add to internal map and take responsibility for deleting. More... | |
virtual void | AdoptPhysical (TGLPhysicalShape &shape) |
Adopt dynamically created physical 'shape' - add to internal map and take responsibility for deleting. More... | |
UInt_t | BeginSmartRefresh () |
Moves logicals that support smart-refresh to intermediate cache. More... | |
virtual Bool_t | BeginUpdate () |
Put scene in update mode, return true if lock acquired. More... | |
virtual void | CalcBoundingBox () const |
Encapsulates all physical shapes bounding box with axes aligned box. More... | |
virtual TSceneInfo * | CreateSceneInfo (TGLViewerBase *view) |
Create a scene-info instance appropriate for this scene class. More... | |
virtual Bool_t | DestroyLogical (TObject *logid, Bool_t mustFind=kTRUE) |
Destroy logical shape defined by unique 'ID'. More... | |
virtual Int_t | DestroyLogicals () |
Destroy all logical shapes in scene. More... | |
virtual Bool_t | DestroyPhysical (UInt_t phid) |
Destroy physical shape defined by unique 'ID'. More... | |
virtual Int_t | DestroyPhysicals () |
Destroy physical shapes. More... | |
void | DumpMapSizes () const |
Print sizes of logical and physical-shape maps. More... | |
void | EndSmartRefresh () |
Wipes logicals in refresh-cache. More... | |
virtual void | EndUpdate (Bool_t minorChange=kTRUE, Bool_t sceneChanged=kTRUE, Bool_t updateViewers=kTRUE) |
Exit scene update mode. More... | |
virtual TGLLogicalShape * | FindLogical (TObject *logid) const |
Find and return logical shape identified by unique logid. More... | |
TGLLogicalShape * | FindLogicalSmartRefresh (TObject *ID) const |
Find and return logical shape identified by unique 'ID' in refresh-cache. More... | |
virtual TGLPhysicalShape * | FindPhysical (UInt_t phid) const |
Find and return physical shape identified by unique 'ID'. More... | |
TGLContextIdentity * | GetGLCtxIdentity () const |
virtual UInt_t | GetMaxPhysicalID () |
Returns the maximum used physical id. More... | |
virtual void | LodifySceneInfo (TGLRnrCtx &rnrCtx) |
Setup LOD-dependant values in scene-info. More... | |
virtual void | PostDraw (TGLRnrCtx &rnrCtx) |
Called after the rendering is finished. More... | |
virtual void | PreDraw (TGLRnrCtx &rnrCtx) |
Initialize rendering. More... | |
virtual void | RebuildSceneInfo (TGLRnrCtx &rnrCtx) |
Major change in scene, need to rebuild all-element draw-vector and sort it. More... | |
LogicalShapeMap_t & | RefLogicalShapes () |
virtual void | RenderAllPasses (TGLRnrCtx &rnrCtx, DrawElementPtrVec_t &elVec, Bool_t check_timeout) |
Do full rendering of scene. More... | |
virtual void | RenderElements (TGLRnrCtx &rnrCtx, DrawElementPtrVec_t &elVec, Bool_t check_timeout, const TGLPlaneSet_t *clipPlanes=0) |
Render DrawElements in elementVec with given timeout. More... | |
virtual void | RenderHighlight (TGLRnrCtx &rnrCtx, DrawElementPtrVec_t &elVec) |
virtual void | RenderOpaque (TGLRnrCtx &rnrCtx) |
Render opaque elements. More... | |
virtual void | RenderSelOpaque (TGLRnrCtx &rnrCtx) |
Render selected opaque elements. More... | |
virtual void | RenderSelOpaqueForHighlight (TGLRnrCtx &rnrCtx) |
Render selected opaque elements for highlight. More... | |
virtual void | RenderSelTransp (TGLRnrCtx &rnrCtx) |
Render selected transparent elements. More... | |
virtual void | RenderSelTranspForHighlight (TGLRnrCtx &rnrCtx) |
Render selected transparent elements for highlight. More... | |
virtual void | RenderTransp (TGLRnrCtx &rnrCtx) |
Render transparent elements. More... | |
virtual Bool_t | ResolveSelectRecord (TGLSelectRecord &rec, Int_t curIdx) |
Process selection record rec. More... | |
UInt_t | SizeOfScene () const |
Return memory cost of scene. More... | |
virtual void | UpdateLogical (TObject *logid) |
Drop display-lists for the logical (assume TGLObject/direct rendering). More... | |
virtual void | UpdatePhysical (UInt_t phid, Double_t *trans, UChar_t *col) |
Reposition/recolor physical shape. More... | |
virtual void | UpdatePhysical (UInt_t phid, Double_t *trans, Color_t cidx=-1, UChar_t transp=0) |
Reposition/recolor physical shape. More... | |
virtual void | UpdatePhysioLogical (TObject *logid, Double_t *trans, UChar_t *col) |
Reposition/recolor physical for given logical (assume TGLObject and a single physical). More... | |
virtual void | UpdatePhysioLogical (TObject *logid, Double_t *trans, Color_t cidx, UChar_t transp) |
Reposition/recolor physical for given logical (assume TGLObject and a single physical). More... | |
virtual void | UpdateSceneInfo (TGLRnrCtx &rnrCtx) |
Fill scene-info with information needed for rendering, take into account the render-context (viewer state, camera, clipping). More... | |
Public Member Functions inherited from TGLSceneBase | |
TGLSceneBase () | |
virtual | ~TGLSceneBase () |
Destructor. More... | |
void | AddViewer (TGLViewerBase *viewer) |
Add viewer to the list. More... | |
const TGLBoundingBox & | BoundingBox () const |
TGLClip * | Clip () const |
Bool_t | GetAutoDestruct () const |
UInt_t | GetMinorStamp () const |
virtual const char * | GetName () const |
Bool_t | GetSelectable () const |
UInt_t | GetTimeStamp () const |
virtual const char * | GetTitle () const |
void | IncMinorStamp () |
void | IncTimeStamp () |
void | InvalidateBoundingBox () |
virtual const char * | LockIdStr () const |
Name printed on locking info messages. More... | |
Short_t | LOD () const |
virtual void | PostRender (TGLRnrCtx &rnrCtx) |
Perform post-render clean-up. More... | |
virtual void | PreRender (TGLRnrCtx &rnrCtx) |
Perform pre-render initialization - fill rnrCtx with values stored during PreDraw(). More... | |
void | RemoveViewer (TGLViewerBase *viewer) |
Remove viewer from the list. More... | |
virtual void | Render (TGLRnrCtx &rnrCtx) |
This function does rendering of all stages, the shapes are rendered in the following order: opaque, transparent, selected-opaque, selected-transparent. More... | |
void | SetAutoDestruct (Bool_t a) |
void | SetClip (TGLClip *p) |
void | SetLOD (Short_t lod) |
virtual void | SetName (const char *name) |
virtual void | SetNameTitle (const char *name, const char *title) |
void | SetSelectable (Bool_t a) |
void | SetStyle (Short_t st) |
virtual void | SetTitle (const char *title) |
Short_t | Style () const |
void | TagViewersChanged () |
Tag all viewers as changed. More... | |
Public Member Functions inherited from TGLLockable | |
TGLLockable () | |
virtual | ~TGLLockable () |
ELock | CurrentLock () const |
Bool_t | IsDrawOrSelectLock () const |
Bool_t | IsLocked () const |
Bool_t | ReleaseLock (ELock lock) const |
Release current lock, make sure it the same as the 'lock' argument. More... | |
Bool_t | TakeLock (ELock lock) const |
Lock the object in mode 'lock'. More... | |
Static Public Member Functions | |
static Bool_t | IsOutside (const TGLBoundingBox &box, const TGLPlaneSet_t &planes) |
Check if box is outside of all planes. More... | |
static void | RGBAFromColorIdx (Float_t rgba[4], Color_t ci, Char_t transp=0) |
Fill rgba color from ROOT color-index ci and transparency (0->100). More... | |
Static Public Member Functions inherited from TGLLockable | |
static const char * | LockName (ELock lock) |
Return name-string for given lock-type. More... | |
static Bool_t | LockValid (ELock lock) |
Test if lock is a valid type to take/release. More... | |
Protected Member Functions | |
virtual void | DestroyPhysicalInternal (PhysicalShapeMapIt_t pit) |
Virtual function to destroy a physical. More... | |
void | ReleaseGLCtxIdentity () |
Release all GL resources for current context identity. More... | |
Protected Attributes | |
TGLContextIdentity * | fGLCtxIdentity |
Bool_t | fInSmartRefresh |
Float_t | fLastLineWidthScale |
Float_t | fLastPointSizeScale |
LogicalShapeMap_t | fLogicalShapes |
PhysicalShapeMap_t | fPhysicalShapes |
LogicalShapeMap_t | fSmartRefreshCache |
Protected Attributes inherited from TGLSceneBase | |
Bool_t | fAutoDestruct |
TGLBoundingBox | fBoundingBox |
Bool_t | fBoundingBoxValid |
TGLClip * | fClip |
Bool_t | fDoClipCheck |
Bool_t | fDoFrustumCheck |
Short_t | fLOD |
UInt_t | fMinorStamp |
TString | fName |
Float_t | fOLLineW |
UInt_t | fSceneID |
Bool_t | fSelectable |
Short_t | fStyle |
UInt_t | fTimeStamp |
TString | fTitle |
ViewerList_t | fViewers |
Float_t | fWFLineW |
Protected Attributes inherited from TGLLockable | |
ELock | fLock |
Private Member Functions | |
TGLScene (const TGLScene &) | |
TGLScene & | operator= (const TGLScene &) |
Static Private Member Functions | |
static Bool_t | ComparePhysicalDiagonals (const TGLPhysicalShape *shape1, const TGLPhysicalShape *shape2) |
Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if 'shape1' bigger than 'shape2'. More... | |
static Bool_t | ComparePhysicalVolumes (const TGLPhysicalShape *shape1, const TGLPhysicalShape *shape2) |
Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if 'shape1' bigger than 'shape2'. More... | |
Friends | |
class | TSceneInfo |
Additional Inherited Members | |
Protected Types inherited from TGLSceneBase | |
typedef std::list< TGLViewerBase * >::iterator | ViewerList_i |
typedef std::list< TGLViewerBase * > | ViewerList_t |
#include <TGLScene.h>
typedef std::vector<DrawElement_t*>::iterator TGLScene::DrawElementPtrVec_i |
Definition at line 71 of file TGLScene.h.
typedef std::vector<DrawElement_t*> TGLScene::DrawElementPtrVec_t |
Definition at line 70 of file TGLScene.h.
typedef std::vector<DrawElement_t>::iterator TGLScene::DrawElementVec_i |
Definition at line 68 of file TGLScene.h.
typedef std::vector<DrawElement_t> TGLScene::DrawElementVec_t |
Definition at line 67 of file TGLScene.h.
typedef std::map<TObject*, TGLLogicalShape*> TGLScene::LogicalShapeMap_t |
Definition at line 43 of file TGLScene.h.
typedef LogicalShapeMap_t::const_iterator TGLScene::LogicalShapeMapCIt_t |
Definition at line 46 of file TGLScene.h.
typedef LogicalShapeMap_t::iterator TGLScene::LogicalShapeMapIt_t |
Definition at line 45 of file TGLScene.h.
typedef LogicalShapeMap_t::value_type TGLScene::LogicalShapeMapValueType_t |
Definition at line 44 of file TGLScene.h.
typedef std::map<UInt_t, TGLPhysicalShape*> TGLScene::PhysicalShapeMap_t |
Definition at line 49 of file TGLScene.h.
typedef PhysicalShapeMap_t::const_iterator TGLScene::PhysicalShapeMapCIt_t |
Definition at line 52 of file TGLScene.h.
typedef PhysicalShapeMap_t::iterator TGLScene::PhysicalShapeMapIt_t |
Definition at line 51 of file TGLScene.h.
typedef PhysicalShapeMap_t::value_type TGLScene::PhysicalShapeMapValueType_t |
Definition at line 50 of file TGLScene.h.
typedef ShapeVec_t::iterator TGLScene::ShapeVec_i |
Definition at line 75 of file TGLScene.h.
typedef std::vector<const TGLPhysicalShape*> TGLScene::ShapeVec_t |
Definition at line 74 of file TGLScene.h.
|
private |
TGLScene::TGLScene | ( | ) |
Definition at line 278 of file TGLScene.cxx.
|
virtual |
Destroy scene objects.
Definition at line 292 of file TGLScene.cxx.
|
virtual |
Adopt dynamically created logical 'shape' - add to internal map and take responsibility for deleting.
Definition at line 1018 of file TGLScene.cxx.
|
virtual |
Adopt dynamically created physical 'shape' - add to internal map and take responsibility for deleting.
Definition at line 1129 of file TGLScene.cxx.
UInt_t TGLScene::BeginSmartRefresh | ( | ) |
Moves logicals that support smart-refresh to intermediate cache.
Destroys the others and returns the number of destroyed ones.
Definition at line 1416 of file TGLScene.cxx.
|
virtual |
Put scene in update mode, return true if lock acquired.
Definition at line 1245 of file TGLScene.cxx.
|
virtual |
Encapsulates all physical shapes bounding box with axes aligned box.
Validity checked in the base-class.
Implements TGLSceneBase.
Definition at line 977 of file TGLScene.cxx.
|
inlinestaticprivate |
Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if 'shape1' bigger than 'shape2'.
Definition at line 366 of file TGLScene.cxx.
|
inlinestaticprivate |
Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if 'shape1' bigger than 'shape2'.
Definition at line 356 of file TGLScene.cxx.
|
virtual |
Create a scene-info instance appropriate for this scene class.
Here we instantiate the inner class TSceneInfo that includes camera/clipping specific draw-list containers.
Reimplemented from TGLSceneBase.
Definition at line 347 of file TGLScene.cxx.
Destroy logical shape defined by unique 'ID'.
Returns kTRUE if found/destroyed - kFALSE otherwise.
If mustFind is true, an error is reported if the logical is not found.
Definition at line 1036 of file TGLScene.cxx.
|
virtual |
Destroy all logical shapes in scene.
Return number of destroyed logicals.
Definition at line 1073 of file TGLScene.cxx.
Destroy physical shape defined by unique 'ID'.
Returns kTRUE if found/destroyed - kFALSE otherwise.
Definition at line 1159 of file TGLScene.cxx.
|
protectedvirtual |
Virtual function to destroy a physical.
Sub-classes might have special checks to perform. Caller should also invalidate the draw-list.
Definition at line 1149 of file TGLScene.cxx.
|
virtual |
Destroy physical shapes.
Definition at line 1183 of file TGLScene.cxx.
void TGLScene::DumpMapSizes | ( | ) | const |
Print sizes of logical and physical-shape maps.
Definition at line 1523 of file TGLScene.cxx.
void TGLScene::EndSmartRefresh | ( | ) |
Wipes logicals in refresh-cache.
Definition at line 1439 of file TGLScene.cxx.
|
virtual |
Exit scene update mode.
If sceneChanged is true (default), the scene timestamp is increased and basic draw-lists etc will be rebuild on next draw request. If you only changed colors or some other visual parameters that do not affect object bounding-box or transformation matrix, you can set it to false.
If updateViewers is true (default), the viewers using this scene will be tagged as changed. If sceneChanged is true the updateViewers should be true as well, unless you take care of the viewers elsewhere or in some other way.
Definition at line 1265 of file TGLScene.cxx.
|
virtual |
Find and return logical shape identified by unique logid.
Returns 0 if not found.
Reimplemented from TGLSceneBase.
Definition at line 1107 of file TGLScene.cxx.
TGLLogicalShape * TGLScene::FindLogicalSmartRefresh | ( | TObject * | ID | ) | const |
Find and return logical shape identified by unique 'ID' in refresh-cache.
Returns 0 if not found.
Definition at line 1455 of file TGLScene.cxx.
|
virtual |
Find and return physical shape identified by unique 'ID'.
Returns 0 if not found.
Definition at line 1221 of file TGLScene.cxx.
|
inline |
Definition at line 232 of file TGLScene.h.
|
virtual |
Returns the maximum used physical id.
Returns 0 if empty.
Definition at line 1231 of file TGLScene.cxx.
|
static |
Check if box is outside of all planes.
Definition at line 1543 of file TGLScene.cxx.
Setup LOD-dependant values in scene-info.
We have to perform LOD quantization for all draw-elements.
Reimplemented from TGLSceneBase.
Definition at line 544 of file TGLScene.cxx.
Called after the rendering is finished.
In debug mode draw statistics is dumped. Parent's PostDraw is called for GL cleanup.
Reimplemented from TGLSceneBase.
Definition at line 707 of file TGLScene.cxx.
Initialize rendering.
Pass to base-class where most work is done. Check if GL-ctx is shared with the previous one; if not wipe display-lists of all logicals.
Reimplemented from TGLSceneBase.
Definition at line 568 of file TGLScene.cxx.
Major change in scene, need to rebuild all-element draw-vector and sort it.
Sort the TGLPhysical draw list by shape bounding box diagonal, from large to small. This makes dropout of shapes with time limited Draw() calls must less noticeable. As this does not use projected size it only needs to be done after a scene content change - not every time scene drawn (potential camera/projection change).
Reimplemented from TGLSceneBase.
Definition at line 382 of file TGLScene.cxx.
|
inline |
Definition at line 218 of file TGLScene.h.
|
protected |
Release all GL resources for current context identity.
Requires iteration over all logical shapes.
Definition at line 311 of file TGLScene.cxx.
|
virtual |
Do full rendering of scene.
First draw the opaques, then the transparents. For each we do the number of passes required by draw mode and clipping setup.
Definition at line 725 of file TGLScene.cxx.
|
virtual |
Render DrawElements in elementVec with given timeout.
If clipPlanes is non-zero, test each element against its clipping planes.
Definition at line 893 of file TGLScene.cxx.
|
virtual |
Definition at line 672 of file TGLScene.cxx.
Render opaque elements.
Reimplemented from TGLSceneBase.
Definition at line 613 of file TGLScene.cxx.
Render selected opaque elements.
Reimplemented from TGLSceneBase.
Definition at line 633 of file TGLScene.cxx.
Render selected opaque elements for highlight.
Reimplemented from TGLSceneBase.
Definition at line 653 of file TGLScene.cxx.
Render selected transparent elements.
Reimplemented from TGLSceneBase.
Definition at line 643 of file TGLScene.cxx.
Render selected transparent elements for highlight.
Reimplemented from TGLSceneBase.
Definition at line 663 of file TGLScene.cxx.
Render transparent elements.
Reimplemented from TGLSceneBase.
Definition at line 623 of file TGLScene.cxx.
|
virtual |
Process selection record rec.
'curIdx' is the item position where the scene should start its processing. Return TRUE if an object has been identified or FALSE otherwise. The scene-info member of the record is already set by the caller.
Reimplemented from TGLSceneBase.
Definition at line 950 of file TGLScene.cxx.
Fill rgba color from ROOT color-index ci and transparency (0->100).
Definition at line 1532 of file TGLScene.cxx.
UInt_t TGLScene::SizeOfScene | ( | ) | const |
Return memory cost of scene.
Warning: NOT CORRECT at present - doesn't correctly calculate size. of logical shapes with dynamic internal contents.
Definition at line 1491 of file TGLScene.cxx.
Drop display-lists for the logical (assume TGLObject/direct rendering).
Re-calculate the bounding box (also for all physicals).
Definition at line 1283 of file TGLScene.cxx.
Reposition/recolor physical shape.
Definition at line 1304 of file TGLScene.cxx.
|
virtual |
Reposition/recolor physical shape.
Definition at line 1325 of file TGLScene.cxx.
Reposition/recolor physical for given logical (assume TGLObject and a single physical).
Definition at line 1352 of file TGLScene.cxx.
|
virtual |
Reposition/recolor physical for given logical (assume TGLObject and a single physical).
Definition at line 1379 of file TGLScene.cxx.
Fill scene-info with information needed for rendering, take into account the render-context (viewer state, camera, clipping).
Here we have to iterate over all the physical shapes and select the visible ones. While at it, opaque and transparent shapes are divided into two groups.
Reimplemented from TGLSceneBase.
Definition at line 426 of file TGLScene.cxx.
|
friend |
Definition at line 123 of file TGLScene.h.
|
protected |
Definition at line 133 of file TGLScene.h.
|
protected |
Definition at line 137 of file TGLScene.h.
|
protected |
Definition at line 142 of file TGLScene.h.
|
protected |
Definition at line 141 of file TGLScene.h.
|
protected |
Definition at line 127 of file TGLScene.h.
|
protected |
Definition at line 128 of file TGLScene.h.
|
mutableprotected |
Definition at line 138 of file TGLScene.h.