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