Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TH3GL.cxx
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11#include "TH3GL.h"
12#include "TH3.h"
13#include "TAxis.h"
14
15#include "TGLSurfacePainter.h"
16#include "TGLHistPainter.h"
17#include "TGLLegoPainter.h"
18#include "TGLBoxPainter.h"
19#include "TGLTF3Painter.h"
20#include "TGLAxisPainter.h"
21#include "TGLPhysicalShape.h"
22#include "TGLCamera.h"
23#include "TPolyMarker3D.h"
24
25#include "TGLRnrCtx.h"
26#include "TGLIncludes.h"
27
28/** \class TH3GL
29\ingroup opengl
30OpenGL renderer class for TH3.
31*/
32
34
35////////////////////////////////////////////////////////////////////////////////
36/// Constructor.
37
39 TGLPlot3D(), fM(0)
40{
41}
42
43////////////////////////////////////////////////////////////////////////////////
44/// Constructor.
45
47 TGLPlot3D(), fM(th3)
48{
49 SetPainter(new TGLBoxPainter(th3, pm, 0, &fCoord));
51}
52
53////////////////////////////////////////////////////////////////////////////////
54/// Destructor.
55
57{
58}
59
60////////////////////////////////////////////////////////////////////////////////
61/// Set model object.
62
64{
65 TString option(opt);
66 option.ToLower();
67
68 fM = SetModelDynCast<TH3>(obj);
69
70 if (option.Index("iso") != kNPOS)
71 SetPainter( new TGLIsoPainter(fM, 0, &fCoord) );
72 else if (option.Index("box") != kNPOS)
73 SetPainter( new TGLBoxPainter(fM, 0, &fCoord) );
74 else {
75 Warning("SetModel", "Option '%s' not supported, assuming 'box'.", option.Data());
76 SetPainter( new TGLBoxPainter(fM, 0, &fCoord) );
77 }
78
80
81 Ssiz_t pos = option.Index("fb");
82 if (pos != kNPOS) {
83 option.Remove(pos, 2);
85 }
86
87 pos = option.Index("bb");
88 if (pos != kNPOS)
90
91 pos = option.Index("a");
92 if (pos != kNPOS)
94
95
97
98 return kTRUE;
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Set bounding box.
103
105{
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Render with OpenGL.
111
112void TH3GL::DirectDraw(TGLRnrCtx & rnrCtx) const
113{
114 if (fFirstPhysical)
116
118
119 glPushAttrib(GL_ENABLE_BIT | GL_LIGHTING_BIT);
120
121 glEnable(GL_NORMALIZE);
122 glDisable(GL_COLOR_MATERIAL);
123
126
127 glDisable(GL_CULL_FACE);
128 glPopAttrib();
129
130 // Axes
131 const Rgl::PlotTranslation trGuard(fPlotPainter);
132
133 if (fPlotPainter->GetDrawAxes()) {
134 TGLAxisPainterBox axe_painter;
135 axe_painter.SetUseAxisColors(kFALSE);
136 axe_painter.SetFontMode(TGLFont::kPixmap);
137 axe_painter.PlotStandard(rnrCtx, fM, fBoundingBox);
138 }
139}
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Ssiz_t kNPOS
Definition RtypesCore.h:124
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:377
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Definition TError.cxx:241
Option_t Option_t option
Painter class for axes encompassing a 3D box.
void PlotStandard(TGLRnrCtx &rnrCtx, TH1 *histo, const TGLBoundingBox &bbox)
void SetUseAxisColors(Bool_t x)
void SetFontMode(TGLFont::EMode m)
void Set(const TGLVertex3 vertex[8])
Set a bounding box from provided 8 vertices.
Paints TH3 histograms by rendering variable-sized boxes matching the bin contents.
"gliso" option for TH3.
TGLBoundingBox fBoundingBox
Also plays the role of ID.
TGLPhysicalShape * fFirstPhysical
physical instance ref counting
const Float_t * Color() const
Description of TGLPlot3D.
Definition TGLPlot3D.h:23
TGLPlotCoordinates fCoord
Definition TGLPlot3D.h:30
TGLPlotPainter * fPlotPainter
Definition TGLPlot3D.h:29
void SetPainter(TGLPlotPainter *p)
Set painter object and destroy the old one.
Definition TGLPlot3D.cxx:52
Int_t FindFrontPoint() const
Convert 3d points into window coordinate system and find the nearest.
const TGLVertex3 * Get3DBox() const
Get 3D box.
const TGLPlotBox & RefBackBox() const
void SetDrawAxes(Bool_t s)
virtual void DrawPlot() const =0
virtual Bool_t InitGeometry()=0
void SetDrawBackBox(Bool_t b)
void SetDrawFrontBox(Bool_t b)
virtual void InitGL() const =0
void SetPhysicalShapeColor(const Float_t *rgba)
virtual void AddOption(const TString &stringOption)=0
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Definition TGLRnrCtx.h:41
OpenGL renderer class for TH3.
Definition TH3GL.h:27
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr)
Set model object.
Definition TH3GL.cxx:63
TH3 * fM
Definition TH3GL.h:33
TH3GL()
Constructor.
Definition TH3GL.cxx:38
virtual void SetBBox()
Set bounding box.
Definition TH3GL.cxx:104
virtual ~TH3GL()
Destructor.
Definition TH3GL.cxx:56
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Render with OpenGL.
Definition TH3GL.cxx:112
The 3-D histogram classes derived from the 1-D histogram classes.
Definition TH3.h:31
Mother of all ROOT objects.
Definition TObject.h:41
A 3D polymarker.
Basic string class.
Definition TString.h:139
auto * th3
Definition textalign.C:22