// @(#)root/eve:$Id$
// Author: Matevz Tadel 2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TEveCalo3DGL
#define ROOT_TEveCalo3DGL

#include "TGLObject.h"
#include "TEveCaloData.h"

class TEveCalo3D;

class TEveCalo3DGL : public TGLObject
{
private:
   TEveCalo3DGL(const TEveCalo3DGL&);            // Not implemented
   TEveCalo3DGL& operator=(const TEveCalo3DGL&); // Not implemented

   void    CrossProduct(const Float_t a[3], const Float_t b[3], const Float_t c[3], Float_t out[3]) const;

   void    RenderBox(const Float_t pnts[8]) const;
   void    RenderGridEndCap() const;
   void    RenderGridBarrel() const;
   void    RenderGrid(TGLRnrCtx & rnrCtx) const;
   void    RenderBarrelCell(const TEveCaloData::CellGeom_t &cell, Float_t towerH, Float_t& offset) const;
   void    RenderEndCapCell(const TEveCaloData::CellGeom_t &cell, Float_t towerH, Float_t& offset) const;

   void    DrawSelectedCells(TEveCaloData::vCellId_t cells) const;

protected:
   TEveCalo3D     *fM;  // Model object.

   mutable std::vector<Float_t>     fOffset;

public:
   TEveCalo3DGL();
   virtual ~TEveCalo3DGL() {}

   virtual Bool_t SetModel(TObject* obj, const Option_t* opt=0);
   virtual void   SetBBox();

   virtual void   DirectDraw(TGLRnrCtx & rnrCtx) const;
   virtual void   DrawHighlight(TGLRnrCtx & rnrCtx, const TGLPhysicalShape* ps, Int_t lvl=-1) const;

   virtual Bool_t ShouldDLCache(const TGLRnrCtx& rnrCtx) const;
   virtual Bool_t SupportsSecondarySelect() const { return kTRUE; }
   virtual Bool_t AlwaysSecondarySelect()   const { return kTRUE; }
   virtual void   ProcessSelection(TGLRnrCtx & rnrCtx, TGLSelectRecord & rec);

   ClassDef(TEveCalo3DGL, 0); // GL renderer class for TEveCalo.
};

#endif
 TEveCalo3DGL.h:1
 TEveCalo3DGL.h:2
 TEveCalo3DGL.h:3
 TEveCalo3DGL.h:4
 TEveCalo3DGL.h:5
 TEveCalo3DGL.h:6
 TEveCalo3DGL.h:7
 TEveCalo3DGL.h:8
 TEveCalo3DGL.h:9
 TEveCalo3DGL.h:10
 TEveCalo3DGL.h:11
 TEveCalo3DGL.h:12
 TEveCalo3DGL.h:13
 TEveCalo3DGL.h:14
 TEveCalo3DGL.h:15
 TEveCalo3DGL.h:16
 TEveCalo3DGL.h:17
 TEveCalo3DGL.h:18
 TEveCalo3DGL.h:19
 TEveCalo3DGL.h:20
 TEveCalo3DGL.h:21
 TEveCalo3DGL.h:22
 TEveCalo3DGL.h:23
 TEveCalo3DGL.h:24
 TEveCalo3DGL.h:25
 TEveCalo3DGL.h:26
 TEveCalo3DGL.h:27
 TEveCalo3DGL.h:28
 TEveCalo3DGL.h:29
 TEveCalo3DGL.h:30
 TEveCalo3DGL.h:31
 TEveCalo3DGL.h:32
 TEveCalo3DGL.h:33
 TEveCalo3DGL.h:34
 TEveCalo3DGL.h:35
 TEveCalo3DGL.h:36
 TEveCalo3DGL.h:37
 TEveCalo3DGL.h:38
 TEveCalo3DGL.h:39
 TEveCalo3DGL.h:40
 TEveCalo3DGL.h:41
 TEveCalo3DGL.h:42
 TEveCalo3DGL.h:43
 TEveCalo3DGL.h:44
 TEveCalo3DGL.h:45
 TEveCalo3DGL.h:46
 TEveCalo3DGL.h:47
 TEveCalo3DGL.h:48
 TEveCalo3DGL.h:49
 TEveCalo3DGL.h:50
 TEveCalo3DGL.h:51
 TEveCalo3DGL.h:52
 TEveCalo3DGL.h:53
 TEveCalo3DGL.h:54
 TEveCalo3DGL.h:55
 TEveCalo3DGL.h:56
 TEveCalo3DGL.h:57
 TEveCalo3DGL.h:58
 TEveCalo3DGL.h:59
 TEveCalo3DGL.h:60