27#include "TGLIncludes.h"
69 fWFLineW =
gEnv->GetValue(
"OpenGL.WireframeLineScalingFactor", 1.0);
70 fOLLineW =
gEnv->GetValue(
"OpenGL.OutlineLineScalingFactor", 1.0);
80 (*i)->GetScene()->RemoveViewer(
this);
94 return "TGLViewerBase";
108 while (i !=
fScenes.end() && (*i)->GetScene() != scene) ++i;
125 Warning(
"TGLViewerBase::AddScene",
"scene '%s' already in the list.",
143 Warning(
"TGLViewerBase::RemoveScene",
"scene '%s' not found.",
176 Warning(
"TGLViewerBase::SceneDestructing",
"scene not found.");
269 (*i)->ResetSceneStamp();
323 if (cid !=
fRnrCtx->GetGLCtxIdentity())
325 if (
fRnrCtx->GetGLCtxIdentity() !=
nullptr)
326 Warning(
"TGLViewerBase::PreRender",
"Switching to another GL context; maybe you should use context-sharing.");
327 fRnrCtx->SetGLCtxIdentity(cid);
356 Warning(
"TGLViewerBase::PreRender",
"locking of scene '%s' failed, skipping.",
360 locked_scenes.push_back(sinfo);
373 for (
SceneInfoList_i i=locked_scenes.begin(); i!=locked_scenes.end(); ++i)
388 fRnrCtx->SetSceneInfo(
nullptr);
403 for (
Int_t i = 0; i < nScenes; ++i)
410 (scene->*render_foo)(*
fRnrCtx);
413 fRnrCtx->SetSceneInfo(
nullptr);
436 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
437 glDepthMask(GL_FALSE);
441 glDepthMask(GL_TRUE);
454 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
455 glDepthMask(GL_FALSE);
459 glDepthMask(GL_TRUE);
474 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
475 glDepthMask(GL_FALSE);
479 glDepthMask(GL_TRUE);
489 if (rnr_non_selected)
507 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
508 glDepthMask(GL_FALSE);
510 if (rnr_non_selected)
519 glDepthMask(GL_TRUE);
530 for (
Int_t i = 0; i < nOvl; ++i)
535 if (selection) glPushName(i);
537 if (selection) glPopName();
553 fRnrCtx->SetSceneInfo(
nullptr);
627 while (recIdx < sb->GetNRecords())
645 while (recIdx < sb->GetNRecords())
664 while (recIdx < sb->GetNRecords())
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
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...
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
TGLLogicalShape * FindLogical(TObject *logid) const override
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.
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
const char * LockIdStr() const override
Name to print in locking output.
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.
void(TGLSceneBase::* SubRender_foo)(TGLRnrCtx &)
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.
SceneInfoList_t::iterator SceneInfoList_i
~TGLViewerBase() override
Destructor.
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.