00001
00002
00003
00004
00005
00006
00007
00008
00009
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
00022
00023
00024
00025
00026
00027
00028 ClassImp(TEveTrackProjectedGL);
00029
00030
00031 TEveTrackProjectedGL::TEveTrackProjectedGL() : TEveTrackGL(), fM(0)
00032 {
00033
00034
00035
00036 }
00037
00038
00039
00040
00041 Bool_t TEveTrackProjectedGL::SetModel(TObject* obj, const Option_t* )
00042 {
00043
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
00056
00057
00058 if (fM->Size() == 0)
00059 return;
00060
00061
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();
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
00081 if (fM->fRnrPoints)
00082 {
00083 TGLUtil::RenderPolyMarkers(*fM, 0,
00084 fM->GetP(), fM->Size(),
00085 rnrCtx.GetPickRadius(),
00086 rnrCtx.Selection());
00087 }
00088
00089
00090 if (fM->fBreakPoints.size() > 1 && fM->fPropagator->GetRnrPTBMarkers())
00091 {
00092
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 }