Logo ROOT   6.16/01
Reference Guide
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
25
26////////////////////////////////////////////////////////////////////////////////
27/// Constructor.
28
30 TGLObject(), fHighlightSet(0)
31{
32}
33
34////////////////////////////////////////////////////////////////////////////////
35/// Set color for rendering of the specified digit.
36
38{
40
41 if (DS.fSingleColor)
42 {
43 return kTRUE;
44 }
45 else if (DS.fValueIsColor)
46 {
47 if (q.fValue != 0)
48 {
49 TGLUtil::Color4ubv((UChar_t*) & q.fValue);
50 return kTRUE;
51 } else {
52 return kFALSE;
53 }
54 }
55 else
56 {
57 UChar_t c[4];
58 Bool_t visible = DS.fPalette->ColorFromValue(q.fValue, DS.fDefaultValue, c);
59 if (visible)
61 return visible;
62 }
63}
64
65////////////////////////////////////////////////////////////////////////////////
66/// Make a decision if the frame should be drawn.
67/// This depends on the render state (selection / highligt) and
68/// on values of members fSelectViaFrame and fHighlightFrame.
69
71{
73
74 if (DS.fFrame != 0 && ! rnrCtx.SecSelection() &&
75 ! (rnrCtx.Selection() && ! DS.fSelectViaFrame) &&
76 ! (rnrCtx.Highlight() && ! DS.fHighlightFrame))
77 {
79 }
80}
81
82////////////////////////////////////////////////////////////////////////////////
83/// Set bounding box.
84
86{
88}
89
90////////////////////////////////////////////////////////////////////////////////
91/// Draw the quad-set in highlight mode.
92/// Incoming lvl is ignored -- physical shape always calls it with -1.
93
94void TEveDigitSetGL::DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* pshp, Int_t /*lvl*/) const
95{
97
99 {
100 if ( ! DS.RefHighlightedSet().empty())
101 {
103 TGLObject::DrawHighlight(rnrCtx, pshp, 3);
104 }
105 if ( ! DS.RefSelectedSet().empty())
106 {
108 TGLObject::DrawHighlight(rnrCtx, pshp, 1);
109 }
110 fHighlightSet = 0;
111 }
112 else
113 {
114 TGLObject::DrawHighlight(rnrCtx, pshp);
115 }
116}
117
118////////////////////////////////////////////////////////////////////////////////
119/// Processes secondary selection from TGLViewer.
120/// Calls DigitSelected(Int_t) in the model object with index of
121/// selected point as the argument.
122
124{
126
128 {
129 DS.ProcessGLSelection(rec);
130 }
131 else
132 {
133 if (rec.GetN() < 2) return;
134 DS.DigitSelected(rec.GetItem(1));
135 }
136}
#define c(i)
Definition: RSha256.hxx:101
int Int_t
Definition: RtypesCore.h:41
unsigned char UChar_t
Definition: RtypesCore.h:34
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
float * q
Definition: THbookFile.cxx:87
OpenGL renderer class for TEveDigitSet.
const std::set< Int_t > * fHighlightSet
virtual void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *pshp, Int_t lvl=-1) const
Draw the quad-set in highlight mode.
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Processes secondary selection from TGLViewer.
virtual void SetBBox()
Set bounding box.
void DrawFrameIfNeeded(TGLRnrCtx &rnrCtx) const
Make a decision if the frame should be drawn.
virtual Bool_t AlwaysSecondarySelect() const
Bool_t SetupColor(const TEveDigitSet::DigitBase_t &q) const
Set color for rendering of the specified digit.
TEveDigitSetGL()
Constructor.
Base-class for storage of digit collections; provides transformation matrix (TEveTrans),...
Definition: TEveDigitSet.h:34
Int_t fDefaultValue
Definition: TEveDigitSet.h:60
TEveRGBAPalette * fPalette
Definition: TEveDigitSet.h:71
Bool_t fSingleColor
Definition: TEveDigitSet.h:62
Bool_t fHighlightFrame
Definition: TEveDigitSet.h:74
Bool_t fSelectViaFrame
Definition: TEveDigitSet.h:73
virtual void DigitSelected(Int_t idx)
Called from renderer when a digit with index idx is selected.
TEveFrameBox * fFrame
Definition: TEveDigitSet.h:70
Bool_t fValueIsColor
Definition: TEveDigitSet.h:61
static void Render(const TEveFrameBox *box)
Render the frame-box with GL.
const UChar_t * ColorFromValue(Int_t val) const
const SelectionSet_t & RefHighlightedSet() const
void ProcessGLSelection(TGLSelectRecord &rec)
Process secondary GL selection and populate selected set accordingly.
const SelectionSet_t & RefSelectedSet() const
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:86
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
Bool_t SecSelection() const
Definition: TGLRnrCtx.h:224
Bool_t Highlight() const
Definition: TGLRnrCtx.h:218
Bool_t Selection() const
Definition: TGLRnrCtx.h:222
UInt_t GetItem(Int_t i) const
Int_t GetN() const
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:1790
static void Color3ubv(const UChar_t *rgb)
Wrapper for glColor3ubv.
Definition: TGLUtil.cxx:1782