File indexing completed on 2025-10-31 09:17:07
0001 
0002 
0003 
0004 
0005 
0006 
0007 
0008 
0009 
0010 
0011 
0012 #ifndef ROOT_TGLTF3Painter
0013 #define ROOT_TGLTF3Painter
0014 
0015 #include <vector>
0016 #include <list>
0017 
0018 #include "TGLPlotPainter.h"
0019 #include "TGLIsoMesh.h"
0020 #include "TGLUtil.h"
0021 
0022 class TGLPlotCamera;
0023 class TF3;
0024 
0025 
0026 
0027 
0028 
0029 class TGLTF3Painter : public TGLPlotPainter {
0030 private:
0031    enum ETF3Style {
0032       kDefault,
0033       kMaple0,
0034       kMaple1,
0035       kMaple2
0036    };
0037 
0038    ETF3Style fStyle;
0039 
0040    Rgl::Mc::TIsoMesh<Double_t> fMesh;
0041    TF3 *fF3;
0042 
0043    TGLTH3Slice fXOZSlice;
0044    TGLTH3Slice fYOZSlice;
0045    TGLTH3Slice fXOYSlice;
0046 
0047 public:
0048    TGLTF3Painter(TF3 *fun, TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
0049 
0050    char   *GetPlotInfo(Int_t px, Int_t py) override;
0051    Bool_t  InitGeometry() override;
0052    void    StartPan(Int_t px, Int_t py) override;
0053    void    Pan(Int_t px, Int_t py) override;
0054    void    AddOption(const TString &stringOption) override;
0055    void    ProcessEvent(Int_t event, Int_t px, Int_t py) override;
0056 
0057 private:
0058    void    InitGL()const override;
0059    void    DeInitGL()const override;
0060 
0061    void    DrawPlot()const override;
0062    
0063    void    DrawToSelectionBuffer()const;
0064    void    DrawDefaultPlot()const;
0065    void    DrawMaplePlot()const;
0066    
0067 
0068    void    SetSurfaceColor()const;
0069    Bool_t  HasSections()const;
0070 
0071    void    DrawSectionXOZ()const override;
0072    void    DrawSectionYOZ()const override;
0073    void    DrawSectionXOY()const override;
0074 
0075    ClassDefOverride(TGLTF3Painter, 0) 
0076 };
0077 
0078 
0079 
0080 
0081 
0082 
0083 
0084 
0085 class TGLIsoPainter : public TGLPlotPainter {
0086 private:
0087    typedef Rgl::Mc::TIsoMesh<Float_t>        Mesh_t;
0088    typedef std::list<Mesh_t>                 MeshList_t;
0089    typedef std::list<Mesh_t>::iterator       MeshIter_t;
0090    typedef std::list<Mesh_t>::const_iterator ConstMeshIter_t;
0091 
0092    TGLTH3Slice           fXOZSlice;
0093    TGLTH3Slice           fYOZSlice;
0094    TGLTH3Slice           fXOYSlice;
0095 
0096    Mesh_t                fDummyMesh;
0097    
0098    MeshList_t            fIsos;
0099    
0100    
0101    MeshList_t            fCache;
0102    
0103    Rgl::Range_t          fMinMax;
0104    
0105    TGLLevelPalette       fPalette;
0106    
0107    std::vector<Double_t> fColorLevels;
0108    
0109    
0110    Bool_t                fInit;
0111 
0112 public:
0113    TGLIsoPainter(TH1 *hist, TGLPlotCamera *camera, TGLPlotCoordinates *coord);
0114 
0115    
0116    char    *GetPlotInfo(Int_t px, Int_t py) override;
0117    Bool_t   InitGeometry() override;
0118    void     StartPan(Int_t px, Int_t py) override;
0119    void     Pan(Int_t px, Int_t py) override;
0120    void     AddOption(const TString &option) override;
0121    void     ProcessEvent(Int_t event, Int_t px, Int_t py) override;
0122 
0123 private:
0124    
0125    void     InitGL()const override;
0126    void     DeInitGL()const override;
0127 
0128    void     DrawPlot()const override;
0129    void     DrawSectionXOZ()const override;
0130    void     DrawSectionYOZ()const override;
0131    void     DrawSectionXOY()const override;
0132    
0133    Bool_t   HasSections()const;
0134    void     SetSurfaceColor(Int_t ind)const;
0135    void     SetMesh(Mesh_t &mesh, Double_t isoValue);
0136    void     DrawMesh(const Mesh_t &mesh, Int_t level)const;
0137    void     FindMinMax();
0138 
0139    TGLIsoPainter(const TGLIsoPainter &);
0140    TGLIsoPainter &operator = (const TGLIsoPainter &);
0141 
0142    ClassDefOverride(TGLIsoPainter, 0) 
0143 };
0144 
0145 #endif