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.
Definition at line 36 of file TGLViewerBase.h.
Public Member Functions | |
TGLViewerBase () | |
virtual | ~TGLViewerBase () |
Destructor. | |
virtual void | AddOverlayElement (TGLOverlayElement *el) |
Add overlay element. | |
TGLSceneInfo * | AddScene (TGLSceneBase *scene) |
Add new scene, appropriate scene-info is created. | |
virtual void | Changed () |
TGLClip * | Clip () const |
virtual void | DeleteOverlayAnnotations () |
Delete overlay elements that are annotations. | |
virtual void | DeleteOverlayElements (TGLOverlayElement::ERole r) |
Delete overlay elements. | |
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'. | |
Bool_t | FindClosestOverlayRecord (TGLOvlSelectRecord &rec, Int_t &recIdx) |
Find next overlay-select record that can be resolved, starting from position 'recIdx'. | |
Bool_t | FindClosestRecord (TGLSelectRecord &rec, Int_t &recIdx) |
Find next select record that can be resolved, starting from position 'recIdx'. | |
TGLLogicalShape * | FindLogicalInScenes (TObject *id) |
Find logical-shape representing object id in the list of scenes. | |
TGLRnrCtx * | GetRnrCtx () const |
TGLSceneInfo * | GetSceneInfo (TGLSceneBase *scene) |
Find scene-info corresponding to scene. | |
virtual Bool_t | IsChanged () const |
virtual const char * | LockIdStr () const |
Name to print in locking output. | |
Short_t | LOD () const |
virtual void | MergeSceneBBoxes (TGLBoundingBox &bbox) |
Merge bounding-boxes of all active registered scenes. | |
Float_t | OLLineW () const |
virtual void | PostRender () |
Function called after rendering is finished. | |
virtual void | PostRenderOverlaySelection () |
Perform cleanup after overlay selection. | |
virtual void | PreRender () |
Initialize render-context, setup camera, GL, render-area. | |
virtual void | PreRenderOverlaySelection () |
Perform minimal initialization for overlay selection. | |
const TGLBoundingBox & | RefOverallBoundingBox () const |
void | RemoveAllScenes () |
Remove all scenes from the viewer, their scene-infos are deleted. | |
virtual void | RemoveOverlayElement (TGLOverlayElement *el) |
Remove overlay element. | |
void | RemoveScene (TGLSceneBase *scene) |
Remove scene from the viewer, its scene-info is deleted. | |
virtual void | Render () |
Render all scenes. | |
virtual void | RenderNonSelected () |
Render non-selected objects from all scenes. | |
virtual void | RenderOpaque (Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE) |
Render opaque objects from all scenes. | |
virtual void | RenderOverlay (Int_t state, Bool_t selection) |
Render overlay objects. | |
virtual void | RenderSelected () |
Render selected objects from all scenes. | |
virtual void | RenderSelectedForHighlight () |
Render selected objects from all scenes for highlight. | |
virtual void | RenderTransparent (Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE) |
Render transparent objects from all scenes. | |
virtual void | ResetSceneInfos () |
Force rebuild of view-dependent scene-info structures. | |
Bool_t | ResolveSelectRecord (TGLSelectRecord &rec, Int_t recIdx) |
Process selection record on buffer-position 'recIdx' and fill the data into 'rec'. | |
TGLRnrCtx & | RnrCtx () const |
void | SceneDestructing (TGLSceneBase *scene) |
Remove scene, its scene-info is deleted. | |
void | SetClip (TGLClip *p) |
void | SetLOD (Short_t lod) |
void | SetOLLineW (Float_t w) |
void | SetStyle (Short_t st) |
void | SetWFLineW (Float_t w) |
Short_t | Style () const |
Float_t | WFLineW () const |
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. | |
Bool_t | TakeLock (ELock lock) const |
Lock the object in mode 'lock'. | |
Protected Types | |
typedef OverlayElmVec_t::iterator | OverlayElmVec_i |
typedef std::vector< TGLOverlayElement * > | OverlayElmVec_t |
typedef SceneInfoList_t::iterator | SceneInfoList_i |
typedef std::list< TGLSceneInfo * > | SceneInfoList_t |
typedef SceneInfoVec_t::iterator | SceneInfoVec_i |
typedef std::vector< TGLSceneInfo * > | SceneInfoVec_t |
typedef void(TGLSceneBase::* | SubRender_foo) (TGLRnrCtx &) |
Protected Member Functions | |
SceneInfoList_i | FindScene (TGLSceneBase *scene) |
Find scene-info corresponding to scene. | |
virtual void | SetupClipObject () |
Setup clip-object. Protected virtual method. | |
void | SubRenderScenes (SubRender_foo render_foo) |
Call sub-rendering function render_foo on all currently visible scenes. | |
Protected Attributes | |
TGLCamera * | fCamera |
Bool_t | fChanged |
TGLClip * | fClip |
Short_t | fLOD |
Float_t | fOLLineW |
TGLBoundingBox | fOverallBoundingBox |
OverlayElmVec_t | fOverlay |
Bool_t | fResetSceneInfosOnRender |
TGLRnrCtx * | fRnrCtx |
SceneInfoList_t | fScenes |
Short_t | fStyle |
SceneInfoVec_t | fVisScenes |
Float_t | fWFLineW |
Protected Attributes inherited from TGLLockable | |
ELock | fLock |
Private Member Functions | |
TGLViewerBase (const TGLViewerBase &) | |
TGLViewerBase & | operator= (const TGLViewerBase &) |
Additional Inherited Members | |
Public Types inherited from TGLLockable | |
enum | ELock { kUnlocked , kDrawLock , kSelectLock , kModifyLock } |
Static Public Member Functions inherited from TGLLockable | |
static const char * | LockName (ELock lock) |
Return name-string for given lock-type. | |
static Bool_t | LockValid (ELock lock) |
Test if lock is a valid type to take/release. | |
#include <TGLViewerBase.h>
|
protected |
Definition at line 50 of file TGLViewerBase.h.
|
protected |
Definition at line 49 of file TGLViewerBase.h.
|
protected |
Definition at line 44 of file TGLViewerBase.h.
|
protected |
Definition at line 43 of file TGLViewerBase.h.
|
protected |
Definition at line 47 of file TGLViewerBase.h.
|
protected |
Definition at line 46 of file TGLViewerBase.h.
Definition at line 54 of file TGLViewerBase.h.
|
private |
TGLViewerBase::TGLViewerBase | ( | ) |
Definition at line 54 of file TGLViewerBase.cxx.
|
virtual |
Destructor.
Definition at line 77 of file TGLViewerBase.cxx.
|
virtual |
Add overlay element.
Definition at line 211 of file TGLViewerBase.cxx.
TGLSceneInfo * TGLViewerBase::AddScene | ( | TGLSceneBase * | scene | ) |
Add new scene, appropriate scene-info is created.
Definition at line 116 of file TGLViewerBase.cxx.
|
inlinevirtual |
Definition at line 121 of file TGLViewerBase.h.
|
inline |
Definition at line 104 of file TGLViewerBase.h.
|
virtual |
Delete overlay elements that are annotations.
Definition at line 231 of file TGLViewerBase.cxx.
|
virtual |
Delete overlay elements.
Definition at line 239 of file TGLViewerBase.cxx.
Bool_t TGLViewerBase::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.
Definition at line 642 of file TGLViewerBase.cxx.
Bool_t TGLViewerBase::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.
Definition at line 660 of file TGLViewerBase.cxx.
Bool_t TGLViewerBase::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.
Definition at line 624 of file TGLViewerBase.cxx.
TGLLogicalShape * TGLViewerBase::FindLogicalInScenes | ( | TObject * | id | ) |
Find logical-shape representing object id in the list of scenes.
Return 0 if not found.
Definition at line 197 of file TGLViewerBase.cxx.
|
protected |
Find scene-info corresponding to scene.
Definition at line 106 of file TGLViewerBase.cxx.
|
inline |
Definition at line 158 of file TGLViewerBase.h.
TGLSceneInfo * TGLViewerBase::GetSceneInfo | ( | TGLSceneBase * | scene | ) |
Find scene-info corresponding to scene.
Definition at line 184 of file TGLViewerBase.cxx.
|
inlinevirtual |
Definition at line 122 of file TGLViewerBase.h.
|
virtual |
Name to print in locking output.
Reimplemented from TGLLockable.
Definition at line 93 of file TGLViewerBase.cxx.
|
inline |
Definition at line 107 of file TGLViewerBase.h.
|
virtual |
Merge bounding-boxes of all active registered scenes.
Definition at line 278 of file TGLViewerBase.cxx.
|
inline |
Definition at line 115 of file TGLViewerBase.h.
|
private |
|
virtual |
Function called after rendering is finished.
Here we just unlock the scenes.
Reimplemented in TGLViewer.
Definition at line 547 of file TGLViewerBase.cxx.
|
virtual |
Perform cleanup after overlay selection.
Definition at line 574 of file TGLViewerBase.cxx.
|
virtual |
Initialize render-context, setup camera, GL, render-area.
Check and lock scenes, determine their visibility.
Reimplemented in TGLViewer.
Definition at line 311 of file TGLViewerBase.cxx.
|
virtual |
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.
Definition at line 566 of file TGLViewerBase.cxx.
|
inline |
Definition at line 126 of file TGLViewerBase.h.
void TGLViewerBase::RemoveAllScenes | ( | ) |
Remove all scenes from the viewer, their scene-infos are deleted.
Definition at line 152 of file TGLViewerBase.cxx.
|
virtual |
Remove overlay element.
Reimplemented in TGLViewer.
Definition at line 220 of file TGLViewerBase.cxx.
void TGLViewerBase::RemoveScene | ( | TGLSceneBase * | scene | ) |
Remove scene from the viewer, its scene-info is deleted.
Definition at line 135 of file TGLViewerBase.cxx.
|
virtual |
Render all scenes.
This is done in two main passes:
Reimplemented in TGLViewer.
Definition at line 423 of file TGLViewerBase.cxx.
|
virtual |
Render non-selected objects from all scenes.
Definition at line 432 of file TGLViewerBase.cxx.
|
virtual |
Render opaque objects from all scenes.
Definition at line 488 of file TGLViewerBase.cxx.
Render overlay objects.
Definition at line 528 of file TGLViewerBase.cxx.
|
virtual |
Render selected objects from all scenes.
Definition at line 450 of file TGLViewerBase.cxx.
|
virtual |
Render selected objects from all scenes for highlight.
Definition at line 468 of file TGLViewerBase.cxx.
|
virtual |
Render transparent objects from all scenes.
Definition at line 505 of file TGLViewerBase.cxx.
|
virtual |
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.
Definition at line 265 of file TGLViewerBase.cxx.
Bool_t TGLViewerBase::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.
Definition at line 601 of file TGLViewerBase.cxx.
|
inline |
Definition at line 159 of file TGLViewerBase.h.
void TGLViewerBase::SceneDestructing | ( | TGLSceneBase * | scene | ) |
Remove scene, its scene-info is deleted.
Called from scene that is being destroyed while still holding viewer references.
Definition at line 169 of file TGLViewerBase.cxx.
Definition at line 105 of file TGLViewerBase.h.
Definition at line 108 of file TGLViewerBase.h.
Definition at line 116 of file TGLViewerBase.h.
Definition at line 111 of file TGLViewerBase.h.
|
protectedvirtual |
Setup clip-object. Protected virtual method.
Reimplemented in TGLViewer.
Definition at line 299 of file TGLViewerBase.cxx.
Definition at line 114 of file TGLViewerBase.h.
|
inline |
Definition at line 110 of file TGLViewerBase.h.
|
protected |
Call sub-rendering function render_foo on all currently visible scenes.
Definition at line 400 of file TGLViewerBase.cxx.
|
inline |
Definition at line 113 of file TGLViewerBase.h.
|
protected |
Definition at line 64 of file TGLViewerBase.h.
|
protected |
Definition at line 72 of file TGLViewerBase.h.
|
protected |
Definition at line 65 of file TGLViewerBase.h.
|
protected |
Definition at line 66 of file TGLViewerBase.h.
|
protected |
Definition at line 69 of file TGLViewerBase.h.
|
protected |
Definition at line 77 of file TGLViewerBase.h.
|
protected |
Definition at line 79 of file TGLViewerBase.h.
|
protected |
Definition at line 71 of file TGLViewerBase.h.
|
protected |
Definition at line 62 of file TGLViewerBase.h.
|
protected |
Definition at line 74 of file TGLViewerBase.h.
|
protected |
Definition at line 67 of file TGLViewerBase.h.
|
protected |
Definition at line 75 of file TGLViewerBase.h.
|
protected |
Definition at line 68 of file TGLViewerBase.h.