File indexing completed on 2025-12-15 10:29:55
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGLSurfacePainter
0013 #define ROOT_TGLSurfacePainter
0014
0015 #include <vector>
0016 #include <list>
0017 #include <utility>
0018
0019 #include "TGLPlotPainter.h"
0020 #include "TString.h"
0021 #include "TGLUtil.h"
0022
0023 class TRandom;
0024
0025 class TGLSurfacePainter : public TGLPlotPainter {
0026 private:
0027 enum ESurfaceType {
0028 kSurf,
0029 kSurf1,
0030 kSurf2,
0031 kSurf3,
0032 kSurf4,
0033 kSurf5
0034 };
0035
0036 mutable ESurfaceType fType;
0037
0038 TGL2DArray<TGLVertex3> fMesh;
0039 mutable TGL2DArray<Double_t> fTexMap;
0040 TGL2DArray<std::pair<TGLVector3, TGLVector3> > fFaceNormals;
0041 TGL2DArray<TGLVector3> fAverageNormals;
0042
0043 mutable TString fObjectInfo;
0044
0045 struct Projection_t {
0046 UChar_t fRGBA[4];
0047 std::vector<TGLVertex3> fVertices;
0048 void Swap(Projection_t &rhs);
0049 };
0050
0051 mutable Projection_t fProj;
0052
0053 mutable std::list<Projection_t> fXOZProj;
0054 mutable std::list<Projection_t> fYOZProj;
0055 mutable std::list<Projection_t> fXOYProj;
0056
0057 mutable TGLLevelPalette fPalette;
0058 mutable std::vector<Double_t> fColorLevels;
0059 Rgl::Range_t fMinMaxVal;
0060
0061 Bool_t fSectionPass;
0062 mutable Bool_t fUpdateTexMap;
0063
0064 public:
0065 TGLSurfacePainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
0066
0067
0068 char *GetPlotInfo(Int_t px, Int_t py) override;
0069 Bool_t InitGeometry() override;
0070 void StartPan(Int_t px, Int_t py) override;
0071 void Pan(Int_t px, Int_t py) override;
0072 void AddOption(const TString &stringOption) override;
0073 void ProcessEvent(Int_t event, Int_t px, Int_t py) override;
0074
0075 private:
0076 void InitGL()const override;
0077 void DeInitGL()const override;
0078
0079 void DrawPlot()const override;
0080
0081 void SetNormals();
0082 void SetSurfaceColor()const;
0083
0084 Bool_t InitGeometryCartesian();
0085 Bool_t InitGeometryPolar();
0086 Bool_t InitGeometryCylindrical();
0087 Bool_t InitGeometrySpherical();
0088
0089 void DrawProjections()const;
0090 void DrawSectionXOZ()const override;
0091 void DrawSectionYOZ()const override;
0092 void DrawSectionXOY()const override;
0093
0094 void ClampZ(Double_t &zVal)const;
0095
0096 char *WindowPointTo3DPoint(Int_t px, Int_t py)const;
0097
0098 Bool_t PreparePalette()const;
0099 void GenTexMap()const;
0100 void DrawContoursProjection()const;
0101
0102 Bool_t Textured()const;
0103 Bool_t HasSections()const;
0104 Bool_t HasProjections()const;
0105
0106 void DrawPalette()const;
0107 void DrawPaletteAxis()const override;
0108
0109 static TRandom *fgRandom;
0110
0111 ClassDefOverride(TGLSurfacePainter, 0)
0112 };
0113
0114 #endif