3 #include "TPCSector3DGL.h"
4 #include <Alieve/TPCSector3D.h>
6 #include <Reve/BoxSetGL.h>
9 #include <TGLIncludes.h>
12 using namespace Alieve;
14 //______________________________________________________________________
18 ClassImp(TPCSector3DGL)
20 TPCSector3DGL::TPCSector3DGL() :
22 fSector(0), fBoxRnr(0),
25 // fDLCache = false; // Disable display list.
28 TPCSector3DGL::~TPCSector3DGL()
33 /**************************************************************************/
35 Bool_t TPCSector3DGL::SetModel(TObject* obj, const Option_t* /*opt*/)
37 if(SetModelCheckClass(obj, Alieve::TPCSector3D::Class())) {
38 fSector = (TPCSector3D*) fExternalObj;
40 fBoxRnr = new BoxSetGL;
41 fBoxRnr->SetModel(&fSector->fBoxSet);
48 void TPCSector3DGL::SetBBox()
50 SetAxisAlignedBBox(((TPCSector3D*)fExternalObj)->AssertBBox());
53 /**************************************************************************/
55 void TPCSector3DGL::DirectDraw(TGLRnrCtx & rnrCtx) const
57 // printf("TPCSector3DGL::DirectDraw Style %d, LOD %d\n", rnrCtx.Style(), rnrCtx.LOD());
59 if(fRTS < fSector->fRTS) {
60 fSector->UpdateBoxes();
64 Bool_t hasData = (fSector->GetSectorData() != 0);
67 fBoxRnr->Render(rnrCtx);
69 glPushAttrib(GL_CURRENT_BIT | GL_POINT_BIT | GL_ENABLE_BIT);
70 glDisable(GL_LIGHTING);
73 if(hasData && fSector->fPointSetOn) {
75 glEnable(GL_POINT_SMOOTH);
76 glPointSize(fSector->fPointSize);
78 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
79 glEnableClientState(GL_VERTEX_ARRAY);
81 const Reve::PointSetArray& psa = fSector->fPointSetArray;
82 for(Int_t b=0; b<psa.GetNBins(); ++b) {
83 Reve::PointSet* ps = psa.GetBin(b);
85 ColorFromIdx(ps->GetMarkerColor(), col);
88 glVertexPointer(3, GL_FLOAT, 0, ps->GetP());
89 glDrawArrays(GL_POINTS, 0, ps->Size());
96 if(fSector->fRnrFrame) {
97 ColorFromIdx(fSector->fFrameColor, col);
101 DrawSegmentFrame(TPCSectorData::GetInnSeg(), 0, 2);
102 if(fSector->fRnrOut1)
103 DrawSegmentFrame(TPCSectorData::GetOut1Seg(), 2, 1);
104 if(fSector->fRnrOut2)
105 DrawSegmentFrame(TPCSectorData::GetOut2Seg(), 2, 2);
111 void TPCSector3DGL::DrawSegmentFrame(const TPCSectorData::SegmentInfo& s,
112 Int_t botExtraPads, Int_t topExtraPads) const
114 Float_t xl, xh, yl, yh, zl, zh;
115 xl = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetFirstRow()) + botExtraPads);
116 xh = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetLastRow()) + topExtraPads);
118 yh = yl + s.GetNRows()*s.GetPadHeight();
120 zh = TPCSectorData::GetZLength();
122 glBegin(GL_LINE_LOOP);
123 glVertex3f( xl, yl, zl); glVertex3f( xh, yh, zl);
124 glVertex3f(-xh, yh, zl); glVertex3f(-xl, yl, zl);
126 glBegin(GL_LINE_LOOP);
127 glVertex3f( xl, yl, zh); glVertex3f( xh, yh, zh);
128 glVertex3f(-xh, yh, zh); glVertex3f(-xl, yl, zh);
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);