27#include "TGLIncludes.h"
63 fResetSceneInfosOnRender (
kFALSE),
81 (*i)->GetScene()->RemoveViewer(
this);
95 return "TGLViewerBase";
109 while (i !=
fScenes.end() && (*i)->GetScene() != scene) ++i;
126 Warning(
"TGLViewerBase::AddScene",
"scene '%s' already in the list.",
144 Warning(
"TGLViewerBase::RemoveScene",
"scene '%s' not found.",
177 Warning(
"TGLViewerBase::SceneDestructing",
"scene not found.");
270 (*i)->ResetSceneStamp();
327 Warning(
"TGLViewerBase::PreRender",
"Switching to another GL context; maybe you should use context-sharing.");
357 Warning(
"TGLViewerBase::PreRender",
"locking of scene '%s' failed, skipping.",
361 locked_scenes.push_back(sinfo);
374 for (
SceneInfoList_i i=locked_scenes.begin(); i!=locked_scenes.end(); ++i)
404 for (
Int_t i = 0; i < nScenes; ++i)
411 (scene->*render_foo)(*
fRnrCtx);
437 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
455 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
475 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
490 if (rnr_non_selected)
508 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
511 if (rnr_non_selected)
531 for (
Int_t i = 0; i < nOvl; ++i)
536 if (selection) glPushName(i);
538 if (selection) glPopName();
628 while (recIdx < sb->GetNRecords())
646 while (recIdx < sb->GetNRecords())
665 while (recIdx < sb->GetNRecords())
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
void SetEmpty()
Set bounding box empty - all vertices at (0,0,0)
void MergeAligned(const TGLBoundingBox &other)
Expand current bbox so that it includes other's bbox.
Rgl::EOverlap FrustumOverlap(const TGLBoundingBox &box) const
Calculate overlap (kInside, kOutside, kPartial) of box with camera frustum Camera must have valid fru...
virtual void Apply(const TGLBoundingBox &sceneBox, const TGLRect *pickRect=0) const =0
virtual void Setup(const TGLBoundingBox &bbox)=0
Identifier of a shared GL-context.
static TGLContextIdentity * GetCurrent()
Find identitfy of current context. Static.
Bool_t TakeLock(ELock lock) const
Lock the object in mode 'lock'.
Bool_t ReleaseLock(ELock lock) const
Release current lock, make sure it the same as the 'lock' argument.
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
TGLScene * GetScene() const
virtual void Render(TGLRnrCtx &rnrCtx)=0
Selection record for overlay objects.
void SetOvlElement(TGLOverlayElement *e)
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
void SetSceneInfo(TGLSceneInfo *si)
void SetViewerLOD(Short_t LOD)
TGLSelectBuffer * GetSelectBuffer() const
void SetViewerOLLineW(Float_t w)
void SetViewerWFLineW(Float_t w)
void SetGLCtxIdentity(TGLContextIdentity *cid)
TGLRect * GetPickRectangle()
Return current pick rectangle.
void SetViewerStyle(Short_t sty)
void SetViewerClip(TGLClip *p)
void SetCamera(TGLCamera *c)
void SetHighlight(Bool_t hil)
TGLContextIdentity * GetGLCtxIdentity() const
Scene base-class – provides basic interface expected by the TGLViewer or its sub-classes:
virtual const char * GetName() const
virtual void PostDraw(TGLRnrCtx &rnrCtx)
Finalize drawing.
virtual void RenderSelOpaque(TGLRnrCtx &rnrCtx)
Render selected opaque elements.
virtual void PostRender(TGLRnrCtx &rnrCtx)
Perform post-render clean-up.
virtual TGLSceneInfo * CreateSceneInfo(TGLViewerBase *view)
Create a scene-info instance appropriate for this scene class.
void RemoveViewer(TGLViewerBase *viewer)
Remove viewer from the list.
virtual void RenderSelTransp(TGLRnrCtx &rnrCtx)
Render selected transparent elements for highlight.
virtual void PreRender(TGLRnrCtx &rnrCtx)
Perform pre-render initialization - fill rnrCtx with values stored during PreDraw().
virtual Bool_t ResolveSelectRecord(TGLSelectRecord &rec, Int_t curIdx)
Process selection record rec.
virtual void RenderTransp(TGLRnrCtx &rnrCtx)
Render transparent elements.
virtual void RenderSelTranspForHighlight(TGLRnrCtx &rnrCtx)
Render selected transparent elements.
virtual void PreDraw(TGLRnrCtx &rnrCtx)
Perform basic pre-render initialization:
void AddViewer(TGLViewerBase *viewer)
Add viewer to the list.
virtual void RenderOpaque(TGLRnrCtx &rnrCtx)
Render opaque elements.
virtual void RenderSelOpaqueForHighlight(TGLRnrCtx &rnrCtx)
Render selected opaque elements for highlight.
Bool_t GetSelectable() const
Base class for extended scene context.
void SetupTransformsAndBBox()
Combine information from scene, scene-info and camera (should be optional) into transformation matric...
const TGLBoundingBox & GetTransformedBBox()
TGLSceneBase * GetScene() const
virtual TGLLogicalShape * FindLogical(TObject *logid) const
Find and return logical shape identified by unique logid.
Encapsulates OpenGL select buffer.
Int_t GetNRecords() const
Int_t SelectRecord(TGLSelectRecordBase &rec, Int_t i)
Fill select record rec with data on (sorted) position i.
UInt_t GetItem(Int_t i) const
Standard selection record including information about containing scene and details ob out selected ob...
Bool_t GetTransparent() const
void SetSceneInfo(TGLSceneInfo *si)
static Int_t CheckError(const char *loc)
Check current GL error state, outputting details via ROOT Error method if one.
Base class for GL viewers.
void SceneDestructing(TGLSceneBase *scene)
Remove scene, its scene-info is deleted.
virtual void RenderTransparent(Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE)
Render transparent objects from all scenes.
virtual void DeleteOverlayElements(TGLOverlayElement::ERole r)
Delete overlay elements.
virtual void PreRenderOverlaySelection()
Perform minimal initialization for overlay selection.
SceneInfoVec_t fVisScenes
virtual ~TGLViewerBase()
Destructor.
virtual void RenderSelected()
Render selected objects from all scenes.
void SubRenderScenes(SubRender_foo render_foo)
Call sub-rendering function render_foo on all currently visible scenes.
Bool_t FindClosestOpaqueRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved and whose result is not transparent, starting from posit...
virtual void ResetSceneInfos()
Force rebuild of view-dependent scene-info structures.
TGLSceneInfo * AddScene(TGLSceneBase *scene)
Add new scene, appropriate scene-info is created.
TGLLogicalShape * FindLogicalInScenes(TObject *id)
Find logical-shape representing object id in the list of scenes.
std::vector< TGLOverlayElement * > OverlayElmVec_t
virtual void RemoveOverlayElement(TGLOverlayElement *el)
Remove overlay element.
virtual void RenderOverlay(Int_t state, Bool_t selection)
Render overlay objects.
SceneInfoVec_t::iterator SceneInfoVec_i
TGLSceneInfo * GetSceneInfo(TGLSceneBase *scene)
Find scene-info corresponding to scene.
virtual void Render()
Render all scenes.
virtual void PostRenderOverlaySelection()
Perform cleanup after overlay selection.
virtual void PreRender()
Initialize render-context, setup camera, GL, render-area.
virtual void PostRender()
Function called after rendering is finished.
virtual void SetupClipObject()
Setup clip-object. Protected virtual method.
SceneInfoList_i FindScene(TGLSceneBase *scene)
Find scene-info corresponding to scene.
Bool_t FindClosestOverlayRecord(TGLOvlSelectRecord &rec, Int_t &recIdx)
Find next overlay-select record that can be resolved, starting from position 'recIdx'.
virtual void MergeSceneBBoxes(TGLBoundingBox &bbox)
Merge bounding-boxes of all active registered scenes.
OverlayElmVec_t::iterator OverlayElmVec_i
void RemoveAllScenes()
Remove all scenes from the viewer, their scene-infos are deleted.
Bool_t fResetSceneInfosOnRender
TGLBoundingBox fOverallBoundingBox
void RemoveScene(TGLSceneBase *scene)
Remove scene from the viewer, its scene-info is deleted.
std::list< TGLSceneInfo * > SceneInfoList_t
virtual void DeleteOverlayAnnotations()
Delete overlay elements that are annotations.
virtual void RenderNonSelected()
Render non-selected objects from all scenes.
Bool_t ResolveSelectRecord(TGLSelectRecord &rec, Int_t recIdx)
Process selection record on buffer-position 'recIdx' and fill the data into 'rec'.
virtual void RenderSelectedForHighlight()
Render selected objects from all scenes for highlight.
virtual void RenderOpaque(Bool_t rnr_non_selected=kTRUE, Bool_t rnr_selected=kTRUE)
Render opaque objects from all scenes.
virtual const char * LockIdStr() const
Name to print in locking output.
SceneInfoList_t::iterator SceneInfoList_i
virtual void AddOverlayElement(TGLOverlayElement *el)
Add overlay element.
Bool_t FindClosestRecord(TGLSelectRecord &rec, Int_t &recIdx)
Find next select record that can be resolved, starting from position 'recIdx'.
Mother of all ROOT objects.