Logo ROOT   6.08/07
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
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:1197
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:137
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:254
Bool_t InitGeometry()
Set mesh, normals.
This is the base class for the ROOT Random number generators.
Definition: TRandom.h:31
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:80
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.