]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveTPCSector2DGL.h
Merge changes from branches/dev/EVE. This branch was following development in ROOT...
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTPCSector2DGL.h
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #ifndef AliEveTPCSector2DGL_H
11 #define AliEveTPCSector2DGL_H
12
13 #include <TGLObject.h>
14 class TGLViewer;
15 class TGLScene;
16
17 #include <EveDet/AliEveTPCSectorData.h>
18 class AliEveTPCSector2D;
19
20 //------------------------------------------------------------------------------
21 // AliEveTPCSector2DGL
22 //
23 // GL renderer for AliEveTPCSector2D.
24 //
25
26 class AliEveTPCSector2DGL : public TGLObject
27 {
28   AliEveTPCSector2DGL(const AliEveTPCSector2DGL&);            // Not implemented
29   AliEveTPCSector2DGL& operator=(const AliEveTPCSector2DGL&); // Not implemented
30
31 protected:
32   virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
33
34   void LoadPadrow(AliEveTPCSectorData::RowIterator& iter, Int_t row, Int_t colOff) const;
35   void CreateTexture() const;
36
37   void DisplayTexture(const AliEveTPCSectorData::SegmentInfo& seg,
38                       Int_t startCol, Int_t startRow) const;
39   void DisplayQuads(const AliEveTPCSectorData::SegmentInfo& seg,
40                     Int_t startCol, Int_t startRow) const;
41   void DisplayNamedQuads(const AliEveTPCSectorData::SegmentInfo& seg,
42                          Int_t startCol, Int_t startRow) const;
43   void DisplayFrame() const;
44
45   UChar_t* GetRowCol(Int_t row, Int_t col) const;
46
47   AliEveTPCSector2D              *fSector;     // Model object.
48   mutable AliEveTPCSectorData    *fSectorData; // Data of displayed sector.
49
50   mutable UChar_t                *fImage;      // Texture data.
51   mutable UInt_t                  fTexture;    // Texture id.
52   mutable UInt_t                  fRTS;        // Render time-stamp.
53
54   static const Int_t fgkTextureWidth;     // Width of the texture.
55   static const Int_t fgkTextureHeight;    // Height of the texture.
56   static const Int_t fgkTextureByteSize;  // Size of the texture in bytes.
57
58 public:
59   AliEveTPCSector2DGL();
60   virtual ~AliEveTPCSector2DGL();
61
62   virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0);
63   virtual void   SetBBox();
64   virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
65
66   virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
67
68   static void TraceStepsUp  (const AliEveTPCSectorData::SegmentInfo& s);
69   static void TraceStepsDown(const AliEveTPCSectorData::SegmentInfo& s);
70
71   ClassDef(AliEveTPCSector2DGL, 0); // GL renderer for AliEveTPCSector2D.
72 };
73
74
75 inline UChar_t* AliEveTPCSector2DGL::GetRowCol(Int_t row, Int_t col) const
76 {
77   return fImage + 4*(row*fgkTextureWidth + col);
78 }
79
80
81 #endif