]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveDet/AliEveTPCSector2DGL.h
From Jochen - EveHLT development accumulated since the end of March.
[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 public:
29   AliEveTPCSector2DGL();
30   virtual ~AliEveTPCSector2DGL();
31
32   virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0);
33   virtual void   SetBBox();
34   virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
35
36   virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);
37
38   static void TraceStepsUp  (const AliEveTPCSectorData::SegmentInfo& s);
39   static void TraceStepsDown(const AliEveTPCSectorData::SegmentInfo& s);
40
41 protected:
42   virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;
43
44   void LoadPadrow(AliEveTPCSectorData::RowIterator& iter, Int_t row, Int_t colOff) const;
45   void CreateTexture() const;
46
47   void DisplayTexture(const AliEveTPCSectorData::SegmentInfo& seg,
48                       Int_t startCol, Int_t startRow) const;
49   void DisplayQuads(const AliEveTPCSectorData::SegmentInfo& seg,
50                     Int_t startCol, Int_t startRow) const;
51   void DisplayNamedQuads(const AliEveTPCSectorData::SegmentInfo& seg,
52                          Int_t startCol, Int_t startRow) const;
53   void DisplayFrame() const;
54
55   UChar_t* GetRowCol(Int_t row, Int_t col) const;
56
57   AliEveTPCSector2D              *fSector;     // Model object.
58   mutable AliEveTPCSectorData    *fSectorData; // Data of displayed sector.
59
60   mutable UChar_t                *fImage;      // Texture data.
61   mutable UInt_t                  fTexture;    // Texture id.
62   mutable UInt_t                  fRTS;        // Render time-stamp.
63
64   static const Int_t fgkTextureWidth;     // Width of the texture.
65   static const Int_t fgkTextureHeight;    // Height of the texture.
66   static const Int_t fgkTextureByteSize;  // Size of the texture in bytes.
67
68 private:
69   AliEveTPCSector2DGL(const AliEveTPCSector2DGL&);            // Not implemented
70   AliEveTPCSector2DGL& operator=(const AliEveTPCSector2DGL&); // Not implemented
71
72   ClassDef(AliEveTPCSector2DGL, 0); // GL renderer for AliEveTPCSector2D.
73 };
74
75
76 inline UChar_t* AliEveTPCSector2DGL::GetRowCol(Int_t row, Int_t col) const
77 {
78   return fImage + 4*(row*fgkTextureWidth + col);
79 }
80
81
82 #endif