#include "AliEveTPCSector3DGL.h"
#include <EveDet/AliEveTPCSector3D.h>
#include <TEveBoxSetGL.h>
#include <TGLIncludes.h>
#include <TGLRnrCtx.h>
#include <TGLSelectRecord.h>
ClassImp(AliEveTPCSector3DGL)
AliEveTPCSector3DGL::AliEveTPCSector3DGL() :
TGLObject(),
fSector(0), fBoxRnr(0),
fRTS(0)
{
fDLCache = false;
}
AliEveTPCSector3DGL::~AliEveTPCSector3DGL()
{
delete fBoxRnr;
}
Short_t AliEveTPCSector3DGL::QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD) const
{
Int_t lod = ((Int_t)shapeLOD * (Int_t)combiLOD) / 100;
if (lod >= 100)
return 100;
else
return (Short_t)(10 * TMath::Nint(0.1*lod));
}
Bool_t AliEveTPCSector3DGL::SetModel(TObject* obj, const Option_t* )
{
if(SetModelCheckClass(obj, AliEveTPCSector3D::Class())) {
fSector = (AliEveTPCSector3D*) fExternalObj;
if(fBoxRnr == 0) {
fBoxRnr = new TEveBoxSetGL;
fBoxRnr->SetModel(&fSector->fBoxSet);
}
return kTRUE;
}
return kFALSE;
}
void AliEveTPCSector3DGL::SetBBox()
{
SetAxisAlignedBBox(((AliEveTPCSector3D*)fExternalObj)->AssertBBox());
}
void AliEveTPCSector3DGL::DirectDraw(TGLRnrCtx & rnrCtx) const
{
if(fRTS < fSector->fRTS) {
fSector->UpdateBoxesAndPoints();
fRTS = fSector->fRTS;
}
if (rnrCtx.SecSelection()) glPushName(0);
Bool_t hasData = (fSector->GetSectorData() != 0);
if(hasData)
{
if (rnrCtx.SecSelection()) glLoadName(9999);
fBoxRnr->Render(rnrCtx);
}
glPushAttrib(GL_CURRENT_BIT | GL_POINT_BIT | GL_ENABLE_BIT);
glDisable(GL_LIGHTING);
if(hasData && fSector->fPointSetOn)
{
glEnable(GL_BLEND);
glEnable(GL_POINT_SMOOTH);
glPointSize(fSector->fPointSize);
glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
glEnableClientState(GL_VERTEX_ARRAY);
const TEvePointSetArray& psa = fSector->fPointSetArray;
for(Int_t b=0; b<psa.GetNBins(); ++b)
{
TEvePointSet* ps = psa.GetBin(b);
if(ps->Size() > 0)
{
TGLUtil::Color(ps->GetMarkerColor());
if (rnrCtx.SecSelection()) glLoadName(b + 1);
glVertexPointer(3, GL_FLOAT, 0, ps->GetP());
glDrawArrays(GL_POINTS, 0, ps->Size());
}
}
glPopClientAttrib();
}
if(fSector->fRnrFrame && ! rnrCtx.SecSelection())
{
TGLUtil::Color(fSector->fFrameColor);
if(fSector->fRnrInn)
DrawSegmentFrame(AliEveTPCSectorData::GetInnSeg(), 0, 2);
if(fSector->fRnrOut1)
DrawSegmentFrame(AliEveTPCSectorData::GetOut1Seg(), 2, 1);
if(fSector->fRnrOut2)
DrawSegmentFrame(AliEveTPCSectorData::GetOut2Seg(), 2, 2);
}
glPopAttrib();
}
void AliEveTPCSector3DGL::DrawSegmentFrame(const AliEveTPCSectorData::SegmentInfo& s,
Int_t botExtraPads, Int_t topExtraPads) const
{
Float_t xl, xh, yl, yh, zl, zh;
xl = 0.5*s.GetPadWidth()*(AliEveTPCSectorData::GetNPadsInRow(s.GetFirstRow()) + botExtraPads);
xh = 0.5*s.GetPadWidth()*(AliEveTPCSectorData::GetNPadsInRow(s.GetLastRow()) + topExtraPads);
yl = s.GetRLow();
yh = yl + s.GetNRows()*s.GetPadHeight();
zl = 0;
zh = AliEveTPCSectorData::GetZLength();
glBegin(GL_LINE_LOOP);
glVertex3f( xl, yl, zl); glVertex3f( xh, yh, zl);
glVertex3f(-xh, yh, zl); glVertex3f(-xl, yl, zl);
glEnd();
glBegin(GL_LINE_LOOP);
glVertex3f( xl, yl, zh); glVertex3f( xh, yh, zh);
glVertex3f(-xh, yh, zh); glVertex3f(-xl, yl, zh);
glEnd();
glBegin(GL_LINES);
glVertex3f( xl, yl, zl); glVertex3f( xl, yl, zh);
glVertex3f( xh, yh, zl); glVertex3f( xh, yh, zh);
glVertex3f(-xh, yh, zl); glVertex3f(-xh, yh, zh);
glVertex3f(-xl, yl, zl); glVertex3f(-xl, yl, zh);
glEnd();
}
void AliEveTPCSector3DGL::ProcessSelection(TGLRnrCtx & , TGLSelectRecord & rec)
{
if (rec.GetN() < 3) return;
if (rec.GetItem(1) == 9999)
{
printf("TPC3D Box selected idx=%u\n", rec.GetItem(2));
return;
}
const TEvePointSetArray& psa = fSector->fPointSetArray;
if (rec.GetItem(1) > 0 && rec.GetItem(1) <= (UInt_t) psa.GetNBins())
{
printf("TPC3D Point selected, bin=%u, idx=%u\n", rec.GetItem(1) - 1, rec.GetItem(2));
return;
}
}
AliEveTPCSector3DGL.cxx:1 AliEveTPCSector3DGL.cxx:2 AliEveTPCSector3DGL.cxx:3 AliEveTPCSector3DGL.cxx:4 AliEveTPCSector3DGL.cxx:5 AliEveTPCSector3DGL.cxx:6 AliEveTPCSector3DGL.cxx:7 AliEveTPCSector3DGL.cxx:8 AliEveTPCSector3DGL.cxx:9 AliEveTPCSector3DGL.cxx:10 AliEveTPCSector3DGL.cxx:11 AliEveTPCSector3DGL.cxx:12 AliEveTPCSector3DGL.cxx:13 AliEveTPCSector3DGL.cxx:14 AliEveTPCSector3DGL.cxx:15 AliEveTPCSector3DGL.cxx:16 AliEveTPCSector3DGL.cxx:17 AliEveTPCSector3DGL.cxx:18 AliEveTPCSector3DGL.cxx:19 AliEveTPCSector3DGL.cxx:20 AliEveTPCSector3DGL.cxx:21 AliEveTPCSector3DGL.cxx:22 AliEveTPCSector3DGL.cxx:23 AliEveTPCSector3DGL.cxx:24 AliEveTPCSector3DGL.cxx:25 AliEveTPCSector3DGL.cxx:26 AliEveTPCSector3DGL.cxx:27 AliEveTPCSector3DGL.cxx:28 AliEveTPCSector3DGL.cxx:29 AliEveTPCSector3DGL.cxx:30 AliEveTPCSector3DGL.cxx:31 AliEveTPCSector3DGL.cxx:32 AliEveTPCSector3DGL.cxx:33 AliEveTPCSector3DGL.cxx:34 AliEveTPCSector3DGL.cxx:35 AliEveTPCSector3DGL.cxx:36 AliEveTPCSector3DGL.cxx:37 AliEveTPCSector3DGL.cxx:38 AliEveTPCSector3DGL.cxx:39 AliEveTPCSector3DGL.cxx:40 AliEveTPCSector3DGL.cxx:41 AliEveTPCSector3DGL.cxx:42 AliEveTPCSector3DGL.cxx:43 AliEveTPCSector3DGL.cxx:44 AliEveTPCSector3DGL.cxx:45 AliEveTPCSector3DGL.cxx:46 AliEveTPCSector3DGL.cxx:47 AliEveTPCSector3DGL.cxx:48 AliEveTPCSector3DGL.cxx:49 AliEveTPCSector3DGL.cxx:50 AliEveTPCSector3DGL.cxx:51 AliEveTPCSector3DGL.cxx:52 AliEveTPCSector3DGL.cxx:53 AliEveTPCSector3DGL.cxx:54 AliEveTPCSector3DGL.cxx:55 AliEveTPCSector3DGL.cxx:56 AliEveTPCSector3DGL.cxx:57 AliEveTPCSector3DGL.cxx:58 AliEveTPCSector3DGL.cxx:59 AliEveTPCSector3DGL.cxx:60 AliEveTPCSector3DGL.cxx:61 AliEveTPCSector3DGL.cxx:62 AliEveTPCSector3DGL.cxx:63 AliEveTPCSector3DGL.cxx:64 AliEveTPCSector3DGL.cxx:65 AliEveTPCSector3DGL.cxx:66 AliEveTPCSector3DGL.cxx:67 AliEveTPCSector3DGL.cxx:68 AliEveTPCSector3DGL.cxx:69 AliEveTPCSector3DGL.cxx:70 AliEveTPCSector3DGL.cxx:71 AliEveTPCSector3DGL.cxx:72 AliEveTPCSector3DGL.cxx:73 AliEveTPCSector3DGL.cxx:74 AliEveTPCSector3DGL.cxx:75 AliEveTPCSector3DGL.cxx:76 AliEveTPCSector3DGL.cxx:77 AliEveTPCSector3DGL.cxx:78 AliEveTPCSector3DGL.cxx:79 AliEveTPCSector3DGL.cxx:80 AliEveTPCSector3DGL.cxx:81 AliEveTPCSector3DGL.cxx:82 AliEveTPCSector3DGL.cxx:83 AliEveTPCSector3DGL.cxx:84 AliEveTPCSector3DGL.cxx:85 AliEveTPCSector3DGL.cxx:86 AliEveTPCSector3DGL.cxx:87 AliEveTPCSector3DGL.cxx:88 AliEveTPCSector3DGL.cxx:89 AliEveTPCSector3DGL.cxx:90 AliEveTPCSector3DGL.cxx:91 AliEveTPCSector3DGL.cxx:92 AliEveTPCSector3DGL.cxx:93 AliEveTPCSector3DGL.cxx:94 AliEveTPCSector3DGL.cxx:95 AliEveTPCSector3DGL.cxx:96 AliEveTPCSector3DGL.cxx:97 AliEveTPCSector3DGL.cxx:98 AliEveTPCSector3DGL.cxx:99 AliEveTPCSector3DGL.cxx:100 AliEveTPCSector3DGL.cxx:101 AliEveTPCSector3DGL.cxx:102 AliEveTPCSector3DGL.cxx:103 AliEveTPCSector3DGL.cxx:104 AliEveTPCSector3DGL.cxx:105 AliEveTPCSector3DGL.cxx:106 AliEveTPCSector3DGL.cxx:107 AliEveTPCSector3DGL.cxx:108 AliEveTPCSector3DGL.cxx:109 AliEveTPCSector3DGL.cxx:110 AliEveTPCSector3DGL.cxx:111 AliEveTPCSector3DGL.cxx:112 AliEveTPCSector3DGL.cxx:113 AliEveTPCSector3DGL.cxx:114 AliEveTPCSector3DGL.cxx:115 AliEveTPCSector3DGL.cxx:116 AliEveTPCSector3DGL.cxx:117 AliEveTPCSector3DGL.cxx:118 AliEveTPCSector3DGL.cxx:119 AliEveTPCSector3DGL.cxx:120 AliEveTPCSector3DGL.cxx:121 AliEveTPCSector3DGL.cxx:122 AliEveTPCSector3DGL.cxx:123 AliEveTPCSector3DGL.cxx:124 AliEveTPCSector3DGL.cxx:125 AliEveTPCSector3DGL.cxx:126 AliEveTPCSector3DGL.cxx:127 AliEveTPCSector3DGL.cxx:128 AliEveTPCSector3DGL.cxx:129 AliEveTPCSector3DGL.cxx:130 AliEveTPCSector3DGL.cxx:131 AliEveTPCSector3DGL.cxx:132 AliEveTPCSector3DGL.cxx:133 AliEveTPCSector3DGL.cxx:134 AliEveTPCSector3DGL.cxx:135 AliEveTPCSector3DGL.cxx:136 AliEveTPCSector3DGL.cxx:137 AliEveTPCSector3DGL.cxx:138 AliEveTPCSector3DGL.cxx:139 AliEveTPCSector3DGL.cxx:140 AliEveTPCSector3DGL.cxx:141 AliEveTPCSector3DGL.cxx:142 AliEveTPCSector3DGL.cxx:143 AliEveTPCSector3DGL.cxx:144 AliEveTPCSector3DGL.cxx:145 AliEveTPCSector3DGL.cxx:146 AliEveTPCSector3DGL.cxx:147 AliEveTPCSector3DGL.cxx:148 AliEveTPCSector3DGL.cxx:149 AliEveTPCSector3DGL.cxx:150 AliEveTPCSector3DGL.cxx:151 AliEveTPCSector3DGL.cxx:152 AliEveTPCSector3DGL.cxx:153 AliEveTPCSector3DGL.cxx:154 AliEveTPCSector3DGL.cxx:155 AliEveTPCSector3DGL.cxx:156 AliEveTPCSector3DGL.cxx:157 AliEveTPCSector3DGL.cxx:158 AliEveTPCSector3DGL.cxx:159 AliEveTPCSector3DGL.cxx:160 AliEveTPCSector3DGL.cxx:161 AliEveTPCSector3DGL.cxx:162 AliEveTPCSector3DGL.cxx:163 AliEveTPCSector3DGL.cxx:164 AliEveTPCSector3DGL.cxx:165 AliEveTPCSector3DGL.cxx:166 AliEveTPCSector3DGL.cxx:167 AliEveTPCSector3DGL.cxx:168 AliEveTPCSector3DGL.cxx:169 AliEveTPCSector3DGL.cxx:170 AliEveTPCSector3DGL.cxx:171 AliEveTPCSector3DGL.cxx:172 AliEveTPCSector3DGL.cxx:173 AliEveTPCSector3DGL.cxx:174 AliEveTPCSector3DGL.cxx:175 AliEveTPCSector3DGL.cxx:176 AliEveTPCSector3DGL.cxx:177 AliEveTPCSector3DGL.cxx:178 AliEveTPCSector3DGL.cxx:179 AliEveTPCSector3DGL.cxx:180 AliEveTPCSector3DGL.cxx:181 AliEveTPCSector3DGL.cxx:182 AliEveTPCSector3DGL.cxx:183 AliEveTPCSector3DGL.cxx:184 AliEveTPCSector3DGL.cxx:185 AliEveTPCSector3DGL.cxx:186 AliEveTPCSector3DGL.cxx:187 AliEveTPCSector3DGL.cxx:188 AliEveTPCSector3DGL.cxx:189 AliEveTPCSector3DGL.cxx:190 AliEveTPCSector3DGL.cxx:191 AliEveTPCSector3DGL.cxx:192 AliEveTPCSector3DGL.cxx:193 AliEveTPCSector3DGL.cxx:194 AliEveTPCSector3DGL.cxx:195 AliEveTPCSector3DGL.cxx:196 AliEveTPCSector3DGL.cxx:197 AliEveTPCSector3DGL.cxx:198 AliEveTPCSector3DGL.cxx:199 AliEveTPCSector3DGL.cxx:200 AliEveTPCSector3DGL.cxx:201 AliEveTPCSector3DGL.cxx:202 AliEveTPCSector3DGL.cxx:203