Logo ROOT   6.14/05
Reference Guide
TEveTrackProjectedGL.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 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 "TEveTrackProjectedGL.h"
13 #include "TEveTrackProjected.h"
14 #include "TEveTrackPropagator.h"
15 #include "TEveProjectionManager.h"
16 
17 #include "TGLIncludes.h"
18 #include "TGLRnrCtx.h"
19 
20 /** \class TEveTrackProjectedGL
21 \ingroup TEve
22 GL-renderer for TEveTrackProjected class.
23 */
24 
26 
27 ////////////////////////////////////////////////////////////////////////////////
28 /// Constructor.
29 
31 {
32  // fDLCache = kFALSE; // Disable display list.
33 }
34 
35 ////////////////////////////////////////////////////////////////////////////////
36 /// Set model object.
37 
39 {
41  fM = DynCast<TEveTrackProjected>(obj);
42  return kTRUE;
43 }
44 
45 ////////////////////////////////////////////////////////////////////////////////
46 /// Draw track with GL.
47 
49 {
50  // printf("TEveTrackProjectedGL::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD());
51  if (fM->Size() == 0)
52  return;
53 
54  // lines
55  if (fM->fRnrLine)
56  {
57  TGLCapabilityEnabler sw_smooth(GL_LINE_SMOOTH, fM->fSmooth);
58  TGLCapabilityEnabler sw_blend(GL_BLEND, fM->fSmooth);
59  Int_t start = 0;
60  Float_t* p = fM->GetP();
61  TGLUtil::LockColor(); // Keep color from TGLPhysicalShape.
62  for (std::vector<Int_t>::iterator bpi = fM->fBreakPoints.begin();
63  bpi != fM->fBreakPoints.end(); ++bpi)
64  {
65  Int_t size = *bpi - start;
67  p += 3*size;
68  start += size;
69  }
71  }
72 
73  // markers on lines
74  if (fM->fRnrPoints)
75  {
77  fM->GetP(), fM->Size(),
78  rnrCtx.GetPickRadius(),
79  rnrCtx.Selection());
80  }
81 
82  // break-points
83  if (fM->fBreakPoints.size() > 1 && fM->fPropagator->GetRnrPTBMarkers())
84  {
85  // Last break-point is last point on track, do not draw it.
86  Int_t nbp = fM->fBreakPoints.size() - 1;
88  Int_t nbptd = bmb ? 2*nbp : nbp;
89  std::vector<Float_t> pnts(3*nbptd);
90  Int_t n = 0;
91  for (Int_t i = 0; i < nbp; ++i, n+=3)
92  {
93  fM->GetPoint(fM->fBreakPoints[i] - 1, pnts[n], pnts[n+1], pnts[n+2]);
94  if (bmb)
95  {
96  n += 3;
97  fM->GetPoint(fM->fBreakPoints[i], pnts[n], pnts[n+1], pnts[n+2]);
98  }
99  }
101  &pnts[0], nbptd,
102  rnrCtx.GetPickRadius(),
103  rnrCtx.Selection());
104  }
105 
107 }
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition: TGLRnrCtx.h:40
Int_t GetPickRadius()
Return pick radius. If selection is not active it returns 0.
Definition: TGLRnrCtx.cxx:257
virtual Char_t GetMainTransparency() const
Definition: TEveElement.h:279
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
Bool_t Selection() const
Definition: TGLRnrCtx.h:222
Bool_t GetRnrPTBMarkers() const
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TEveTrackPropagator * fPropagator
Last path-mark index tried in track-propagation.
Definition: TEveTrack.h:64
static void RenderPolyMarkers(const TAttMarker &marker, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE, Bool_t sec_selection=kFALSE)
Render polymarkers at points specified by p-array.
Definition: TGLUtil.cxx:1941
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model object.
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=0)
Set model object.
Definition: TEveTrackGL.cxx:38
static UInt_t LockColor()
Prevent further color changes.
Definition: TGLUtil.cxx:1630
static UInt_t UnlockColor()
Allow color changes.
Definition: TGLUtil.cxx:1638
Bool_t fSmooth
Definition: TEveLine.h:37
TEveTrackProjectedGL()
Constructor.
virtual void GetPoint(Int_t n, Float_t &x, Float_t &y, Float_t &z) const
Fills the parameters x, y, z with the coordinate of the n-th point n must be between 0 and Size() - 1...
Bool_t fRnrLine
Definition: TEveLine.h:35
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Draw track with GL.
Bool_t fRnrPoints
Definition: TEveLine.h:36
GL-renderer for TEveTrackProjected class.
GL-renderer for TEveTrack class.
Definition: TEveTrackGL.h:22
#define ClassImp(name)
Definition: Rtypes.h:359
static void RenderPolyLine(const TAttLine &aline, Char_t transp, Float_t *p, Int_t n, Int_t pick_radius=0, Bool_t selection=kFALSE)
Render poly-line as specified by the p-array.
Definition: TGLUtil.cxx:2213
Mother of all ROOT objects.
Definition: TObject.h:37
virtual Float_t * GetP() const
Definition: TPolyMarker3D.h:59
void RenderPathMarksAndFirstVertex(TGLRnrCtx &rnrCtx) const
Render path-marks and the first vertex, if required.
Definition: TEveTrackGL.cxx:78
std::vector< Int_t > fBreakPoints
const Bool_t kTRUE
Definition: RtypesCore.h:87
const Int_t n
Definition: legend1.C:16
virtual Int_t Size() const
Definition: TPolyMarker3D.h:73
TEveTrackProjected * fM
UChar_t GetProjTrackBreaking() const