Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveDigitSetGL.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "TEveDigitSetGL.h"
13#include "TEveFrameBoxGL.h"
14
15#include "TGLRnrCtx.h"
16#include "TGLSelectRecord.h"
17#include "TGLIncludes.h"
18
19/** \class TEveDigitSetGL
20\ingroup TEve
21OpenGL renderer class for TEveDigitSet.
22*/
23
24
25////////////////////////////////////////////////////////////////////////////////
26/// Constructor.
27
29 TGLObject(), fHighlightSet(nullptr)
30{
31}
32
33////////////////////////////////////////////////////////////////////////////////
34/// Set color for rendering of the specified digit.
35
37{
39
40 if (DS.fSingleColor)
41 {
42 return kTRUE;
43 }
44 else if (DS.fValueIsColor)
45 {
46 if (q.fValue != 0)
47 {
48 TGLUtil::Color4ubv((UChar_t*) & q.fValue);
49 return kTRUE;
50 } else {
51 return kFALSE;
52 }
53 }
54 else
55 {
56 UChar_t c[4];
57 Bool_t visible = DS.fPalette->ColorFromValue(q.fValue, DS.fDefaultValue, c);
58 if (visible)
60 return visible;
61 }
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Make a decision if the frame should be drawn.
66/// This depends on the render state (selection / highligt) and
67/// on values of members fSelectViaFrame and fHighlightFrame.
68
70{
72
73 if (DS.fFrame != nullptr && ! rnrCtx.SecSelection() &&
74 ! (rnrCtx.Selection() && ! DS.fSelectViaFrame) &&
75 ! (rnrCtx.Highlight() && ! DS.fHighlightFrame))
76 {
78 }
79}
80
81////////////////////////////////////////////////////////////////////////////////
82/// Set bounding box.
83
88
89////////////////////////////////////////////////////////////////////////////////
90/// Draw the quad-set in highlight mode.
91/// Incoming lvl is ignored -- physical shape always calls it with -1.
92
94{
96
98 {
99 if ( ! DS.RefHighlightedSet().empty())
100 {
101 fHighlightSet = & DS.RefHighlightedSet();
103 }
104 if ( ! DS.RefSelectedSet().empty())
105 {
106 fHighlightSet = & DS.RefSelectedSet();
108 }
109 fHighlightSet = nullptr;
110 }
111 else
112 {
114 }
115}
116
117////////////////////////////////////////////////////////////////////////////////
118/// Processes secondary selection from TGLViewer.
119/// Calls DigitSelected(Int_t) in the model object with index of
120/// selected point as the argument.
121
123{
125
127 {
128 DS.ProcessGLSelection(rec);
129 }
130 else
131 {
132 if (rec.GetN() < 2) return;
133 DS.DigitSelected(rec.GetItem(1));
134 }
135}
#define c(i)
Definition RSha256.hxx:101
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
float * q
Bool_t AlwaysSecondarySelect() const override
const std::set< Int_t > * fHighlightSet
void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec) override
Processes secondary selection from TGLViewer.
void DrawFrameIfNeeded(TGLRnrCtx &rnrCtx) const
Make a decision if the frame should be drawn.
void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *pshp, Int_t lvl=-1) const override
Draw the quad-set in highlight mode.
Bool_t SetupColor(const TEveDigitSet::DigitBase_t &q) const
Set color for rendering of the specified digit.
void SetBBox() override
Set bounding box.
TEveDigitSetGL()
Constructor.
Base-class for storage of digit collections; provides transformation matrix (TEveTrans),...
static void Render(const TEveFrameBox *box)
Render the frame-box with GL.
TObject * fExternalObj
first replica
virtual void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *pshp, Int_t lvl=-1) const
Draw the logical shape in highlight mode.
Base-class for direct OpenGL renderers.
Definition TGLObject.h:22
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
Definition TGLObject.cxx:85
Concrete physical shape - a GL drawable.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
Standard selection record including information about containing scene and details ob out selected ob...
static void Color4ubv(const UChar_t *rgba)
Wrapper for glColor4ubv.
Definition TGLUtil.cxx:1770
static void Color3ubv(const UChar_t *rgb)
Wrapper for glColor3ubv.
Definition TGLUtil.cxx:1762