Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGLTF3Painter.h
Go to the documentation of this file.
1// @(#)root/gl:$Id$
2// Author: Timur Pocheptsov 31/08/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, 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
12#ifndef ROOT_TGLTF3Painter
13#define ROOT_TGLTF3Painter
14
15#include <vector>
16#include <list>
17
18#include "TGLPlotPainter.h"
19#include "TGLIsoMesh.h"
20#include "TGLUtil.h"
21
22class TGLPlotCamera;
23class TF3;
24
25/*
26Draw TF3 using marching cubes.
27*/
28
30private:
31 enum ETF3Style {
32// clang++ <v20 (-Wshadow) complains about shadowing TSystem.h global enum ESendRecvOptions. Let's silence warning:
33#if defined(__clang__) && __clang_major__ < 20
34#pragma clang diagnostic push
35#pragma clang diagnostic ignored "-Wshadow"
36#endif
38#if defined(__clang__) && __clang_major__ < 20
39#pragma clang diagnostic pop
40#endif
44 };
45
47
50
54
55public:
57
58 char *GetPlotInfo(Int_t px, Int_t py) override;
59 Bool_t InitGeometry() override;
60 void StartPan(Int_t px, Int_t py) override;
61 void Pan(Int_t px, Int_t py) override;
62 void AddOption(const TString &stringOption) override;
63 void ProcessEvent(Int_t event, Int_t px, Int_t py) override;
64
65private:
66 void InitGL()const override;
67 void DeInitGL()const override;
68
69 void DrawPlot()const override;
70 //
71 void DrawToSelectionBuffer()const;
72 void DrawDefaultPlot()const;
73 void DrawMaplePlot()const;
74 //
75
76 void SetSurfaceColor()const;
77 Bool_t HasSections()const;
78
79 void DrawSectionXOZ()const override;
80 void DrawSectionYOZ()const override;
81 void DrawSectionXOY()const override;
82
83 ClassDefOverride(TGLTF3Painter, 0) // GL TF3 painter.
84};
85
86/*
87 Iso painter draws iso surfaces - "gliso" option for TH3XXX::Draw.
88 Can be one-level iso (as standard non-gl "iso" option),
89 or multi-level iso: equidistant contours (if you only specify
90 number of contours, or at user defined levels).
91*/
92
94private:
96 typedef std::list<Mesh_t> MeshList_t;
97 typedef std::list<Mesh_t>::iterator MeshIter_t;
98 typedef std::list<Mesh_t>::const_iterator ConstMeshIter_t;
99
103
105 //List of meshes.
107 //Cached meshes (will be used if geometry must be rebuilt
108 //after TPad::PaintModified)
110 //Min and max bin contents.
112 //Palette. One color per iso-surface.
114 //Iso levels. Equidistant or user-defined.
115 std::vector<Double_t> fColorLevels;
116 //Now meshes are initialized only once.
117 //To be changed in future.
119
120public:
122
123 //TGLPlotPainter final-overriders.
124 char *GetPlotInfo(Int_t px, Int_t py) override;
125 Bool_t InitGeometry() override;
126 void StartPan(Int_t px, Int_t py) override;
127 void Pan(Int_t px, Int_t py) override;
128 void AddOption(const TString &option) override;
129 void ProcessEvent(Int_t event, Int_t px, Int_t py) override;
130
131private:
132 //TGLPlotPainter final-overriders.
133 void InitGL()const override;
134 void DeInitGL()const override;
135
136 void DrawPlot()const override;
137 void DrawSectionXOZ()const override;
138 void DrawSectionYOZ()const override;
139 void DrawSectionXOY()const override;
140 //Auxiliary methods.
141 Bool_t HasSections()const;
142 void SetSurfaceColor(Int_t ind)const;
144 void DrawMesh(const Mesh_t &mesh, Int_t level)const;
145 void FindMinMax();
146
149
150 ClassDefOverride(TGLIsoPainter, 0) // Iso option for TH3.
151};
152
153#endif
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
winID h TVirtualViewer3D TVirtualGLPainter char GetPlotInfo
Option_t Option_t option
TF3 defines a 3D Function with Parameters.
Definition TF3.h:28
"gliso" option for TH3.
TGLIsoPainter(const TGLIsoPainter &)
TGLTH3Slice fXOZSlice
Bool_t HasSections() const
Any section exists.
MeshList_t fCache
TGLTH3Slice fYOZSlice
TGLIsoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
void DeInitGL() const override
Initialize OpenGL state variables.
Bool_t InitGeometry() override
Initializes meshes for 3d iso contours.
void DrawMesh(const Mesh_t &mesh, Int_t level) const
Draw TF3 surface.
TGLLevelPalette fPalette
Rgl::Mc::TIsoMesh< Float_t > Mesh_t
void DrawSectionXOY() const override
Draw XOY parallel section.
Rgl::Range_t fMinMax
void DrawSectionXOZ() const override
Draw XOZ parallel section.
void AddOption(const TString &option) override
No additional options for TGLIsoPainter.
std::list< Mesh_t >::iterator MeshIter_t
std::list< Mesh_t > MeshList_t
void FindMinMax()
Find max/min bin contents for TH3.
std::vector< Double_t > fColorLevels
TGLIsoPainter & operator=(const TGLIsoPainter &)
void SetMesh(Mesh_t &mesh, Double_t isoValue)
Grid geometry.
MeshList_t fIsos
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
Change color scheme.
void InitGL() const override
Initialize OpenGL state variables.
void DrawSectionYOZ() const override
Draw YOZ parallel section.
TGLTH3Slice fXOYSlice
void SetSurfaceColor(Int_t ind) const
Set color for surface.
void DrawPlot() const override
Draw mesh.
std::list< Mesh_t >::const_iterator ConstMeshIter_t
void StartPan(Int_t px, Int_t py) override
User clicks right mouse button (in a pad).
void Pan(Int_t px, Int_t py) override
User's moving mouse cursor, with middle mouse button pressed (for pad).
Camera for TGLPlotPainter and sub-classes.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms,...
Plot-painter for TF3 functions.
Rgl::Mc::TIsoMesh< Double_t > fMesh
void DeInitGL() const override
Initialize OpenGL state variables.
void DrawSectionXOZ() const override
Draw XOZ parallel section.
Bool_t InitGeometry() override
Create mesh.
void DrawSectionYOZ() const override
Draw YOZ parallel section.
TGLTF3Painter(TF3 *fun, TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
void DrawDefaultPlot() const
Surface with material properties and lighting.
void AddOption(const TString &stringOption) override
No options for tf3.
void Pan(Int_t px, Int_t py) override
User's moving mouse cursor, with middle mouse button pressed (for pad).
TGLTH3Slice fXOZSlice
void DrawPlot() const override
Draw mesh.
void InitGL() const override
Initialize OpenGL state variables.
void DrawToSelectionBuffer() const
Draw triangles, no normals, no lighting.
TGLTH3Slice fXOYSlice
void SetSurfaceColor() const
Set color for surface.
ETF3Style fStyle
void ProcessEvent(Int_t event, Int_t px, Int_t py) override
Change color scheme.
void DrawSectionXOY() const override
Draw XOY parallel section.
void DrawMaplePlot() const
Colored surface, without lighting and material properties.
TGLTH3Slice fYOZSlice
void StartPan(Int_t px, Int_t py) override
User clicks right mouse button (in a pad).
Bool_t HasSections() const
Any section exists.
A slice of a TH3.
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:109
Basic string class.
Definition TString.h:138
std::pair< Double_t, Double_t > Range_t
Definition TGLUtil.h:1202