Logo ROOT   6.10/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 #include "TGLPlotPainter.h"
19 #include "TString.h"
20 #include "TGLUtil.h"
21 
22 class TRandom;
23 
25 private:
26  enum ESurfaceType {
33  };
34 
36 
41 
43 
44  struct Projection_t {
46  std::vector<TGLVertex3> fVertices;
47  void Swap(Projection_t &rhs);
48  };
49 
51 
52  mutable std::list<Projection_t> fXOZProj;
53  mutable std::list<Projection_t> fYOZProj;
54  mutable std::list<Projection_t> fXOYProj;
55 
57  mutable std::vector<Double_t> fColorLevels;
59 
62 
63 public:
64  TGLSurfacePainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
65 
66  //TGLPlotPainter's final-overriders.
67  char *GetPlotInfo(Int_t px, Int_t py);
69  void StartPan(Int_t px, Int_t py);
70  void Pan(Int_t px, Int_t py);
71  void AddOption(const TString &stringOption);
72  void ProcessEvent(Int_t event, Int_t px, Int_t py);
73 
74 private:
75  void InitGL()const;
76  void DeInitGL()const;
77 
78  void DrawPlot()const;
79 
80  void SetNormals();
81  void SetSurfaceColor()const;
82 
87 
88  void DrawProjections()const;
89  void DrawSectionXOZ()const;
90  void DrawSectionYOZ()const;
91  void DrawSectionXOY()const;
92 
93  void ClampZ(Double_t &zVal)const;
94 
95  char *WindowPointTo3DPoint(Int_t px, Int_t py)const;
96 
97  Bool_t PreparePalette()const;
98  void GenTexMap()const;
99  void DrawContoursProjection()const;
100 
101  Bool_t Textured()const;
102  Bool_t HasSections()const;
103  Bool_t HasProjections()const;
104 
105  void DrawPalette()const;
106  void DrawPaletteAxis()const;
107 
108  static TRandom *fgRandom;
109 
110  ClassDef(TGLSurfacePainter, 0)//Surface painter.
111 };
112 
113 #endif
void ClampZ(Double_t &zVal) const
Clamp z value.
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 DrawSectionXOZ() const
Draw section X.
void DrawContoursProjection() const
Draw flat textured surface.
TGL2DArray< TGLVector3 > fAverageNormals
void DrawProjections() const
Draw projections.
std::pair< Double_t, Double_t > Range_t
Definition: TGLUtil.h:1193
Bool_t HasSections() const
Any section exists.
TGL2DArray< Double_t > fTexMap
void ProcessEvent(Int_t event, Int_t px, Int_t py)
Remove all profiles/sections.
void DrawPalette() const
Draw.
void InitGL() const
Initialize some OpenGL state variables.
Basic string class.
Definition: TString.h:129
Rgl::Range_t fMinMaxVal
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
void GenTexMap() const
Find texture coordinates.
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.
void DrawSectionYOZ() const
Draw section Y.
std::vector< TGLVertex3 > fVertices
void DrawPaletteAxis() const
Draw. Palette. Axis.
void SetNormals()
One normal per vertex; this normal is average of neighbouring triangles normals.
void DrawSectionXOY() const
Draw section Z.
#define ClassDef(name, id)
Definition: Rtypes.h:297
Bool_t InitGeometry()
Set mesh, normals.
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:27
TGL2DArray< std::pair< TGLVector3, TGLVector3 > > fFaceNormals
char * WindowPointTo3DPoint(Int_t px, Int_t py) const
Find 3d coords using mouse cursor coords.
Bool_t InitGeometrySpherical()
Find bin ranges for X and Y axes, axes ranges for X, Y and Z.
TGLLevelPalette fPalette
void Pan(Int_t px, Int_t py)
User&#39;s moving mouse cursor, with middle mouse button pressed (for pad).
Bool_t Textured() const
Checks, if surf requires texture.
Helper class for plot-painters holding information about axis ranges, numbers of bins and flags if ce...
Bool_t HasProjections() const
Any projection exists.
Base class for plot-painters that provide GL rendering of various 2D and 3D histograms, functions and parametric surfaces.
void DrawPlot() const
Draw surf/surf1/surf2/surf4.
void Swap(Projection_t &rhs)
Constructor.
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 SetSurfaceColor() const
Set color for surface.
static TRandom * fgRandom
The TH1 histogram class.
Definition: TH1.h:56
void AddOption(const TString &stringOption)
Additional options for surfaces.
Bool_t PreparePalette() const
Generate palette.
std::vector< Double_t > fColorLevels
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.
void DeInitGL() const
Initialize some OpenGL state variables.