forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TGLSurfacePainter.h
113 lines (84 loc) · 3.01 KB
/
TGLSurfacePainter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// @(#)root/gl:$Id$
// Author: Timur Pocheptsov 31/08/2006
/*************************************************************************
* Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGLSurfacePainter
#define ROOT_TGLSurfacePainter
#include <vector>
#include <list>
#include "TGLPlotPainter.h"
#include "TString.h"
#include "TGLUtil.h"
class TRandom;
class TGLSurfacePainter : public TGLPlotPainter {
private:
enum ESurfaceType {
kSurf,
kSurf1,
kSurf2,
kSurf3,
kSurf4,
kSurf5
};
mutable ESurfaceType fType;
TGL2DArray<TGLVertex3> fMesh;
mutable TGL2DArray<Double_t> fTexMap;
TGL2DArray<std::pair<TGLVector3, TGLVector3> > fFaceNormals;
TGL2DArray<TGLVector3> fAverageNormals;
mutable TString fObjectInfo;
struct Projection_t {
UChar_t fRGBA[4];
std::vector<TGLVertex3> fVertices;
void Swap(Projection_t &rhs);
};
mutable Projection_t fProj;
mutable std::list<Projection_t> fXOZProj;
mutable std::list<Projection_t> fYOZProj;
mutable std::list<Projection_t> fXOYProj;
mutable TGLLevelPalette fPalette;
mutable std::vector<Double_t> fColorLevels;
Rgl::Range_t fMinMaxVal;
Bool_t fSectionPass;
mutable Bool_t fUpdateTexMap;
public:
TGLSurfacePainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
//TGLPlotPainter's final-overriders.
char *GetPlotInfo(Int_t px, Int_t py);
Bool_t InitGeometry();
void StartPan(Int_t px, Int_t py);
void Pan(Int_t px, Int_t py);
void AddOption(const TString &stringOption);
void ProcessEvent(Int_t event, Int_t px, Int_t py);
private:
void InitGL()const;
void DeInitGL()const;
void DrawPlot()const;
void SetNormals();
void SetSurfaceColor()const;
Bool_t InitGeometryCartesian();
Bool_t InitGeometryPolar();
Bool_t InitGeometryCylindrical();
Bool_t InitGeometrySpherical();
void DrawProjections()const;
void DrawSectionXOZ()const;
void DrawSectionYOZ()const;
void DrawSectionXOY()const;
void ClampZ(Double_t &zVal)const;
char *WindowPointTo3DPoint(Int_t px, Int_t py)const;
Bool_t PreparePalette()const;
void GenTexMap()const;
void DrawContoursProjection()const;
Bool_t Textured()const;
Bool_t HasSections()const;
Bool_t HasProjections()const;
void DrawPalette()const;
void DrawPaletteAxis()const;
static TRandom *fgRandom;
ClassDef(TGLSurfacePainter, 0)//Surface painter.
};
#endif