ROOT logo
ROOT » GRAF3D » GL » TGLScene

class TGLScene: public TGLSceneBase


 TGLScene provides managememnt 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 syncronisation reasons. Hence viewer variant objects
 camera, clips etc being owned by viewer and passed at draw/select

Function Members (Methods)

public:
TGLScene()
virtual~TGLScene()
voidTGLSceneBase::AddViewer(TGLViewerBase* viewer)
virtual voidAdoptLogical(TGLLogicalShape& shape)
virtual voidAdoptPhysical(TGLPhysicalShape& shape)
UInt_tBeginSmartRefresh()
virtual Bool_tBeginUpdate()
const TGLBoundingBox&TGLSceneBase::BoundingBox() const
virtual voidCalcBoundingBox() const
static TClass*Class()
TGLClip*TGLSceneBase::Clip() const
virtual TGLScene::TSceneInfo*CreateSceneInfo(TGLViewerBase* view)
virtual TGLSceneInfo*TGLSceneBase::CreateSceneInfo(TGLViewerBase* view)
TGLLockable::ELockTGLLockable::CurrentLock() const
virtual Bool_tDestroyLogical(TObject* logid, Bool_t mustFind = kTRUE)
virtual Int_tDestroyLogicals()
virtual Bool_tDestroyPhysical(UInt_t phid)
virtual Int_tDestroyPhysicals(Bool_t incModified, const TGLCamera* camera = 0)
voidDumpMapSizes() const
voidEndSmartRefresh()
virtual voidEndUpdate(Bool_t minorChange = kTRUE, Bool_t sceneChanged = kTRUE, Bool_t updateViewers = kTRUE)
virtual TGLLogicalShape*FindLogical(TObject* logid) const
TGLLogicalShape*FindLogicalSmartRefresh(TObject* ID) const
virtual TGLPhysicalShape*FindPhysical(UInt_t phid) const
Bool_tTGLSceneBase::GetAutoDestruct() const
TGLContextIdentity*GetGLCtxIdentity() const
virtual UInt_tGetMaxPhysicalID()
UInt_tTGLSceneBase::GetMinorStamp() const
virtual const char*TGLSceneBase::GetName() const
Bool_tTGLSceneBase::GetSelectable() const
UInt_tTGLSceneBase::GetTimeStamp() const
virtual const char*TGLSceneBase::GetTitle() const
voidTGLSceneBase::IncMinorStamp()
voidTGLSceneBase::IncTimeStamp()
voidTGLSceneBase::InvalidateBoundingBox()
virtual TClass*IsA() const
virtual TClass*TGLSceneBase::IsA() const
virtual TClass*TGLLockable::IsA() const
Bool_tTGLLockable::IsDrawOrSelectLock() const
Bool_tTGLLockable::IsLocked() const
static Bool_tIsOutside(const TGLBoundingBox& box, const TGLPlaneSet_t& planes)
virtual const char*TGLSceneBase::LockIdStr() const
virtual const char*TGLLockable::LockIdStr() const
static const char*TGLLockable::LockName(TGLLockable::ELock lock)
static Bool_tTGLLockable::LockValid(TGLLockable::ELock lock)
Short_tTGLSceneBase::LOD() const
virtual voidLodifySceneInfo(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::LodifySceneInfo(TGLRnrCtx& ctx)
virtual voidPostDraw(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::PostDraw(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::PostRender(TGLRnrCtx& rnrCtx)
virtual voidPreDraw(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::PreDraw(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::PreRender(TGLRnrCtx& rnrCtx)
virtual voidRebuildSceneInfo(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::RebuildSceneInfo(TGLRnrCtx& ctx)
TGLScene::LogicalShapeMap_t&RefLogicalShapes()
Bool_tTGLLockable::ReleaseLock(TGLLockable::ELock lock) const
voidTGLSceneBase::RemoveViewer(TGLViewerBase* viewer)
virtual voidTGLSceneBase::Render(TGLRnrCtx& rnrCtx)
virtual voidRenderAllPasses(TGLRnrCtx& rnrCtx, TGLScene::DrawElementPtrVec_t& elVec, Bool_t check_timeout)
virtual voidRenderElements(TGLRnrCtx& rnrCtx, TGLScene::DrawElementPtrVec_t& elVec, Bool_t check_timeout, const TGLPlaneSet_t* clipPlanes = 0)
virtual voidRenderOpaque(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::RenderOpaque(TGLRnrCtx& rnrCtx)
virtual voidRenderSelOpaque(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::RenderSelOpaque(TGLRnrCtx& rnrCtx)
virtual voidRenderSelTransp(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::RenderSelTransp(TGLRnrCtx& rnrCtx)
virtual voidRenderTransp(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::RenderTransp(TGLRnrCtx& rnrCtx)
virtual Bool_tResolveSelectRecord(TGLSelectRecord& rec, Int_t curIdx)
virtual Bool_tTGLSceneBase::ResolveSelectRecord(TGLSelectRecord& rec, Int_t curIdx)
static voidRGBAFromColorIdx(Float_t* rgba, Color_t ci, Char_t transp = 0)
voidTGLSceneBase::SetAutoDestruct(Bool_t a)
voidTGLSceneBase::SetClip(TGLClip* p)
voidTGLSceneBase::SetLOD(Short_t lod)
virtual voidTGLSceneBase::SetName(const char* name)
virtual voidTGLSceneBase::SetNameTitle(const char* name, const char* title)
voidTGLSceneBase::SetSelectable(Bool_t a)
voidTGLSceneBase::SetStyle(Short_t st)
virtual voidTGLSceneBase::SetTitle(const char* title)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTGLSceneBase::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidTGLLockable::ShowMembers(TMemberInspector& insp, char* parent)
UInt_tSizeOfScene() const
virtual voidStreamer(TBuffer& b)
virtual voidTGLSceneBase::Streamer(TBuffer& b)
virtual voidTGLLockable::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTGLSceneBase::StreamerNVirtual(TBuffer& b)
voidTGLLockable::StreamerNVirtual(TBuffer& b)
Short_tTGLSceneBase::Style() const
voidTGLSceneBase::TagViewersChanged()
Bool_tTGLLockable::TakeLock(TGLLockable::ELock lock) const
virtual voidUpdateLogical(TObject* logid)
virtual voidUpdatePhysical(UInt_t phid, Double_t* trans, UChar_t* col)
virtual voidUpdatePhysical(UInt_t phid, Double_t* trans, Color_t cidx = -1, UChar_t transp = 0)
virtual voidUpdatePhysioLogical(TObject* logid, Double_t* trans, UChar_t* col)
virtual voidUpdatePhysioLogical(TObject* logid, Double_t* trans, Color_t cidx = -1, UChar_t transp = 0)
virtual voidUpdateSceneInfo(TGLRnrCtx& rnrCtx)
virtual voidTGLSceneBase::UpdateSceneInfo(TGLRnrCtx& ctx)
private:
TGLScene(const TGLScene&)
static Bool_tComparePhysicalDiagonals(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2)
static Bool_tComparePhysicalVolumes(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2)
TGLScene&operator=(const TGLScene&)

Data Members

private:
enum TGLLockable::ELock { kUnlocked
kDrawLock
kSelectLock
kModifyLock
};
protected:
Bool_tTGLSceneBase::fAutoDestruct
TGLBoundingBoxTGLSceneBase::fBoundingBoxbounding box for scene (axis aligned) - lazy update - use BoundingBox() to access
Bool_tTGLSceneBase::fBoundingBoxValidbounding box valid?
TGLClip*TGLSceneBase::fClipScene clipping-plane.
Bool_tTGLSceneBase::fDoClipCheckPerform global clip-plane-check in UpdateSceneInfo()
Bool_tTGLSceneBase::fDoFrustumCheckPerform global frustum-check in UpdateSceneInfo()
TGLContextIdentity*fGLCtxIdentity
Bool_tfInSmartRefresh!
Short_tTGLSceneBase::fLODScene-lod.
TGLLockable::ELockTGLLockable::fLockLock state.
map<TObject*,TGLLogicalShape*>fLogicalShapes!
UInt_tTGLSceneBase::fMinorStampCounter increased on minimal update.
TStringTGLSceneBase::fNameObject identifier.
map<unsigned int,TGLPhysicalShape*>fPhysicalShapes!
UInt_tTGLSceneBase::fSceneIDUnique scene id.
Bool_tTGLSceneBase::fSelectableObjects in the scene are selectable.
map<TObject*,TGLLogicalShape*>fSmartRefreshCache!
Short_tTGLSceneBase::fStyleScene-style.
UInt_tTGLSceneBase::fTimeStampCounter increased on every update.
TStringTGLSceneBase::fTitleObject title.
list<TGLViewerBase*>TGLSceneBase::fViewers

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGLScene()
{}
~TGLScene()
 Destroy scene objects
void ReleaseGLCtxIdentity()
 Release all GL resources for current context identity.
 Requires iteration over all logical shapes.
Bool_t ComparePhysicalVolumes(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2)
 Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if
 'shape1' bigger than 'shape2'.
Bool_t ComparePhysicalDiagonals(const TGLPhysicalShape* shape1, const TGLPhysicalShape* shape2)
 Compare 'shape1' and 'shape2' bounding box volumes - return kTRUE if
 'shape1' bigger than 'shape2'.
void RebuildSceneInfo(TGLRnrCtx& rnrCtx)
 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 noticable. As this does not use projected
 size it only needs to be done after a scene content change - not
 everytime scene drawn (potential camera/projection change).
void UpdateSceneInfo(TGLRnrCtx& rnrCtx)
 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.
void LodifySceneInfo(TGLRnrCtx& rnrCtx)
 Setup LOD-dependant values in scene-info.
 We have to perform LOD quantization for all draw-elements.
void PreDraw(TGLRnrCtx& rnrCtx)
 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.
void RenderOpaque(TGLRnrCtx& rnrCtx)
 Render opaque elements.
void RenderTransp(TGLRnrCtx& rnrCtx)
 Render transparent elements.
void RenderSelOpaque(TGLRnrCtx& rnrCtx)
 Render selected opaque elements.
void RenderSelTransp(TGLRnrCtx& rnrCtx)
 Render selected transparent elements.
void PostDraw(TGLRnrCtx& rnrCtx)
 Called after the rendering is finished.
 In debug mode draw statistcs is dumped.
 Parent's PostDraw is called for GL cleanup.
void RenderAllPasses(TGLRnrCtx& rnrCtx, TGLScene::DrawElementPtrVec_t& elVec, Bool_t check_timeout)
 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.
void RenderElements(TGLRnrCtx& rnrCtx, TGLScene::DrawElementPtrVec_t& elVec, Bool_t check_timeout, const TGLPlaneSet_t* clipPlanes = 0)
 Render DrawElements in elementVec with given timeout.
 If clipPlanes is non-zero, test each element against its
 clipping planes.
Bool_t ResolveSelectRecord(TGLSelectRecord& rec, Int_t curIdx)
 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.
void CalcBoundingBox() const
 Encapsulates all physical shapes bounding box with axes aligned box.
 Validity checked in the base-class.
void AdoptLogical(TGLLogicalShape& shape)
 Adopt dynamically created logical 'shape' - add to internal map
 and take responsibility for deleting.
Bool_t DestroyLogical(TObject* logid, Bool_t mustFind = kTRUE)
 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.
Int_t DestroyLogicals()
 Destroy all logical shapes in scene.
 Return number of destroyed logicals.
TGLLogicalShape * FindLogical(TObject* logid) const
 Find and return logical shape identified by unqiue logid.
 Returns 0 if not found.
void AdoptPhysical(TGLPhysicalShape& shape)
 Adopt dynamically created physical 'shape' - add to internal map and take
 responsibility for deleting
void DestroyPhysicalInternal(TGLScene::PhysicalShapeMapIt_t pit)
 Virtual function to destroy a physical. Sub-classes might have
 special checks to perform.
 Caller should also invalidate the draw-list.
Bool_t DestroyPhysical(UInt_t phid)
 Destroy physical shape defined by unique 'ID'.
 Returns kTRUE if found/destroyed - kFALSE otherwise.
Int_t DestroyPhysicals(Bool_t incModified, const TGLCamera* camera = 0)
 Destroy physical shapes that are no longer of interest to camera.
 If 'incModified' is true also the modified ones are deleted.
 Return count of number destroyed.
TGLPhysicalShape* FindPhysical(UInt_t phid) const
 Find and return physical shape identified by unqiue 'ID'.
 Returns 0 if not found.
UInt_t GetMaxPhysicalID()
 Returns the maximum used physical id.
 Returns 0 if empty.
Bool_t BeginUpdate()
 Put scene in update mode, return true if lock acquired.
void EndUpdate(Bool_t minorChange = kTRUE, Bool_t sceneChanged = kTRUE, Bool_t updateViewers = kTRUE)
 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.
void UpdateLogical(TObject* logid)
 Drop display-lists for the logical (assume TGLObject/direct rendering).
 Re-calculate the bounding box (also for all physicals).
void UpdatePhysical(UInt_t phid, Double_t* trans, UChar_t* col)
 Reposition/recolor physical shape.
void UpdatePhysical(UInt_t phid, Double_t* trans, Color_t cidx = -1, UChar_t transp = 0)
 Reposition/recolor physical shape.
void UpdatePhysioLogical(TObject* logid, Double_t* trans, UChar_t* col)
 Reposition/recolor physical for given logical (assume TGLObject and
 a single physical).
void UpdatePhysioLogical(TObject* logid, Double_t* trans, Color_t cidx = -1, UChar_t transp = 0)
 Reposition/recolor physical for given logical (assume TGLObject and
 a single physical).
UInt_t BeginSmartRefresh()
 Moves logicals that support smart-refresh to intermediate cache.
 Destroys the others and returns the number of destroyed ones.
void EndSmartRefresh()
 Wipes logicals in refresh-cache.
TGLLogicalShape * FindLogicalSmartRefresh(TObject* ID) const
 Find and return logical shape identified by unqiue 'ID' in refresh-cache.
 Returns 0 if not found.
UInt_t SizeOfScene() const
 Return memory cost of scene.
 Warning: NOT CORRECT at present - doesn't correctly calculate size.
 of logical shapes with dynamic internal contents.
void DumpMapSizes() const
 Print sizes of logical nad physical-shape maps.
void RGBAFromColorIdx(Float_t* rgba, Color_t ci, Char_t transp = 0)
 Fill rgba color from ROOT color-index ci and transparency (0->100).
Bool_t IsOutside(const TGLBoundingBox& box, const TGLPlaneSet_t& planes)
 Check if box is outside of all planes.
TGLScene(const TGLScene& )
TGLScene& operator=(const TGLScene& )
TSceneInfo* CreateSceneInfo(TGLViewerBase* view)
LogicalShapeMap_t& RefLogicalShapes()
 Temporary export for setting selected-state of physical shapes.
{ return fLogicalShapes; }
TGLContextIdentity* GetGLCtxIdentity() const
 GL-context holding display-list definitions
{ return fGLCtxIdentity; }