]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/TPCSector3DGL.cxx
Missing initialization; fiddle with the track marker-style a bit more.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector3DGL.cxx
CommitLineData
dcb55984 1// $Header$
2
3#include "TPCSector3DGL.h"
4#include <Alieve/TPCSector3D.h>
5
6#include <Reve/BoxSetGL.h>
7
8#include <TGLDrawFlags.h>
9
10#ifdef WIN32
11#include "Windows4root.h"
12#endif
13#include <GL/gl.h>
14#include <GL/glu.h>
15
16using namespace Reve;
17using namespace Alieve;
18
19//______________________________________________________________________
20// TPCSector3DGL
21//
22
23ClassImp(TPCSector3DGL)
24
265ecb21 25TPCSector3DGL::TPCSector3DGL() :
26 TGLObject(),
27 fSector(0), fBoxRnr(0),
28 fRTS(0)
dcb55984 29{
30 // fCached = false; // Disable display list.
31}
32
33TPCSector3DGL::~TPCSector3DGL()
34{
35 delete fBoxRnr;
36}
37
38/**************************************************************************/
39
40Bool_t TPCSector3DGL::SetModel(TObject* obj)
41{
42#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
43 if(set_model(obj, "Alieve::TPCSector3D")) {
426530cc 44#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
dcb55984 45 if(SetModelCheckClass(obj, "Alieve::TPCSector3D")) {
426530cc 46#else
47 if(SetModelCheckClass(obj, Alieve::TPCSector3D::Class())) {
dcb55984 48#endif
49 fSector = (TPCSector3D*) fExternalObj;
50 if(fBoxRnr == 0) {
51 fBoxRnr = new BoxSetGL;
52 fBoxRnr->SetModel(&fSector->fBoxSet);
53 }
54 return kTRUE;
55 }
56 return kFALSE;
57}
58
59void TPCSector3DGL::SetBBox()
60{
61#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
62 set_axis_aligned_bbox(((TPCSector3D*)fExternalObj)->AssertBBox());
63#else
64 SetAxisAlignedBBox(((TPCSector3D*)fExternalObj)->AssertBBox());
65#endif
66}
67
68/**************************************************************************/
69
70void TPCSector3DGL::DirectDraw(const TGLDrawFlags & flags) const
71{
72 // printf("TPCSector3DGL::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD());
73
7b7bcadc 74 if(fRTS < fSector->fRTS) {
75 fSector->UpdateBoxes();
76 fRTS = fSector->fRTS;
77 }
78
79 Bool_t hasData = (fSector->GetSectorData() != 0);
80
81 if(hasData)
f80216f6 82 fBoxRnr->Render(flags);
dcb55984 83
6a3de3d4 84 glPushAttrib(GL_CURRENT_BIT | GL_POINT_BIT | GL_ENABLE_BIT);
85 glDisable(GL_LIGHTING);
86 UChar_t col[4];
9a7ad6a0 87
7b7bcadc 88 if(hasData && fSector->fPointSetOn) {
9a7ad6a0 89 glEnable(GL_BLEND);
90 glEnable(GL_POINT_SMOOTH);
6a3de3d4 91 glPointSize(fSector->fPointSize);
9a7ad6a0 92
93 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
94 glEnableClientState(GL_VERTEX_ARRAY);
95
96 const Reve::PointSetArray& psa = fSector->fPointSetArray;
97 for(Int_t b=0; b<psa.GetNBins(); ++b) {
98 Reve::PointSet* ps = psa.GetBin(b);
7b7bcadc 99 if(ps->Size() > 0) {
100 ColorFromIdx(ps->GetMarkerColor(), col);
101 glColor4ubv(col);
9a7ad6a0 102
f80216f6 103 glVertexPointer(3, GL_FLOAT, 0, ps->GetP());
7b7bcadc 104 glDrawArrays(GL_POINTS, 0, ps->Size());
f80216f6 105 }
9a7ad6a0 106 }
107
108 glPopClientAttrib();
9a7ad6a0 109 }
110
dcb55984 111 if(fSector->fRnrFrame) {
dcb55984 112 ColorFromIdx(fSector->fFrameColor, col);
113 glColor4ubv(col);
114
115 if(fSector->fRnrInn)
91cb2b7c 116 DrawSegmentFrame(TPCSectorData::GetInnSeg(), 0, 2);
dcb55984 117 if(fSector->fRnrOut1)
91cb2b7c 118 DrawSegmentFrame(TPCSectorData::GetOut1Seg(), 2, 1);
dcb55984 119 if(fSector->fRnrOut2)
91cb2b7c 120 DrawSegmentFrame(TPCSectorData::GetOut2Seg(), 2, 2);
dcb55984 121 }
6a3de3d4 122
123 glPopAttrib();
dcb55984 124}
125
91cb2b7c 126void TPCSector3DGL::DrawSegmentFrame(const TPCSectorData::SegmentInfo& s,
127 Int_t botExtraPads, Int_t topExtraPads) const
dcb55984 128{
129 Float_t xl, xh, yl, yh, zl, zh;
91cb2b7c 130 xl = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetFirstRow()) + botExtraPads);
131 xh = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetLastRow()) + topExtraPads);
dcb55984 132 yl = s.GetRLow();
133 yh = yl + s.GetNRows()*s.GetPadHeight();
6a3de3d4 134 zl = 0;
135 zh = TPCSectorData::GetZLength();
dcb55984 136
137 glBegin(GL_LINE_LOOP);
138 glVertex3f( xl, yl, zl); glVertex3f( xh, yh, zl);
139 glVertex3f(-xh, yh, zl); glVertex3f(-xl, yl, zl);
140 glEnd();
141 glBegin(GL_LINE_LOOP);
142 glVertex3f( xl, yl, zh); glVertex3f( xh, yh, zh);
143 glVertex3f(-xh, yh, zh); glVertex3f(-xl, yl, zh);
144 glEnd();
145 glBegin(GL_LINES);
146 glVertex3f( xl, yl, zl); glVertex3f( xl, yl, zh);
147 glVertex3f( xh, yh, zl); glVertex3f( xh, yh, zh);
148 glVertex3f(-xh, yh, zl); glVertex3f(-xh, yh, zh);
149 glVertex3f(-xl, yl, zl); glVertex3f(-xl, yl, zh);
150 glEnd();
151}