ROOT logo
// $Id$
// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007

/**************************************************************************
 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
 * full copyright notice.                                                 *
 **************************************************************************/

#ifndef AliEveTPCSector2DGL_H
#define AliEveTPCSector2DGL_H

#include <TGLObject.h>
class TGLViewer;
class TGLScene;

#include <EveDet/AliEveTPCSectorData.h>
class AliEveTPCSector2D;

//------------------------------------------------------------------------------
// AliEveTPCSector2DGL
//
// GL renderer for AliEveTPCSector2D.
//

class AliEveTPCSector2DGL : public TGLObject
{
public:
  AliEveTPCSector2DGL();
  virtual ~AliEveTPCSector2DGL();

  virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0);
  virtual void   SetBBox();
  virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }

  virtual void ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);

  static void TraceStepsUp  (const AliEveTPCSectorData::SegmentInfo& s);
  static void TraceStepsDown(const AliEveTPCSectorData::SegmentInfo& s);

protected:
  virtual void DirectDraw(TGLRnrCtx & rnrCtx) const;

  void LoadPadrow(AliEveTPCSectorData::RowIterator& iter, Int_t row, Int_t colOff) const;
  void CreateTexture() const;

  void DisplayTexture(const AliEveTPCSectorData::SegmentInfo& seg,
                      Int_t startCol, Int_t startRow) const;
  void DisplayQuads(const AliEveTPCSectorData::SegmentInfo& seg,
		    Int_t startCol, Int_t startRow) const;
  void DisplayNamedQuads(const AliEveTPCSectorData::SegmentInfo& seg,
			 Int_t startCol, Int_t startRow) const;
  void DisplayFrame() const;

  UChar_t* GetRowCol(Int_t row, Int_t col) const;

  AliEveTPCSector2D              *fSector;     // Model object.
  mutable AliEveTPCSectorData    *fSectorData; // Data of displayed sector.

  mutable UChar_t                *fImage;      // Texture data.
  mutable UInt_t                  fTexture;    // Texture id.
  mutable UInt_t                  fRTS;        // Render time-stamp.

  static const Int_t fgkTextureWidth;     // Width of the texture.
  static const Int_t fgkTextureHeight;    // Height of the texture.
  static const Int_t fgkTextureByteSize;  // Size of the texture in bytes.

private:
  AliEveTPCSector2DGL(const AliEveTPCSector2DGL&);            // Not implemented
  AliEveTPCSector2DGL& operator=(const AliEveTPCSector2DGL&); // Not implemented

  ClassDef(AliEveTPCSector2DGL, 0); // GL renderer for AliEveTPCSector2D.
};


inline UChar_t* AliEveTPCSector2DGL::GetRowCol(Int_t row, Int_t col) const
{
  return fImage + 4*(row*fgkTextureWidth + col);
}


#endif
 AliEveTPCSector2DGL.h:1
 AliEveTPCSector2DGL.h:2
 AliEveTPCSector2DGL.h:3
 AliEveTPCSector2DGL.h:4
 AliEveTPCSector2DGL.h:5
 AliEveTPCSector2DGL.h:6
 AliEveTPCSector2DGL.h:7
 AliEveTPCSector2DGL.h:8
 AliEveTPCSector2DGL.h:9
 AliEveTPCSector2DGL.h:10
 AliEveTPCSector2DGL.h:11
 AliEveTPCSector2DGL.h:12
 AliEveTPCSector2DGL.h:13
 AliEveTPCSector2DGL.h:14
 AliEveTPCSector2DGL.h:15
 AliEveTPCSector2DGL.h:16
 AliEveTPCSector2DGL.h:17
 AliEveTPCSector2DGL.h:18
 AliEveTPCSector2DGL.h:19
 AliEveTPCSector2DGL.h:20
 AliEveTPCSector2DGL.h:21
 AliEveTPCSector2DGL.h:22
 AliEveTPCSector2DGL.h:23
 AliEveTPCSector2DGL.h:24
 AliEveTPCSector2DGL.h:25
 AliEveTPCSector2DGL.h:26
 AliEveTPCSector2DGL.h:27
 AliEveTPCSector2DGL.h:28
 AliEveTPCSector2DGL.h:29
 AliEveTPCSector2DGL.h:30
 AliEveTPCSector2DGL.h:31
 AliEveTPCSector2DGL.h:32
 AliEveTPCSector2DGL.h:33
 AliEveTPCSector2DGL.h:34
 AliEveTPCSector2DGL.h:35
 AliEveTPCSector2DGL.h:36
 AliEveTPCSector2DGL.h:37
 AliEveTPCSector2DGL.h:38
 AliEveTPCSector2DGL.h:39
 AliEveTPCSector2DGL.h:40
 AliEveTPCSector2DGL.h:41
 AliEveTPCSector2DGL.h:42
 AliEveTPCSector2DGL.h:43
 AliEveTPCSector2DGL.h:44
 AliEveTPCSector2DGL.h:45
 AliEveTPCSector2DGL.h:46
 AliEveTPCSector2DGL.h:47
 AliEveTPCSector2DGL.h:48
 AliEveTPCSector2DGL.h:49
 AliEveTPCSector2DGL.h:50
 AliEveTPCSector2DGL.h:51
 AliEveTPCSector2DGL.h:52
 AliEveTPCSector2DGL.h:53
 AliEveTPCSector2DGL.h:54
 AliEveTPCSector2DGL.h:55
 AliEveTPCSector2DGL.h:56
 AliEveTPCSector2DGL.h:57
 AliEveTPCSector2DGL.h:58
 AliEveTPCSector2DGL.h:59
 AliEveTPCSector2DGL.h:60
 AliEveTPCSector2DGL.h:61
 AliEveTPCSector2DGL.h:62
 AliEveTPCSector2DGL.h:63
 AliEveTPCSector2DGL.h:64
 AliEveTPCSector2DGL.h:65
 AliEveTPCSector2DGL.h:66
 AliEveTPCSector2DGL.h:67
 AliEveTPCSector2DGL.h:68
 AliEveTPCSector2DGL.h:69
 AliEveTPCSector2DGL.h:70
 AliEveTPCSector2DGL.h:71
 AliEveTPCSector2DGL.h:72
 AliEveTPCSector2DGL.h:73
 AliEveTPCSector2DGL.h:74
 AliEveTPCSector2DGL.h:75
 AliEveTPCSector2DGL.h:76
 AliEveTPCSector2DGL.h:77
 AliEveTPCSector2DGL.h:78
 AliEveTPCSector2DGL.h:79
 AliEveTPCSector2DGL.h:80
 AliEveTPCSector2DGL.h:81
 AliEveTPCSector2DGL.h:82