TEveTrackProjectedGL.cxx

Go to the documentation of this file.
00001 // @(#)root/eve:$Id: TEveTrackProjectedGL.cxx 36384 2010-10-20 14:26:41Z matevz $
00002 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #include "TEveTrackProjectedGL.h"
00013 #include "TEveTrackProjected.h"
00014 #include "TEveTrackPropagator.h"
00015 #include "TEveProjectionManager.h"
00016 
00017 #include "TGLIncludes.h"
00018 #include "TGLRnrCtx.h"
00019 
00020 //==============================================================================
00021 // TEveTrackProjectedGL
00022 //==============================================================================
00023 
00024 //______________________________________________________________________________
00025 //
00026 // GL-renderer for TEveTrackProjected class.
00027 
00028 ClassImp(TEveTrackProjectedGL);
00029 
00030 //______________________________________________________________________________
00031 TEveTrackProjectedGL::TEveTrackProjectedGL() : TEveTrackGL(), fM(0)
00032 {
00033    // Constructor.
00034 
00035    // fDLCache = kFALSE; // Disable display list.
00036 }
00037 
00038 /******************************************************************************/
00039 
00040 //______________________________________________________________________________
00041 Bool_t TEveTrackProjectedGL::SetModel(TObject* obj, const Option_t* /*opt*/)
00042 {
00043    // Set model object.
00044 
00045    TEveTrackGL::SetModel(obj);
00046    fM = DynCast<TEveTrackProjected>(obj);
00047    return kTRUE;
00048 }
00049 
00050 /******************************************************************************/
00051 
00052 //______________________________________________________________________________
00053 void TEveTrackProjectedGL::DirectDraw(TGLRnrCtx& rnrCtx) const
00054 {
00055    // Draw track with GL.
00056 
00057    // printf("TEveTrackProjectedGL::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD());
00058    if (fM->Size() == 0)
00059       return;
00060 
00061    // lines
00062    if (fM->fRnrLine)
00063    {
00064       TGLCapabilityEnabler sw_smooth(GL_LINE_SMOOTH, fM->fSmooth);
00065       TGLCapabilityEnabler sw_blend(GL_BLEND, fM->fSmooth);
00066       Int_t start = 0;
00067       Float_t* p  = fM->GetP();
00068       TGLUtil::LockColor(); // Keep color from TGLPhysicalShape.
00069       for (std::vector<Int_t>::iterator bpi = fM->fBreakPoints.begin();
00070            bpi != fM->fBreakPoints.end(); ++bpi)
00071       {
00072          Int_t size = *bpi - start;
00073          TGLUtil::RenderPolyLine(*fM, fM->GetMainTransparency(), p, size);
00074          p     += 3*size;
00075          start +=   size;
00076       }
00077       TGLUtil::UnlockColor();
00078    }
00079 
00080    // markers on lines
00081    if (fM->fRnrPoints)
00082    {
00083       TGLUtil::RenderPolyMarkers(*fM, 0,
00084                                  fM->GetP(), fM->Size(),
00085                                  rnrCtx.GetPickRadius(),
00086                                  rnrCtx.Selection());
00087    }
00088 
00089    // break-points
00090    if (fM->fBreakPoints.size() > 1 && fM->fPropagator->GetRnrPTBMarkers())
00091    {
00092       // Last break-point is last point on track, do not draw it.
00093       Int_t  nbp   = fM->fBreakPoints.size() - 1;
00094       Bool_t bmb   = fM->fPropagator->GetProjTrackBreaking() == TEveTrackPropagator::kPTB_Break;
00095       Int_t  nbptd = bmb ? 2*nbp : nbp;
00096       std::vector<Float_t> pnts(3*nbptd);
00097       Int_t n = 0;
00098       for (Int_t i = 0; i < nbp; ++i, n+=3)
00099       {
00100          fM->GetPoint(fM->fBreakPoints[i] - 1, pnts[n], pnts[n+1], pnts[n+2]);
00101          if (bmb)
00102          {
00103             n += 3;
00104             fM->GetPoint(fM->fBreakPoints[i], pnts[n], pnts[n+1], pnts[n+2]);
00105          }
00106       }
00107       TGLUtil::RenderPolyMarkers(fM->fPropagator->RefPTBAtt(), 0,
00108                                  &pnts[0], nbptd,
00109                                  rnrCtx.GetPickRadius(),
00110                                  rnrCtx.Selection());
00111    }
00112 
00113    RenderPathMarksAndFirstVertex(rnrCtx);
00114 }

Generated on Tue Jul 5 14:16:14 2011 for ROOT_528-00b_version by  doxygen 1.5.1