ROOT logo
// @(#)root/eve:$Id: TH3GL.cxx 28378 2009-04-28 15:40:53Z matevz $
// 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.             *
 *************************************************************************/

#include "TH3GL.h"
#include "TH3.h"
#include "TVirtualPad.h"
#include "TAxis.h"
#include "TMath.h"

#include "TGLSurfacePainter.h"
#include "TGLHistPainter.h"
#include "TGLLegoPainter.h"
#include "TGLBoxPainter.h"
#include "TGLTF3Painter.h"
#include "TGLAxisPainter.h"
#include "TGLCamera.h"

#include "TGLRnrCtx.h"
#include "TGLIncludes.h"

//______________________________________________________________________________
// OpenGL renderer class for TH3.
//

ClassImp(TH3GL);

//______________________________________________________________________________
TH3GL::TH3GL() :
   TGLObject(), fM(0), fPlotPainter(0)
{
   // Constructor.

   fDLCache = kFALSE; // Disable display list.
}

//______________________________________________________________________________
TH3GL::~TH3GL()
{
   // Destructor.

   delete fPlotPainter;
}

/******************************************************************************/

//______________________________________________________________________________
Bool_t TH3GL::SetModel(TObject* obj, const Option_t* opt)
{
   // Set model object.

   TString option(opt);
   option.ToLower();

   if (SetModelCheckClass(obj, TH3::Class())) {
      fM = dynamic_cast<TH3*>(obj);
      if (option.Index("iso") != kNPOS)
         fPlotPainter = new TGLIsoPainter(fM, 0, &fCoord);
      else if (option.Index("box") != kNPOS)
         fPlotPainter = new TGLBoxPainter(fM, 0, &fCoord);

      fPlotPainter->AddOption(option);
      fPlotPainter->InitGeometry();
      return kTRUE;
   }
   return kFALSE;
}

//______________________________________________________________________________
void TH3GL::SetBBox()
{
   // Set bounding box.

   fBoundingBox.Set(fPlotPainter->RefBackBox().Get3DBox());
}

/******************************************************************************/

//______________________________________________________________________________
void TH3GL::DirectDraw(TGLRnrCtx & rnrCtx) const
{
   // Render with OpenGL.

   fPlotPainter->RefBackBox().FindFrontPoint();

   glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);

   glEnable(GL_NORMALIZE);
   glDisable(GL_COLOR_MATERIAL);

   fPlotPainter->InitGL();
   fPlotPainter->DrawPlot();

   glDisable(GL_CULL_FACE);
   glPopAttrib();

   // Axes
   TGLAxisPainterBox axe_painter;
   axe_painter.SetFontMode(TGLFont::kPixmap);
   axe_painter.PlotStandard(rnrCtx, fM, fBoundingBox);
}
 TH3GL.cxx:1
 TH3GL.cxx:2
 TH3GL.cxx:3
 TH3GL.cxx:4
 TH3GL.cxx:5
 TH3GL.cxx:6
 TH3GL.cxx:7
 TH3GL.cxx:8
 TH3GL.cxx:9
 TH3GL.cxx:10
 TH3GL.cxx:11
 TH3GL.cxx:12
 TH3GL.cxx:13
 TH3GL.cxx:14
 TH3GL.cxx:15
 TH3GL.cxx:16
 TH3GL.cxx:17
 TH3GL.cxx:18
 TH3GL.cxx:19
 TH3GL.cxx:20
 TH3GL.cxx:21
 TH3GL.cxx:22
 TH3GL.cxx:23
 TH3GL.cxx:24
 TH3GL.cxx:25
 TH3GL.cxx:26
 TH3GL.cxx:27
 TH3GL.cxx:28
 TH3GL.cxx:29
 TH3GL.cxx:30
 TH3GL.cxx:31
 TH3GL.cxx:32
 TH3GL.cxx:33
 TH3GL.cxx:34
 TH3GL.cxx:35
 TH3GL.cxx:36
 TH3GL.cxx:37
 TH3GL.cxx:38
 TH3GL.cxx:39
 TH3GL.cxx:40
 TH3GL.cxx:41
 TH3GL.cxx:42
 TH3GL.cxx:43
 TH3GL.cxx:44
 TH3GL.cxx:45
 TH3GL.cxx:46
 TH3GL.cxx:47
 TH3GL.cxx:48
 TH3GL.cxx:49
 TH3GL.cxx:50
 TH3GL.cxx:51
 TH3GL.cxx:52
 TH3GL.cxx:53
 TH3GL.cxx:54
 TH3GL.cxx:55
 TH3GL.cxx:56
 TH3GL.cxx:57
 TH3GL.cxx:58
 TH3GL.cxx:59
 TH3GL.cxx:60
 TH3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