ROOT logo
ROOT » GRAF3D » GL » TGLViewerBase

class TGLViewerBase: public TGLLockable


 Base class for GL viewers. Provides a basic scene management and a
 small set of control variables (camera, LOD, style, clip) that are
 used by the scene classes. Renering wrappers are available but
 minimal.

 There is no concept of GL-context here ... we just draw
 into whatever is set from outside.

 Development notes:

 Each viewer automatically creates a TGLRnrCtx and passes it down
 all render functions.

Function Members (Methods)

public:
TGLViewerBase()
virtual~TGLViewerBase()
virtual voidAddOverlayElement(TGLOverlayElement* el)
TGLSceneInfo*AddScene(TGLSceneBase* scene)
virtual voidChanged()
static TClass*Class()
TGLClip*Clip() const
TGLLockable::ELockTGLLockable::CurrentLock() const
virtual voidDeleteOverlayAnnotations()
virtual voidDeleteOverlayElements(TGLOverlayElement::ERole r)
Bool_tFindClosestOpaqueRecord(TGLSelectRecord& rec, Int_t& recIdx)
Bool_tFindClosestOverlayRecord(TGLOvlSelectRecord& rec, Int_t& recIdx)
Bool_tFindClosestRecord(TGLSelectRecord& rec, Int_t& recIdx)
TGLRnrCtx*GetRnrCtx() const
TGLSceneInfo*GetSceneInfo(TGLSceneBase* scene)
virtual TClass*IsA() const
virtual Bool_tIsChanged() const
Bool_tTGLLockable::IsDrawOrSelectLock() const
Bool_tTGLLockable::IsLocked() const
virtual const char*LockIdStr() const
static const char*TGLLockable::LockName(TGLLockable::ELock lock)
static Bool_tTGLLockable::LockValid(TGLLockable::ELock lock)
Short_tLOD() const
virtual voidMergeSceneBBoxes(TGLBoundingBox& bbox)
Float_tOLLineW() const
virtual voidPostRender()
virtual voidPostRenderOverlaySelection()
virtual voidPreRender()
virtual voidPreRenderOverlaySelection()
Bool_tTGLLockable::ReleaseLock(TGLLockable::ELock lock) const
voidRemoveAllScenes()
virtual voidRemoveOverlayElement(TGLOverlayElement* el)
voidRemoveScene(TGLSceneBase* scene)
virtual voidRender()
virtual voidRenderNonSelected()
virtual voidRenderOverlay()
virtual voidRenderSelected()
virtual voidResetSceneInfos()
Bool_tResolveSelectRecord(TGLSelectRecord& rec, Int_t recIdx)
TGLRnrCtx&RnrCtx() const
voidSceneDestructing(TGLSceneBase* scene)
voidSetClip(TGLClip* p)
voidSetLOD(Short_t lod)
voidSetOLLineW(Float_t w)
voidSetStyle(Short_t st)
voidSetWFLineW(Float_t w)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
Short_tStyle() const
Bool_tTGLLockable::TakeLock(TGLLockable::ELock lock) const
Float_tWFLineW() const

Data Members

public:
enum TGLLockable::ELock { kUnlocked
kDrawLock
kSelectLock
kModifyLock
};
protected:
TGLCamera*fCameraCamera for rendering.
Bool_tfChangedChange requiring redraw is pending.
TGLClip*fClipViewer clipping-plane.
Short_tfLODViewer-lod for rendering.
TGLLockable::ELockTGLLockable::fLockLock state.
Float_tfOLLineWOptional override of scene outline line-width
TGLBoundingBoxfOverallBoundingBoxAxis-aligned union of scene bboxes.
vector<TGLOverlayElement*>fOverlay
Bool_tfResetSceneInfosOnRenderRequest rebuild of view-specific scene data.
TGLRnrCtx*fRnrCtx
list<TGLSceneInfo*>fScenesRegistered scenes.
Short_tfStyleViewer-style for rendering.
vector<TGLSceneInfo*>fVisScenesVisible scenes.
Float_tfWFLineWOptional override of scene wire-frame line-width

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TGLViewerBase()
 Constructor.
~TGLViewerBase()
 Destructor.
const char* LockIdStr() const
 Name to print in locking output.
FindScene(TGLSceneBase* scene)
 Find scene-info corresponding to scene.
TGLSceneInfo* AddScene(TGLSceneBase* scene)
 Add new scene, appropriate scene-info is created.
void RemoveScene(TGLSceneBase* scene)
 Remove scene from the viewer, its scene-info is deleted.
void RemoveAllScenes()
 Remove all scenes from the viewer, their scene-infos are deleted.
void SceneDestructing(TGLSceneBase* scene)
 Remove scene, its scene-info is deleted.
 Called from scene that is being destroyed while still holding
 viewer references.
TGLSceneInfo* GetSceneInfo(TGLSceneBase* scene)
 Find scene-info corresponding to scene.
void AddOverlayElement(TGLOverlayElement* el)
 Add overlay element.
void RemoveOverlayElement(TGLOverlayElement* el)
 Remove overlay element.
void DeleteOverlayAnnotations()
 Delete overlay elements that are annotations.
void DeleteOverlayElements(TGLOverlayElement::ERole r)
 Delete overlay elements.
void ResetSceneInfos()
 Force rebuild of view-dependent scene-info structures.

 This should be called before calling render (draw/select) if
 something that affects camera interest has been changed.
void MergeSceneBBoxes(TGLBoundingBox& bbox)
 Merge bounding-boxes of all active registered scenes.
void PreRender()
 Initialize render-context, setup camera, GL, render-area.
 Check and lock scenes, determine their visibility.
void SubRenderScenes(TGLViewerBase::SubRender_foo render_foo)
 Call sub-rendering function render_foo on all currently visible
 scenes.
void Render()
 Render all scenes. This is done in four passes:
 - render opaque objects from all scenes
 - render transparent objects from all scenes
 - clear depth buffer
 - render opaque selected objects from all scenes (with highlight)
 - render transparent selected objects from all scenes (with highlight)
void RenderNonSelected()
 Render non-selected objects from all scenes.
void RenderSelected()
 Render selected objects from all scenes.
void RenderOverlay()
 Render overlay objects.
void PostRender()
 Function called after rendering is finished.
 Here we just unlock the scenes.
void PreRenderOverlaySelection()
 Perform minimal initialization for overlay selection.
 Here we assume that scene has already been drawn and that
 camera and overall bounding box are ok.
 Scenes are not locked.
void PostRenderOverlaySelection()
 Perform cleanup after overlay selection.
Bool_t ResolveSelectRecord(TGLSelectRecord& rec, Int_t recIdx)
 Process selection record on buffer-position 'recIdx' and
 fill the data into 'rec'.

 Returns TRUE if scene was demangled and an object identified.
 When FALSE is returned it is still possible that scene has been
 identified. Check for this if interested in scene-selection.

 The select-buffer is taken form fRnrCtx.
Bool_t FindClosestRecord(TGLSelectRecord& rec, Int_t& recIdx)
 Find next select record that can be resolved, starting from
 position 'recIdx'.
 'recIdx' is passed as reference and points to found record in the buffer.
Bool_t FindClosestOpaqueRecord(TGLSelectRecord& rec, Int_t& recIdx)
 Find next select record that can be resolved and whose result is
 not transparent, starting from position 'recIdx'.
 'recIdx' is passed as reference and points to found record in the buffer.
Bool_t FindClosestOverlayRecord(TGLOvlSelectRecord& rec, Int_t& recIdx)
 Find next overlay-select record that can be resolved, starting from
 position 'recIdx'.
 'recIdx' is passed as reference and points to found record in the buffer.
TGLViewerBase(const TGLViewerBase& )
TGLViewerBase& operator=(const TGLViewerBase& )
void SetClip(TGLClip* p)
{ fClip = p; }
Short_t LOD() const
{ return fLOD; }
void SetLOD(Short_t lod)
{ fLOD = lod; }
Short_t Style() const
{ return fStyle; }
void SetStyle(Short_t st)
{ fStyle = st; }
Float_t WFLineW() const
{ return fWFLineW; }
void SetWFLineW(Float_t w)
{ fWFLineW = w; }
Float_t OLLineW() const
{ return fOLLineW; }
void SetOLLineW(Float_t w)
{ fOLLineW = w; }
void Changed()
Bool_t IsChanged() const
{ return fChanged; }
TGLRnrCtx* GetRnrCtx() const
{ return fRnrCtx; }