ROOT  6.06/09
Reference Guide
TGLSurfacePainter.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_TGLSurfacePainter
13 #define ROOT_TGLSurfacePainter
14 
15 #include <vector>
16 #include <list>
17 
18 #ifndef ROOT_TGLPlotPainter
19 #include "TGLPlotPainter.h"
20 #endif
21 #ifndef ROOT_TString
22 #include "TString.h"
23 #endif
24 #ifndef ROOT_TGLUtil
25 #include "TGLUtil.h"
26 #endif
27 
28 class TRandom;
29 
31 private:
32  enum ESurfaceType {
39  };
40 
42 
47 
49 
50  struct Projection_t {
52  std::vector<TGLVertex3> fVertices;
53  void Swap(Projection_t &rhs);
54  };
55 
57 
58  mutable std::list<Projection_t> fXOZProj;
59  mutable std::list<Projection_t> fYOZProj;
60  mutable std::list<Projection_t> fXOYProj;
61 
63  mutable std::vector<Double_t> fColorLevels;
65 
68 
69 public:
70  TGLSurfacePainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
71 
72  //TGLPlotPainter's final-overriders.
73  char *GetPlotInfo(Int_t px, Int_t py);
75  void StartPan(Int_t px, Int_t py);
76  void Pan(Int_t px, Int_t py);
77  void AddOption(const TString &stringOption);
78  void ProcessEvent(Int_t event, Int_t px, Int_t py);
79 
80 private:
81  void InitGL()const;
82  void DeInitGL()const;
83 
84  void DrawPlot()const;
85 
86  void SetNormals();
87  void SetSurfaceColor()const;
88 
93 
94  void DrawProjections()const;
95  void DrawSectionXOZ()const;
96  void DrawSectionYOZ()const;
97  void DrawSectionXOY()const;
98 
99  void ClampZ(Double_t &zVal)const;
100 
101  char *WindowPointTo3DPoint(Int_t px, Int_t py)const;
102 
103  Bool_t PreparePalette()const;
104  void GenTexMap()const;
105  void DrawContoursProjection()const;
106 
107  Bool_t Textured()const;
108  Bool_t HasSections()const;
109  Bool_t HasProjections()const;
110 
111  void DrawPalette()const;
112  void DrawPaletteAxis()const;
113 
114  static TRandom *fgRandom;
115 
116  ClassDef(TGLSurfacePainter, 0)//Surface painter.
117 };
118 
119 #endif
Camera for TGLPlotPainter and sub-classes.
Definition: TGLPlotCamera.h:21
Bool_t InitGeometryCylindrical()
Find bin ranges for X and Y axes, axes ranges for X, Y and Z.
void SetSurfaceColor() const
Set color for surface.
TGL2DArray< TGLVector3 > fAverageNormals
void DrawSectionXOZ() const
Draw section X.
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1197
void DrawPaletteAxis() const
Draw. Palette. Axis.
TGL2DArray< Double_t > fTexMap
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Remove all profiles/sections.
Basic string class.
Definition: TString.h:137
Rgl::Range_t fMinMaxVal
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TGL2DArray< TGLVertex3 > fMesh
Implements painting of TH2 with "SURF" option.
void StartPan(Int_t px, Int_t py)
User clicks right mouse button (in a pad).
Bool_t InitGeometryPolar()
Find bin ranges for X and Y axes, axes ranges for X, Y and Z.
std::vector< TGLVertex3 > fVertices
void SetNormals()
One normal per vertex; this normal is average of neighbouring triangles normals.
Bool_t InitGeometry()
Set mesh, normals.
void ClampZ(Double_t &zVal) const
Clamp z value.
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:29
void DeInitGL() const
Initialize some OpenGL state variables.
void DrawSectionXOY() const
Draw section Z.
TGL2DArray< std::pair< TGLVector3, TGLVector3 > > fFaceNormals
Bool_t PreparePalette() const
Generate palette.
static TRandom * fgRandom
Bool_t InitGeometrySpherical()
Find bin ranges for X and Y axes, axes ranges for X, Y and Z.
TGLLevelPalette fPalette
void DrawContoursProjection() const
Draw flat textured surface.
char * WindowPointTo3DPoint(Int_t px, Int_t py) const
Find 3d coords using mouse cursor coords.
void Pan(Int_t px, Int_t py)
User's moving mouse cursor, with middle mouse button pressed (for pad).
ClassDef(TVirtualGLPainter, 0)
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, functions and parametric surfaces.
Bool_t HasSections() const
Any section exists.
void GenTexMap() const
Find texture coordinates.
void Swap(Projection_t &rhs)
std::list< Projection_t > fXOYProj
char * GetPlotInfo(Int_t px, Int_t py)
Coords for point on surface under cursor.
double Double_t
Definition: RtypesCore.h:55
void DrawProjections() const
Draw projections.
The TH1 histogram class.
Definition: TH1.h:80
void DrawSectionYOZ() const
Draw section Y.
void AddOption(const TString &stringOption)
Additional options for surfaces.
std::vector< Double_t > fColorLevels
void DrawPalette() const
Draw.
void DrawPlot() const
Draw surf/surf1/surf2/surf4.
TGLSurfacePainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord)
Constructor.
std::list< Projection_t > fXOZProj
std::list< Projection_t > fYOZProj
unsigned char UChar_t
Definition: RtypesCore.h:34
Bool_t InitGeometryCartesian()
Find bin ranges for X and Y axes, axes ranges for X, Y and Z.
Bool_t HasProjections() const
Any projection exists.
Bool_t Textured() const
Checks, if surf requires texture.
void InitGL() const
Initialize some OpenGL state variables.